Manually setting simulation parameters after loading a data file leads to molecules not interacting

Hello everyone,

I have created a water box that I load into LAMMPS at the beginning of the script. After that, I manually change some of the parameters because this is supposed to be a template for further scripts.

For now, I just have the water box. Expected behaviour is that the molecules just move about in the box for the duration of the run. However, just running this water box results in the system rapidly expanding with water molecules moving linearly outwards without any interaction between them. Before using the water box I was introducing water by hand as well and it worked, so I suspect the loading from the data file somehow conflicts with the manually defined parameters.

I would appreciate some guidance on what I’m doing wrong.

AgAu1135b (2.4 KB)

Beginning of the waterbox file:

LAMMPS data file. CGCMM style. atom_style full generated by VMD/TopoTools v1.8 on Tue Apr 14 12:02:47 +0200 2026
 189540 atoms
 126360 bonds
 0 angles
 0 dihedrals
 0 impropers
 2 atom types
 1 bond types
 0 angle types
 0 dihedral types
 0 improper types
 -49.089001 49.071003  xlo xhi
 -49.090002 49.070002  ylo yhi
 -98.165005 98.155002  zlo zhi

# Pair Coeffs
#
# 1  H
# 2  O

# Bond Coeffs
#
# 1  

 Masses

 1 1.008000 # H
 2 15.999000 # O

 Atoms # full

1 1 1 0.000000 -25.124001 -20.059999 6.619000 # H HOH
2 1 1 0.000000 -26.712000 -20.027000 6.240000 # H HOH
3 1 2 0.000000 -25.787001 -20.113001 5.872000 # O HOH
4 2 1 0.000000 -24.407000 -34.773998 0.149000 # H HOH
5 2 1 0.000000 -25.427000 -33.866001 -0.747000 # H HOH
6 2 2 0.000000 -24.490000 -33.948002 -0.409000 # O HOH
7 3 1 0.000000 6.687000 -5.517000 -60.152000 # H HOH
8 3 1 0.000000 6.312000 -7.100000 -60.005001 # H HOH
9 3 2 0.000000 6.939000 -6.379000 -59.710999 # O HOH

Thank you for your time.

I don’t think so.

That is basically impossible to say without the ability to reproduce it and see the case where it works as expected. Please also note, that generally, it is your job to debug your inputs. You do this be back tracking until you have something that works as you expect and then making small changes and checking at every step if things still work as expected.

There is only one thing that stands out from your input. You have some region commands after setting a lattice to a non-default value where you don’t use “units box” and some where you do. Are you sure those regions are located where you expect them to be?
Please note that regions can now be visualized in LAMMPS / LAMMPS-GUI. See 10.1.2. Visualize LAMMPS snapshots — LAMMPS documentation for some examples and a discussion.

1 Like

My response is a bit late, but thank you for the reply.

I have found the mistake, so I will share in case someone stumbles upon this thread.

In the LAMMPS input file, i have set so that atom type 3 is oxygen and atom type 4 is hydrogen. However, when generating the box of water, the algorithm made id so that atom type 1 is hydrogen and atom type 2 is oxygen. So, when the data file is read, the type indices are in the opposite orders, and the file is interpreted incorrectly.

Is there a way to reorder atom types once they are defined?

The regions are fine. One element goes through the entire box and has to be in lattice units, while the other is just in the box and it is easier to define in angstroms.

Thank you for your time.

If you want to change all atoms with type 3 to type 4 and all atoms with type 4 to type 3 you can do something like the following:

group t3 type 3
group t4 type 4
set group t3 type 4
set group t4 type 3
group t4 delete
group t3 delete