Skip to content

Incorrect unwrapping for LAMMPS trajectories due to unused image flags for periodic boundary condition #5138

@gitsirsha

Description

@gitsirsha

Is your feature request related to a problem?

MDAnalysis universe currently ignores LAMMPS image flags (ix, iy and iz) to properly unwrap wrapped coordinates according to periodic boundary condition when unwrapping coordinates from LAMMPSDUMP files. MDAnalysis solely does:

x_unwrapped = x_scaled * L + L/2 (where L is box dimension)

This works good only when atoms never crossed boundaries i.e., flag ix_i = 0 but this is incorrect unwrapping when the atoms have crossed boundaries and that leads to wrong results when computing MSD or diffusion coefficients or COM.

While comparing MSD results from the new method in PR#5066 (merged) vs our in-house code (that incorporates proper conversion accounting the image flags) there is a discrepancy.

x_unwrapped = x_scaled * L + L*ix (Correct convention with the in-house code)

We've further verified this when provided with an already pre-unwrapped LAMMPSSUMP file. The results are consistent between MDAnalysis and In-house code! Meaning that it's definitely the improper unwrapping only while creating the universe that creates the discrepancy.

Describe the solution you'd like

i. Properly take care of the periodic boundary condition image flags while unwrapping the universe
ii. Or at least for the time-being provide a warning to the user to provide unwrapped coordinates.

Describe alternatives you've considered

Pre-unwrapping the trajectory file (LAMMPSDUMP) following proper PBC flags

Additional context

Example below:

Image Notice the shoot up! Image Pre-unwrap to get correct results!

notebooks for this example can be found in the repository-link.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions