### Author Topic: Bond Angle Distribution  (Read 511 times)

#### akhoursh

• Newbie
• Posts: 18
##### Bond Angle Distribution
« on: August 10, 2018, 04:24:35 PM »
Dear Ovito users,
Hi,

I'm trying to use python in ovito to calculate the BAD. However, I have  non-periodicity in z direction. For the whole periodicity I have this as a part of my code:

.
.
.
bond_vectors = particle_positions[bonds_array[:,1]] - particle_positions[bonds_array[:,0]]
bond_vectors += np.dot(data.cell.matrix[:,:3], data.bonds.pbc_vectors.T).T
bond_vectors /= np.linalg.norm(bond_vectors, axis=1).reshape(-1,1)
.
.
.

But, how can I modify it to have non-periodicity in z direction ?

Ali

#### Alexander Stukowski

• Hero Member
• Posts: 551
##### Re: Bond Angle Distribution
« Reply #1 on: August 11, 2018, 09:14:34 AM »
Hi Ali,

This code should for work for non-periodic or mixed periodic/non-periodic cells as well. For every bond in the system, OVITO keeps track of whether it crosses a periodic boundary of the simulation. This information is stored in the data.bonds.pbc_vectors array, which contains a triplet of integers for each bond specifying which boundaries it crosses, how many times and in which directions. For bonds that do not cross any boundary, the triple will be (0,0,0). In your case, the cell is non-periodic in Z, so the third number of the triplet will be zero for every bond, because there simply are no bonds crossing the z-boundaries of the cell in your system. Due to that 0 entry in the data.bonds.pbc_vectors array, the z-components of the calculated bond vectors will be left untouched by the calculation performed in line 2 of your code.

The above statement assumes that OVITO is informed about the mixed PBCs of your system. For LAMMPS dump files this information gets automatically read from the input file. You can verify that by inspecting the pbc field of the SimulationCell object.

-Alex
« Last Edit: August 13, 2018, 11:06:27 AM by Alexander Stukowski »

#### akhoursh

• Newbie
• Posts: 18
##### Re: Bond Angle Distribution
« Reply #2 on: August 13, 2018, 04:11:14 PM »
Hi Alex,