schrodinger.application.matsci.espresso.qeinput module

Classes and functions to deal with XML input generation for Quantum Espresso.

Copyright Schrodinger, LLC. All rights reserved.

class schrodinger.application.matsci.espresso.qeinput.BandsType

Bases: schrodinger.application.matsci.espresso.qeinput.GenericType

Class to generate QE input XML section related to bands.

DEFAULTS = {'nbnd': 0, 'occupations': 'smearing', 'smearing_type': 'gaussian', 'smearing_degauss': 0.01, 'total_magnetization': -1.0, 'nbnd_empty_percent': 20.0, 'total_charge': 0.0}
MIN_EMPTY_BANDS = 10
TOT_CHARGE_KEY = 'total_charge'
TOT_MAG_KEY = 'total_magnetization'
class schrodinger.application.matsci.espresso.qeinput.BasisType

Bases: schrodinger.application.matsci.espresso.qeinput.GenericType

Class to generate QE input XML section related to basis.

DEFAULTS = {'fft_smooth_grid': [], 'fft_grid': [], 'ecutwfc': 0.0, 'gamma_only': False, 'ecutrho': 0.0}
GAMMA_ONLY_KEY = 'gamma_only'
class schrodinger.application.matsci.espresso.qeinput.BoundaryType

Bases: schrodinger.application.matsci.espresso.qeinput.GenericType

Class to generate QE input XML section related to boundary conditions type.

ASSUME_ISOLATED_KEY = 'assume_isolated'
DEFAULTS = {'efermi': 0.0, 'relative_pot': None, 'esm': {'offset': 0.0, 'efield': 0.0, 'bc': 'bc1'}, 'assume_isolated': ''}
EFERMI_KEY = 'efermi'
ESM_KEY = 'esm'
RELATIVE_POT_KEY = 'relative_pot'
esm

Getter for the esm attribute.

Return type:EsmType
Returns:esm object
class schrodinger.application.matsci.espresso.qeinput.CellControlType

Bases: schrodinger.application.matsci.espresso.qeinput.GenericType

Class to generate QE cell control XML section related to control.

CELL_DYNAMICS_KEY = 'cell_dynamics'
CELL_FACTOR_KEY = 'cell_factor'
DEFAULTS = {'pressure': 0.0, 'cell_dynamics': 'bfgs', 'cell_factor': 2.0}
PRESSURE_KEY = 'pressure'
class schrodinger.application.matsci.espresso.qeinput.ControlType

Bases: schrodinger.application.matsci.espresso.qeinput.GenericType

Class to generate QE input XML section related to control.

DEFAULTS = {'wf_keep': False, 'relax_steps': 50, 'prefix': '', 'calculation_type': '', 'stress': False, 'wf_collect': False, 'title': 'Default Title', 'forc_conv_thr': 0.001, 'forces': False, 'etot_conv_thr': 1e-05, 'press_conv_thr': 0.5}
class schrodinger.application.matsci.espresso.qeinput.DataType(engine, path)

Bases: tuple

engine

Alias for field number 0

path

Alias for field number 1

class schrodinger.application.matsci.espresso.qeinput.DftType

Bases: schrodinger.application.matsci.espresso.qeinput.GenericType

Class to generate QE input XML section related to dft type.

DEFAULTS = {'hybrid': {'qpts_mesh': [1, 1, 1], 'exxdiv_treatment': 'vcut_ws', 'x_gamma_extrapolation': True, 'ecutvcut': 0.7}, 'functional': '', 'vdw': {'london_rcut': 200, 'xdm_a1': 0.6836, 'correction': '', 'xdm_a2': 1.5045, 'london_s6': 0.75}, 'dftu': {'struct': None}}
dftu

Get DftU attribute from self._dftu.

Returns:Hybrid attribute
Return type:HybridType
hybrid

Get hybrid attribute (self._hybrid).

Returns:Hybrid attribute
Return type:HybridType
vdw
class schrodinger.application.matsci.espresso.qeinput.DftUType

Bases: schrodinger.application.matsci.espresso.qeinput.GenericType

Class to generate QE input XML section related to Dft U.

DEFAULTS = {'struct': None}
class schrodinger.application.matsci.espresso.qeinput.ElectronControlType

Bases: schrodinger.application.matsci.espresso.qeinput.GenericType

Class to generate QE input XML section related to electron control.

DEFAULTS = {'diago_cg_maxiter': 20, 'mixing_ndim': 8, 'mixing_mode': 'plain', 'conv_thr': 1e-06, 'diago_thr_init': 0.0, 'diagonalization': 'davidson', 'diago_full_acc': False, 'max_steps': 100, 'mixing_beta': 0.7, 'real_space_q': False}
class schrodinger.application.matsci.espresso.qeinput.EsmType

Bases: schrodinger.application.matsci.espresso.qeinput.GenericType

Class to generate QE input XML section related to esm type.

