mbuild
mbuild copied to clipboard
lammpsdata box parameters
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?
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).
https://github.com/mosdef-hub/mbuild/pull/739
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
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.