Calculations

Quantum Espresso - ph.x

Plugin to create a Quantum Espresso ph.x input file.

class aiida_quantumespresso.calculations.ph.PhCalculation(*args, **kwargs)[source]

CalcJob implementation for the ph.x code of Quantum ESPRESSO.

prepare_for_submission(folder)[source]

Create the input files from the input nodes passed to this instance of the CalcJob.

Parameters:folder – an aiida.common.folders.Folder to temporarily write files on disk
Returns:aiida.common.datastructures.CalcInfo instance

Quantum Espresso - pw.x

class aiida_quantumespresso.calculations.pw.PwCalculation(*args, **kwargs)[source]

CalcJob implementation for the pw.x code of Quantum ESPRESSO.

classmethod input_helper(*args, **kwargs)[source]

Validate if the keywords are valid Quantum ESPRESSO pw.x keywords, and also helps in preparing the input parameter dictionary in a ‘standardized’ form (e.g., converts ints to floats when required, or if the flag flat_mode is specified, puts the keywords in the right namelists).

This function calls aiida_quantumespresso.calculations.helpers.pw_input_helper(), see its docstring for further information.

Quantum Espresso helpers

exception aiida_quantumespresso.calculations.helpers.QEInputValidationError[source]

This class is the exception that is generated by the parser when it encounters an error while creating the input file of Quantum ESPRESSO.

aiida_quantumespresso.calculations.helpers.pw_input_helper(input_params, structure, stop_at_first_error=False, flat_mode=False, version='6.2')[source]

Validate if the input dictionary for Quantum ESPRESSO is valid. Return the dictionary (possibly with small variations: e.g. convert integer to float where necessary, recreate the proper structure if flat_mode is True, …) to use as input parameters (use_parameters) for the pw.x calculation.

Parameters:
  • input_params
    If flat_mode is True, pass a dictionary
    with ‘key’ = value; use the correct type (int, bool, …) for value. If an array is required:
    • if its length is fixed: pass a list of the required length
    • if its length is ‘ntyp’: pass a dictionary, associating each specie to its value.
    • (other lengths are not supported)

    Example:

    {
    'calculation': 'vc-relax',
    'ecutwfc': 30.,
    'hubbard_u': {'O': 1},
    }
    

    If instead flat_mode is False, pass a dictionary in the format expected by AiiDA (keys are namelists, values are in the format specified above, i.e. key/value pairs for all keywords in the given namelist). Example:

    {
        'CONTROL': {
            'calculation': 'vc-relax'
            }, 
        'SYSTEM': {
            'hubbard_u': {'O': 1.0}, 
            'ecutwfc': 30.,
            },
    },
    
  • structure – the StructureData object used as input for QE pw.x
  • stop_at_first_error – if True, stops at the first error. Otherwise, when, possible, continue and give a global error for all the issues encountered.
  • flat_mode – if True, instead of passing the dictionary of namelists, and inside the keywords, pass directly the keywords - this function will return the correct dictionary to pass to the PwCalculation, with the keywords arranged in the correct namelist.
  • version – string with version number, used to find the correct XML file descriptor. If not specified, uses the most recent version available in the validator. It reads the definitions from the XML files in the same folder as this python module. If the version is not recognised, the Exception message will also suggest a close-by version.
Raises:

QEInputValidationError – if the input is not considered valid.

Quantum Espresso - dos.x

class aiida_quantumespresso.calculations.dos.DosCalculation(*args, **kwargs)[source]

CalcJob implementation for the dos.x code of Quantum ESPRESSO.

Quantum Espresso - projwfc.x

class aiida_quantumespresso.calculations.projwfc.ProjwfcCalculation(*args, **kwargs)[source]

Projwfc.x code of the Quantum ESPRESSO distribution, handles the the computation of projections of bloch wavefunctions onto atomic orbitals <Psi(n,k) | Y(theta,phi)R(r) >. For more information, refer to http://www.quantum-espresso.org/

Quantum Espresso - PW immigrant

Plugin to immigrate a Quantum Espresso pw.x job that was not run using AiiDa.

class aiida_quantumespresso.calculations.pwimmigrant.PwimmigrantCalculation(*args, **kwargs)[source]

Create a PwCalculation object that can be used to import old jobs.

This is a sublass of aiida_quantumespresso.calculations.PwCalculation with slight modifications to some of the class variables and additional methods that

  1. parse the job’s input file to create the calculation’s input nodes that would exist if the calculation were submitted using AiiDa,
  2. bypass the functions of the daemon, and prepare the node’s attributes such that all the processes (copying of the files to the repository, results parsing, ect.) can be performed

