matcalc._qha module

Calculator for phonon properties under quasi-harmonic approximation.

class QHACalc(calculator: Calculator | str, *, t_step: float = 10, t_max: float = 1000, t_min: float = 0, fmax: float = 0.1, optimizer: str = 'FIRE', eos: str = 'vinet', relax_structure: bool = True, relax_calc_kwargs: dict | None = None, phonon_calc_kwargs: dict | None = None, scale_factors: Sequence[float] = (0.95, 0.96, 0.97, 0.98, 0.99, 1.0, 1.01, 1.02, 1.03, 1.04, 1.05), write_helmholtz_volume: bool | str | Path = False, write_volume_temperature: bool | str | Path = False, write_thermal_expansion: bool | str | Path = False, write_gibbs_temperature: bool | str | Path = False, write_bulk_modulus_temperature: bool | str | Path = False, write_heat_capacity_p_numerical: bool | str | Path = False, write_heat_capacity_p_polyfit: bool | str | Path = False, write_gruneisen_temperature: bool | str | Path = False)[source]

Bases: PropCalc

Class for performing quasi-harmonic approximation calculations.

This class utilizes phonopy and Pymatgen-based structure manipulation to calculate thermal properties such as Gibbs free energy, thermal expansion, heat capacity, and bulk modulus as a function of temperature under the quasi-harmonic approximation. It allows for structural relaxation, handling customized scale factors for lattice constants, and fine-tuning various calculation parameters. Calculation results can be selectively saved to output files.

Variables:
  • calculator – Calculator instance used for electronic structure or energy calculations.

  • t_step – Temperature step size in Kelvin.

  • t_max – Maximum temperature in Kelvin.

  • t_min – Minimum temperature in Kelvin.

  • fmax – Maximum force threshold for structure relaxation in eV/Å.

  • optimizer – Type of optimizer used for structural relaxation.

  • eos – Equation of state used for fitting energy vs. volume data.

  • relax_structure – Whether to perform structure relaxation before phonon calculations.

  • relax_calc_kwargs – Additional keyword arguments for structure relaxation calculations.

  • phonon_calc_kwargs – Additional keyword arguments for phonon calculations.

  • scale_factors – List of scale factors for lattice scaling.

  • write_helmholtz_volume – Path or boolean to control saving Helmholtz free energy vs. volume data.

  • write_volume_temperature – Path or boolean to control saving volume vs. temperature data.

  • write_thermal_expansion – Path or boolean to control saving thermal expansion coefficient data.

  • write_gibbs_temperature – Path or boolean to control saving Gibbs free energy as a function of temperature.

  • write_bulk_modulus_temperature – Path or boolean to control saving bulk modulus vs. temperature data.

  • write_heat_capacity_p_numerical – Path or boolean to control saving numerically calculated heat capacity vs. temperature data.

  • write_heat_capacity_p_polyfit – Path or boolean to control saving polynomial-fitted heat capacity vs. temperature data.

  • write_gruneisen_temperature – Path or boolean to control saving Grüneisen parameter vs. temperature data.

Initializes the class that handles thermal and structural calculations, including atomic structure relaxation, property evaluations, and phononic calculations across temperature ranges. This class is mainly designed to facilitate systematic computations involving temperature-dependent material properties and thermodynamic quantities.

Parameters:
  • calculator – Calculator object or string indicating the computational engine to use for performing calculations.

  • t_step – Step size for the temperature range, given in units of temperature.

  • t_max – Maximum temperature for the calculations, given in units of temperature.

  • t_min – Minimum temperature for the calculations, given in units of temperature.

  • fmax – Maximum force convergence criterion for structure relaxation, in force units.

  • optimizer – Name of the optimizer to use for structure optimization, default is “FIRE”.

  • eos – Equation of state to use for calculating energy vs. volume relationships. Default is “vinet”.

  • relax_structure – A boolean flag indicating whether the atomic structure should be relaxed as part of the computation workflow.

  • relax_calc_kwargs – A dictionary containing additional keyword arguments to pass to the relax calculation.

  • phonon_calc_kwargs – A dictionary containing additional parameters to pass to the phonon calculation routine.

  • scale_factors – A sequence of scale factors for volume scaling during thermodynamic and phononic calculations.

  • write_helmholtz_volume – Path, boolean, or string to indicate whether and where to save Helmholtz energy as a function of volume.

  • write_volume_temperature – Path, boolean, or string to indicate whether and where to save equilibrium volume as a function of temperature.

  • write_thermal_expansion – Path, boolean, or string to indicate whether and where to save the thermal expansion coefficient as a function of temperature.

  • write_gibbs_temperature – Path, boolean, or string to indicate whether and where to save Gibbs energy as a function of temperature.

  • write_bulk_modulus_temperature – Path, boolean, or string to indicate whether and where to save bulk modulus as a function of temperature.

  • write_heat_capacity_p_numerical – Path, boolean, or string to indicate whether and where to save specific heat capacity at constant pressure, calculated numerically.

  • write_heat_capacity_p_polyfit – Path, boolean, or string to indicate whether and where to save specific heat capacity at constant pressure, calculated via polynomial fitting.

  • write_gruneisen_temperature – Path, boolean, or string to indicate whether and where to save Grüneisen parameter values as a function of temperature.

