How to merge the atom types in data file?

Hi all,
I have a system including cations, hydroxide ions and water molecules, using ReaxFF potential from Van Duin. I added some new OH- into my system using read_data, and then I want to merge the old “O in OH-” and the new “O in added OH-” together.
The part of data file was showed below, as you can see, the old " O in OH-" is with type=5 but the newly added " O in OH-" is classified as type =6: I want them to have some atom type.

Could you please tell me whether there is a command in LAMMPS to merge the atom type, or I have to post-process the data file/group the two types of atom in calculation? Thanks! (39.6 KB)


1 12.01 #C
2 1.008 #H
3 14.06 #N
4 15.999 #O in H20
5 15.999 #O in OH-
6 15.999 #O in added OH-
7 1.008 #H in added OH
8 22.98977 #Na(Na+)

Songlin Li
Ph.D. Student,
Technion, GETP & TEEM lab

You can change the type of atoms with the set command — LAMMPS documentation
Mind you, you cannot change the number of types. That one is locked in after the simulation box is created, but it is not a problem to have atom types defined that are not used. The only downside is that the number of total atom types defines the number of type-2-element mappings you have to use with the pair_coeff command. So that will be unchanged.

Mind you, there is no specific benefit from “merging” atom types for your setup. The forces and energies should be computed exactly the same with having your O atoms spread over 3 atom types. They will all use the same parameters in the calculation.

1 Like

Thank you so much Alex. Actually I just want to calculate the RDF(N-O/H-O) more easily without grouping all O together. Maybe the group command can do the same job …

No. The set command is exactly the right solution for this.

something like:

set type 5 type 4
set type 6 type 4

Should make all oxygen atoms type 4

1 Like