# chemtools.calculators.calculator module¶

An abstract class that should be subclassed when addding a new code interface.

All the methods should be implemented for the basisopt module to work with the new code.

class Calculator(exevar=None, executable=None, runopts=None, scratch=None)[source]

Bases: object

Abstract class that should be subclassed when adding a new code interace.

accomplished(fname)[source]

Return True if the job completed without errors

executable

Set the executable

parse(fname, objective, regexp=None)[source]

Parse the value of the objective from the file fname

run(*args)[source]

run a single job

run_multiple(*args)[source]

Run multiple jobs

scratch

Return scratch

write_input()[source]

write the input file in the format of the code used

class InputTemplate(template)[source]

Bases: string.Template

Modified string.Template class to be used for input rendering

delimiter = '%'
get_keys()[source]

Parse the string and return a dict with possible keys to substitute. For most use case only the named fields are interesting.

idpattern = '[a-z][_a-z0-9]*'
pattern = re.compile('\n \\%(?:\n (?P<escaped>\\%) | # Escape sequence of two delimiters\n (?P<named>[a-z][_a-z0-9]*) | # delimiter and a Python identifier\n {(?P<braced>[a-z][_a-z0-9]*)} | , re.IGNORECASE|re.VERBOSE)
parse_objective(fname, regexp, reflags=2)[source]

Wrapper for the parse methods

Args:
fname : str
Name of the file to be parsed
regexp : str
Regular expression as raw string
reflags :
Flags for the regular expression compilation