principia_materia.io_interface.jobs_db module
- class principia_materia.io_interface.jobs_db.JobsDB(root_directory, db_path, db_type, structure, table=None)
- Bases: - object- Interface jobs with database. - Parameters:
- root_directory (str) – The root directory that hosts all the jobs of the series. 
- db_path (str) – Path to database. 
- db_type (str) – Type of the database, for example “sqlite”. 
- structure (Crystal or CrystalFTG object) – The primitive crystal structure. Input input is a CrystalFTG object, the primitive cell will be used. 
 
 - add_filter(key, value)
- Add a filtering condition for database action (query/update/insert). - Parameters:
- key (str) – The name of the column. 
- value (str/int/float/array) – The filtering value of that column. 
 
 
 - create_job(jobname, supa, prefix=None, displacement=None, strain=None, velocities=None, append=False, dry_run=False)
- Create a job with the given jobname in the database. - 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, additional_filters={}, dry_run=False)
- Create a series of jobs in database. - Parameters:
- jobnames (list of str) – The names of the jobs. 
- 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=None, step_index=None)
- Get 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. 
- step_index (int) – The step index of the job in an finite difference calculation. 
 
 
 - get_dielectric_tensor_from_job(jobname=None, step_index=None)
- Get 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. 
- step_index (int) – The step index of the job in an finite difference calculation. 
 
 
 - get_energy_from_job(jobname=None, step_index=None)
- Get the energy from the job. - Parameters:
- jobname (str) – The name of the job, as well as the directory name to create the job in. 
- step_index (int) – The step index of the job in an finite difference calculation. 
 
 
 - get_forces_from_job(jobname=None, step_index=None)
- Get forces from the job. - Parameters:
- jobname (str) – The name of the job, as well as the directory name to create the job in. 
- step_index (int) – The step index of the job in an finite difference calculation. 
 
 
 - get_metadata_path(filename)
 - get_results_from_jobs(jobnames, data_type, job_index_name=None)
- Get results of a series of jobs from database. - Parameters:
- jobnames (list of str) – The names of the jobs. 
- 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 prefix 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=None, step_index=None)
- Get the stress from the job. - Parameters:
- jobname (str) – The name of the job, as well as the directory name to create the job in. 
- step_index (int) – The step index of the job in an finite difference calculation. 
 
 
 - remove_filter(key)
- Remive a filtering condition from database action. - Parameters:
- key (str) – The name of the column. 
 
 - reset_filters()
- Reset the database filters. 
 - save_metadata(filename, metadata, dry_run=False)
 - save_table_info(info_table, data)
- Save some generic information of the table that the jobs are created in to an information table. - Parameters:
- info_table (str) – The name of the information table. 
- data (dict) – The generic information to save in the information table. 
 
 
 - set_table(table)
- Set name of the table to access. - Parameters:
- table (str) – Table name. 
 
 - property structure