PwInput

Class to create and manipulate an input file for pw.x computations of QuantumESPRESSO. The input can be created from scratch or can be initialized from an existing input file.

class mppi.InputFiles.PwInput.PwInput(file=None, **kwargs)[source]

Bases: dict

Class to generate an manipulate the pw.x input files. Can be initialized either reading from a file or starting from scratch. All the elements that belong to the possible namelist of pw are parsed. Instead, among the possible pw cards the actual implementation considers only : ATOMIC_SPECIES, ATOMIC_POSITIONS, K_POINTS, CELL_PARAMETERS.

add_atom(atom, pseudo_name, mass='1.0')[source]

Update the self[‘atomic_species’] dictionary

Parameters
  • atom (str) –

  • mass (str) – is used only for molecular dynamics run

  • pseudo_name (str) –

convert_string()[source]

Convert the input object into a string

parseInputFile(file)[source]

Read the arguments and variables from the input file. All the elements that belong to the possible namelist of pw are parsed. Instead, among the possible pw cards the actual implementation considers only : ATOMIC_SPECIES, ATOMIC_POSITIONS, K_POINTS, CELL_PARAMETERS

set_atomic_positions(positions, type='alat')[source]

Define the the positions of the atoms in the lattice.

Parameters
  • type (str) – units for the positions (alat,angstrom,crystal,…)

  • positions (list) – a list with the structure [[‘atom1’,[x,y,z]],[‘atom2’,[x,y,z]],…]}

set_atoms_number(nat)[source]

Set the self[‘control’][‘ntyp’] using the self[‘atomic_species’] dictionary and set the number of atoms in the cell. If the number of atoms in the cell is lower than the number of atomic species write an alert and set nat = ntyp.

Parameters

nat (int) – number of atoms in the cell

set_bands(nbnd, conv_thr=1e-08, diago_full_acc=False, force_symmorphic=False, verbosity='high')[source]

Set the variables for a bands calculation

Parameters
  • nbnd (int) – number of bands

  • conv_thr (float) – the convergence threshold value

  • diago_full_acc (boolean) –

  • force_symmorphic (boolean) –

  • verbosity (string) –

set_energy_cutoff(e)[source]

Set the value of the kinetic energy cutoff (Ry) for wavefunctions

set_kpoints(type='automatic', points=[1.0, 1.0, 1.0], shift=[0.0, 0.0, 0.0], klist=[])[source]

Define the sampling of the Brillouin zone.

Parameters
  • type (str) – type of sampling (automatic, tpiba, tpiba_b,…)

  • points (list) – number of kpoints in the x,y,z directions. Used only is type is automatic

  • shift (list) – shifts in the x,y,z directions. Used only is type is automatic

  • klist (list) – list with the structure: [[k1x,k1y,k1z,w1],[k2x,k2y,k2z,w2],….] Used only if type is not automatic

set_lattice(ibrav, cell_vectors=None, cell_units='angstrom', celldm1=None, celldm2=None, celldm3=None, celldm4=None, celldm5=None, celldm6=None)[source]

Set the lattice structure using the typical QuantumESPRESSO input variables.

Parameters
  • ibrav (int) – Bravais-lattice index. 0 : Free, 1 : Cubic, 2 : Fcc, 3 : bcc, 4 : Hexagonal

  • cell_vectors (list) – the list with the crystal lattice vectors in the form [[v1_x,v1_y,v1_z],[v2_x,v2_y,v2_z],[v3_x,v3_y,v3_z]]

  • cell_units (string) – units used for the cell vectors (angstrom, BOHR or alat). If alat is used the lattice vectors are in units of the lattice parameter celldm(1)

  • celldms (**kwargs) – Crystallographic constants. Only needed values (depending on “ibrav”) must be specified. alat = celldm(1) is the lattice parameter (in BOHR). If ibrav==0, only celldm(1) is used if present and cell vectors are read from card CELL_PARAMETERS

set_nscf(nbnd, conv_thr=1e-08, diago_full_acc=False, force_symmorphic=False, verbosity='high')[source]

Set the variables for a nscf calculation

Parameters
  • nbnd (int) – number of bands

  • conv_thr (float) – the convergence threshold value

  • diago_full_acc (boolean) –

  • force_symmorphic (boolean) –

  • verbosity (string) –

set_occupations(occupations='fixed', smearing='fermi-dirac', degauss=50.0)[source]

Set the type of orbital of occupations of the ks states. If a smearing is present set also the type of smearing and the value of the degauss parameter.

Parameters
  • occupations (string) – type of occupation of the ks states (fixed, smearing,…)

  • smearing (string) – type of smearing (gaussian, fermi-dirac,…)

  • degauss (float) – value of the gaussian spreading (meV) for brillouin-zone integration in metals

set_prefix(prefix)[source]

Set the value of prefix

set_pseudo_dir(pseudo_dir='../pseudos')[source]

Set the value of the pseudo_folder. The default is ‘../pseudos’ because usually the pw input is written in the run_dir folder by the QeCalculator or Dataset.

set_scf(conv_thr=1e-08, diago_full_acc=False, force_symmorphic=False, verbosity='high')[source]

Set the variables for a scf calculation

Parameters
  • conv_thr (float) – the convergence threshold value

  • diago_full_acc (boolean) –

  • force_symmorphic (boolean) –

  • verbosity (string) –

set_spinorbit()[source]

Set the lspinorb and noncolin to True.

set_spinpolarized()[source]

Set the value of nspin to 2. Useful to treat collinear spin polarized systems.

write(file)[source]

Write the QE input on file.

Parameters

file (string) – the file name

mppi.InputFiles.PwInput.fortran_bool(boolean)[source]