pymatgen.io.abinit.abiobjects module

Low-level objects providing an abstraction for the objects involved in the calculation.

class AbivarAble[source]

Bases: object

An AbivarAble object provides a method to_abivars that returns a dictionary with the abinit variables.

to_abivars()[source]

Returns a dictionary with the abinit variables.

class Constraints[source]

Bases: pymatgen.io.abinit.abiobjects.AbivarAble

This object defines the constraints for structural relaxation

to_abivars()[source]
class Electrons(spin_mode='polarized', smearing='fermi_dirac:0.1 eV', algorithm=None, nband=None, fband=None, charge=0.0, comment=None)[source]

Bases: pymatgen.io.abinit.abiobjects.AbivarAble, monty.json.MSONable

The electronic degrees of freedom

Constructor for Electrons object.

Parameters:
  • comment – String comment for Electrons
  • charge – Total charge of the system. Default is 0.
as_dict()[source]

json friendly dict representation

classmethod from_dict(d)[source]
nspden
nspinor
nsppol
to_abivars()[source]
class ElectronsAlgorithm(*args, **kwargs)[source]

Bases: dict, pymatgen.io.abinit.abiobjects.AbivarAble, monty.json.MSONable

Variables controlling the SCF/NSCF algorithm.

as_dict()[source]
classmethod from_dict(d)[source]
to_abivars()[source]
class ExcHamiltonian(bs_loband, nband, mbpt_sciss, coulomb_mode, ecuteps, spin_mode='polarized', mdf_epsinf=None, exc_type='TDA', algo='haydock', with_lf=True, bs_freq_mesh=None, zcut=None, **kwargs)[source]

Bases: pymatgen.io.abinit.abiobjects.AbivarAble

This object contains the parameters for the solution of the Bethe-Salpeter equation.

Parameters:
  • bs_loband – Lowest band index (Fortran convention) used in the e-h basis set. Can be scalar or array of shape (nsppol,). Must be >= 1 and <= nband
  • nband – Max band index used in the e-h basis set.
  • mbpt_sciss – Scissors energy in Hartree.
  • coulomb_mode – Treatment of the Coulomb term.
  • ecuteps – Cutoff energy for W in Hartree.
  • mdf_epsinf – Macroscopic dielectric function \(\epsilon_\inf\) used in the model dielectric function.
  • exc_type – Approximation used for the BSE Hamiltonian
  • with_lf – True if local field effects are included <==> exchange term is included
  • bs_freq_mesh – Frequency mesh for the macroscopic dielectric function (start, stop, step) in Ha.
  • zcut – Broadening parameter in Ha.
  • **kwargs – Extra keywords
inclvkb

Treatment of the dipole matrix element (NC pseudos, default is 2)

to_abivars()[source]

Returns a dictionary with the abinit variables.

use_cg

True if we are using the conjugate gradient method.

use_direct_diago

True if we are performing the direct diagonalization of the BSE Hamiltonian.

use_haydock

True if we are using the Haydock iterative technique.

class HilbertTransform(nomegasf, domegasf=None, spmeth=1, nfreqre=None, freqremax=None, nfreqim=None, freqremin=None)[source]

Bases: pymatgen.io.abinit.abiobjects.AbivarAble

Parameters for the Hilbert-transform method (Screening code) i.e. the parameters defining the frequency mesh used for the spectral function and the frequency mesh used for the polarizability

Parameters:
  • nomegasf – Number of points for sampling the spectral function along the real axis.
  • domegasf – Step in Ha for the linear mesh used for the spectral function.
  • spmeth – Algorith for the representation of the delta function.
  • nfreqre – Number of points along the real axis (linear mesh).
  • freqremax – Maximum frequency for W along the real axis (in hartree).
  • nfreqim – Number of point along the imaginary axis (Gauss-Legendre mesh).
  • freqremin – Minimum frequency for W along the real axis (in hartree).
to_abivars()[source]

Returns a dictionary with the abinit variables

class KSampling(mode=<KSamplingModes.monkhorst: 1>, num_kpts=0, kpts=((1, 1, 1), ), kpt_shifts=(0.5, 0.5, 0.5), kpts_weights=None, use_symmetries=True, use_time_reversal=True, chksymbreak=None, comment=None)[source]

Bases: pymatgen.io.abinit.abiobjects.AbivarAble, monty.json.MSONable

Input variables defining the K-point sampling.

Highly flexible constructor for KSampling objects. The flexibility comes at the cost of usability and in general, it is recommended that you use the default constructor only if you know exactly what you are doing and requires the flexibility. For most usage cases, the object be constructed far more easily using the convenience static constructors:

  1. gamma_only
  2. gamma_centered
  3. monkhorst
  4. monkhorst_automatic
  5. path

and it is recommended that you use those.

