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.
-
property
isnc¶ True if norm-conserving calculation.
-
property
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
-
property
pos_str¶ String representation of self.pos
-
property
processes¶ Return a list of objects that support the subprocess.Popen protocol.
-
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 or Task object.deps – Dictionary specifying the dependency of this node or list of dependencies 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
-
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 or Task object.deps – Dictionary specifying the dependency of this node or list of dependencies 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
-
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
-
property
status¶ Returns the status of the work i.e. the minimum of the status of the tasks.
-
property
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 consists of nirred Phonon tasks where nirred is the number of irreducible atomic perturbations for a given set of q-points. It provides the callback method (on_all_ok) that calls mrgddb (mrgdv) to merge all the partial DDB (POT) files produced. The two files are available in the output directory of the Work.
- Parameters
workdir – Path to the working directory.
manager –
TaskManagerobject.
-
classmethod
from_scf_input(scf_input, qpoints, is_ngqpt=False, tolerance=None, with_becs=False, ddk_tolerance=None, manager=None)[source]¶ Similar to from_scf_task, the difference is that this method requires an input for SCF calculation. A new ScfTask is created and added to the Work. This API should be used if the DDB of the GS task should be merged.
-
classmethod
from_scf_task(scf_task, qpoints, is_ngqpt=False, tolerance=None, with_becs=False, ddk_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 the scf_task.- Parameters
scf_task – ScfTask object.
qpoints – q-points in reduced coordinates. Accepts single q-point, list of q-points or three integers defining the q-mesh if is_ngqpt.
is_ngqpt – True if qpoints should be interpreted as divisions instead of q-points.
tolerance – dict {“varname”: value} with the tolerance to be used in the phonon run. None to use AbiPy default.
with_becs – Activate calculation of Electric field and Born effective charges.
ddk_tolerance – dict {“varname”: value} with the tolerance used in the DDK run if with_becs. None to use AbiPy default.
manager –
TaskManagerobject.
-
class
PhononWfkqWork(workdir=None, manager=None)[source]¶ Bases:
pymatgen.io.abinit.works.Work,pymatgen.io.abinit.works.MergeDdbThis work computes phonons with DFPT on an arbitrary q-mesh (usually denser than the k-mesh for electrons) by computing WKQ files for each q-point. The number of irreducible atomic perturbations for each q-point are taken into account. It provides the callback method (on_all_ok) that calls mrgddb (mrgdv) to merge all the partial DDB (POT) files produced. The two files are available in the output directory of the Work. The WKQ files are removed at runtime.
- Parameters
workdir – Path to the working directory.
manager –
TaskManagerobject.
-
classmethod
from_scf_task(scf_task, ngqpt, ph_tolerance=None, tolwfr=1e-22, nband=None, with_becs=False, ddk_tolerance=None, shiftq=(0, 0, 0), is_ngqpt=True, remove_wfkq=True, manager=None)[source]¶ Construct a PhononWfkqWork from a
ScfTaskobject. The input files for WFQ and phonons are automatically generated from the input of the ScfTask. Each phonon task depends on the WFK file produced by scf_task and the associated WFQ file.- Parameters
scf_task – ScfTask object.
ngqpt – three integers defining the q-mesh
with_becs – Activate calculation of Electric field and Born effective charges.
ph_tolerance – dict {“varname”: value} with the tolerance for the phonon run. None to use AbiPy default.
tolwfr – tolerance used to compute WFQ.
ddk_tolerance – dict {“varname”: value} with the tolerance used in the DDK run if with_becs. None to use AbiPy default.
shiftq – Q-mesh shift. Multiple shifts are not supported.
is_ngqpt – the ngqpt is interpreted as a set of integers defining the q-mesh, otherwise is an explicit list of q-points
remove_wfkq – Remove WKQ files when the children are completed.
manager –
TaskManagerobject.
-
class
GKKPWork(workdir=None, manager=None)[source]¶ Bases:
pymatgen.io.abinit.works.WorkThis work computes electron-phonon matrix elements for all the q-points present in a DVDB and DDB file
- Parameters
workdir – Path to the working directory.
manager –
TaskManagerobject.
-
classmethod
from_den_ddb_dvdb(inp, den_path, ddb_path, dvdb_path, mpiprocs=1, remove_wfkq=True, qpath=None, with_ddk=True, expand=True, manager=None)[source]¶ Construct a PhononWfkqWork from a DDB and DVDB file. For each q found, a WFQ task and an EPH task computing the matrix elements are created.
-
class
BecWork(workdir=None, manager=None)[source]¶ Bases:
pymatgen.io.abinit.works.Work,pymatgen.io.abinit.works.MergeDdbWork for the computation of the Born effective charges.
This work consists of DDK tasks and phonon + electric field perturbation It provides the callback method (on_all_ok) that calls mrgddb to merge the partial DDB files produced by the work.
- Parameters
workdir – Path to the working directory.
manager –
TaskManagerobject.
-
classmethod
from_scf_task(scf_task, ddk_tolerance=None, ph_tolerance=None, manager=None)[source]¶ Build tasks for the computation of Born effective charges from a ground-state task.
- Parameters
scf_task – ScfTask object.
ddk_tolerance – tolerance used in the DDK run if with_becs. None to use AbiPy default.
ph_tolerance – dict {“varname”: value} with the tolerance used in the phonon run. None to use AbiPy default.
manager –
TaskManagerobject.
-
class
DteWork(workdir=None, manager=None)[source]¶ Bases:
pymatgen.io.abinit.works.Work,pymatgen.io.abinit.works.MergeDdbWork for the computation of the third derivative of the energy.
This work consists of DDK tasks and electric field perturbation. 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.