PAOFLOW.phonon.structure#
Structure bridge between PAOFLOW and phonopy/phono3py.
PAOFLOW stores the crystal structure (parsed from the DFT output) in the
DataController using the following conventions:
alat Lattice parameter in Bohr (atomic units).
a_vectors (3, 3) array; rows are the direct lattice vectors expressed
in units of
alat(so the Cartesian lattice in Bohr isa_vectors * alat).
tau (natoms, 3) array of Cartesian atomic positions in Bohr.
atoms length-natoms list of atom labels (e.g. 'Si', 'Fe1').
species list of (label, pseudo_file) tuples.
omega cell volume in Bohr^3.
When phonopy is driven through its Quantum ESPRESSO interface
(Phonopy(..., calculator='qe')) the lattice and positions are expressed in
Bohr (the QE-native length unit), forces in Ry/Bohr, and the frequency
conversion factor is set accordingly. PAOFLOW already stores the structure in
Bohr, so the bridge keeps everything in Bohr: lattice row-wise in Bohr and
atomic positions as fractional (scaled) coordinates. This module performs the
bidirectional conversion and provides a round-trip verification helper.
Functions#
|
Build a |
|
Convert a |
|
Check that PAOFLOW -> PhonopyAtoms -> PAOFLOW preserves the structure. |
|
Return the phonopy primitive-cell atom ordering for Born-charge I/O. |
Module Contents#
- PAOFLOW.phonon.structure.paoflow_to_phonopy(data_controller, scale=1.0)[source]#
Build a
phonopy.structure.atoms.PhonopyAtomsfrom PAOFLOW data.- Parameters:
data_controller (DataController) – Provides the structural arrays/attributes described in the module docstring.
scale (float, optional) – Isotropic linear scale factor applied to the lattice vectors (the cell volume scales as
scale**3). The fractional atomic positions are preserved, so atoms move with the cell. Used by the quasi-harmonic volume scan; defaults to1.0(no scaling).
- Returns:
Primitive/unit cell in the phonopy QE convention (Bohr lattice, scaled positions, chemical symbols and default isotopic masses).
- Return type:
phonopy.structure.atoms.PhonopyAtoms
- PAOFLOW.phonon.structure.phonopy_to_paoflow(cell, alat=None)[source]#
Convert a
PhonopyAtomsback to PAOFLOW structural quantities.- Parameters:
cell (phonopy.structure.atoms.PhonopyAtoms) – Cell to convert (Bohr lattice, scaled positions; QE convention).
alat (float, optional) – Lattice parameter in Bohr to use as the
alatreference. When not supplied the norm of the first lattice vector (in Bohr) is used, which matches QE’s defaultalatconvention for many Bravais lattices.
- Returns:
Mapping with keys
alat,a_vectors,tau,atoms,omegaexpressed in PAOFLOW conventions (Bohr / units ofalat).- Return type:
- PAOFLOW.phonon.structure.verify_round_trip(data_controller, rtol=1e-08, atol=1e-08)[source]#
Check that PAOFLOW -> PhonopyAtoms -> PAOFLOW preserves the structure.
Compares the Cartesian lattice (Bohr), Cartesian atomic positions (Bohr) and chemical symbols/masses before and after the conversion.
- Parameters:
data_controller (DataController) – Source of the reference structure.
rtol (float) – Relative/absolute tolerances forwarded to
numpy.allclose().atol (float) – Relative/absolute tolerances forwarded to
numpy.allclose().
- Returns:
Diagnostics with the maximum lattice/position deviations (in Bohr), the symbol/mass match flags and an overall
okboolean.- Return type:
- PAOFLOW.phonon.structure.primitive_atom_info(data_controller)[source]#
Return the phonopy primitive-cell atom ordering for Born-charge I/O.
Born effective charges are a property of the primitive cell, so a phonopy
BORNfile lists one tensor per primitive atom in the phonopy primitive order (which may differ from the PAOFLOWtauorder). This helper exposes that ordering and the per-atom masses/positions.- Returns:
symbols(list),masses(ndarray),scaled_positions(natom_prim, 3),cell(Bohr lattice rows) andnatom.- Return type: