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:
what the backend can do (
Backend.scheme,Backend.device,Backend.max_fragments,Backend.options()), so the GUI can offer only valid choices;Backend.files()– the input files for a batch;Backend.iniandBackend.command()– howseamm_execruns it;Backend.read_results()– the native terms of each calculation, kJ/mol.
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:
objectBase class for the EDA backends.
- device = 'cpu'#
“gpu” or “cpu”.
- fingerprint(data)[source]#
The fingerprint of a task: what determines its results.
datais the task’s input (input.json). Seefingerprint().
- 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.
- name = None#
Short name, used in the parameters and the ini file name.
- 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).
- class interaction_eda_step.backends.base.Calculation(key: tuple, fragments: list)[source]#
Bases:
objectOne EDA calculation: a set of fragments.
- Variables:
key (tuple(int, ...)) – Ascending fragment indices.
fragments ([interaction_eda_step.fragments.Fragment])
- 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:
objectThe 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.gpu4pyscf module#
ALMO-EDA2 with GPU4PySCF on a GPU.
- class interaction_eda_step.backends.gpu4pyscf.GPU4PySCF[source]#
Bases:
BackendSecond-generation ALMO-EDA in GPU4PySCF (1.9 or later).
- 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.
- 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.
- name = 'GPU4PySCF'#
Short name, used in the parameters and the ini file name.
- 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).
- 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.