Note

The keyword arguments of PwCalculation are also available.

Parameters:
  • remote_workdir (str) – Absolute path to the directory where the job was run. The transport of the computer you link ask input to the calculation is the transport that will be used to retrieve the calculation’s files. Therefore, remote_workdir should be the absolute path to the job’s directory on that computer.
  • input_file_name (str) – The file name of the job’s input file.
  • output_file_name (str) – The file name of the job’s output file (i.e. the file containing the stdout of QE).
create_input_nodes(open_transport, input_file_name=None, output_file_name=None, remote_workdir=None)[source]

Create calculation input nodes based on the job’s files.

Parameters:open_transport (aiida.transport.plugins.local.LocalTransport or aiida.transport.plugins.ssh.SshTransport) – An open instance of the transport class of the calculation’s computer. See the tutorial for more information.

This method parses the files in the job’s remote working directory to create the input nodes that would exist if the calculation were submitted using AiiDa. These nodes are

  • a 'parameters' Dict node, based on the namelists and their variable-value pairs;
  • a 'kpoints' KpointsData node, based on the K_POINTS card;
  • a 'structure' StructureData node, based on the ATOMIC_POSITIONS and CELL_PARAMETERS cards;
  • one 'pseudo_X' UpfData node for the pseudopotential used for the atomic species with name X, as specified in the ATOMIC_SPECIES card;
  • a 'settings' Dict node, if there are any fixed coordinates, or if the gamma kpoint is used;

and can be retrieved as a dictionary using the get_incoming() method. These input links are cached-links; nothing is stored by this method (including the calculation node itself).

Note

QE stores the calculation’s pseudopotential files in the <outdir>/<prefix>.save/ subfolder of the job’s working directory, where outdir and prefix are QE CONTROL variables (see pw input file description). This method uses these files to either get–if the a node already exists for the pseudo–or create a UpfData node for each pseudopotential.

Keyword arguments

Note

These keyword arguments can also be set when instantiating the class or using the set_ methods (e.g. set_remote_workdir). Offering to set them here simply offers the user an additional place to set their values. Only the values that have not yet been set need to be specified.

Parameters:
  • input_file_name (str) – The file name of the job’s input file.
  • output_file_name (str) – The file name of the job’s output file (i.e. the file containing the stdout of QE).
  • remote_workdir (str) – Absolute path to the directory where the job was run. The transport of the computer you link ask input to the calculation is the transport that will be used to retrieve the calculation’s files. Therefore, remote_workdir should be the absolute path to the job’s directory on that computer.
Raises:
prepare_for_retrieval_and_parsing(open_transport)[source]

Tell the daemon that the calculation is computed and ready to be parsed.

Parameters:open_transport (aiida.transport.plugins.local.LocalTransport or aiida.transport.plugins.ssh.SshTransport) – An open instance of the transport class of the calculation’s computer. See the tutorial for more information.

The next time the daemon updates the status of calculations, it will see this job is in the ‘COMPUTED’ state and will retrieve its output files and parse the results.

If the daemon is not currently running, nothing will happen until it is started again.

This method also stores the calculation and all input nodes. It also copies the original input file to the calculation’s repository folder.

Raises:
set_input_file_name(input_file_name)[source]

Set the file name of the job’s input file (e.g. 'pw.in').

Parameters:input_file_name (str) – The file name of the job’s input file.
set_output_file_name(output_file_name)[source]

Set the file name of the job’s output file (e.g. 'pw.out').

Parameters:output_file_name (str) – The file name of file containing the job’s stdout.
set_output_subfolder(output_subfolder)[source]

Manually set the job’s outdir variable (e.g. './out/').

Note

The outdir variable is normally set automatically by

  1. looking for the outdir CONTROL namelist variable
  2. looking for the $ESPRESSO_TMPDIR environment variable on the calculation’s computer (using the transport)
  3. using the QE default, the calculation’s remote_workdir

but this method is made available to the user, in the event that they wish to set it manually.

Parameters:output_subfolder (str) – The job’s outdir variable.
set_prefix(prefix)[source]

Manually set the job’s prefix variable (e.g. 'pwscf').

Note

The prefix variable is normally set automatically by

  1. looking for the prefix CONTROL namelist variable
  2. using the QE default, 'pwscf'

but this method is made available to the user, in the event that they wish to set it manually.

Parameters:prefix (str) – The job’s prefix variable.
set_remote_workdir(remote_workdir)[source]

Set the job’s remote working directory.

Parameters:remote_workdir (str) – Absolute path of the job’s remote working directory.