Fix reaxff/species : save molecules layer by layer

Hello everyone,

I am simulating how atomic oxygen reacts with kapton, for that I am using the reaxff potential. In my simulation box I have Kapton (my polymer) at the bottom of the cell (between 0-50 A in z direction) the supercell is empty between 50 and 400A in z direction. During the simulation I bombard Kapton by introducing atoms of oxygen at 5eV and direct them towards the kapton surface.

I wanna study the chemical modification of Kapton layer by layer. For that I am defining differnt regions with steps of 9 A between 0 and 45 A in z direction. Then I determine the moleuclar composition of each layer using fix reaxff/species. The problem is that when defining my regions I cut some of the molecules, so in the final file I don’t see the entire molecule but just the pieces that are inside each region. What I want to do is to include in each region the entire molecule without cutting it.

I know it is possible to do it in a classic system with chunk/atom and group dynamic all include molecule. But as I am using ReaxFF I don’t have that option (no molecude IDs). Someone knows how to solve that?

Here is how I define the different groups:

# Kapton composition layer by layer
variable z_min equal 0
variable z_max equal 45
variable step  equal 9

label loop_layers
region region_layer_$(v_z_min) block INF INF INF INF ${z_min} $(v_z_min+ v_step) units box
group kapton_layer_$(v_z_min) dynamic all region region_layer_$(v_z_min) every 500
fix             layer_$(v_z_min) kapton_layer_$(v_z_min) reaxff/species 1000 1 1000 kapton_molecules_$(v_z_min)_$(v_z_min+step).out
variable z_min equal $(v_z_min + v_step)
if "${z_min} < ${z_max}" then "jump SELF loop_layers"

If it is the lack of molecule IDs that is limiting you, you can use the per-atom vector generated by fix reaxff/species instead.

1 Like

Thank you for your answer. I’ve past a few hours trying to print the per-atom vector to access the molecule IDs but th eonly output that i see is :

# Time-averaged data for fix store_mols_ID_0
# TimeStep f_layer_0[1] f_layer_0[2]
0 0 0
10 85 28
20 85 28
30 85 28
40 85 28
50 85 28

This are the corresponding lines :slight_smile:

region region_layer_$(v_z_min) block INF INF INF INF ${z_min} $(v_z_min+ v_step) units box
group kapton_layer_$(v_z_min) dynamic all region region_layer_$(v_z_min) every 500
fix             layer_$(v_z_min) kapton_layer_$(v_z_min) reaxff/species 10 1 10 kapton_molecules_$(v_z_min)_$(v_z_min+v_step).out
fix     store_mols_ID_$(v_z_min) kapton_layer_$(v_z_min) ave/time       10 1 10 f_layer_$(v_z_min)[*] file molecules_$(v_z_min)_$(v_z_min+v_step).dat

How can I have access and print the molecules IDs?

Your use of fix ave/time is incorrect. For per-atom data, it should be fix ave/atom.

I was able to save the IDs of the molecules using the next commands :

region region_layer_$(v_z_min) block INF INF INF INF ${z_min} $(v_z_min+ v_step) units box
group kapton_layer_$(v_z_min) dynamic all region region_layer_$(v_z_min) every 1
fix             layer_$(v_z_min) kapton_layer_$(v_z_min) reaxff/species 10 1 10 kapton_$(v_z_min)_$(v_z_min+v_step).out cutoff * * 0.4
dump dumpMolID_$(v_z_min) all custom 10 molecule_ids_$(v_z_min).dat id type f_layer_$(v_z_min)

The output looks like this :

ITEM: TIMESTEP
10
ITEM: NUMBER OF ATOMS
13114
ITEM: BOX BOUNDS pp pp ff
0.0000000000000000e+00 1.9557654758181411e+02
0.0000000000000000e+00 2.3175884170858467e+01
0.0000000000000000e+00 4.0023099999999999e+02
ITEM: ATOMS id type f_layer_0
231 2 2
221 2 2
216 1 2
220 2 2
211 3 2
...

The problem is that in the output I have more than 73 IDs even at the beginning of the simulation. But I only have 3 types of molecules in my kapton (before it reacts with the oxygen). So i don’t think this is a good method to do what I want.

When describing the different regions, some molecules are divided in different regions. What I want is that each group of atoms include all the molecules not only the part that is present in each region. To be clear, what I want is lammps to add to every atom group, the whole molecule even if a part of the molecule is in another region.

I don’t know if that is possible with ReaxFF? Someone has an idea?

molecule IDs != molecule types. That is irrelevant from whether you using ReaxFF or not.

It may be possible, but you’ll have to write your own C++ code based on the existing code.
Or you do the whole thing in post-processing. Then you may be better off using fix reaxff/bonds and also do the whole topology/molecule classification on your own.
This is becoming to narrow a use case and to specific to be something that would make sense to implement in LAMMPS as a generic feature.

There is also a conceptual issue - if you want to include molecules which are only partly in the region, they will be counted multiple times.

Why don’t you output molecules’ CoM (one of the options of fix reaxff/species) and post-process that?

I knew about this conceptual issue but I was thinking about correcitng it in post processing.

I am going to calculate the molecular composition of all my kapton (working only with one region), compute the center of mass of each molecule. Then I’ll write a python code that reads all this information and will count the molecules in each region. This way I will not cut the molecules.

Given the information being outputted by fix reaxff/species it SHOULD be possible to use compute chunk/atom ... f_FIX_NAME ... to ā€œchunkā€ atoms into molecules.

Once chunking is successful, you can calculate each chunk’s CoM (and thus each ā€œmoleculeā€'s CoM) using compute com/chunk. You can also write a custom ā€œelement variableā€ and sum across a chunk:

variable elem atom 100^(type-1) # types start from 1
compute molformula all reduce/chunk COMPUTE_NAME sum v_elem

Then a chunk with (for example) a molformula of 50401 is a molecule with 1 atom of type 1, 4 atoms of type 2, and 5 atoms of type 3.

You can then use compute chunk/spread/atom so each atom ā€œknowsā€ what its molecular formula is, and so on.

You can maybe use the ā€˜Cluster Analysis’ option in OVITO. That might help!