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("model_296.data")
traj_mod = LoadTrajectoryModifier()
traj_mod.source.load("results/dump.*")
pipeline.modifiers.append(traj_mod)

modifier = CreateBondsModifier()
modifier.mode = CreateBondsModifier.Mode.Pairwise
# Create bond between water oxygen and water hydrogen ( create water )
modifier.set_pairwise_cutoff(4,7,1.1)
# Create bond between water oxygen and oxygen
modifier.set_pairwise_cutoff(6,7,3.5)
# Create bond between water oxygen and nitrogen
modifier.set_pairwise_cutoff(5,7,2.3)
modifier.lower_cutoff = 0.0
pipeline.modifiers.append(modifier)

pipeline.modifiers.append(BondAnalysisModifier(partition=BondAnalysisModifier.Partition.ByParticleType))

# Perform time averaging of the DataTable 'bond-angle-distr'.
pipeline.modifiers.append(TimeAveragingModifier(operate_on='table: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]')

 

 

Hi,

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.

https://stackoverflow.com/questions/2827393/angles-between-two-n-dimensional-vectors-in-python