# QNumbers¶

class QNumbers(md_trajectory, element_selection, fuzz_factor=None, start_time=None, end_time=None, calculate_distribution=True, time_resolution=None, info_panel=None)

Class for calculating the extended coordination number (Q-Numbers) for an MD simulation.

Parameters: md_trajectory (MDTrajectory | AtomicConfiguration) – The MDTrajectory or configuration to calculate the Q-numbers for. element_selection – The triple of elements that is used to calculate the q-numbers. The first element is the central element in the coordination, the second element specifies the required first neighbor to the central atom, and the third element denotes that the first neighbor needs to have at least one neighbor atom of that element. fuzz_factor (float) – The fuzz factor which the sum of the covalent radii is multiplied with, to obtain the cutoff radii. Default: 1.2 start_time (PhysicalQuantity of type time) – The start time. Default: 0.0 * fs end_time (PhysicalQuantity of type time) – The end time. Default: The last time frame. calculate_distribution (bool) – A flag to determine whether the distribution of Q-numbers or the time-dependent evolution of Q-Numbers along the trajectory should be calculated. Default: True (the distribution is calculated) time_resolution (PhysicalQuantity of type time) – The time interval between snapshots in the MD trajectory that are included in the analysis. info_panel (InfoPanel) – Info panel to show the calculation progress. Default: No info panel
data()
Returns: The q-number number distribution if calculate_distribution has been selected, other wise an array with dimensions (n_snapshots, q_max+1) with the time-dependent evolution of the various q-numbers. numpy array
qNumbers()
Returns: The Q-number values associated with the histogram if calculate_distribution has been selected, None, otherwise. numpy array | None
times()
Returns: The MD-times in case the time-evolution has been calculated, None otherwise. PhysicalQuantity of type time | None

## Usage Examples¶

Load an MDTrajectory and calculate the q-number distribution for a O-Si-O path:

md_trajectory = nlread('sio2.nc')[-1]

q_number = QNumbers(
md_trajectory,
element_selection=[Oxygen, Silicon, Oxygen],
fuzz_factor=1.2,
calculate_distribution=True,
)

# Get the histogram and the associated the coordination numbers.
bin_edges = q_number.qNumbers() - 0.4
histogram = q_number.data()

# Plot the data using pylab.
import pylab

pylab.bar(bin_edges, histogram, label='O-Si-O', width=0.8)
pylab.xlabel('Q-number')
pylab.ylabel('Histogram')
pylab.legend()

pylab.show()


q_numbers.py

Calculate and plot the time evolution of the q-numbers for a O-Si-O path:

md_trajectory = nlread('sio2.nc')[-1]

q_number = QNumbers(
md_trajectory,
element_selection=[Oxygen, Silicon, Oxygen],
fuzz_factor=1.2,
calculate_distribution=False,
)

# Get the histogram and the associated the coordination numbers.
times = q_number.times().inUnitsOf(fs)
q_number_evolution = q_number.data()

# Plot the data using pylab.
import pylab

# Make a plot for each q-number.
n_q_numbers = q_number_evolution.shape[1]
for i in range(n_q_numbers):
label = 'Q%i O-Si-O' % i
pylab.plot(times, q_number_evolution[:, i], label=label)
pylab.xlabel('Time (fs)')
pylab.ylabel('Q-number count')

pylab.legend()

pylab.show()


q_numbers2.py

## Notes¶

The Q-Number analysis is an extended coordination number. The coordination of each atom of the central element with atoms of the primary neighbor element is counted. In contrast to the regular CoordinationNumber analysis, the primary neighbors must have at least one neighbor atom to the secondary neighbor element [MDGH08].

This quantity is often used to interpret NMR or Raman experiments, to identify e.g. the coordination number of oxide tetrahedra, such as SiO4.

This analysis has two modes, distribution and time evolution, which can be switched via the calculate distribution argument. In the distribution analysis the histogram of the Q-numbers is plotted, similar to the coordination number analysis. In the time evolution analysis, the change of the number of atoms associated with a Q-number is analyzed as a function the simulation time. This analysis is performed each Q-number detected in the snapshots of the simulation, as shown in the second example, this yields $$Q_{max}+1$$ data sets, where $$Q_{max}$$ is the largest Q-Number found in the simulation.

The neighbors are identified via cutoff radii, which are determined as the sum of the covalent radii of the elements multiplied by the fuzz_factor, similar to the way the bonds are displayed in the Viewer.

In contrast to most other MD-Analysis functions, only elements can be given in the element_selection.

 [MDGH08] H. Manzano, J. S. Dolado, M. Griebel, and J. Hamaekers. A molecular dynamics study of the aluminosilicate chains structure in al-rich calcium silicate hydrated (c–s–h) gels. Phys. Stat. Sol. (a), 205(6):1324–1329, 2008. doi:10.1002/pssa.200778175.