Parameters:
  • mode – Mode for generating k-poits. Use one of the KSamplingModes enum types.
  • num_kpts – Number of kpoints if mode is “automatic” Number of division for the sampling of the smallest segment if mode is “path”. Not used for the other modes
  • kpts – Number of divisions. Even when only a single specification is required, e.g. in the automatic scheme, the kpts should still be specified as a 2D array. e.g., [[20]] or [[2,2,2]].
  • kpt_shifts – Shifts for Kpoints.
  • use_symmetries – False if spatial symmetries should not be used to reduce the number of independent k-points.
  • use_time_reversal – False if time-reversal symmetry should not be used to reduce the number of independent k-points.
  • kpts_weights – Optional weights for kpoints. For explicit kpoints.
  • chksymbreak – Abinit input variable: check whether the BZ sampling preserves the symmetry of the crystal.
  • comment – String comment for Kpoints

Note

The default behavior of the constructor is monkhorst.

as_dict()[source]
classmethod automatic_density(structure, kppa, chksymbreak=None, use_symmetries=True, use_time_reversal=True, shifts=(0.5, 0.5, 0.5))[source]

Returns an automatic Kpoint object based on a structure and a kpoint density. Uses Gamma centered meshes for hexagonal cells and Monkhorst-Pack grids otherwise.

Algorithm:
Uses a simple approach scaling the number of divisions along each reciprocal lattice vector proportional to its length.
Parameters:
  • structure – Input structure
  • kppa – Grid density
classmethod explicit_path(ndivsm, kpath_bounds)[source]

See _path for the meaning of the variables

classmethod from_dict(d)[source]
classmethod gamma_centered(kpts=(1, 1, 1), use_symmetries=True, use_time_reversal=True)[source]

Convenient static constructor for an automatic Gamma centered Kpoint grid.

Parameters:
  • kpts – Subdivisions N_1, N_2 and N_3 along reciprocal lattice vectors.
  • use_symmetries – False if spatial symmetries should not be used to reduce the number of independent k-points.
  • use_time_reversal – False if time-reversal symmetry should not be used to reduce the number of independent k-points.
Returns:

KSampling object.

classmethod gamma_only()[source]

Gamma-only sampling

is_homogeneous
classmethod monkhorst(ngkpt, shiftk=(0.5, 0.5, 0.5), chksymbreak=None, use_symmetries=True, use_time_reversal=True, comment=None)[source]

Convenient static constructor for a Monkhorst-Pack mesh.

Parameters:
  • ngkpt – Subdivisions N_1, N_2 and N_3 along reciprocal lattice vectors.
  • shiftk – Shift to be applied to the kpoints.
  • use_symmetries – Use spatial symmetries to reduce the number of k-points.
  • use_time_reversal – Use time-reversal symmetry to reduce the number of k-points.
Returns:

KSampling object.

classmethod monkhorst_automatic(structure, ngkpt, use_symmetries=True, use_time_reversal=True, chksymbreak=None, comment=None)[source]

Convenient static constructor for an automatic Monkhorst-Pack mesh.

Parameters:
  • structureStructure object.
  • ngkpt – Subdivisions N_1, N_2 and N_3 along reciprocal lattice vectors.
  • use_symmetries – Use spatial symmetries to reduce the number of k-points.
  • use_time_reversal – Use time-reversal symmetry to reduce the number of k-points.
Returns:

KSampling object.

classmethod path_from_structure(ndivsm, structure)[source]

See _path for the meaning of the variables

to_abivars()[source]
class KSamplingModes[source]

Bases: enum.Enum

An enumeration.

automatic = 3
monkhorst = 1
path = 2
class ModelDielectricFunction(mdf_epsinf)[source]

Bases: pymatgen.io.abinit.abiobjects.AbivarAble

Model dielectric function used for BSE calculation

to_abivars()[source]
class PPModel(mode='godby', plasmon_freq=None)[source]

Bases: pymatgen.io.abinit.abiobjects.AbivarAble, monty.json.MSONable

Parameters defining the plasmon-pole technique. The common way to instanciate a PPModel object is via the class method PPModel.as_ppmodel(string)

as_dict()[source]
classmethod as_ppmodel(obj)[source]

Constructs an instance of PPModel from obj.

Accepts obj in the form:
  • PPmodel instance
  • string. e.g “godby:12.3 eV”, “linden”.
static from_dict(d)[source]
classmethod get_noppmodel()[source]
to_abivars()[source]
class PPModelModes[source]

Bases: enum.Enum

An enumeration.

farid = 4
godby = 1
hybersten = 2
linden = 3
noppmodel = 0
class RelaxationMethod(*args, **kwargs)[source]

Bases: pymatgen.io.abinit.abiobjects.AbivarAble, monty.json.MSONable

This object stores the variables for the (constrained) structural optimization ionmov and optcell specify the type of relaxation. The other variables are optional and their use depend on ionmov and optcell. A None value indicates that we use abinit default. Default values can be modified by passing them to the constructor. The set of variables are constructed in to_abivars depending on ionmov and optcell.

IONMOV_DEFAULT = 3
OPTCELL_DEFAULT = 2
as_dict()[source]
classmethod atoms_and_cell(atoms_constraints=None)[source]
classmethod atoms_only(atoms_constraints=None)[source]
classmethod from_dict(d)[source]
move_atoms

True if atoms must be moved.

