Comments (5)
Hi @scmartin, I believe this relate to the unit system being written to the hoomd snapshot. At the moment, the create_hoomd_snaphot()
and create_hood_forcefield()
is working on a parmed Structure object, which utilize the unit of kCal and Angstrom, and hence permittivity e0 is in e^2 / ((kcal/mol) * Angstrom)
with the value of 2.396452e-04
(please refer to this code excerpt https://github.com/mosdef-hub/mbuild/blob/main/mbuild/formats/hoomd_snapshot.py#L419-L426).
We are working on developing a different backend, called GMSO, which will allow more control over the unit aspect during conversion. The package is still under development and there is no direct path to go from gmso to hoomd forcefield (there is currently a WIP PR).
from mbuild.
So does this mean that the units that create_hoomd_forcefield()
outputs are in the units used by the parmed object by default? I just saw that the option ref_mass
, ref_energy
, and ref_distance
arguments. In the current version, I take it I need to pass these arguments the proper conversion factors if I want to convert back to the units used by Foyer. Am I understanding this correctly?
This unit conversion seems extremely opaque in the documentation. It wasn't until I saw the ref_[dimension]
optional arguments that I realized the output units were changed from the units used by Foyer.
from mbuild.
Hello @scmartin. You're right, the unit conversions that are happening are not made clear. After applying a forcefield using Foyer, the object returned is now a Parmed structure instead of an mBuild compound, and the units of distance and energy are converted from nm and kJ/mol to Angstrom and kcal/mol. So, the conversion is technically happening before calling create_hoomd_forcefield()
.
You should be able to the use ref_
parameters to convert back to nm, and kJ/mol, and as @daico007 pointed out, I believe the correct conversion of e0
is being performed on line 420 of hoomd_snapshot.py
.
I'll start a PR that adds a better explanation to the documentation. Also, I noticed some inconsistencies of the doc strings for the reference value parameters in create_hoomd_forcefield
and to_hoomdsnapshot
in hoomd_snapshot.py
.
from mbuild.
@daico007 and @chrisjonesBSU Thank you both for clarifying this behavior. I'm still trying to get a feel for the interactions of Foyer and mBuild (for example, calling the apply
method on an mBuild compound changing the underlying mBuild object) but you have completely answered my original question, so I'm going to close this issue.
from mbuild.
You're welcome @scmartin, the unit issue is something we have been trying to address with the new backend data structure (GMSO), and hopefully when that library is ready for production, it will eliminate such confusion with unit that you're experiencing
from mbuild.
Related Issues (20)
- Extensive memory usage for fill box
- CI failing
- New treelib (1.7) mess up the print_hierarchy output
- `Compound.add` scale quite badly with big list
- combining rule not read from xml file when saving a .top file HOT 4
- Cannot commit to Build instance HOT 1
- Ability to change bead size in visualization
- Issue with mbuild docs HOT 2
- Performance loading from `.json` file
- Take into the forming of double bonds in Polymer builder
- Documentation defines build.format.charmm_writer which does not exist HOT 2
- Ability for Polymer Builder to connect ends for a loop
- Loss of meaningful port names and labels
- Error when Compiling Docs Locally HOT 2
- Plugins error when creating anaconda environment with python 3.12 HOT 7
- CI failing for Windowns build HOT 1
- Floating point error converting .gro to .xyz HOT 1
- add variable in the box packing functions to allow more packmol iterations HOT 3
- Add Ruff to pre-commit
- `mb.Compound.save()` feature returns a PDB file without bonds HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from mbuild.