pwtools.batch.Calculation

class pwtools.batch.Calculation(machine=None, templates=[], params=[], calc_dir='calc_dir')[source]

Bases: object

Represent a single calculation.

The calculation data will be placed, e.g., in dir calc_foo/0/. A Calculation is bound to one Machine. This class is usually not used on it’s own, but only by ParameterStudy.

The dir where file templates live is defined in the FileTemplates (usually ‘calc.templ’).

__init__(machine=None, templates=[], params=[], calc_dir='calc_dir')[source]
Parameters:
  • machine (Machine, optional) – Used to add machine specific attributes. Pulled from Machine.get_sql_record(). Used for FileTemplate replacement.

  • templates (sequence) – Sequence of FileTemplate instances.

  • params (sequence of SQLEntry instances) – A single “parameter set”. The key attribute (=sql column name) of each SQLEntry will be converted to a placeholder in each FileTemplate and an attempt to replacement in the template files is made.

  • calc_dir (str, optional) – Calculation directory to which input files are written (e.g. ‘calc_foo/0/’)

Methods

get_sql_record()

Return a dict of SQLEntry instances.

write_input()

For each template in self.templates, write an input file to self.calc_dir.