Code Monkey home page Code Monkey logo

Comments (5)

daico007 avatar daico007 commented on July 19, 2024

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.

scmartin avatar scmartin commented on July 19, 2024

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.

chrisjonesBSU avatar chrisjonesBSU commented on July 19, 2024

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.

scmartin avatar scmartin commented on July 19, 2024

@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.

daico007 avatar daico007 commented on July 19, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.