pymatgen.io.abinit.works module¶
Works for Abinit
-
class
Work(workdir=None, manager=None)[source]¶ Bases:
pymatgen.io.abinit.works.BaseWork,pymatgen.io.abinit.works.NodeContainerA Work is a list of (possibly connected) tasks.
Parameters: - workdir – Path to the working directory.
- manager –
TaskManagerobject.
-
allocate(manager=None)[source]¶ This function is called once we have completed the initialization of the
Work. It sets the manager of each task (if not already done) and defines the working directories of the tasks.Parameters: manager – TaskManagerobject or None
-
get_all_status(only_min=False)[source]¶ Returns a list with the status of the tasks in self.
Parameters: only_min – If True, the minimum of the status is returned.
-
isnc¶ True if norm-conserving calculation.
-
ispaw¶ True if PAW calculation.
-
move(dest, isabspath=False)[source]¶ Recursively move self.workdir to another location. This is similar to the Unix “mv” command. The destination path must not already exist. If the destination already exists but is not a directory, it may be overwritten depending on os.rename() semantics.
Be default, dest is located in the parent directory of self.workdir, use isabspath=True to specify an absolute path.
-
opath_from_ext(ext)[source]¶ Returns the path of the output file with extension ext. Use it when the file does not exist yet.
-
parse_timers()[source]¶ Parse the TIMER section reported in the ABINIT output files.
Returns: AbinitTimerParserobject
-
pos_str¶ String representation of self.pos
-
processes¶
-
read_etotals(unit='Ha')[source]¶ Reads the total energy from the GSR file produced by the task.
Return a numpy array with the total energies in Hartree The array element is set to np.inf if an exception is raised while reading the GSR file.
-
register(obj, deps=None, required_files=None, manager=None, task_class=None)[source]¶ Registers a new
Taskand add it to the internal list, taking into account possible dependencies.Parameters: - obj –
AbinitInputinstance. - deps – Dictionary specifying the dependency of this node. None means that this obj has no dependency.
- required_files – List of strings with the path of the files used by the task. Note that the files must exist when the task is registered. Use the standard approach based on Works, Tasks and deps if the files will be produced in the future.
- manager – The
TaskManagerresponsible for the submission of the task. If manager is None, we use the TaskManager specified during the creation of theWork. - task_class – Task subclass to instantiate. Default:
AbinitTask
Returns: Taskobject- obj –
-
register_task(obj, deps=None, required_files=None, manager=None, task_class=None)¶ Registers a new
Taskand add it to the internal list, taking into account possible dependencies.Parameters: - obj –
AbinitInputinstance. - deps – Dictionary specifying the dependency of this node. None means that this obj has no dependency.
- required_files – List of strings with the path of the files used by the task. Note that the files must exist when the task is registered. Use the standard approach based on Works, Tasks and deps if the files will be produced in the future.
- manager – The
TaskManagerresponsible for the submission of the task. If manager is None, we use the TaskManager specified during the creation of theWork. - task_class – Task subclass to instantiate. Default:
AbinitTask
Returns: Taskobject- obj –
-
rmtree(exclude_wildcard='')[source]¶ Remove all files and directories in the working directory
Parameters: exclude_wildcard – Optional string with regular expressions separated by |. Files matching one of the regular expressions will be preserved. example: exclude_wildard=”.nc|.txt” preserves all the files whose extension is in [“nc”, “txt”].
-
set_workdir(workdir, chroot=False)[source]¶ Set the working directory. Cannot be set more than once unless chroot is True
-
setup(*args, **kwargs)[source]¶ Method called before running the calculations. The default implementation is empty.
-
start(*args, **kwargs)[source]¶ Start the work. Calls build and _setup first, then submit the tasks. Non-blocking call unless wait is set to True
-
status¶ Returns the status of the work i.e. the minimum of the status of the tasks.
-
status_counter¶ Returns a Counter object that counts the number of task with given status (use the string representation of the status as key).
-
class
BandStructureWork(scf_input, nscf_input, dos_inputs=None, workdir=None, manager=None)[source]¶ Bases:
pymatgen.io.abinit.works.WorkWork for band structure calculations.
Parameters: - scf_input – Input for the SCF run
- nscf_input – Input for the NSCF run defining the band structure calculation.
- dos_inputs – Input(s) for the DOS. DOS is computed only if dos_inputs is not None.
- workdir – Working directory.
- manager –
TaskManagerobject.
-
plot_ebands(**kwargs)[source]¶ Plot the band structure. kwargs are passed to the plot method of
ElectronBands.Returns: matplotlib figure
-
plot_ebands_with_edos(dos_pos=0, method='gaussian', step=0.01, width=0.1, **kwargs)[source]¶ Plot the band structure and the DOS.
Parameters: - dos_pos – Index of the task from which the DOS should be obtained (note: 0 refers to the first DOS task).
- method – String defining the method for the computation of the DOS.
- step – Energy step (eV) of the linear mesh.
- width – Standard deviation (eV) of the gaussian.
- kwargs – Keyword arguments passed to plot_with_edos method to customize the plot.
Returns: matplotlib figure.
-
plot_edoses(dos_pos=None, method='gaussian', step=0.01, width=0.1, **kwargs)[source]¶ Plot the band structure and the DOS.
Parameters: - dos_pos – Index of the task from which the DOS should be obtained. None is all DOSes should be displayed. Accepts integer or list of integers.
- method – String defining the method for the computation of the DOS.
- step – Energy step (eV) of the linear mesh.
- width – Standard deviation (eV) of the gaussian.
- kwargs – Keyword arguments passed to plot method to customize the plot.
Returns: matplotlib figure.
-
class
RelaxWork(ion_input, ioncell_input, workdir=None, manager=None, target_dilatmx=None)[source]¶ Bases:
pymatgen.io.abinit.works.WorkWork for structural relaxations. The first task relaxes the atomic position while keeping the unit cell parameters fixed. The second task uses the final structure to perform a structural relaxation in which both the atomic positions and the lattice parameters are optimized.
Parameters: - ion_input – Input for the relaxation of the ions (cell is fixed)
- ioncell_input – Input for the relaxation of the ions and the unit cell.
- workdir – Working directory.
- manager –
TaskManagerobject.
-
on_ok(sender)[source]¶ This callback is called when one task reaches status S_OK. If sender == self.ion_task, we update the initial structure used by self.ioncell_task and we unlock it so that the job can be submitted.
-
class
G0W0Work(scf_inputs, nscf_inputs, scr_inputs, sigma_inputs, workdir=None, manager=None)[source]¶ Bases:
pymatgen.io.abinit.works.WorkWork for general G0W0 calculations. All input can be either single inputs or lists of inputs
Parameters: - scf_inputs – Input(s) for the SCF run, if it is a list add all but only link to the last input (used for convergence studies on the KS band gap)
- nscf_inputs – Input(s) for the NSCF run, if it is a list add all but only link to the last (i.e. addditiona DOS and BANDS)
- scr_inputs – Input for the screening run
- sigma_inputs – List of :class:AbinitInput`for the self-energy run. if scr and sigma are lists of the same length, every sigma gets its own screening. if there is only one screening all sigma inputs are linked to this one
- workdir – Working directory of the calculation.
- manager –
TaskManagerobject.
-
class
QptdmWork(workdir=None, manager=None)[source]¶ Bases:
pymatgen.io.abinit.works.WorkThis work parallelizes the calculation of the q-points of the screening. It also provides the callback on_all_ok that calls mrgscr to merge all the partial screening files produced.
Parameters: - workdir – Path to the working directory.
- manager –
TaskManagerobject.
-
create_tasks(wfk_file, scr_input)[source]¶ Create the SCR tasks and register them in self.
Parameters: - wfk_file – Path to the ABINIT WFK file to use for the computation of the screening.
- scr_input – Input for the screening calculation.
-
class
SigmaConvWork(wfk_node, scr_node, sigma_inputs, workdir=None, manager=None)[source]¶ Bases:
pymatgen.io.abinit.works.WorkWork for self-energy convergence studies.
Parameters: - wfk_node – The node who has produced the WFK file or filepath pointing to the WFK file.
- scr_node – The node who has produced the SCR file or filepath pointing to the SCR file.
- sigma_inputs – List of
AbinitInputfor the self-energy runs. - workdir – Working directory of the calculation.
- manager –
TaskManagerobject.
-
class
BseMdfWork(scf_input, nscf_input, bse_inputs, workdir=None, manager=None)[source]¶ Bases:
pymatgen.io.abinit.works.WorkWork for simple BSE calculations in which the self-energy corrections are approximated by the scissors operator and the screening is modeled with the model dielectric function.
Parameters: - scf_input – Input for the SCF run.
- nscf_input – Input for the NSCF run.
- bse_inputs – List of Inputs for the BSE run.
- workdir – Working directory of the calculation.
- manager –
TaskManager.
-
class
PhononWork(workdir=None, manager=None)[source]¶ Bases:
pymatgen.io.abinit.works.Work,pymatgen.io.abinit.works.MergeDdbThis work usually consists of one GS + nirred Phonon tasks where nirred is the number of irreducible perturbations for a given q-point. It provides the callback method (on_all_ok) that calls mrgddb to merge the partial DDB files produced
Parameters: - workdir – Path to the working directory.
- manager –
TaskManagerobject.
-
classmethod
from_scf_input(scf_input, qpoints, tolerance=None, manager=None)[source]¶ Similar to from_scf_task, the difference is that this method requires an input for SCF calculation instead of a ScfTask. All the tasks (Scf + Phonon) are packed in a single Work whereas in the previous case we usually have multiple works.
-
classmethod
from_scf_task(scf_task, qpoints, tolerance=None, manager=None)[source]¶ Construct a PhononWork from a
ScfTaskobject. The input file for phonons is automatically generated from the input of the ScfTask. Each phonon task depends on the WFK file produced by scf_task.Parameters: - scf_task – ScfTask object.
- qpoints – q-points in reduced coordinates. Accepts single q-point or list of q-points
- tolerance – dict {varname: value} with the tolerance to be used in the DFPT run. Defaults to {“tolvrs”: 1.0e-10}.
- manager –
TaskManagerobject.