BC_EFIELD_KEY = 'efield'
BC_KEY = 'bc'
BC_W_KEY = 'offset'
DEFAULTS = {'offset': 0.0, 'efield': 0.0, 'bc': 'bc1'}
class schrodinger.application.matsci.espresso.qeinput.FreePositionsType

Bases: schrodinger.application.matsci.espresso.qeinput.GenericType

Class to generate QE input XML section related to Cartesian atomic constraints.

DEFAULTS = {}
static saveConstraint(data, atom)

Static method to save Cartesian atomic constraint.

Parameters:
  • data (list of 3 integers) – Cartesian constraints for each coordinate: 1 - not constrained, 0 - constrained (QE convention)
  • atom (structure._StructureAtom) – Atom to add/modify constraint to
Raises:

ValueError – If data is not a list of 3 elements

class schrodinger.application.matsci.espresso.qeinput.GenericType

Bases: object

Generic class for different input types.

updateWithData(data)

Update attributes from data. Set object attribute from data. Example: self.attribute = self.data.get(attribute)

Parameters:data (dict) – Dictionary of settings
class schrodinger.application.matsci.espresso.qeinput.HybridType

Bases: schrodinger.application.matsci.espresso.qeinput.GenericType

Class to generate QE input XML section related to hybrid functional type.

DEFAULTS = {'qpts_mesh': [1, 1, 1], 'exxdiv_treatment': 'vcut_ws', 'x_gamma_extrapolation': True, 'ecutvcut': 0.7}
class schrodinger.application.matsci.espresso.qeinput.InputType(data)

Bases: object

Class to generate QE input XML section related to input.

class schrodinger.application.matsci.espresso.qeinput.IonControlType

Bases: schrodinger.application.matsci.espresso.qeinput.GenericType

Class to generate QE ionic control XML section related to control.

DEFAULTS = {'dynamics': {'nraise': 1, 'timestep': 2.0, 'ion_temperature': 'rescale-v', 'tempw': 300.0, 'deltat': 1.0}, 'ion_dynamics': 'bfgs'}
ION_DYNAMICS_KEY = 'ion_dynamics'
dynamics

Getter for the dynamics attribute.

Return type:MdType
Returns:dynamics object
class schrodinger.application.matsci.espresso.qeinput.KpointsType

Bases: schrodinger.application.matsci.espresso.qeinput.GenericType

Class to generate QE input XML section related to k-points.

DEFAULTS = {'kpts_band': False, 'kpts_dens': 0, 'kpts_mesh': [6, 6, 6, 1, 1, 1], 'kpts_dens_force_gamma': False, 'kpts_list': [], 'kpts_band_line_density': 20}
KPTS_TYPES = set(['kpts_band', 'kpts_dens', 'kpts_list', 'kpts_mesh'])
getNKpts()

Get total number of k-points based on k-points definition. If k-points type is defined, throw a ValueError.

Return type:int
Returns:Number of k-points
Raises:ValueError – If k-points type is not defined
matdynStr()

Get kpoint list suitable for matdyn input.

Return type:str
Returns:Kpoint list
setStructure(struct)

Set structure in self.struct and several other attributes: self.vecs and self.alat.

Parameters:struct (structure.Structure) – Structure used for k-point generation (‘kpts_dens’ case)
class schrodinger.application.matsci.espresso.qeinput.MagSpecies

Bases: object

Class that defines species with starting magnetization.

createUniqueElement(element, mag, hubb_u)

Fill self.data dict. Keys of the self.data are elements. Values are dicts with magnetization as key and unique element as value. Unique element is just the atomic symbol plus (if element has more than one magnetization value) a unique integer. Example: {‘C’: {0.0: ‘C’}, ‘H’: {0.0: ‘H’, 0.1: ‘H1’}}

self.species is a dict where unique elements are keys and elements are values. Example (based on the example above): {‘C’: ‘C’, ‘H’: ‘H’, ‘H1’: ‘H’}

Parameters:
  • element (str) – Element
  • mag (float) – Starting magnetization
  • hubb_u (float) – Hubbard U parameter
Return type:

str

Returns:

Unique element

getMag(element, unique_element)

Get magnetization given element and unique element values.

Parameters:
  • element (str) – Element
  • unique_element (str) – Unique element
Return type:

tuple

Returns:

Starting magnetization and Hubbard U

Raises:

ValueError – If element, unique_element combination is not found

class schrodinger.application.matsci.espresso.qeinput.MdType

Bases: schrodinger.application.matsci.espresso.qeinput.GenericType

Class to generate XML section related to MD control.

DEFAULTS = {'nraise': 1, 'timestep': 2.0, 'ion_temperature': 'rescale-v', 'tempw': 300.0, 'deltat': 1.0}
class schrodinger.application.matsci.espresso.qeinput.NEBInputType(data)

Bases: schrodinger.application.matsci.espresso.qeinput.InputType

Class to generate QE input XML section related to NEB input.

class schrodinger.application.matsci.espresso.qeinput.NEBPathType

Bases: schrodinger.application.matsci.espresso.qeinput.GenericType

