Skip to content

Commit

Permalink
Some small cleanup (typing mostly)
Browse files Browse the repository at this point in the history
  • Loading branch information
bennybp committed Apr 20, 2024
1 parent 5990324 commit c34f937
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 8 deletions.
11 changes: 7 additions & 4 deletions qcmanybody/builder.py
Original file line number Diff line number Diff line change
@@ -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

Expand Down Expand Up @@ -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
-------
Expand Down Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion qcmanybody/manybody.py
Original file line number Diff line number Diff line change
Expand Up @@ -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())

Expand Down
7 changes: 4 additions & 3 deletions qcmanybody/tests/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down Expand Up @@ -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 = {}

Expand Down

0 comments on commit c34f937

Please sign in to comment.