CodeEntropy.entropy.vibrational module

Vibrational entropy calculations.

This module provides VibrationalEntropy, which computes vibrational entropy from force, torque, or combined force-torque covariance matrices.

The implementation is intentionally split into small, single-purpose methods: - Eigenvalue extraction + unit conversion - Frequency calculation with robust filtering - Entropy component computation - Mode selection / summation rules based on matrix type

class CodeEntropy.entropy.vibrational.VibrationalEntropy(run_manager: Any, planck_const: float = 6.62607004081818e-34, gas_const: float = 8.3144598484848)[source]

Bases: object

Compute vibrational entropy from covariance matrices.

This class focuses only on vibrational entropy math and relies on run_manager for unit conversions (eigenvalue unit conversion and kT conversion).

vibrational_entropy_calculation(matrix: ndarray, matrix_type: Literal['force', 'torque', 'forcetorqueTRANS', 'forcetorqueROT'], temp: float, highest_level: bool, flexible: int) float[source]

Compute vibrational entropy for the given covariance matrix.

Supported matrix types:
  • “force”: 3N x 3N force covariance.

  • “torque”: 3N x 3N torque covariance.

  • “forcetorqueTRANS”: 6N x 6N combined covariance (translational part).

  • “forcetorqueROT”: 6N x 6N combined covariance (rotational part).

Mode handling:
  • Frequencies are computed from eigenvalues, filtered to valid values, then sorted ascending.

  • For “force”:
    • If highest_level, include all modes.

    • Otherwise, drop the lowest 6 modes.

  • For “torque”: include all modes.

  • For combined “forcetorque*”:
    • Split the sorted spectrum into two halves (first 3N, last 3N).

    • If not highest_level, drop the lowest 6 modes only within the translational half.

Parameters:
  • matrix – Covariance matrix (shape depends on matrix_type).

  • matrix_type – Type of covariance matrix.

  • temp – Temperature in Kelvin.

  • highest_level – Whether this is the highest level in the hierarchy.

Returns:

Vibrational entropy value in J/mol/K.

Raises:

ValueError – If matrix_type is unknown.

class CodeEntropy.entropy.vibrational.VibrationalEntropyResult(total: float, n_modes: int)[source]

Bases: object

Result of a vibrational entropy computation.

Variables:
  • total (float) – Computed entropy value (J/mol/K) for the requested matrix type.

  • n_modes (int) – Number of vibrational modes used (after filtering eigenvalues).

n_modes: int
total: float