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.


Return True if the job completed without errors


Set the executable

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

Parse the value of the objective from the file fname


run a single job


Run multiple jobs


Return scratch


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 = '%'

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

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