PwInput¶
This module manages the 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:
dictClass to generate an manipulate the QuantumESPRESSO 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 (
string) –mass (
string) – is used only for molecular dynamics runpseudo_name (
string) –
- cards = ['atomic_species', 'atomic_positions', 'kpoints', 'cell_parameters']¶
- default = {'control': {'calculation': "'scf'", 'outdir': "'./'", 'prefix': "'pwscf'", 'verbosity': "'high'"}, 'electrons': {'diago_full_acc': '.false.'}, 'system': {'force_symmorphic': '.false.'}}¶
- get_outdir()[source]¶
Get the value of outdir.
- Returns:
The value of the outdir key of the input dictionary. If the key is not present return the default value ‘.’
- Return type:
string
- get_prefix()[source]¶
Get the value of prefix.
- Returns:
The value of the prefix key of the input dictionary. If the key is not present return the default value ‘pwscf’
- Return type:
string
- namelist = ['control', 'system', 'electrons', 'ions', 'cell']¶
- 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
- Parameters:
file (
string) – name of an exsistent input file, used initialize the dictionaries of the object
- set_atomic_positions(positions, type='alat')[source]¶
Define the the positions of the atoms in the lattice.
- Parameters:
type (
string) – 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 bandsconv_thr (
float) – the convergence threshold valuediago_full_acc (
bool) –force_symmorphic (
bool) –verbosity (
bool) –
- set_energy_cutoff(energy)[source]¶
Set the value of the kinetic energy cutoff (Ry) for wavefunctions
- Parameters:
energy (
float) – value of the energy cutoff in Ry
- 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 (
string) – type of sampling (automatic, tpiba, tpiba_b,…)points (
list) – number of kpoints in the x,y,z directions. Used only if the type variable is set to automaticshift (
list) – shifts in the x,y,z directions. Used only if the type varible is set to automaticklist (
list) – list with the structure: [[k1x,k1y,k1z,w1],[k2x,k2y,k2z,w2],….] Used if type variable is not se to 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 : Hexagonalcell_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 (
float) – Crystallographic constants. Only some values depending on ibrav have to be specified. For instance, 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 bandsconv_thr (
float) – the convergence threshold valuediago_full_acc (
bool) –force_symmorphic (
bool) –verbosity (
string) –
- set_num_bnds(nbnd)[source]¶
Set the value of the variable nbnd. This method is useful if we need to set the number of bands in a scf calculation to include some empty bands.
- Parameters:
nbnd (
int) – number of bands
- 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_outdir(outdir)[source]¶
Set the value of outdir
- Parameters:
outdir (
string) – value of the outdir
- set_prefix(prefix)[source]¶
Set the value of prefix
- Parameters:
prefix (
string) – value of the prefix
- set_pseudo_dir(pseudo_dir='pseudos', abs_path=False)[source]¶
Set the position of the folder with the pseudo-potentials. If abs_path is True the path is converted in a absolute path. In this way it is possible to provide a relative path (expressed from the root of the folder where the notebook is located) and the pseudo location can be found from an arbitrary folder.
- Parameters:
( (pseudo_dir) – py:class:’string’) : (relative) path of the folder with the pseduopotentials
Note
If the folder tree contains blank spaces, QuantumESPRESSO cannot be able to find the pseudo, in this cas it is safer to provide a relative path (expressed from the folder where the input file is written)
- 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 (
string) – the convergence threshold valuediago_full_acc (
bool) –force_symmorphic (
bool) –verbosity (
string) –