diff --git a/qcmanybody/builder.py b/qcmanybody/builder.py index dd6576c..42e3441 100644 --- a/qcmanybody/builder.py +++ b/qcmanybody/builder.py @@ -1,7 +1,7 @@ from __future__ import annotations import itertools -from typing import Iterable, Union, Literal, Optional, Dict, Set +from typing import Iterable, Union, Literal, Optional, Dict, Set, List from qcmanybody.models import BsseEnum, FragBasIndex @@ -29,7 +29,10 @@ def build_nbody_compute_list( Whether the total data (True; energy/gradient/Hessian) of the molecular system has been requested, as opposed to interaction data (False). supersystem_ie_only - ???? + Target the supersystem total/interaction energy (IE) data over the many-body expansion (MBE) " + analysis, thereby omitting intermediate-body calculations. + supersystem_max_nbody + Maximum n-body to use for a supersystem calculation. Must be specified if "supersystem" is in `nbodies` Returns ------- @@ -62,8 +65,8 @@ def build_nbody_compute_list( raise ValueError("supersystem_max_nbody must be provided if 'supersystem' contains nbodies") include_supersystem = True - nbodies = list(nbodies) - nbodies.remove("supersystem") + + nbodies: List[int] = [x for x in nbodies if x != "supersystem"] # What levels do we need? fragment_range = range(1, nfragments + 1) diff --git a/qcmanybody/manybody.py b/qcmanybody/manybody.py index b22298c..71004e0 100644 --- a/qcmanybody/manybody.py +++ b/qcmanybody/manybody.py @@ -452,7 +452,7 @@ def analyze( # All properties that were passed to us # * seed with "energy" so free/no-op jobs can process - available_properties = set(["energy"]) + available_properties: Set[str] = {"energy"} for property_data in component_results.values(): available_properties.update(property_data.keys()) diff --git a/qcmanybody/tests/utils.py b/qcmanybody/tests/utils.py index fba203d..655affe 100644 --- a/qcmanybody/tests/utils.py +++ b/qcmanybody/tests/utils.py @@ -65,8 +65,8 @@ def load_component_data(file_base): return unjsonify(json.load(f)) -def generate_component_data(mol, levels, specifications, bsse_type, return_total_data, out_filename): - mc, component_results = run_qcengine(mol, levels, specifications, bsse_type, return_total_data) +def generate_component_data(mol, levels, specifications, bsse_type, return_total_data, out_filename, supsersytem_ie_only=False): + mc, component_results = run_qcengine(mol, levels, specifications, bsse_type, return_total_data, supsersytem_ie_only) component_results = jsonify(component_results) filepath = os.path.join(_my_dir, "component_data", out_filename + ".json.zst") @@ -164,9 +164,10 @@ def run_qcengine( specifications: Mapping[str, Mapping[str, Any]], bsse_type: Iterable[BsseEnum], return_total_data: bool, + supersystem_ie_only: bool ): - mc = ManyBodyCalculator(molecule, bsse_type, levels, return_total_data) + mc = ManyBodyCalculator(molecule, bsse_type, levels, return_total_data, supersystem_ie_only) component_results = {}