_abc_impl = <_abc._abc_data object>[source]
_calculate_energy(structure: Structure) float[source]

Helper to calculate the electronic energy of a structure.

Parameters:

structure – Pymatgen structure for which the energy is calculated.

Returns:

Electronic energy of the structure.

_calculate_thermal_properties(structure: Structure) dict[source]

Helper to calculate the thermal properties of a structure.

Parameters:

structure – Pymatgen structure for which the thermal properties are calculated.

Returns:

Dictionary of thermal properties containing free energies, entropies and heat capacities.

_collect_properties(structure: Structure) tuple[list, list, list, list, list][source]

Helper to collect properties like volumes, electronic energies, and thermal properties.

Parameters:

structure – Pymatgen structure for which the properties need to be calculated.

Returns:

Tuple containing lists of volumes, electronic energies, free energies, entropies,

and heat capacities for different scale factors.

_create_qha(volumes: list, electronic_energies: list, temperatures: list, free_energies: list, entropies: list, heat_capacities: list) PhonopyQHA[source]

Helper to create a PhonopyQHA object for quasi-harmonic approximation.

Parameters:
  • volumes – List of volumes corresponding to different scale factors.

  • electronic_energies – List of electronic energies corresponding to different volumes.

  • temperatures – List of temperatures in ascending order (in Kelvin).

  • free_energies – List of free energies corresponding to different volumes and temperatures.

  • entropies – List of entropies corresponding to different volumes and temperatures.

  • heat_capacities – List of heat capacities corresponding to different volumes and temperatures.

Returns:

Phonopy.qha object.

_generate_output_dict(qha: PhonopyQHA, volumes: list, electronic_energies: list, temperatures: list) dict[source]

Helper to generate the output dictionary after QHA calculation.

Parameters:
  • qha – Phonopy.qha object.

  • volumes – List of volumes corresponding to different scale factors.

  • electronic_energies – List of electronic energies corresponding to different volumes.

  • temperatures – List of temperatures in ascending order (in Kelvin).

Returns:

Dictionary containing the results of QHA calculation.

_scale_structure(structure: Structure, scale_factor: float) Structure[source]

Helper to scale the lattice of a structure.

Parameters:
  • structure – Pymatgen structure to be scaled.

  • scale_factor – Factor by which the lattice constants are scaled.

Returns:

Pymatgen structure with scaled lattice constants.

_write_output_files(qha: PhonopyQHA) None[source]

Helper to write various output files based on the QHA calculation.

Parameters:

qha – Phonopy.qha object

calc(structure: Structure | dict[str, Any]) dict[source]

Calculates thermal properties of Pymatgen structure with phonopy under quasi-harmonic approximation.

Parameters:

structure – Pymatgen structure.

Returns: {

“qha”: Phonopy.qha object, “scale_factors”: List of scale factors of lattice constants, “volumes”: List of unit cell volumes at corresponding scale factors (in Angstrom^3), “electronic_energies”: List of electronic energies at corresponding volumes (in eV), “temperatures”: List of temperatures in ascending order (in Kelvin), “thermal_expansion_coefficients”: List of volumetric thermal expansion coefficients at corresponding

temperatures (in Kelvin^-1),

“gibbs_free_energies”: List of Gibbs free energies at corresponding temperatures (in eV), “bulk_modulus_P”: List of bulk modulus at constant pressure at corresponding temperatures (in GPa), “heat_capacity_P”: List of heat capacities at constant pressure at corresponding temperatures (in J/K/mol), “gruneisen_parameters”: List of Gruneisen parameters at corresponding temperatures,

}