principia_materia.io_interface.compute_job_series module
- class principia_materia.io_interface.compute_job_series.ComputeJobSeries(structure, root_directory, compute_engine, config_path=None, jobinput=None, joboutput=None)
Bases:
object
Manage a series of jobs
Since many part of this package (for example, phonon irreducible derivatives computaiton), usually needs to create and read a series of calculations.
The series of jobs are assumed to have a hierarchical directory structure, that every job is in its own directory with the job name as the directory name.
- Parameters:
structure (Crystal or CrystalFTG object) – The primitive crystal structure. Input input is a CrystalFTG object, the primitive cell will be used.
root_directory (str) – The root directory that hosts all the jobs of the series.
compute_engine (str, or a subclass of principia_materia.io_interface.compute_job.ComputeJob) – The compute engine, for example “vasp” or VASPJob is referring to VASP DFT engine.
config_path (str, optional, default to None) – The path of the configuration file, it is used to create the series of jobs as a template.
- property config_path
- create_directory(dirname, exists=False)
Create directory inside root directory of the job series.
- Parameters:
dirname (str) – Directory name to create.
- create_job(jobname, supa, prefix=None, displacement=None, strain=None, velocities=None, append=False, dry_run=False)
Create a job at the given jobname (jobname will be the directory name).
- Parameters:
jobname (str) – The name of the job, as well as the directory name to create the job in.
supa (array of int, shape(dim, dim)) – The supercell matrix.
prefix (str, optional, default to None) – The prefixing directory of the job relative to the root directory of the job series.
displacement (array of float, optional, default to None) – The displacement to the crystal.
strain (array of float, shape(dim, dim), optional, default to None) – The strain matrix of the structure.
velocities (array of float, optional, default to None) – The initial velocities of the atoms of the crystal.
append (bool, optional, default to False) – If True, skip existing jobs. Otherwise, throw an error.
dry_run (bool, optional, default to False) – If True, don’t actually create the job.
- create_jobs(jobnames, supa, prefix=None, displacements=None, strain=None, velocities=None, append=False, job_index_name=None, dry_run=False)
Create a series of jobs.
- Parameters:
jobnames (list of str) – The names of the jobs, as well as the directory name to create the jobs in.
supa (array of int, shape(dim, dim)) – The supercell matrix.
prefix (str, optional, default to None) – The prefixing directory of the jobs relative to the root directory of the job series.
displacements (array of float, optional, default to None) – The displacements to the crystal for the jobs.
strain (array of float, shape(dim, dim), optional, default to None) – The strain matrix of the structure.
velocities (array of float, optional, default to None) – The initial velocities of the atoms of the crystal for the jobs.
append (bool, optional, default to False) – If True, skip existing jobs. Otherwise, throw an error.
dry_run (bool, optional, default to False) – If True, don’t actually create the job.
- get_born_effective_charges_from_job(jobname, prefix=None)
Parse Born effective charges from the job.
- Parameters:
jobname (str) – The name of the job, as well as the directory name to create the job in.
- get_compute_job(jobname, prefix=None)
Get the job from the given jobname (jobname would be the directory name).
- Parameters:
jobname (str) – The name of the job, as well as the directory name to create the job in.
- get_dielectric_tensor_from_job(jobname, prefix=None)
Parse the dielectric tensor from the job.
- Parameters:
jobname (str) – The name of the job, as well as the directory name to create the job in.
- get_energy_from_job(jobname, prefix=None)
Parse the energy from the job.
- Parameters:
jobname (str) – The name of the job, as well as the directory name to create the job in.
- get_forces_from_job(jobname, prefix=None)
Parse forces from the job.
- Parameters:
jobname (str) – The name of the job, as well as the directory name to create the job in.
- get_metadata_path(filename)
Get the path to save the metadata file in.
- Parameters:
filename (str) – The base name of metadata file.
- get_results_from_jobs(jobnames, data_type, prefix=None)
Get results from a series of jobs.
- Parameters:
jobnames (list of str) – The names of the jobs, as well as the directory name to create the jobs in.
data_type (str) – The type of results to retrieve, can be “forces”, “energy”, “stress”, “born_effective_charges” or “dielectric_tensor”.
prefix (str, optional, default to None) – The prefixing directory of the jobs relative to the root directory of the job series.
- Returns:
data – The retrieved results from jobs.
- Return type:
array of float
- get_stress_from_job(jobname, prefix=None)
Parse the stress from the job.
- Parameters:
jobname (str) – The name of the job, as well as the directory name to create the job in.
- save_metadata(filename, metadata, dry_run=False)
Save metadata into a file in the root directory of job series.
- Parameters:
filename (str) – The base name of metadata file.
metadata (str) – The metadata to save in plain text.
dry_run (bool, optional, default to False) – If True, don’t actually create the metadata file.
- property series_exists
Whether if the root directory exists.
- set_static_files(filenames, abspath=False)
Set a list of static files to copy into the job directory.
- Parameters:
filenames (str of list of str) – The path names of the files to copy.
abspath (bool, optional, default to False) – Whether the input filenames are absolute path.
- property structure