Hi,
I’m running a simulation with 2196 Xenon atoms and 1 Rb (ID = 2197) atom to study the Xe-Rb collision events. Since I have to run these simulations for very long time, the trajectory file size soon build up. Is there any way to dump only the position and velocities of atoms that are within a 20 angstrom radius of the Rb atom? I looked in the manual and could not find an option myself.
this is my current input script, how can I modify this to achieve what I want?
Thanks
units real #Angstroms, g/mol, etc.
atom_style full #Molecule + charge
timestep 1.0
boundary p p p
read_restart restart_file1
variable dt equal 1.0
variable ext_temp equal 300
variable Tdamp equal 100.0*${dt}
variable Pdamp equal 100.0*${dt}
pair_style table linear 172500 #
pair_coeff 1 1 POT_XeXe.pot POT_XeXe 15.0
pair_coeff 1 2 POT_RbXe.pot POT_RbXe 15.0
pair_coeff 2 2 POT_RbXe.pot POT_RbXe 10.0
bond_style none nocoeff #harmonic
angle_style none nocoeff #harmonic
dihedral_style none
improper_style none
group xenon type 1
group rubiduim type 2
velocity all create ${ext_temp} 4561 dist uniform
reset_timestep 0 #Reset the time step counter to 0
fix 2 all nve
#Output Style
dump dump_1 all custom 100 dump.min id type x y z vx vy vz
run 1000000
undump dump_1
write_restart ./restart_file_nve
Thank you, that was what I was looking for. @akohlmey . By the way I’m currently writing my trajectories in this custom ‘LAMMPSDUMP’ format. This takes too much space, what are some binary traj file formats that are available in the LAMMPS binary by default? DCD for example is not available by default. Which is the binary format that is available by default, that can store the velocity information and also support this dump_modify command? thank you.
You should check the documentation for details. Everything is explained there.
You should be able to use the custom dump style and just use a filename that ends in .bin.
Another option is to append .gz, provided you have the gzip program installed. You should see if support for that is available with lmp -h and also which compression formats and extensions are available (depends on which programs are installed).
The .bin files can be converted back with binary2txt or you can use the source code of that tool as a template for writing a reader program yourself.
My experience is that DCD is a very old Fortran related format and very difficult and inflexible format to work with.
Lammps dump(.gz) aka lammpstraj in some tools is modern and very flexible.
Depending on your post processing needs for precision full 16 digits is probably overkill if you’re just trying to render a video for example. Look at dump_modify format. If 4 digits of precision for positions and velocities is enough for your post analysis, you can cut your dump files by ~75%. Im not sure how that would relate to the dump.gz compression ratio exactly but it should also be smaller.
Since you know the ID of the Rb atom, an alternative (or addendum) to @akohlmey’s answer could be to create a spherical region around your Rb atom and use it with the dump_modify command.
variable rx equal x[2197]
variable ry equal y[2197]
variable rz equal z[2197]
region mysphere sphere v_rx v_ry v_rz 20. units box
[...]
dump_modify region mysphere
Or create a dynamic group associated with this region and only dump atoms from that group. There are a lot of possibilities available.
Please note, that LAMMPS regions are not wrapped around periodic boundaries, so this approach would only work if the atom of interest stays away from the box boundaries by the distance of the spherical regions’ radius.
@akohlmey: thank you for the heads up. In my case the ‘target’ atom is often moving close to the boundary region. I guess this approach is not effective in that case as I will miss some collisions.
Could you also let me know if this problem could still arise with the dump modify thresh option?
Or is there any way to make the region wrap around the boundary condition?
That depends on how you compute this threshold value.
Using the region approach could probably be made to work, if you define a union of regions that include the principal location and all (26?) permutations of regions where one or more dimensions are displaced +/- one box length.
Another idea worth looking into could be to use compute coord/atom where you look for the coordination number for the Xe atoms limited to the Rb atom type. Then all Xe atoms within the cutoff should have a coordination number of 1 while the rest should have a number of zero.
@akohlmey
Thank you, this seems like a simpler solution to implement. I have tried doing the same,
group xenon type 1
group rubidium type 2
group rb_atom id 2197
# Compute coordination: Xe atoms with Rb atom (ID 2197) within 9 Å
#########
compute mycord1 xenon coord/atom cutoff 10.0 group rb_atom 2
variable xe_near_rb atom c_mycord1
dump dump_1 xenon custom 100 dump.lammpsdump id type x y z vx vy vz
dump_modify dump_1 thresh v_xe_near_rb > 0
############
# Main run
run 10000
undump dump_1
write_restart ./restart_file_nve
1 ) Is this the right syntax? This seems to be working for now, or should I add some extra to take care of the boundary condition?
…
2) In this approach I’m facing the following issue: my cutoff radius for the pair-potential calculation is 15 angstrom. So when I try to calculate the coordinate number for the 20 angstrom sphere, I get the error that:
ERROR: Compute coord/atom cutoff is longer than pairwise cutoff
Is it possible to calculate the coord number for 20 angstrom sphere without raising the pair-cuoff to 20 ?
…
3) I’m doing the simulation in NVE ensemble, and the simulation box is fixed. But when I dump the trajfile, it is writing the box size at each step, which is redundant. Is there any way to suppress this?
Hi,
Thank you. Currently. I’m just using the default settings to write the dump file. It looks like this
ITEM: TIMESTEP
3000
ITEM: NUMBER OF ATOMS
2
ITEM: BOX BOUNDS pp pp pp
0.0000000000000000e+00 3.3600000000000000e+02
0.0000000000000000e+00 3.3600000000000000e+02
0.0000000000000000e+00 3.3600000000000000e+02
ITEM: ATOMS id type x y z vx vy vz
1950 1 236.745 229.06 222.309 0.000860414 0.00175857 -0.000742939
1930 1 222.394 233.634 223.397 0.000724146 -0.0016363 0.00146766
the position and velocity has 6 significant digits. I guess I only need one decimal place accuracy for position. It would be also helpfull to remove some redundant information from the header for example lines 5-8.
Is there any way to remove these lines selectively? using the dump_modify dump_1 header no option removes all headers, including the timestep inforamtion.
In your situation I would use fix recenter ... shift all to simply fix the Rb atom’s position, while having the entire system displace consistently to preserve the correct dynamics (fix recenter command — LAMMPS documentation).
Then you can define a static region around the Rb atom to dump over time.