Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Include tests based on OpenFF Evaluator and Recharge #252

Merged
merged 5 commits into from
Dec 6, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions devtools/conda-envs/test_env.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ name: forcebalance-test
channels:
- conda-forge
- bioconda
- openeye
dependencies:
# Base depends
- python
Expand All @@ -24,3 +25,6 @@ dependencies:
- geometric
- gromacs =2019.1
- openff-toolkit >=0.11.3
- openff-evaluator-base
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

- openff-recharge
- openeye-toolkits
12 changes: 6 additions & 6 deletions src/recharge_io.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@
from forcebalance.target import Target

try:
from openff.recharge.charges.charges import ChargeSettings
from openff.recharge.charges import ChargeSettings
from openff.recharge.esp.storage import MoleculeESPStore
from openff.recharge.optimize import ElectricFieldOptimization, ESPOptimization
from openff.recharge.smirnoff import from_smirnoff
from openff.recharge.optimize import ElectricFieldObjective, ESPObjective # ElectricFieldOptimization, ESPOptimization
from openff.recharge.charges.bcc import BCCCollection
recharge_import_success = True
except ImportError:
recharge_import_success = False
Expand Down Expand Up @@ -96,7 +96,7 @@ def _initialize(self):
# TODO: it is assumed that the MDL aromaticity model should be used
# rather than the once specified in the FF as the model is not
# currently exposed. See OpenFF toolkit issue #663.
bcc_collection = from_smirnoff(bcc_handler)
bcc_collection = BCCCollection.from_smirnoff(bcc_handler)
bcc_smirks = [bcc.smirks for bcc in bcc_collection.parameters]

# Determine the indices of the BCC parameters being refit.
Expand Down Expand Up @@ -136,8 +136,8 @@ def _initialize(self):
# Pre-calculate the expensive operations which are needed to evaluate the
# objective function, but do not depend on the current parameters.
optimization_class = {
"esp": ESPOptimization,
"electric-field": ElectricFieldOptimization,
"esp": ESPObjective,
"electric-field": ElectricFieldObjective,
}[self.recharge_property]

objective_terms = [
Expand Down