# bond angle distribution

12

Dear Constanze Kalcher

I would like to know the correct result of the 'compute_bonds_angle_distribution.py' program for the 'CuZr_metallic_glass.dump.gz ' data . I want to verify the result I got myself. Can you show it to me?

Thanks.

Sacho

Dear Sacho,

I assume you are referring to a python script posted by Alexander a while ago, which uses the Create Bonds modifier to compute bond vectors and then creates a histogram of the different angles between those bond vectors.

If I execute that with OVITO 2.9 and use the example data from this tutorial, https://www.ovito.org/tutorials-2/create-custom-particle-properties/, I get the following distribution of bond angles:

Number of particles: 108000
Number of bonds: 786452
Bond angle cosine histogram:
[49171 34539 29644 27101 26466 26260 25248 23971 23328 22579 21827 21146
21145 21544 21886 22491 23859 24638 26205 28226 30216 32609 34170 36541
38790 40118 42065 42518 43127 43047 42341 41856 40882 39360 37640 35935
34059 32355 30766 28848 26837 25043 23284 21406 20013 18367 16883 15539
14574 14021 13333 12971 12365 12395 12297 12400 12886 13984 14581 16105
17896 19662 22335 25074 28343 32215 36865 42435 47970 54769 61257 66933
71451 74323 74744 72069 66762 57374 46285 34353 23153 13456 6006 1893
431 54 6 1 0 0 0 0 0 0 0 0
0 0 0 0]

The pairwise cutoff values were chosen as 2.7 Å (1-1) , 2.9 Å (1-2) and 3.3 Å (2-2).

-Constanze

Dear Constanze Kalche

Thanks for your answer. I got the same result with you. As shown on the left, I have drawn the bond angle distribution curve. But I don’t understand the result of this program. The end of the curve is upturned. I reviewed a number of relevant papers and found that the bond angle distribution function shows a downward trend at both ends and converges to zero, as shown on the right. So I am confused.

Sacho

Dear Sacho,

you are comparing two different things here. Note that the output of this script is only a histogram of the cosine of all bond angles that occur, i.e. you have created a histogram with equally sized bins in the cos(theta) space.

To get a bond angle distribution function you need to map the bin counts to a histogram with bins that are equally sized in theta-angle space (not cos(theta)-space). I think that during this transformation the bin counts should be multiplied with a factor of sin(theta), which will change the tail of the distribution function.

-Constanze

Dear Constanze

You are right, the x-coordinate of the two figures are different. I am sorry that I did not accurately express what I mean. For the output result, that is a histogram with equally sized bins in the cos(theta) space, I got the histogram, as shown below. But the bond-angle contribution curve I saw in papers is a downward trend at both ends, and to 0. I don’t know the result if it is correct. In addition, I did not understand the meaning of the last paragraph, why should the bin counts be multiplied with a factor of sin(theta)?

I am a beginner, thank you very much for helping me.

Sacho

Dear Sacho,

sorry for not being clear, I didn't only hint at the two axes being different in your pictures, I meant that it will make a difference if you create a histogram of a list of cos(theta)-values or if you bin the theta-values directly. In the latter case the tail of the distribution will look like what you're describing above. Maybe it's easier to see if you try it out and plot it yourself, e.g. by comparing:

```#METHOD 1
# Create linear array of bond angle cosines (all values in the upper half of matrix)
angle_cosines = angle_matrix[np.triu_indices(len(angle_matrix), k=1)]
# Incrementally compute histogram of angle cosines
angle_cosine_histogram += np.histogram(angle_cosines, bins=bin_count, range=(-1.0,1.0))

#METHOD 2
# Create linear array of bond angles
angles =np.arccos(angle_cosines)
# Incrementally compute histogram of angles
angle_histogram += np.histogram(angles, bins=bin_count, range=(0,np.pi))```

Furthermore, you should be able to convert one distribution curve into the other by converting the x-values and multiplying the bin-counts with sin(theta) (and a normalization factor of 0.5*pi). Do you agree?

-Constanze

Quote from Constanze Kalcher on October 14, 2019, 12:57 pm

Dear Sacho,

I assume you are referring to a python script posted by Alexander a while ago, which uses the Create Bonds modifier to compute bond vectors and then creates a histogram of the different angles between those bond vectors.

If I execute that with OVITO 2.9 and use the example data from this tutorial, https://www.ovito.org/tutorials-2/create-custom-particle-properties/, I get the following distribution of bond angles:

Number of particles: 108000
Number of bonds: 786452
Bond angle cosine histogram:
[49171 34539 29644 27101 26466 26260 25248 23971 23328 22579 21827 21146
21145 21544 21886 22491 23859 24638 26205 28226 30216 32609 34170 36541
38790 40118 42065 42518 43127 43047 42341 41856 40882 39360 37640 35935
34059 32355 30766 28848 26837 25043 23284 21406 20013 18367 16883 15539
14574 14021 13333 12971 12365 12395 12297 12400 12886 13984 14581 16105
17896 19662 22335 25074 28343 32215 36865 42435 47970 54769 61257 66933
71451 74323 74744 72069 66762 57374 46285 34353 23153 13456 6006 1893
431 54 6 1 0 0 0 0 0 0 0 0
0 0 0 0]

The pairwise cutoff values were chosen as 2.7 Å (1-1) , 2.9 Å (1-2) and 3.3 Å (2-2).

-Constanze

Dear Constanze

Could you tell me where can i find this Python script you mentioned above.

Thanks

-Ryan

Dear Ryan,

since we get a lot of questions on this topic I will create a tutorial and publish it in our tutorials section this week.
https://www.ovito.org/tutorials-2/

Best,

Constanze

Dear Constanze，

Thank you for your help, you are really great. I think what you said is that the output of the method1 code is only a cosine histogram and cannot directly convert only the horizontal axis, the value of Y axis also needs to be converted，multiplying the bin-counts with sin (theta) and 0.5*pi，is it right？The picture on the left is the result of running the method2 code, and the picture on the right is the bond-angle- distribution of method1 and method2. Their results are not equal. Is there something wrong with me?

best wishes.

Sacho