strucscan Reference
strucscan.core module
Main module of strucscan. This module contains definitions of the two major
classes, strucscan.core.jobmanager.JobManager and strucscan.core.jobmaker.JobMaker.
Both communicate together with strucscan.core.datatree, strucscan.core.statusmanager,
and strucscan.core.collector
to initialize a list of :class:`strucscan.core.jobobject`s
which is updated and monitored.
This module contains classes that build the interface to the certain material simulation codes.
Each interface class inherit the abstract class strucscan.engine.generalengine.GeneralEngine.
strucscan.engine module
- class strucscan.engine.generalengine.GeneralEngine(input_dict)[source]
- __init__(input_dict)[source]
Abstract engine object :param input_dict: (dict) input dictionary. Please follow to the examples in strucscan.resources.inputyaml
- check_if_finished(files)[source]
abstract method to check if the calculation in job directory with files with files is finished
- Parameters
files – (str list) str list of all files in directory
- Returns
(bool)
- get_absolute_jobpath(property, structpath)[source]
abstract method to return absolute path to job directory
this is engine specific: ‘DATA_TREE_PATH/ENGINE_SIGNATURE/RELATIVE_JOBPATH’
while ‘DATA_TREE_PATH’ is configured in .strucscan and ‘RELATIVE_JOBPATH’ is generated by
strucscan.datatree.get_relative_jobpath, ‘ENGINE_SIGNATURE’ needs to be generated by this method - example: ‘DATA_TREE_PATH/VASP_5_4_PBE/AlNi/static__L1_2_NiAl’
- Parameters
property – (str) name of property
structpath – (str) absolute path to structure file
- Returns
(str) absolute path to job directory
- get_result_filename()[source]
abstract method that returns name of final result file. For VASP, e.g. it is ‘OUTCAR’
- Returns
(str) name of final result file
- has_resultfile(files)[source]
VASP specific method to check if the final result file lies in job directory with files
- Parameters
files – (str list) str list of all files in directory
- Returns
(bool)
- make_inputfiles(machine_info, jobobject)[source]
abstract method that creates / writes engine specific input files
for VASP, e.g. this method needs to write INCAR, KPOINTS, POSCAR, POTCAR
calls strucscan.engine.generalengine.GeneralEngine.get_absolute_jobpath
calls strucscan.engine.generalengine.GeneralEngine.make_machinefile
calls strucscan.engine.generalengine.GeneralEngine.write_structure
- Parameters
machineconfig – (dict) dictionary of form {“queuename”: str, “ncores”: int, “nnodes”: int}
jobobject – (strucscan.core.jobobject.JobObject object) object that contains information about job
- Returns
(str) machine_script_fname
- make_machinefile(machineconfig, jobname, ntotalcores, property, nsteps)[source]
abstract method to create / write machine script
- Parameters
machineconfig – (dict) machine configuration script taken from ‘input_dict’
jobname – (str) name of job, e.g. ‘static__fcc__Al’
ntotalcores – (int) number of total cores, that is #cores per node * #of nodes
property – (str) name of property
nsteps – (int) number of single calculation of, e.g. E-V curves, transformation path, …
- Returns
(str list, str) tuple of (list of lines in machine script, machine script file name)
- static read_final_structure(path, resultfilename=None)[source]
abstract method to read final structure file
- Parameters
path – (str) absolute path to result directory
resultfilename – (str) name of final structure file. for VASP, structfilename is ‘OUTCAR.gz’
- Returns
(ASE atoms object) final atoms object
- set_scheduler()[source]
assigns strucscan.scheduler.GeneralScheduler object to GeneralEngine
- Returns
0
- static subjobname(species, property)[source]
- Parameters
species – (str) e.g. ‘Al Ni’
property – (str) name of property
- Returns
(str) job name
- submit_job(machinefilename)[source]
calls strucscan.scheduler.GeneralScheduler.submit
- Parameters
machinefilename – (str) name of machine script file
- Returns
(str) id of job. On queuing systems, job_id equilas queue id,
on systems without queue, job_id euqils process id
- static write_structure(atoms, jobpath, structfilename=None)[source]
abstract method to write engine specific structure file
- Parameters
atoms – (ASE atoms object) atoms object with assigned chemical symbols, magnetic moments
and scaled positions :param jobpath: (str) absolute path to job directory :param structfilename: (str) name of structure file that is written to disk. for VASP, structfilename is ‘POSCAR’ :return: 0
strucscan.properties module
This module contains classes that generate, or pre-process, the structure files for each material property. By default, strucscan comes with a methods for running bulk and equation of stat (EOS) calculations.
- strucscan.properties.bulk.get_bulk_properties(calc, absolute_path)[source]
- Parameters
calc – (strucscan.engine.generalengine.GeneralEngine object) calculator object
absolute_path – (str) absolute path to job directory
- Returns
(dict) python dictionary with summarized results
strucscan.error module
This module contains classes to manage and handle occuring errors. Similar to the
stucscan.core.statusmanager., the stucscan.error.errormanager.
checks the type of error and hands it over to the stucscan.error.errorhandler.
related to the material code that generated the job files.
- strucscan.error.errormanager.determine_status__job_id(calc, jobpath, job_list)[source]
checks job ib jobpath on any errors
if the job has been restarted more than 3 times, the job status is set to (1, ‘error’) which leads the JobManager to count the job as finished, i.e. to stop monitoring it
if the job has been restarted less than 3 times, the engine specific errorhandler is called
Legend - 0 : does not exist - 0 : queued - 0 : error - 1 : error - 1 : finished
- Parameters
calc – (strucscan.engine.generalengine.GeneralEngine object) calculator object
jobpath – (str) absolute path to job directory
job_list – (list) list of all JobObjects
- Returns
(int, str, str) tuple of job status index (int), status (str) and job id (str).
On queuing systems, job_id equals queue id, on systems without queue, job_id equals process id
strucscan.scheduler module
This module contains classes that build the interface to queueing systems (and machines without any queue).
Each interface class inherit the abstract class strucscan.scheduler.GeneralScheduler.
- class strucscan.scheduler.GeneralScheduler(machinename)[source]
Bases:
object- __init__(machinename)[source]
Abstract class for general queuing system
- Parameters
machinename – (str) name of machine. This is equals to the directory name
containing the config.yaml and machinescripts for the specific machine.
- configure_machine_script(machine_info, jobname='noname')[source]
SunGridEngine specific method to configure machine script.
- Parameters
machine_info – (dict) machine information about queue, nnodes, ncores provided by user in input.yaml
jobname – (str) name of job
- Returns
(str list, str) tuple of (machine file lines, machine file name)
- get_job_id_by_jobpath(jobpath)[source]
Abstract method
- Parameters
jobpath – (str) absolute path to job directory
- Returns
(str) id of job: on queuing systems, job_id equals queue id,
on systems without queue, job_id equals process id
- static get_queue_ids()[source]
Abstract method that returns str list of all job ids in queue. On systems without queue, job_id equals process id
- Returns
(str list) str list of all job ids in queue. On systems without queue, job_id equals process id
- get_total_number_of_cores(machine_script)[source]
Abstract method that scans the machine_script and returns total number of cores used for calculation
- Parameters
machine_script – (str) machine script lines
- Returns
(int) total number of cores