-
Notifications
You must be signed in to change notification settings - Fork 13
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 hoomd2 support, with tutorials #27
Conversation
This involves writing new hoomd headers that get written when saving a hoomd runscript. In MSIBI.optimize(), the hoomd version is deduced with a try-except block. In workers.py, the _hoomd_worker() now uses the correct executable depending on the hoomd version, because hoomd1 was a standalone executable, whereas hoomd2 is now a python module.
This makes more sense because MDTraj reads hoomd xml files as so if they have a .hoomdxml extension
msibi/optimize.py
Outdated
@@ -62,7 +62,8 @@ def __init__(self, rdf_cutoff, n_rdf_points, pot_cutoff=None, r_switch=None, | |||
self.dr = rdf_cutoff / (n_rdf_points - 1) | |||
self.smooth_rdfs = smooth_rdfs | |||
self.rdf_r_range = np.array([0.0, self.rdf_cutoff + self.dr]) | |||
self.rdf_n_bins = self.n_rdf_points + 1 | |||
# got rid of +1 because mdtraj now # does this as we expect | |||
self.rdf_n_bins = self.n_rdf_points |
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.
👍 but remove the comment before finalizing things
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 will be sure to do that next time
msibi/state.py
Outdated
name=None, backup_trajectory=False): | ||
self.kT = k * T | ||
self.kT = kT |
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.
Is this backwards compatible with HOOMD 1?
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 don't think so. HOOMD documentation states for v2.0.0
Integrators now take kT arguments for temperature instead of T to avoid confusion on the units of temperature.
under the heading
Changes that require job script modifications
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.
Yeah, they just changed the syntax to the integrators. I think this is probably cleaner instead of passing k
and T
separately.
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.
Ok so do we just want to completely drop 1.0 support then? Or are we going to divide the user input by k
and then passing that along for HOOMD 1.0 users?
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.
In HOOMD 1.0, the value you pass to the integrator is still kT, but the parameter you pass is called T. They changed it to kT because everybody new to HOOMD seemed to have issues with that, so this is still good for HOOMD. We'll have to make this clear in the docs that for other engines you make have to pass kT, e.g., state = State(kT=305*8.314e-3, ...)
msibi/state.py
Outdated
from hoomd_script import * | ||
|
||
system = init.read_xml(filename="{0}", wrap_coordinates=True) |
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.
You sure this needs to be deleted? This was working correctly in HOOMD 1.x, right?
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.
Good catch, I think this is just an accidental deletion
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 think the deleted line has been replaced by the following line system = read_xml(filename="{0}", wrap_coordinates=True)
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.
It does indeed need to be init.read_xml(...)
Looks like it's coming along. Just make sure to tidy up all the stray comments and polish up code to be PEP8 compliant. |
setup.py
Outdated
@@ -28,13 +28,13 @@ def run_tests(self): | |||
version='0.1', | |||
description='', | |||
url='http://github.com/ctk3b/misibi', | |||
author='Christoph Klein, Timothy C. Moore', | |||
author_email='[email protected], [email protected]', | |||
author='Christoph Klein, Timothy C. Moore', 'Davy Yue' |
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.
This field is typically used for the official package maintainers (i.e. people who approve PRs and distribute the package via PyPI/conda). We're more than happy to add you once you get to that point but for now you fall into the "contributor" category :)
One thing you could add is module doc strings to the entire project like this. That would provide an intermediate level of authorship acknowledgement between maintainers and the github contribution list
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.
Looking good
msibi/state.py
Outdated
name=None, backup_trajectory=False): | ||
self.kT = k * T | ||
self.kT = kT |
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.
Yeah, they just changed the syntax to the integrators. I think this is probably cleaner instead of passing k
and T
separately.
msibi/tutorials/lj/opt.py
Outdated
# Clear out the temp files | ||
# back up, not hard coded, not file-based (development dependent) | ||
# later - storing data (backups potentially), some fiels may not exist in future |
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.
Clean up comments
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.
Yeah I'll do a scan through the code and delete all the stray comments
# **** 2017_05_31 Notes ****** | ||
# update file to correct hoomd 2.0 syntax | ||
# look up docs | ||
# combine with state.py in main folder |
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.
Probably not the best idea to take notes within the source code...
run(1e3) | ||
all = hoomd.group.all() | ||
nvt_int = hoomd.md.integrate.langevin(group=all, kT=T_final, seed=1) # possibly use kT instead of T??? | ||
hoomd.md.integrate.mode_standard(dt=0.001) #integrate.\*_rigid() no longer exists. Use a standard integrator on group.rigid_center(), and define rigid bodies using constrain.rigid() |
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.
Clean up comments
# **** 2017_05_31 Notes ****** | ||
# update file to correct hoomd 2.0 syntax | ||
# look up docs | ||
# combine with state.py in main folder |
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.
Comments
msibi/workers.py
Outdated
else: | ||
logging.info(' Running state {state.name} on CPU'.format(**locals())) | ||
cmds = ['hoomd', 'run.py'] | ||
cmds = [executable, 'run.py'] |
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.
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.
If we're only using one rank then this should just be whatever the most straight forward way to launch HOOMD 2.0 is. I'm assuming that would not involve an explicit call to mpiexec
?
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.
Indeed if each CG simulation is run on a single GPU then mpiexec is not needed. We will just support single GPU CG simulaitons for now and then worry about multi-GPU runs in the future?
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.
That seems like an easy way to start since it appears that you were only launching one rank per sim anyways, right? This shouldn't have been a major limitation for the system sizes you've been working on.
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.
Yup.
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.
Looks good.
setup.py
Outdated
author_email='[email protected], [email protected]', '[email protected]' | ||
author='Christoph Klein, Timothy C. Moore' | ||
author_email='[email protected], [email protected]' | ||
contributors='Davy Yue' |
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.
Have you tested this? I don't think this is a valid keyword and is not what I was suggesting. Sorry if I was unclear. By contributors, I just meant that you are a contributor to the package which is picked up here https://github.com/mosdef-hub/msibi/graphs/contributors
http://setuptools.readthedocs.io/en/latest/setuptools.html?highlight=metadata#metadata
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 removed the contributors='Davy Yue'
setup.py
Outdated
# Contributors: Tim Moore, Davy Yue | ||
# | ||
############################################################################## | ||
|
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.
For the module level doc strings, I was suggesting mimicking what packages like MDTraj do where every file has a header with the project description, copyright, license and a list of people who wrote THIS particular file and contributed to it - not the package as a whole. So for example, remove all of your changes from setup.py and add this header to all the .py files within msibi and you can add yourself to the ones that you contributed relevant code too. However, please do this in a separate pull request as this will become quite nasty to review.
# **** 2017_05_31 Notes ****** | ||
# update file to correct hoomd 2.0 syntax | ||
# look up docs | ||
# combine with state.py in main folder |
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.
Last remaining stray comments
Just want to get this started. I'm sure there is some code cleanup that needs to be done.