mdanalysis icon indicating copy to clipboard operation
mdanalysis copied to clipboard

Support for LAMMPS LJ reduced units

Open timbernat opened this issue 7 months ago • 3 comments

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

timbernat avatar Apr 02 '25 17:04 timbernat

Any thoughts on this so far?

mrshirts avatar Apr 09 '25 17:04 mrshirts

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?

orbeckst avatar Jun 11 '25 19:06 orbeckst

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.

orbeckst avatar Jun 11 '25 20:06 orbeckst

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

orbeckst avatar Jun 26 '25 22:06 orbeckst

I helped write some of the LAMMPs stuff so happy to chip in.

hmacdope avatar Jun 26 '25 23:06 hmacdope

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

jnnsmpth avatar Jun 30 '25 15:06 jnnsmpth

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.

jaclark5 avatar Oct 16 '25 00:10 jaclark5