Author Topic: How to color code atoms showing third peak of a histogram  (Read 71 times)

akhoursh

  • Newbie
  • *
  • Posts: 10
How to color code atoms showing third peak of a histogram
« on: August 20, 2018, 04:47:40 PM »
Dear OVITO users,
Hi,

I used the below code to obtain the Bond angle distribution:

.
.
.
for particle_index in range(data.number_of_particles):
      local_bonds = bond_vectors[np.fromiter(bonds_enum.bonds_of_particle(particle_index), np.intp)]
      angle_matrix = np.squeeze(np.inner(local_bonds[np.newaxis,:,:], local_bonds[:,np.newaxis,:]), axis=(0,3))
      angle_cosines = angle_matrix[np.triu_indices(len(angle_matrix), k=1)]
      angle_cosine_histogram += np.histogram(angle_cosines, bins=bin_count, range=(-1.0,1.0))[0]
.
.
.

Since it is based on the cosine of theta, I then used Matlab to draw the diagram based on the Theta. I also attached the image of it. Now, I'm looking to find a way to colorcode atoms corresponding the third peak, i.e. around 130 degree.  I wonder if you could please help me out with it.

Thanks in advance,
Ali



Constanze Kalcher

  • Administrator
  • Jr. Member
  • *****
  • Posts: 62
Re: How to color code atoms showing third peak of a histogram
« Reply #1 on: August 21, 2018, 04:32:43 PM »
Dear Ali,

are you using the GUI of OVITO or is your code snippet part of a larger batch script?
Also can you explain a little bit more on what bonds we are looking at here and how you generate them. It is not yet clear to me which atoms you would like to color code.   A bond angle is defined by three atoms, so which of these three should it be?

-Constanze