Class to generate QE input XML section related to the NEB path.

DEFAULTS = {'esm_last_image_charge': 0.0, 'climbing_image': 'no-CI', 'string_method': 'neb', 'esm_first_image_charge': 0.0, 'optimization_scheme': 'broyden', 'optimize_first_last': False, 'esm_efermi': 0.0, 'use_masses': False, 'esm': False, 'nimages': 4, 'nsteps': 50}
class schrodinger.application.matsci.espresso.qeinput.PHControlType

Bases: schrodinger.application.matsci.espresso.qeinput.GenericType

Class to generate phonon control input XML section related to control.

DEFAULTS = {'epsil': False, 'qpts_mesh': [1, 1, 1], 'prefix': ''}
class schrodinger.application.matsci.espresso.qeinput.PHInputType(data)

Bases: schrodinger.application.matsci.espresso.qeinput.InputType

Class to generate QE input XML section related to PHonon input.

class schrodinger.application.matsci.espresso.qeinput.PseudopotentialsType

Bases: schrodinger.application.matsci.espresso.qeinput.GenericType

Class to generate QE input XML section related to pseudopotentials.

DEFAULTS = {'species': {}}
getData()

Get pseudopotentials file paths and other related data from the database having the same functional and family.

Return type:dict, float, float, float
Returns:Dict with paths to PPs ({‘element’: ‘path’}), number of valence electrons, max ecutwfc, max ecutrho for elements
setStructureType(struct_type)

Set structure_type in self.struct_type and atom types in self.st_species.

Parameters:struct_type (StructureType) – Structure type used to calculate number of valence electrons in the cell
class schrodinger.application.matsci.espresso.qeinput.SpinType

Bases: schrodinger.application.matsci.espresso.qeinput.GenericType

Class to generate QE input XML section related to spin.

DEFAULTS = {'spin_type': ''}
SPIN_LSDA_ID = 2
SPIN_NON_LSDA_ID = 1
getNSpin()

Get nspin based on the spin settings.

Returns:Spin type in the PW integer representation
Return type:int
class schrodinger.application.matsci.espresso.qeinput.StructureType(struct, use_symmetry)

Bases: object

Class to generate QE input XML section related to structure.

X = 0
Y = 1
Z = 2
alignStructWithPlane(vector_index)

Slide structure (self.struct) along the axis such that all atoms are on top of the plane perpendicular to the axis defined by vector_index.

Parameters:vector_index (int) – Vector index (X or Y or Z) to align structure to the perpendicular plane
fetchPPDB(functional)

Get pseudopotentials file paths and other related data from the database having the same functional and family.

Parameters:functional (str) – DFT Functional (one of the DFT_FUNCTIONALS)
Return type:dict, float, float, float
Returns:Dict with paths to PPs ({‘element’: ‘path’}), number of valence electrons, max ecutwfc, max ecutrho for elements
getAtomicSpecies(ppfiles)

Generate XML input related to atomic species.

Param:Dictionary containing paths to PPs ({‘Element’: ‘Path’})
Return type:str
Returns:species xml data
getAtomicStructure()

Generate XML input related to atomic_structure.

Return type:str
Returns:cell xml data
setElements()

Set elements in self.elements.

setPrimitiveCell()

Set and use primitive cell found by spglib, if any.

validateStruct(struct)

Validate provided structure against self.struct.

Parameters:struct (schrodinger.structure.Structure) – Structure to validate
Raises:ValueError – If number of atoms or atomic types differ compared to the initial structure (self.structure)
class schrodinger.application.matsci.espresso.qeinput.SymmetryType

Bases: schrodinger.application.matsci.espresso.qeinput.GenericType

Class to generate QE input XML section related to symmetry.

DEFAULTS = {'get_std_cell': False, 'use_primitive': False, 'use_symmetry': False}
GET_STD_CELL = 'get_std_cell'
USE_PRIM_KEY = 'use_primitive'
USE_SYMM_KEY = 'use_symmetry'
class schrodinger.application.matsci.espresso.qeinput.VdwType

Bases: schrodinger.application.matsci.espresso.qeinput.GenericType

Class to generate QE input XML section related to vdw type.

DEFAULTS = {'london_rcut': 200, 'xdm_a1': 0.6836, 'correction': '', 'xdm_a2': 1.5045, 'london_s6': 0.75}
schrodinger.application.matsci.espresso.qeinput.deep_update(source, overrides)

Override/append source dict values using overrides dict, return a new dict. Everything is deepcopied to prevent unexpected changes.

Parameters:
  • source (dict) – Source dictionary
  • overrides (dict) – Dictionary to override with
Return type:

dict

Returns:

Updated dictionary

schrodinger.application.matsci.espresso.qeinput.validate_value(name, value, allowed_values)

Check that value is in list of allowed values.

Parameters:
  • name (str) – Name of the variable
  • value (str or int or float) – Value of the variable
  • allowed_values (list) – List of values
Raises:

ValueError – If value is not in list