-
Notifications
You must be signed in to change notification settings - Fork 8
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
Add ability to use number density when calculating target box lenghts for shrinking and NVT. #112
Conversation
Codecov ReportAttention:
Additional details and impacted files@@ Coverage Diff @@
## main #112 +/- ##
==========================================
+ Coverage 94.23% 94.28% +0.04%
==========================================
Files 23 25 +2
Lines 1770 1801 +31
==========================================
+ Hits 1668 1698 +30
- Misses 102 103 +1
|
Ok, for now I took out the We can still figure out what to do in
|
For the purpose of keeping function interfaces simple, I think option 2 is better. |
Ok, I think everything is implemented correctly. I just need to update doc strings and run through the tutorials to make sure they are working correctly. |
flowermd/base/simulation.py
Outdated
).value | ||
final_box = hoomd.Box(Lx=L, Ly=L, Lz=L) | ||
|
||
# TODO: Do we need to do anything here? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Forgot about this TODO that is remaining.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can't think of anything to do for cases where final_box_lengths
does not have units. I guess we can remove this else for now?
@@ -95,21 +95,27 @@ def run_droplet( | |||
|
|||
""" | |||
# Shrink down to high density | |||
target_box = get_target_box_mass_density( | |||
density=shrink_density * (u.g / (u.cm**3)), mass=self.mass.to("g") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe we need an if statement here. Maybe someone passes in other density units for final_density
and shrink_density
and we don't always want to use g/cm^3
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess the behavior here should basically be the same as what we do in Pack
now.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agree. same as in Pack
we could first check if the units exists and if not assume the default is g/cm^3
Check out this pull request on See visual diffs & provide feedback on Jupyter Notebooks. Powered by ReviewNB |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM overall! I added a few comments/questions.
Thank you Chris
flowermd/base/simulation.py
Outdated
).value | ||
final_box = hoomd.Box(Lx=L, Ly=L, Lz=L) | ||
|
||
# TODO: Do we need to do anything here? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can't think of anything to do for cases where final_box_lengths
does not have units. I guess we can remove this else for now?
@@ -95,21 +95,27 @@ def run_droplet( | |||
|
|||
""" | |||
# Shrink down to high density | |||
target_box = get_target_box_mass_density( | |||
density=shrink_density * (u.g / (u.cm**3)), mass=self.mass.to("g") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agree. same as in Pack
we could first check if the units exists and if not assume the default is g/cm^3
…to number-density
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. Thank you
Being able to easily and reliability get volumes that correspond to a desired density is very helpful, we currently do this for mass density, but that isn't very intuitive or helpful when running non-atomistic coarse-grain simulations such as the
LJChain
, 'KremerGrestBeadSpring' and ellipsoids (see #102).Right now, the changes are in
utils.calculate_box_length
.This PR also solves #64.
Still left to do:
Simulation
property ofN_beads
Simulation.run_update_volume
handles itsdensity
parameter.