Forum Navigation
You need to log in to create posts and topics.

Hydrogen bonding question

Hello everybody,


i am calculating bonded particles ( i create bonds since i am using ReaxFF and no initial bonds are presented ) and want to use the "ovito.modifiers.BondAnalysisModifier" to calculate hydrogen bonding of water oxygens and other particles. My water oxygen is particle 7 and i create a bond to particle 4 which is the hydrogen of water. Now i want to create a bond between particle 7 and particles 6 and 5 with a defined cutoff. My questions are:

In my particle 6 there are molecules 1 and 3 and i want to do a bond analysis between my water oxygen 7 and particle 6 of molecule 1 and another analysis with particle 6 of molecule 3. The bond analysis with particle 5 is straight forward.

Is it possible after doing the bond analysis to extract the coordinates of the particles  bonded to particle 7 (water oxygen) which do have an angle smaller than a defined (e.g. 120 ) one between Particle 7 (water oxygen) - Particle 4 ( Hydrogen of water ) and the bonded particle ?

Thank you

My first code looks like this:

pipeline = import_file("")
traj_mod = LoadTrajectoryModifier()

modifier = CreateBondsModifier()
modifier.mode = CreateBondsModifier.Mode.Pairwise
# Create bond between water oxygen and water hydrogen ( create water )
# Create bond between water oxygen and oxygen
# Create bond between water oxygen and nitrogen
modifier.lower_cutoff = 0.0


# Perform time averaging of the DataTable 'bond-angle-distr'.

# Compute and export the time-averaged histogram to a text file.
export_file(pipeline, "avg_bond_angles.txt", 'txt/table', key='bond-angle-distr[average]')




yes, that should be possible through the python scripting interface:  You can use the particle indices in the bond topology property array to look up the particle types and/or coordinates of any two atoms connected by a bond. Two calculate the angle between two bond vectors you can simply use numpy, see e.g.