VibrationalMode¶
- class VibrationalMode(dynamical_matrix, configuration=None, kpoint_fractional=None, mode_indices=None)¶
Class for calculating the vibrational modes of a configuration.
- Parameters:
dynamical_matrix (
DynamicalMatrix
) – The dynamical matrix to use for the calculation.configuration (
MoleculeConfiguration
|BulkConfiguration
|DeviceConfiguration
) – The configuration for which the vibrational modes should be calculated. If no calculator is attached to the configuration, the calculator from dynamical_matrix is used. Currently, configuration must be the same as the configuration from dynamical_matrix and is therefore not needed. Default: The configuration fromdynamical_matrix
kpoint_fractional (tuple of float) – The kpoint (in fractional reciprocal space coordinates) for which the vibrational modes should be calculated. Default: The gamma point
(0.0, 0.0, 0.0)
mode_indices (list of int) – The indices of the modes (bands) to include. Default: All modes.
- eigenvectors(mode_index=None)¶
Return the vibration eigenvectors, \(u\), for the selected k-point and mode indices.
The eigenvectors are solutions to \(D u = \omega^2 u\), where \(D\) is the dynamical matrix, and \(\omega\) is the frequency. If
mode_index
is not specified all calculated modes are returned.Note, the mode
u[:,i]
is the eigenvector corresponding to mode indexmodeIndices()[i]
.- Parameters:
mode_index (int) – Mode index. Default: All calculated modes.
- Returns:
Eigenvectors of the vibrational modes
- Return type:
numpy.array
- evaluate(mode_index=None)¶
Return the vibrational energies at the selected mode index. If
mode_index
is not specified all mode energies are returned.- Parameters:
mode_index (int) – Mode index. Default: All modes.
- Returns:
Energies of the vibrational modes.
- Return type:
PhysicalQuantity of type energy
- kPoint()¶
- Returns:
The kpoint (in fractional reciprocal space coordinates).
- Return type:
tuple of float
- metatext()¶
- Returns:
The metatext of the object or None if no metatext is present.
- Return type:
str | None
- mode(mode_index, temperature=None)¶
Return the vibrational mode with the specified mode_index. The eigenmode, \(v\), is obtained from the eigenvectors, \(u\), as \(v = \frac{u}{\sqrt{M}} s\), where the scaling factor, \(s = \frac{\sqrt{k_B T}}{\omega}\), gives the amplitude of a classical oscillator with frequency \(\omega\).
- Parameters:
mode_index (int) – The mode index. Must be contained in the list returned by
modeIndices()
.temperature (PhysicalQuantity of type temperature) – The temperature used in scaling the amplitude. Default:
300 * Kelvin
- Returns:
(N, 3) complex array
- Return type:
PhysicalQuantity of type length
- modeIndices()¶
- Returns:
The mode indices.
- Return type:
list of int
- movie(mode_index, mode=None, temperature=None, number_of_frames=None, repeat=None)¶
Method for generating a trajectory showing the vibrations with the specified
mode_index
.- Parameters:
mode_index (int) – The mode index. Must be contained in the list returned by
modeIndices()
.mode (PhysicalQuantity of type length) – The mode (N, 3) complex array.
temperature (PhysicalQuantity of type temperature) – The temperature used in scaling the amplitude. Default:
300 * Kelvin
number_of_frames (int) – The number of frames in the trajectory. Default:
20
repeat (tuple of integers) – The number of repetitions along A, B, and C axes. For molecules this must be
(1, 1, 1)
; for devices(n, m, 1)
. Default:(1, 1, 1)
- Returns:
A trajectory.
- Return type:
- nlprint(stream=None)¶
Print a string containing an ASCII table useful for plotting the AnalysisSpin object.
- Parameters:
stream (python stream) – The stream the table should be written to. Default:
NLPrintLogger()
- setMetatext(metatext)¶
Set a given metatext string on the object.
- Parameters:
metatext (str | None) – The metatext string that should be set. A value of “None” can be given to remove the current metatext.
- uniqueString()¶
Return a unique string representing the state of the object.
- wavenumbers(mode_index=None)¶
Return vibrational wavenumbers. If
mode_index
is not specified all wavenumbers are returned.- Parameters:
mode_index (int) – Mode index. Default: All modes.
- Returns:
Wavenumbers of the vibrational modes
- Return type:
PhysicalQuantity of type inverse length
Usage Examples¶
Calculate the vibrational eigenmodes of a methane molecule using the BrennerCalculator:
# -------------------------------------------------------------
# Molecule configuration, CH4
# -------------------------------------------------------------
# Define elements
elements = [Hydrogen, Carbon, Hydrogen, Hydrogen, Hydrogen]
# Define coordinates
cartesian_coordinates = [[ 11.61454603, 11.09244804, 9.99999993],
[ 10.67862603, 10.93144595, 10.52879495],
[ 9.99999997, 11.75542099, 10.3236729 ],
[ 10.22904002, 10.00000001, 10.1942581 ],
[ 10.87074303, 10.87768505, 11.59731907]]*Angstrom
# Set up configuration
molecule_configuration = MoleculeConfiguration(
elements=elements,
cartesian_coordinates=cartesian_coordinates
)
# -------------------------------------------------------------
# Calculator
# -------------------------------------------------------------
calculator = BrennerCalculator()
molecule_configuration.setCalculator(calculator)
molecule_configuration.update()
molecule_configuration = OptimizeGeometry(
molecule_configuration,
max_forces=0.001*eV/Ang,
max_steps=200,
max_step_length=0.5*Ang,
trajectory_filename=None,
optimize_cell=False,
optimizer_method=LBFGS(),
)
# -------------------------------------------------------------
# Vibrational modes
# -------------------------------------------------------------
# Compute Hessian by finite difference of forces.
dynamical_matrix = DynamicalMatrix(molecule_configuration, 'ch4.hdf5', object_id='dynamical_matrix')
# Vibrational analysis.
vib_mode = VibrationalMode(dynamical_matrix, mode_indices=range(6,15))
vib_mode.nlprint()
Notes¶
For a MoleculeConfiguration, the six lowest vibrational modes have zero-frequency. In the above example, these modes are not calculated since
mode_indices=range(6,15)
. The six zero-frequency modes correspond to three rigid translational modes and three rigid rotational modes.It is important to do a fine structual relaxation before calculating vibrational (or phonon) modes. This may also require specifying a higher
density_mesh_cutoff
in NumericalAccuracyParameters.