Skip to content

lammpsdata box parameters #741

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
amorshedi opened this issue May 29, 2020 · 4 comments
Closed

lammpsdata box parameters #741

amorshedi opened this issue May 29, 2020 · 4 comments

Comments

@amorshedi
Copy link

amorshedi commented May 29, 2020

In lammpsdata.py the box data are written as:
data.write('{0:.6f} {1:.6f} xlo xhi\n'.format(
xlo_bound, xhi_bound))
data.write('{0:.6f} {1:.6f} ylo yhi\n'.format(
ylo_bound, yhi_bound))
data.write('{0:.6f} {1:.6f} zlo zhi\n'.format(
zlo_bound, zhi_bound))

This seems to be a remnant of lammpstrj.py. However, the data file does NOT use box bounds to define the cell and directly takes xlo,xhi;ylo,yhi;zlo,zhi.
Is this a bug or am I missing something?

@chrisiacovella
Copy link
Contributor

The lammps data file should contain the bounds of the simulation cell (see: https://lammps.sandia.gov/doc/2001/data_format.html)

I just submitted PR related to the simulation cell bounds not being set properly (things were being set to 0 to Length in all cases, not using actual bounds).

#739

@amorshedi
Copy link
Author

Thanks for the response.
Yes, exactly. As you can see, lammps takes xlo,xhi,etc. themselves:
-0.5 0.5 xlo xhi
-0.5 0.5 ylo yhi
-0.5 0.5 zlo zhi
These are NOT the same thing as box bounds (xlo_bound, xhi_bound, etc). Bounds are calculated using those, e.g: xlo_bound = xlo + MIN(0.0,xy,xz,xy+xz). See https://lammps.sandia.gov/doc/Howto_triclinic.html for the rest.
Bounds are what's written to dump files (and lammpstrj files) as described in https://lammps.sandia.gov/doc/dump.html which is different from what's written in data file.

My guess is this has gone undetected because the issue only arises for "triclinic" boxes. For orthogonal ones, xlo_bound=xlo etc. I'm attaching a pdf for demonstrating with an example. We also have A = (xhi-xlo,0,0); B = (xy,yhi-ylo,0); C = (xz,yz,zhi-zlo) which are cell vectors as described in https://lammps.sandia.gov/doc/read_data.html. You can see that if you have an xy tilt, xhi_bound can be different from xhi.
box.pdf

Please let me know if I'm missing something.
Best,
Ali

@CalCraven CalCraven added the bug label Aug 10, 2022
@CalCraven
Copy link
Contributor

Most of what we use are orthogonal boxes, so there might be an issue with triclinic boxes we're not catching. This functionality seems to be supported with this function. Is the bug related to the fact that ?low and ?hi need to be written instead? If so, this is a pretty simple change to the writer.

@chrisjonesBSU
Copy link
Contributor

Closing this as the gro writer has moved to GMSO, and it looks like we have a check for triclinic boxes there.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants