ChemTraYzer -- Reaction Models from Molecular Dynamics Simulations
ChemTraYzer (CTY) is an integrated simulation and analysis tool to study reactive molecular dynamics of a gas phase.
How to run the ChemTraYzer:
The main script is simulation.py which takes a configuration file as input:
python simulation.py < example/sim.confAvailable settings are desribed in the configuration file (example/sim.conf). CTY then builds the box with packmol and runs the dynamics with LAMMPS. Reactions and species are registered and sent to an quantum mechanics engine for optimization (Gaussian by default).
Once the high level calculations are done, CTY can build the reaction mechanism, and fit Arrhenius and NASA parameters:
python master.py . -reac default.reac -source QMwhere default.reac is the reaction list output from simulation.py and QM is the folder with the QM engine output. Final output is the reaction list default.reac, the observed rate constants reac.rate.tab, time-wise species and reactive event counts reac.spec.tab and reac.reac.tab, the mechanism in ChemKin format Default.therm and Default.chem, and the mechanism in a graph format Default.gml.
It is possible to run CTY without the dynamics part, if there is a LAMMPS-style bond table as in example/bonds.tatb:
python processing.py example/bonds.tatb -i 1:6 -i 2:1 -i 3:8 -norec 5where the repeated -i provides the atom/element mapping and -norec 5 enables the recrossing detection for an interval of 5 data points in the bond table. CTY then creates the reaction list output (bonds.tatb.reac), which in turn can be used to calculate rate constants from the observed events and concentrations:
python analyzing.py examples/bonds.tatb.reacSince in this case, CTY lacks the geometry information from the dynamics, a QM optimization and thermochemistry parameter fitting is not possible.
How to change the QM engine or the QM submission scripts:
The method submitQM() in simulation.py creates and submits a batch job containing the input for the QM engine (Gaussian09 in our case). It uses some static variables from the Simulation class to fill in e.g. the QM method. If you change the QM engine to something else than Gaussian, you also need to change the QM output read routine harvestGaussian() in harvesting.py. Keep in mind that the hindered rotor contribution to the RRHO partition functions is adapted to Gaussian output only.
Extending the supported elements of ChemTraYzer
CTY can handle the elements C, H O, N, F, S, Cl, He, Ne, and Ar by default. If you have other elements in your simulation, you need to add the maximum possible valency and the maximum possible coordination for those elements. Search for ".Val" and ".Cor" in processing.py and add the new numbers accordingly. CTY uses both values to distingush between long range interactions and actual bonds.
Python packages that are required to run ChemTraYzer:
Anharmonic correction to rate constants from RRHO-TST
For a short tutorial on how to correct your rate constants according to ACS Omega 2020, 5, 5, 2242-2253, please read the README.doc located in the folder small_tools/ACSOmega2020. You will need the python library TAMkin, which is not required to run ChemTraYzer.
Bug Reports:
2016-01-07: OpenBabel ignores the aromaticity of carbon atoms in SMILES in some cases
- OpenBabel adds too many implicit hydrogen atoms to carbon atoms which should be aromatic
-> analyzing.py returns a warning that the balance of elements failed, although the SMILES are balanced correctly
Bug Closed:
2015-07-30: Recrossing filter fails if final reaction of recrossing event is of type A -> A
- Reaction A -> A is removed before tracing reaction history
-> If Reaction A -> A is part of the recrossing process (only as one of the final steps), the filter tries to remove that reaction, but it cannot find it (due to previous point)
Version 1.1:
2015-07-15: (not directly related to the code) Installation of pygraphviz for windows failed
- a user reported problems with installing pygraphviz for windows 8
-> 'analyzing.py' cannot be used without pygraphviz
**SOLUTION:** pygraphviz is optional now -> 'analyzing.py' runs witout
Bug Fixes:
Version 1.1:
2015-07-08: Disturbance of atom balance in 'analyzing.py' if the initial chemical composition contains single-atom molecules.
- 'processing.py' does not recognize initializing reactions (atoms -> molecules) for single-atom molecules
- 'analyzing.py' computes initial chemical composition from initializing reactions
-> single-atom molecules are missed and concentration will become negative when these molecules are consumed. This in turn leads to wrong concentration integrals and therefore to wrong rate constants.
**SOLUTION:** Initial reactions changed so that single atoms are recognized
2015-08-31: When being initialized, Open Babel displays H and H2 molecules as empty strings
- Problems with displaying pure hydogen molecules
-> String representations of Reactions may have commas enclosing an empty string
**SOLUTION:** Identify H and H2 separately
2015-09-29: Systems without any initial bond will end with an error in the 'splitBonds' function
- Initialization of bond handler yields empty array
-> 'splitBonds' trys to access empty array and fails
**SOLUTION:** 'splitBonds' checks for empty bond array to avoid abort
2016-01-29: Recorssing filter period too long if first timestep in Bond-Order output non-Zero
- Filter period is the the product of the number of timesteps between two entries in the Bond-Order file and a user-defined number of Bond-Order steps
- the code assumes that the first timestep is zero and simply takes the second timestep as number of steps between two steps
-> the computed number of steps between two timesteps is way to large, thus the filter period is way too long and actual reactions may be filtered
**SOLUTION:** Initial timestep extraction method added
2016-01-29: Depending on the ReaxFF force field the Bond-Order between the two oxygens of a peroxide group (R-O-O.) is oscillating around 1.5
- O-O bond is oscillating between single and double bond, thus the 'open' valence of the central O is oscillating between one and zero. As a consequence, the R-O bond is periodically forming and breaking
-> the Recrossing filter is removing these oscillator events from the output until the R-O-O. undergoes further reactions (in which case R-O-O. would appear as an extremely short-lived intermediate).
**SOLUTION:** half-step bond orders allowed -> issue shifted to 0.25 BO before and after integer bond orders, which are presumably less important
Hi Wolfgan Veresteck,
as shown on the website you should run the bonds.tatb file with the processing.py script and not with the analyzing.py. The outcome would be a reaction file called “bonds.tatb.reac” which can then be supplied to the analyzing.py script (Website example):
Please contact us again, if it's still not working.
Last edit: Enia Mudimu 2024-11-25
Hi Enia Mudimu,
that was a mistake on my side. Sorry for misunderstanding the instructions.
However, I am getting a new error on OBBOndObject (see below). It seems the API to OpenBabel has changed the function name GetBO to GetBondOrder.
Running
on the python scripts solved the issue.
Thanks for the support.
Regards
Wolfgang
with GetBondOrder()
After the example worked i tried my own molecule (PPEK + O) and get an error message.
First Question: I have several types of O (coming from the classical force field one is in the aromatic rings, etc.
should sth like this work (multiple mappings to C, H and O)?
python ~/Downloads/ChemTraYzer_2.1/processing.py bonds.reaxff.dump -gen -dp 0.2 -i 1:6 -i 2:1 -i 3:1 -i 4:8 -i 5:8 -i 6:8 -i 7:8 -i 9:1 -i 10:6 -i 11:6 -i 12:6 -i 13:6 -i 14:8
I get an error message:
Is there a known limit to the molecule size?
In my case it's a sinlge PEEK molecule with 5170 atoms in the beginning + some Oxygens
Hi Enia Mudimu, I have installed CTY2.0, but when using the case study, the situation shown in the figure below occurs, and the result does not match the case study. May I ask what the reason for this is?
just like this
(ct) E:\chemtrayzer-code>python processing.py bonds.tatb -n 0 -i 1:6 -i 2:1 -i 3:8 -norec 100
Tue Nov 26 07:34:40 2024 / UTC
!--------------- ChemTraYzer - ReaxFF Data Processing ---------------! [<work file="">]</work> [-start <start time="">]</start> [-mem <memory in="" !="" bytes="">]</memory> [-cut <satic bond="" order="" cutoff="">]</satic> [-n <number of="" steps="">]</number> [-i ! ): ! binding of element identifiers. Each !
! !
! Version 2017-04-07 !
! Author Malte Doentgen, LTT RWTH Aachen University !
! Email chemtrayzer@ltt.rwth-aachen.de !
! !
!
! <element id="" in="" reaxff="">:<atomic number="" of="" element="">]</atomic></element> [-all] [-norec !
! <recsteps>]</recsteps> [-skip <steps>]</steps> !
! !
! options (for latest
! !
! -start: timestep to start reading at, except the latest timestep in !
! a <work file=""> exceeds the <start time=""> (default=0) !
! !
! -mem: bytes of memory available for reading from the bond order file !
! (default=10000) !
! !
! -cut: static bond order cutoff which is used to eliminate long range !
! interactions (default=0.5) !
! !
! -n: set number of steps for processing; to run until end of file is !
! reached use negative value or zero (default=0) !
! !
! -i: define element identifier (without identifiers the code can not !
! process data). Note: each element has to be given in a separte -i !
! option (e.g. -i 1:6 -i 2:1, for ID 1 being carbon and ID 2 being !
! hydrogen) !
! !
! -all: remove
! identifier given in the command line is copied to all bond order !
! files !
! !
! -norec: filter-period for fast back- and forth reactions. Note: For !
! very reactive systems, recrossing events and "normal" fast back- and !
! forth reactions can occur on the same timescale! !
! !
! -skip: analyzse only each <steps>th entry of the connectivity file !
!----------------------------------------------------------------------!</steps></start></work>
Reading files ...
!----------------------------------------------------------------------!
! Bond order files without work data !
!----------------------------------------------------------------------!
bonds.tatb
Processing files ...
bonds.tatb reading all steps, staring at timestep 0, using 10000
bytes memory, a static cutoff of 0.5, considering 100 steps for
recrossing and reading each 1th step of connectivity.
Identifying 1: 6, 2: 1, 3: 8
0::C
0::[OH]
1000:[CH3]:
1000:O:
630:C,[OH]:[CH3],O
Hi GYH123456,
it seems you have set another recrossing time (norec parameter than in the example. This can lead to another result than expected from the example.
Hi Enia,I set norec1,10,100 respectively, but still have the problem
Hi Wolfgang,
initially we only considered small-sized molecule systems only. Due to that we did not consider the constraints imposed by python for recursive methods. While creating the graph objects that eventually iterate over all atoms to map the bonding partners it seems your molecule has reached that recursion limit. In processing.py you can try to add to the imports the lines:
import sys
sys.setrecursionlimit(10000) # Increase to a higher or lower values
to increase the recursion limit.
Hi Enia,
yes, i played around a little bit more last night, but was too tired to post. Basically, i did as you said and included
after the imports in processing.py.
However, as i am running a newer version of openbabel there was another error in processing.py around line 790 with
Unlike the other functions, see post above, where it was just a change of the function name and easy to resolve, this one doesn't have a replacement though. So as a first test to simply get it runnning, i commented out these lines.
Finally, as the recursive loop can take quite a time, i got a timeoput from openbabel. I adjusted "maxSeconds" to 600 in openbabel/src/formats/smilesformat.cpp around line 3980 and recompiled the library
Just reporting, in case somebody else runs into the same thing.
At the moment it's running, but quite slow, as could be expected. I'll have to see, if i can reduce the system in VMD or Ovito before going into analysis, which might speed things up properly.
Regards
Wolfgang
Hi all,
I didn't manage to get ChemTrayzer running properly. Therefore, I fumbled some python together while using NetworkX as graph library. With this i don't have the problem in analyzing "large" molecules anymore and can extract the reactions from reaxff simulations.
At the moment, this is just some basic code and obviously cannot extract to smiles or do some fancy analysis. But it is creating some simple figures before and after reaction. In case anybody is having issues with chemtrayzer, or when some pictures are enough or you just want to give it a shot, you can find it here:
https://github.com/wverestek/reaXtract
Regards
Wolfgang
Last edit: Wolfgang Verestek 2024-12-17
Hi Enia ,
it seems that I have encountered exactly the same problem with GYH123456, I tried with my own example does not work, it seems to be openbabel library problem, but I am not sure of the exact reason, please can you help us find the reason, thank you!
When the first step is wrong, he'll report an error in the "analysis" program.
Hi winwinwin,
it looks like you are using Windows. ChemTraYzer was developed for Linux and does not work on Windows. I assume this is why you get this error when ChemTraYzer tries to call the mkdir command.
Hi Enia .
Hi, thank you so much. I think I have successfully installed cty but I would like to ask what should be the valence and coordination number of iron if I wish to add it to it, I tried valence and coordination number of 6 but it doesn't seem to work, it's not recognized
Last edit: GYH123456 2025-02-05