AngularDistribution¶
- class AngularDistribution(md_trajectory, cutoff_radius=None, start_time=None, end_time=None, triplet_selection=None, time_resolution=None, info_panel=None)¶
Constructor for the AngularDistribution object.
- Parameters:
md_trajectory (
MDTrajectory
|AtomicConfiguration
) – The MDTrajectory or configuration the angular-distribution should be calculated for.cutoff_radius (PhysicalQuantity of type length) – Cutoff radius to define the maximum considered bond distance between the central atom and each of its two neighbors. Either a single value for both neighbors or one value for each pair. Default:
2.5 * Angstrom
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 frame time
triplet_selection (list of
PeriodicTableElement
| list of ints | list of str) – Only consider angles between these atoms. The order must be (central_atom, neighbor_1, neighbor_2). The selection can be given by a list of 3 elements i.e.PeriodicTableElement
or a list of 3 atom indices i.e. ints or by a list of tags i.e. str. Default: first elementtime_resolution (PhysicalQuantity of type time) – The time interval between snapshots in the MD trajectory that are included in the analysis.
info_panel (InfoPanel (Plot2D)) – Info panel to show the calculation progress. Default: No info panel
- angles()¶
Return the angles associated with the histogram.
- data()¶
Return the angular distribution histogram.
Usage Examples¶
Load an MDTrajectory containing ethane molecules and calculate the angular distribution for C-C-H angles:
md_trajectory = nlread('ethane_md.nc')[-1]
angular_distribution = AngularDistribution(md_trajectory,
cutoff_radius=[2.3*Angstrom, 1.2*Angstrom],
triplet_selection=[Carbon, Carbon, Hydrogen])
# Get the histogram of the angle distribution and the associated angles.
histogram = angular_distribution.data()
angles = angular_distribution.angles().inUnitsOf(Degrees)
# Plot the data using pylab.
import pylab
pylab.bar(angles, histogram, label='C-C-H angles')
pylab.xlabel('angle (degrees)')
pylab.ylabel('Histogram')
pylab.legend()
pylab.show()
Notes¶
Set the cutoff_radius
parameter to the maximum bond length that should be
considered. A good choice is typically the end of the first peak in the
RadialDistribution function of the respective elements. If only one
value is given, this value is used for both neighbor pairs. As shown in the
usage example, you can also specify different cutoff radii for the two neighbor
pairs.
Instead of each of the three elements in the triplet_selection
parameter,
you can alternatively specify a list or a tag to select the atoms between which
the angular distribution is calculated.