Job Object

The Job class is the base object defining similar machine learning predictions for a single or many atomic configurations.

class mlcalcdriver.base.job.Job(name='', posinp=None, calculator=None)[source]

Bases: object

This class defines a machine learning prediction. It must contain a mlcalcdriver.Posinp instance to define the atomic configuration.

Parameters
  • name (str) – Name of the job. Will be used to name the created files.

  • posinp (Posinp or list of Posinp) – Atomic positions for the job. Many different configurations may be predicted at the same time, in that case they should be passed in a list.

  • calculator (Calculator) – Calculator instance to use to evaluate properties in the run() method.

property posinp
Returns

Initial positions of the prediction

Return type

Posinp

property name
Returns

Base name of the prediction used to set the names of files and directories.

Return type

str

property num_struct
Returns

Number of different structures when Job is declared

Return type

int

property results
Returns

The dictionnary containing the results of the calculation

Return type

JobResults

property calculator
Returns

The Calculator object to use for the Job

Return type

Calculator

run(property, batch_size=128, finite_difference=False)[source]

Main method to call to obtain results for a Job

Parameters
  • property (str) – Property to calculate. Must be in the available_properties of the Calculator except the forces which can be derived from an energy Calculator.

  • batch_size (int) – Size of the mini-batches used in predictions. Default is 128.

class mlcalcdriver.base.job.JobResults(properties)[source]

Bases: dict

Dictionnary containing results from a Job after the run() method is completed. A JobResults instance is created for each Job, and the results of the latter should be accessed through the former, by using the Job.results property.

Predicted values can be accessed as in a standard dictionnary

>>> energy = Job.results["energy"]
>>> type(energy)
<class 'list'>

The returned values will be None if the Job was not complete. Otherwise, the list contains one value for each structure in the Job.

Parameters

properties (str or list of str) – Property or properties that are returned by the chosen model.