move_cell

True if lattice parameters must be optimized.

to_abivars()[source]

Returns a dictionary with the abinit variables

class Screening(ecuteps, nband, w_type='RPA', sc_mode='one_shot', hilbert=None, ecutwfn=None, inclvkb=2)[source]

Bases: pymatgen.io.abinit.abiobjects.AbivarAble

This object defines the parameters used for the computation of the screening function.

Parameters:
  • ecuteps – Cutoff energy for the screening (Ha units).
  • Number of bands for the Green's function (nband) –
  • w_type – Screening type
  • sc_mode – Self-consistency mode.
  • hilbert – Instance of HilbertTransform defining the parameters for the Hilber transform method.
  • ecutwfn – Cutoff energy for the wavefunctions (Default: ecutwfn == ecut).
  • inclvkb – Option for the treatment of the dipole matrix elements (NC pseudos).
to_abivars()[source]

Returns a dictionary with the abinit variables

use_hilbert
class SelfEnergy(se_type, sc_mode, nband, ecutsigx, screening, gw_qprange=1, ppmodel=None, ecuteps=None, ecutwfn=None, gwpara=2)[source]

Bases: pymatgen.io.abinit.abiobjects.AbivarAble

This object defines the parameters used for the computation of the self-energy.

Parameters:
  • se_type – Type of self-energy (str)
  • sc_mode – Self-consistency mode.
  • nband – Number of bands for the Green’s function
  • ecutsigx – Cutoff energy for the exchange part of the self-energy (Ha units).
  • screeningScreening instance.
  • gw_qprange – Option for the automatic selection of k-points and bands for GW corrections. See Abinit docs for more detail. The default value makes the code computie the QP energies for all the point in the IBZ and one band above and one band below the Fermi level.
  • ppmodelPPModel instance with the parameters used for the plasmon-pole technique.
  • ecuteps – Cutoff energy for the screening (Ha units).
  • ecutwfn – Cutoff energy for the wavefunctions (Default: ecutwfn == ecut).
gwcalctyp

Returns the value of the gwcalctyp input variable.

symsigma

1 if symmetries can be used to reduce the number of q-points.

to_abivars()[source]

Returns a dictionary with the abinit variables.

use_ppmodel

True if we are using the plasmon-pole approximation.

class Smearing(occopt, tsmear)[source]

Bases: pymatgen.io.abinit.abiobjects.AbivarAble, monty.json.MSONable

Variables defining the smearing technique. The preferred way to instanciate a Smearing object is via the class method Smearing.as_smearing(string)

as_dict()[source]

json friendly dict representation of Smearing

classmethod as_smearing(obj)[source]

Constructs an instance of Smearing from obj. Accepts obj in the form:

  • Smearing instance
  • “name:tsmear” e.g. “gaussian:0.004” (Hartree units)
  • “name:tsmear units” e.g. “gaussian:0.1 eV”
  • None –> no smearing
static from_dict(d)[source]
mode
static nosmearing()[source]
to_abivars()[source]
class SpinMode[source]

Bases: pymatgen.io.abinit.abiobjects.SpinMode, pymatgen.io.abinit.abiobjects.AbivarAble, monty.json.MSONable

Different configurations of the electron density as implemented in abinit: One can use as_spinmode to construct the object via SpinMode.as_spinmode (string) where string can assume the values:

  • polarized
  • unpolarized
  • afm (anti-ferromagnetic)
  • spinor (non-collinear magnetism)
  • spinor_nomag (non-collinear, no magnetism)

Create new instance of SpinMode(mode, nsppol, nspinor, nspden)

as_dict()[source]
classmethod as_spinmode(obj)[source]

Converts obj into a SpinMode instance

classmethod from_dict(d)[source]
to_abivars()[source]
contract(s)[source]
>>> assert contract("1 1 1 2 2 3") == "3*1 2*2 1*3"
>>> assert contract("1 1 3 2 3") == "2*1 1*3 1*2 1*3"
lattice_from_abivars(cls=None, *args, **kwargs)[source]

Returns a Lattice object from a dictionary with the Abinit variables acell and either rprim in Bohr or angdeg If acell is not given, the Abinit default is used i.e. [1,1,1] Bohr

Parameters:cls – Lattice class to be instantiated. pymatgen.core.lattice.Lattice if cls is None

Example

lattice_from_abivars(acell=3*[10], rprim=np.eye(3))

structure_from_abivars(cls=None, *args, **kwargs)[source]

Build a Structure object from a dictionary with ABINIT variables.

Parameters:cls – Structure class to be instantiated. pymatgen.core.structure.Structure if cls is None

example

al_structure = structure_from_abivars(

acell=3*[7.5], rprim=[0.0, 0.5, 0.5,

0.5, 0.0, 0.5, 0.5, 0.5, 0.0],

typat=1, xred=[0.0, 0.0, 0.0], ntypat=1, znucl=13,

)

xred can be replaced with xcart or xangst.

structure_to_abivars(structure, **kwargs)[source]

Receives a structure and returns a dictionary with the ABINIT variables.