-
Notifications
You must be signed in to change notification settings - Fork 79
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
Reference units different between hoomd_simulation.py, gsdwriter.py and hoomdxml.py #799
Comments
@chrisjonesBSU was this issue fixed by #798 or #698? |
No it doesn't look like it was. |
Hi, I wanted to clarify the units of mbuild gsdwriter. I am using mbuild to build a coarse grain molecule and then mbuild fill box to pack molecules in a box. The position of atoms are defined such as the distance is in nm and my box length is in units of nm. After preparation of a box of the coarse grain molecule, i am using foyer and openmm to define the atom, bond, angle and dihedral types and charge of the coarse grain molecule. Distance is in nm, angles is in radian and energies are in kj/mol (I already have the values of equilibrium bond, angle...) After this I want to save a gsd file to use it for hoomd runs. For this I am using mbuilds gsdwriter. Using this set of commands changes the distance in angstroms and energy units I am not sure even though all the parameters in my files are nm and kj/mol. |
Hi @slenka93, I believe this is because when we perform the atomtyping using foyer, we actually have to convert our object to a parmed Structure to be able to store information related to potential parameters, which have a different set of default units than ours. The default unit of parmed is |
Hi @daico007, thanks for the clarification. |
Hi @slenka93, the charge will also be in electron charge (which i think is also the case in the in the original XML). The |
Thanks @daico007! |
GSD writer has been transitioned to GMSO in PR 680. |
This is very similar to the changes made in #463
From what I understand, the idea in #463, is that for the sake of consistency, the units used by the reference value parameters in
write_hoomdxml
should be same units that are used in mbuild and foyer (nm, kJ/mol, amu).Since parmed is actually being used behind the scenes, the reference values are converted from nm and kJ/mol into angstroms and kcal/mol. #463 added units to the reference value parameter doc strings and took care of the conversions required.
However, this is not how the reference values are being handled in
create_hoomd_simulation
andwrite_gsd
(I'm not familiar with the lammps or par writers). These functions still require the user to enter their reference values in parmed units (kcal/mol, angstroms, Da) so that they are consistent with the parametrized parmed structure. There isn't any conversion being done, the values are used as entered by the user.I agree with the method we're using in
write_hoomdxml
. To me, its a lot more intuitive to enter reference value as they appear in the forcefield files, and in the case of foyer that's nm and kJ/mol, so we should probably update the other relevant writers to handle to use the same process.I can write up the PR for it, I just wanted to start some discussion since messing around with units can result in breaking changes to any existing workflows. Note that if
auto_scale = True
for any of these 3 writers, then this isn't an issue. Also, I just realized thatwrite_gsd
doesn't have an auto scale option, maybe that could be added with this PR as well.This came up when talking with Mike earlier about the changes made in #798
#798
Also, if these changes are made, I assume they should also be made in #698 @mikemhenry
The text was updated successfully, but these errors were encountered: