Skip to content

Commit

Permalink
details on max_nbody
Browse files Browse the repository at this point in the history
  • Loading branch information
loriab committed Jun 24, 2024
1 parent ebce46c commit b8ebd9c
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 9 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ jobs:
- name: Build Documentation
run: |
python -m pip install . --no-deps
PYTHONPATH=docs/extensions mkdocs build
QCMANYBODY_MAX_NBODY=5 PYTHONPATH=docs/extensions mkdocs build
cd docs
- name: GitHub Pages Deploy
Expand Down
9 changes: 6 additions & 3 deletions docs/qcschema.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,10 +49,13 @@ $pydantic: qcmanybody.models.manybody_input_pydv1.ManyBodyProtocols
The properties model is generated dynamically based on a constant
``MAX_NBODY``. To not overload the docs table, this is set to 5, which
covers full calculations on tetramers. To use a larger
``ManyBodyKeywords.max_nbody``, reset this value.
``ManyBodyKeywords.max_nbody``, reset this value *outside* the interpreter.

import qcmanybody as qcmb
qcmb.models.MAX_NBODY = 8
python -c "import qcmanybody as qcmb;print(qcmb.models.MAX_NBODY)"
#> 5
export QCMANYBODY_MAX_NBODY=9 # allows octamers
python -c "import qcmanybody as qcmb;print(qcmb.models.MAX_NBODY)"
#> 9


::: qcmanybody.models.ManyBodyResultProperties
Expand Down
5 changes: 4 additions & 1 deletion qcmanybody/models/manybody_output_pydv1.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
from __future__ import annotations

import os
from typing import TYPE_CHECKING, Any, Dict, Literal, Optional, Union

# v2: from pydantic import create_model, Field, field_validator, FieldValidationInfo
Expand Down Expand Up @@ -29,7 +30,9 @@
* nmbe: number of jobs = :attr:`~qcelemental.models.ManyBodyResultProperties.calcinfo_nmbe`
"""

MAX_NBODY = 5 # 5 covers tetramers
MAX_NBODY = int(os.environ.get("QCMANYBODY_MAX_NBODY", 5)) # 5 covers tetramers

# TODO: bump up default MAX_NBODY and add some warnings or mitigations so insufficient value doesn't fail at very end at Result formation time

json_schema_extras = {
"energy": {"units": "E_h"},
Expand Down
8 changes: 4 additions & 4 deletions qcmanybody/tests/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ def generate_component_data(
supsersytem_ie_only=False,
embedding_charges=None,
):
mc, component_results = run_qcengine(
mbc, component_results = run_qcengine(
specifications, mol, bsse_type, levels, return_total_data, supsersytem_ie_only, embedding_charges
)

Expand Down Expand Up @@ -188,7 +188,7 @@ def run_qcengine(
):
import qcengine as qcng

mc = ManyBodyCore(
mbc = ManyBodyCore(
molecule,
bsse_type,
levels,
Expand All @@ -200,7 +200,7 @@ def run_qcengine(
component_results = {}

computation_count = {}
for chem, label, imol in mc.iterate_molecules():
for chem, label, imol in mbc.iterate_molecules():
print(label)
inp = AtomicInput(molecule=imol, **specifications[chem]["specification"])

Expand All @@ -226,4 +226,4 @@ def run_qcengine(
if v is not None:
component_results[label][p] = v

return mc, component_results
return mbc, component_results

0 comments on commit b8ebd9c

Please sign in to comment.