-
Notifications
You must be signed in to change notification settings - Fork 5
Remove temperature from interface #49
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
66f2fe2
removed temperature from all parts of interface except hydrodynamicVe…
rykerfish 79ec6e0
update examples
rykerfish ef8da55
rename thermalDrift -> divM and removed implicit prefactors from sqrt…
rykerfish f562bb3
rearranged arguments for LangevinVelocities since the scalars are man…
rykerfish 4f9e51e
Merge branch 'main' into remove_temperature
RaulPPelaez 42a01c3
style: formatting
RaulPPelaez 22d5a16
build: bump UAMMD and nanobind versions
RaulPPelaez 221ebed
test: Make tests runnable from anywhere by using relative directories
RaulPPelaez File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -25,7 +25,6 @@ enum class periodicity_mode { | |
| struct Parameters { | ||
| std::vector<real> hydrodynamicRadius; | ||
| real viscosity = 1; | ||
| real temperature = 0; | ||
| real tolerance = 1e-4; // Tolerance for Lanczos fluctuations | ||
| std::uint64_t seed = 0; | ||
| bool includeAngular = false; | ||
|
|
@@ -49,7 +48,6 @@ class Mobility { | |
| real lanczosTolerance; | ||
| std::shared_ptr<LanczosStochasticVelocities> lanczos; | ||
| std::vector<real> lanczosOutput; | ||
| real temperature; | ||
| bool includeAngular = false; | ||
| std::mt19937 rng; | ||
|
|
||
|
|
@@ -98,7 +96,6 @@ class Mobility { | |
| this->initialized = true; | ||
| this->lanczosSeed = this->rng(); | ||
| this->lanczosTolerance = par.tolerance; | ||
| this->temperature = par.temperature; | ||
| this->includeAngular = par.includeAngular; | ||
| } | ||
|
|
||
|
|
@@ -120,8 +117,6 @@ class Mobility { | |
| // will be used automatically | ||
| virtual void sqrtMdotW(device_span<real> ilinear, device_span<real> iangular, | ||
| real prefactor = 1) { | ||
| if (this->temperature == 0) | ||
| return; | ||
| if (prefactor == 0) | ||
| return; | ||
| if (not this->initialized) | ||
|
|
@@ -143,9 +138,6 @@ class Mobility { | |
| "[libMobility] The number of linear velocities does not match the " | ||
| "number of particles"); | ||
| } | ||
| // if (this->needsTorque && linear.size() != angular.size()) | ||
| // throw std::runtime_error("[libMobility] This solver requires angular " | ||
| // "velocities when configured with torques"); | ||
| const auto numberElements = | ||
| numberParticles + (this->includeAngular ? numberParticles : 0); | ||
| if (not lanczos) { | ||
|
|
@@ -178,25 +170,29 @@ class Mobility { | |
| thrust::plus<real>()); | ||
| } | ||
|
|
||
| // Equivalent to calling Mdot, then stochasticDisplacements, and then thermal | ||
| // drift. Can be faster in some solvers | ||
| virtual void hydrodynamicVelocities(device_span<const real> forces, | ||
| device_span<const real> torques, | ||
| device_span<real> linear, | ||
| device_span<real> angular, | ||
| real prefactor = 1) { | ||
| // computes velocities according to the Langevin equation. | ||
| virtual void LangevinVelocities(real dt, real kbt, | ||
| device_span<const real> forces, | ||
| device_span<const real> torques, | ||
| device_span<real> linear, | ||
| device_span<real> angular) { | ||
| if (!forces.empty() or !torques.empty()) { | ||
| Mdot(forces, torques, linear, angular); | ||
| } | ||
| sqrtMdotW(linear, angular, prefactor); | ||
| thermalDrift(linear, angular, prefactor); | ||
|
|
||
| // prefactors (last argument) are chosen for dimensional consistency | ||
| if (kbt != 0) { | ||
| const real sqrt_prefactor = std::sqrt(2 * kbt / dt); | ||
| sqrtMdotW(linear, angular, sqrt_prefactor); | ||
| divM(linear, angular, kbt); | ||
| } | ||
| } | ||
|
|
||
| // Compute the thermal drift, | ||
| // :math:`k_BT\boldsymbol{\partial}_\boldsymbol{x}\cdot | ||
| // Compute the divergence of the mobility matrix, | ||
| // :math:`\boldsymbol{\partial}_\boldsymbol{x}\cdot | ||
|
Comment on lines
+191
to
+192
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should we document these the right way with Doxygen, even when we are not rendering them at all in the docs? |
||
| // \boldsymbol{\mathcal{M}}`. | ||
| virtual void thermalDrift(device_span<real> ilinear, | ||
| device_span<real> angular, real prefactor = 1) { | ||
| virtual void divM(device_span<real> ilinear, device_span<real> angular, | ||
| real prefactor = 1) { | ||
| // For open and periodic solvers the thermal drift is zero, so this function | ||
| // does nothing by default. | ||
| } | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.