interaction_eda_step.backends package#

Submodules#

interaction_eda_step.backends.base module#

The interface between the Interaction EDA step and the codes that do the EDA.

A backend runs a batch of EDA calculations, one per set of fragments, in its own environment through seamm_exec. The step knows only this interface:

Backends planned: gpu4pyscf (ALMO-EDA2 on a GPU), psi4_almo (ALMO-EDA2 on CPUs) and psi4_sapt (SAPT0/F-SAPT, dimers only).

class interaction_eda_step.backends.base.Backend[source]#

Bases: object

Base class for the EDA backends.

citations(settings)[source]#

[(alias, bibtex, level, note)] to cite.

command()[source]#

The command line, with {code} from the ini file.

configure(config)[source]#

The ini section as the executor should use it (default: unchanged).

device = 'cpu'#

“gpu” or “cpu”.

files(calculations, settings)[source]#

The input files for a batch of calculations: {name: text}.

fingerprint(data)[source]#

The fingerprint of a task: what determines its results.

data is the task’s input (input.json). See fingerprint().

ini = None#

The ini file (in the installation’s root) that says how to run the code.

max_fragments = None#

The most fragments in one calculation; None for no limit.

method_string(settings)[source]#

A one-line description of the method, for labels and tables.

name = None#

Short name, used in the parameters and the ini file name.

options()[source]#

The settings this backend accepts: {name: default}.

problems(settings)[source]#

Why these settings cannot run with this backend; [] if they can.

program = None#

The seamm_exec program of a task (its resolver finds the code’s Python).

read_results(directory, calculations)[source]#

{key: Result} for the calculations, from the results file.

A calculation with no result is reported with an error.

results_file = 'results.jsonl'#

Results file the code writes.

results_version = 1#

The version of the results the driver computes from its input. Raise it when a change to the driver could change the energies. Leave it for changes that cannot (memory, threads, logging, speed): finished calculations are then kept when a job is rerun.

scheme = None#

The EDA scheme (a key of interaction_eda_step.terms.SCHEMES).

task_resources(calc, settings, cores='automatic', memory='automatic')[source]#

(seamm_exec.Resources, estimated seconds) for one calculation.

class interaction_eda_step.backends.base.Calculation(key: tuple, fragments: list)[source]#

Bases: object

One EDA calculation: a set of fragments.

Variables:
fragments: list#
property id#
key: tuple#
interaction_eda_step.backends.base.RUN_ONLY_SETTINGS = ('memory_gb', 'threads')#

Settings that change how a calculation runs but not its results.

class interaction_eda_step.backends.base.Result(key: tuple, energies: dict = None, error: str = None, data: dict = <factory>)[source]#

Bases: object

The outcome of one calculation.

Variables:
  • key (tuple(int, ...))

  • energies ({str: float} or None) – Native terms, kJ/mol; None if it failed.

  • error (str or None)

  • data (dict) – Everything else the backend reports (timing, memory, versions, …).

data: dict#
energies: dict = None#
error: str = None#
key: tuple#
interaction_eda_step.backends.base.fingerprint(data, backend, results_version)[source]#

The fingerprint of an EDA task, from what determines its results.

seamm_exec otherwise fingerprints a task by its command and input files, which include the driver script, so any edit to the driver – even one that only changes how much memory it uses – makes every finished calculation run again. This uses instead the backend, its results_version, and the task’s input (settings and fragments) without the settings that only change how it runs (RUN_ONLY_SETTINGS).

Parameters:
  • data (dict or str) – The task’s input, as written to input.json (or its text).

  • backend (str) – The backend’s name, e.g. “Psi4”.

  • results_version (int) – The backend’s results version.

Returns:

“eda-sha256:” and the hex digest.

Return type:

str

interaction_eda_step.backends.base.read_jsonl(path)[source]#

The records of a JSON-lines file; later records replace earlier ones with the same id (a rerun after a failure).

interaction_eda_step.backends.gpu4pyscf module#

ALMO-EDA2 with GPU4PySCF on a GPU.

class interaction_eda_step.backends.gpu4pyscf.GPU4PySCF[source]#

Bases: Backend

Second-generation ALMO-EDA in GPU4PySCF (1.9 or later).

citations(settings)[source]#

[(alias, bibtex, level, note)] to cite.

command()[source]#

The command line, with {code} from the ini file.

defaults = {'allow_low_fp64': False, 'auxbasis': None, 'basis': 'def2-tzvpd', 'disp': None, 'ferf': 'coupled', 'nlc': None, 'nlc_grid': [99, 590], 'response_nlc': True, 'svd_threshold': 0.0001, 'verbose': 3, 'xc': 'wb97m-v', 'xc_grid': [150, 974]}#

The settings and their defaults.

device = 'gpu'#

“gpu” or “cpu”.

driver = 'gpu4pyscf_eda.py'#

The driver script, in the package’s data, run with the code’s Python.

files(calculations, settings)[source]#

The input files for a batch of calculations: {name: text}.

ini = 'gpu4pyscf.ini'#

The ini file (in the installation’s root) that says how to run the code.

max_fragments = None#

The most fragments in one calculation; None for no limit.

method_string(settings)[source]#

A one-line description of the method, for labels and tables.

name = 'GPU4PySCF'#

Short name, used in the parameters and the ini file name.

options()[source]#

The settings this backend accepts: {name: default}.

program = 'gpu4pyscf_eda'#

The seamm_exec program of a task (its resolver finds the code’s Python).

read_results(directory, calculations)[source]#

{key: Result} for the calculations, from the results file.

A calculation with no result is reported with an error.

scheme = 'ALMO-EDA2'#

The EDA scheme (a key of interaction_eda_step.terms.SCHEMES).

settings(settings)[source]#

The full settings: the defaults updated with those given.

task_resources(calc, settings, cores='automatic', memory='automatic')[source]#

One GPU, a few cores for the host side, and the estimated time.

interaction_eda_step.backends.gpu4pyscf.GRIDS = {'fine': {'nlc_grid': [99, 590], 'xc_grid': [150, 974]}, 'standard': {'nlc_grid': [50, 194], 'xc_grid': [99, 590]}}#

The grids for each choice of the step’s “integration grid”.

Module contents#

The codes that do the energy decomposition (see base).

interaction_eda_step.backends.BACKENDS = {'GPU4PySCF': <class 'interaction_eda_step.backends.gpu4pyscf.GPU4PySCF'>, 'Psi4': <class 'interaction_eda_step.backends.psi4.Psi4'>}#

The backends by name.