pw

The Espresso object is used to perform a PW calculation.

A example of PW calculation of H2 molecule. One need to define the following inputs:

  • ASE Atoms.

  • kpoints.

  • pseudopotentials.

  • input_data.

  • queue.

from ase.build import molecule
from xespresso import Espresso

# define H2 molecule
h2 = molecule("H2")
h2.cell = [8, 8, 8]
h2.pbc = [True, True, True]
# set pseudo-potential
pseudopotentials = {
    "H": "H.pbe-rrkjus_psl.1.0.0.UPF",
}
calc = Espresso(
    pseudopotentials=pseudopotentials,
    label="calculations/scf/h2",
    ecutwfc=20,
    occupations="smearing",
    degauss=0.03,
    kpts=(1, 1, 1), # kpoints
    debug=True,
)
h2.calc = calc
e = h2.get_potential_energy()
print("Energy: {0:1.4f}".format(e))
assert np.isclose(e, -31.4454)

nscf

A example of nscf calculation following the above one.

from xespresso.post.nscf import EspressoNscf
nscf = EspressoNscf(calc.directory, prefix = calc.prefix,
                occupations = 'tetrahedra',
                kpts = (2, 2, 2),
                debug = True,
                )
nscf.run()

List of all Methods

class xespresso.xespresso.Espresso(label='xespresso', prefix=None, atoms=None, package='pw', parallel='', queue=None, debug=False, pseudo_group=None, **kwargs)[source]

Accepts all the options for pw.x as given in the QE docs, plus some additional options:

input_data, pseudopotentials, kspacing, kpts, koffset

Please have a look at Espresso module in ASE. https://wiki.fysik.dtu.dk/ase/ase/calculators/espresso.html

queue: dict

A dictionary with parameters for job submission, e.g.

>>> queue = {'nodes': 4, 'ntasks-per-node': 20,
>>>         'account': 'xxx', 'partition': 'normal',
>>>         'time': '23:59:00'}
package: str

Choose the quantum espresso package: pw, dos, projwfc, band, pp, ph, .. For NEB calculation, please use neb.NEBEspresso module. Calculaiton use phonon is not implemented yet.

parallel: str

A str which control the parallelization parameters: -nimage, -npools, -nband, -ntg, -ndiag or -northo (shorthands, respectively: -ni, -nk, -nb, -nt, -nd).

Examples:

  1. Perform a regular self-consistent calculation:

>>> calc = Espresso(input_data=input_data, ...)
>>> atoms.set_calculator(calc)
>>> atoms.get_potential_energy()
backup_file(src, directory='.')[source]

compare files backup

classmethod check_input(kwargs, prefix='pw', package='PW')[source]

Chekc input paramter type. set parameters for pw.x all other parameters are stored in ‘input_data’

check_pseudopotentials(pseudopotentials)[source]

check pseudopotentials

check_state(atoms, tol=0.0001)[source]

Check for any system changes since last calculation.

check_xml_file()[source]

If data-file-schema.xml is readable, then xml_end = True

clean()[source]

remove wfc, hub files

command: Optional[str] = 'PACKAGE.x  PARALLEL  -in  PREFIX.PACKAGEi  >  PREFIX.PACKAGEo'

Command used to start calculation

discard_results_on_any_change = False

Whether we purge the results following any change in the set() method.

find_pseudopotentials(pseudo_group='SSSP_1.1.2_PBE_efficiency')[source]

Get pseudo potential by family name.

Parameters:

pseudo_group (str) – name of the pseudo family.

implemented_properties: List[str] = ['energy', 'forces', 'stress', 'magmoms', 'time']

Properties calculator can handle (energy, forces, …)

read(label)[source]

Read the files in a calculation if they exist. This function reads self.parameters and atoms.

read_convergence()[source]

Read the status of the calculation. exit code: ‘0’: ‘Done’, ‘-1’: ‘ manual cancelled’, ‘1’: ‘Maximum CPU time exceeded’, convergence NOT achieved after n iterations

Then, change the parameter: 1) mixing_beta or 2) degauss

‘2’: ‘manual restart’, ‘Pending or not submit’, ‘3’: ‘other errors’, ‘4’: ‘unknow error’,

read_results()[source]

Read PW results. get atomic species

run(atoms=None, restart=False)[source]

run and restart

set_label(label, prefix)[source]

Set directory and prefix from label

write_input(atoms, properties=None, system_changes=None)[source]

Write input file(s).

Call this method first in subclasses so that directories are created automatically.