aiida_quantumespresso.utils.validation.trajectory#

Utilities for the validation of TrajectoryData content.

Module Contents#

Functions#

verify_convergence_trajectory(→ bool)

Verify that the data of the given TrajectoryData is converged with respect to the given thresholds.

verify_convergence_forces(→ bool)

Verify that the forces of the given TrajectoryData are converged with respect to given threshold.

verify_convergence_stress(→ bool)

Verify that the stress of the given TrajectoryData are converged with respect to given threshold.

aiida_quantumespresso.utils.validation.trajectory.verify_convergence_trajectory(trajectory: aiida.orm.TrajectoryData, index: int = -1, threshold_forces: float | None = None, threshold_stress: float | None = None, reference_pressure: float = 0, fixed_coords: List[List[bool]] | None = None) bool[source]#

Verify that the data of the given TrajectoryData is converged with respect to the given thresholds.

Two are properties checked for convergence: forces and stress. If no threshold is specified for a property, the check is skipped. If all thresholds are successfully met, True is returned. If at least one of them fails, False is returned.

The stress is converged if the absolute difference of its corresponding pressure and the reference pressure is within the given threshold.

For calculations with fixed coordinates using the fixed_coords setting, the fixed coordinates can be provided. The forces that correspond to a fixed coordinate are ignored when comparing with the threshold.

Parameters:
  • trajectory – the TrajectoryData

  • index – the frame index of the trajectory data to check, default is -1 meaning the last frame

  • threshold_forces – the force threshold in Ry / bohr

  • threshold_stress – the stress threshold in kbar

  • reference_pressure – reference pressure in kbar

  • fixed_coords – list of fixed coordinates in the calculation for each site

Returns:

True if all thresholds are valid, False otherwise

Raises:

ValueError – if any of the arrays or indices don’t exist

aiida_quantumespresso.utils.validation.trajectory.verify_convergence_forces(trajectory: aiida.orm.TrajectoryData, index: int = -1, threshold: float | None = None, fixed_coords: List[List[bool]] | None = None) bool[source]#

Verify that the forces of the given TrajectoryData are converged with respect to given threshold.

For calculations with fixed coordinates using the fixed_coords setting, the fixed coordinates can be provided. The forces that correspond to a fixed coordinate are ignored when comparing with the threshold.

Parameters:
  • trajectory – the TrajectoryData

  • index – the frame index of the trajectory data to check, default is -1 meaning the last frame

  • threshold – the force threshold in Ry / bohr

  • fixed_coords – list of fixed coordinates in the calculation for each site

Returns:

True if threshold is valid, False otherwise

Raises:

ValueError – if the forces array or given index does not exist

aiida_quantumespresso.utils.validation.trajectory.verify_convergence_stress(trajectory: aiida.orm.TrajectoryData, index: int = -1, threshold: float | None = None, reference_pressure: float = 0) bool[source]#

Verify that the stress of the given TrajectoryData are converged with respect to given threshold.

The stress is converged if the absolute difference of its corresponding pressure and the reference pressure is within the given threshold.

Parameters:
  • trajectory – the TrajectoryData

  • index – the frame index of the trajectory data to check, default is -1 meaning the last frame

  • threshold – the stress threshold in kbar

  • reference_pressure – reference pressure in kbar

Returns:

True if threshold is valid, False otherwise

Raises:

ValueError – if the stress array or given index does not exist