Centering a PDB-Derived Slab in a LAMMPS Simulation Box to Prevent Particle Displacement

Hi,
I have a PDB file that I want to convert to a LAMMPS data file format. I tried saving the coordinates using VMD and exporting them as a lammpstrj file, but the resulting axis lo and hi values are incorrect (from -0.5 to +0.5). When I use the command topo writelammpsdata lmp.data full, the box dimensions are set to:

X-axis: 2.639 to 30.334
Y-axis: 7.679 to 42.551
Z-axis: -5.921 to 28.597

I would like to center this slab within the box so that there are no negative axis values. The issue arises during the simulation when two particles move outside the box. How can I adjust the coordinates to center the slab and avoid negative axis values?

I am attaching the snapshot of the pdb and after simulation

Blockquote

The PDB file does not have box information, so you would have to set the box dimensions from the VMD command prompt manually.

If there is no box given, TopoTools will use the min/max of the positions to determine the box.
If you set the box dimensions manually, TopoTools will use that information. But since VMD doesn’t store the box origin (only the extent) the box will be centered around the positions.

You have multiple options:

  • you can manually edit the box dimension in the files (this will not translate the positions) and then use the displace_atoms command in LAMMPS (this will only work for periodic boundaries)
  • you can set the box dimensions in VMD before saving
  • you can move the atoms to the center in VMD first and then set the box dimensions

Hi,
I displaced the initial structure using the displace_atoms command with the following dimensions:
0 27.695 xlo xhi
0 34.872 ylo yhi
0 34.518 zlo zhi

I saved the results in final_topo.pdb and final_topo.data files. When visualizing, final_topo.pdb displayed the correct structure. However, after running the simulation, the output dump trajectory shows two particles outside the slab (see figure below)


and with shifted coordinates. There should not be any shift of coordinates, that must remain same as the final_topo.data as the coordinates are frozen. I’m unsure why this discrepancy is occurring.

My Lammps script:

units real
dimension 3
boundary p p p
atom_style full

read_data final_topo.data

Define potentials

pair_style table linear 100
pair_coeff 1 1 CdCd_potential.table Cd1-Cd1
pair_coeff 1 2 CdS_potential.table Cd1-S2
pair_coeff 2 2 SS_potential.table S2-S2

group freeze type 1 2
velocity freeze set 0.0 0.0 0.0
fix 4 freeze setforce 0.0 0.0 0.0

neighbor 0.3 bin
neigh_modify every 1 delay 0 check yes

fix 1 all nvt temp 300.0 300.0 100.0 # NVT ensemble at 300K

variable vstep equal (step)
variable vtmp equal (temp)
fix temp all print 100 " {vstep} {vtmp}" file temperature.txt screen no
variable vpe equal (pe)
variable vke equal (ke)
fix pe all print 1000 “{vstep} {vpe}” file pe.txt screen no
fix ke all print 1000 “{vstep} {vke}” file ke.txt screen no

timestep 0.001 # Set an appropriate timestep
thermo 100 # Print thermo output every 100 steps
thermo_style custom step temp pe ke etotal press

dump 3 all atom 100 dump.lammpstrj
dump 2 all custom 100 pos.xyz id mol type x y z xu yu zu
dump_modify 2 sort id

run 1000000 # Run for 10000 timesteps

  1. Please have a look at the forum guidelines for how to correctly quote text file. Can you read everything correctly at the moment?
  2. It is difficult to tell without the actual files, but if the atoms are at the corner of the box, just the slightest numerical noise can move those atoms to the next periodic box. That is not an error. If you want those atoms to “stick together” just output unwrapped coordinates.
  3. The best way to keep atoms immobile is to not include them in the time integration. That also avoids incorrect thermostatting.
  4. There don’t seem to be any mobile atoms in your system, so why running an MD, why using a thermostat?
1 Like

many thanks for the suggestions. Actually, I’m supposed to incorporate free random ions in the box. Anyway, what you say is right, bcz for initial check it is not required. displace_atoms helped.