mdanalysis
mdanalysis copied to clipboard
Support for LAMMPS LJ reduced units
Is your feature request related to a problem?
- The current MDAnalysis LAMMPS DATA Reader explicitly does not support Lennard-Jones units
- Support for reduced (LJ) units would be immensely useful for coarse-grained simulations of polymer systems
- Useful not only for LAMMPS, but for HOOMD, GROMACS, and other simulation engines
- Integral to an ongoing polymer simulations collaboration
Describe the solution you'd like
- Support for LJ units (e.g. as an argument in the reader which allows one to specify this preference)
- Ability to distinguish between unitless quantities vs quantities with implicit units
- Guidance from MDA maintainers on how to proceed with this feature (i.e. should this be supported, how general should LJ unit support be, etc.)
- Are happy to provide manpower to generate PR
Describe alternatives you've considered
- Provide feature which permits assignment of arbitrary units which are later converted back to MDAnalysis' internal units
Any thoughts on this so far?
How would you like MDAnalysis to behave when a system in LJ units is read?
Are you currently able to read a system in LJ units into MDAnalysis? (Sorry, I know little about LAMMPS in particular.) If so, does it matter to you that MDAnalysis thinks that the data are in Å and ps?
As a workaround for reading: can you use convert_units=False
u = mda.Universe("LJ.dump", convert_units=False)
to make it load raw LJ numbers?
It may also be possible to set timeunit and lengthunit to None.
@timbernat can you provide a user perspective on how you'd wish MDAnalysis behaved? You can use the following "user story" prompts:
- "As someone who has a simulation that was written by LAMMPS in LJ units, I would like MDAnalysis to do ...".
- "When I use a sim with LJ units in MDAnalysis then it fails to do X when I use Y ...".
If you can show mock code examples then that would also be great.
(I am not running anything in LAMMPS or with LJ units so I just need to have a sense of where the friction points are. Then it's also easier to understand if there are some deep limitations at the core of MDA or something that can be tweaked/hacked easily.)
I helped write some of the LAMMPs stuff so happy to chip in.
@orbeckst Thanks for the suggestions. While there might be some programmatic issues with setting "None" as the time or length units, we could set the units to "None" when we're reading a LAMMPS file, and then any time we're doing a calculation that depends on units, print something like "As a reminder, MDAnalysis defaults to Angstroms, but the simulation data that was read in for this calculation had dimensionless units -- These are NOT Angstroms."
I have used MDAnalysis for LAMMPS simulation in LJ units without issue with convert_units=False, the ability to set a timeunit, lengthunit, and energyunit in #5117 will allow any unit to be used in theory.