Skip to content

Commit

Permalink
Merge pull request #243 from leeping/v1.9.2-final
Browse files Browse the repository at this point in the history
Final changes for v1.9.2 release
  • Loading branch information
leeping authored Sep 24, 2021
2 parents 514000f + 2c69c23 commit 78a48d0
Show file tree
Hide file tree
Showing 14 changed files with 61 additions and 32 deletions.
2 changes: 1 addition & 1 deletion bin/ForceBalance.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ def process(word, color):
return Answer

def main():
printcool("Welcome to ForceBalance version 1.9.1! =D\nForce Field Optimization System\n\nAuthors:\nLee-Ping Wang\nYudong Qiu, Keri A. McKiernan\nJeffrey R. Wagner, Hyesu Jang, Simon Boothroyd\nArthur Vigil, Erik G. Brandt, John Stoppelman\nJohnny Israeli, Matt Thompson", ansi="1", bold=True, minwidth=64)
printcool("Welcome to ForceBalance version 1.9.2! =D\nForce Field Optimization System\n\nAuthors:\nLee-Ping Wang\nYudong Qiu, Keri A. McKiernan\nJeffrey R. Wagner, Hyesu Jang, Simon Boothroyd\nArthur Vigil, Erik G. Brandt, John Stoppelman\nJohnny Israeli, Matt Thompson", ansi="1", bold=True, minwidth=64)
logostr = """
,'+++
,++++++. .:,,.
Expand Down
2 changes: 1 addition & 1 deletion devtools/conda-recipe/meta.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package:
name: forcebalance-dev
version: !!str 1.9.1
version: !!str 1.9.2

source:
path: ../..
Expand Down
2 changes: 1 addition & 1 deletion doc/api_header.tex
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@
\vspace*{1cm}
\begin{center}

{\Large ForceBalance Developer API Guide version 1.9.1}\\
{\Large ForceBalance Developer API Guide version 1.9.2}\\
\vspace*{2cm}
{\large Generated by Doxygen 1.8.11}\\
\vspace*{2.5 cm}
Expand Down
2 changes: 1 addition & 1 deletion doc/doxygen.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ PROJECT_NAME = ForceBalance
# This could be handy for archiving the generated documentation or
# if some version control system is used.

PROJECT_NUMBER = 1.9.1
PROJECT_NUMBER = 1.9.2

# Using the PROJECT_BRIEF tag one can provide an optional one line description
# for a project that appears at the top of each page and should give viewer
Expand Down
2 changes: 1 addition & 1 deletion doc/header.tex
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@
\vspace*{1cm}
\begin{center}

{\Large ForceBalance version 1.9.1}\\
{\Large ForceBalance version 1.9.2}\\
\vspace*{2cm}
{\large Generated by Doxygen 1.8.11}\\
\vspace*{2.5 cm}
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
#| doc/api_header.tex |#
#| bin/ForceBalance.py |#
#===================================#
__version__ = "v1.9.1"
__version__ = "v1.9.2"
try:
# use git to find current version
git_describe = subprocess.check_output(["git", "describe"]).strip()
Expand Down
4 changes: 2 additions & 2 deletions src/forcefield.py
Original file line number Diff line number Diff line change
Expand Up @@ -518,7 +518,7 @@ def check_dupes(self, pid, ffname, ln, pfld):
extranum += 1
def warn_or_err(*args):
if self.duplicate_pnames:
logger.warn(*args)
logger.warning(*args)
else:
logger.error(*args)
warn_or_err("Encountered an duplicate parameter ID (%s)\n" % pid_)
Expand All @@ -527,7 +527,7 @@ def warn_or_err(*args):
for dupfnm, dupln, dupfld in zip(dupfnms, duplns, dupflds):
warn_or_err("file %s line %i field %i\n" % (dupfnm, dupln+1, dupfld))
if self.duplicate_pnames:
logger.warn("Parameter name has been changed to %s\n" % pid)
logger.warning("Parameter name has been changed to %s\n" % pid)
else:
raise RuntimeError
return pid
Expand Down
2 changes: 1 addition & 1 deletion src/lipid.py
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ def prepare_temp_directory(self):

def read_data(self):
# Read the 'data.csv' file. The file should contain guidelines.
with open(os.path.join(self.tgtdir,'data.csv'),'rU') as f: R0 = list(csv.reader(f))
with open(os.path.join(self.tgtdir,'data.csv'),'r') as f: R0 = list(csv.reader(f))
# All comments are erased.
R1 = [[sub('#.*$','',word) for word in line] for line in R0 if len(line[0]) > 0 and line[0][0] != "#"]
# All empty lines are deleted and words are converted to lowercase.
Expand Down
10 changes: 5 additions & 5 deletions src/smirnoff_hack.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,11 @@ def hash_molecule_args_and_kwargs(molecule, *args, **kwargs):


if _SHOULD_CACHE:

print(
"SMIRNOFF functions will be replaced with cached versions to improve their "
"performance."
)
# Commented out because it is printed even for non-SMIRNOFF calculations.
# print(
# "SMIRNOFF functions will be replaced with cached versions to improve their "
# "performance."
# )

# time based on total 540s evaluation
# cache for OE find_smarts_matches (save 300+ s)
Expand Down
18 changes: 18 additions & 0 deletions src/tests/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,3 +27,21 @@ def setup_method(self, method):

def teardown_method(self):
os.chdir(self.start_directory)

def check_for_openmm():
try:
try:
# Try importing openmm using >=7.6 namespace
from openmm import app
import openmm as mm
from openmm import unit
except ImportError:
# Try importing openmm using <7.6 namespace
import simtk.openmm as mm
from simtk.openmm import app
from simtk import unit
return True
except ImportError:
# If OpenMM classes cannot be imported, then set this flag
# so the testing classes/functions can use to skip.
return False
9 changes: 5 additions & 4 deletions src/tests/test_engine.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
from forcebalance.tinkerio import TINKER
from forcebalance.openmmio import OpenMM
from collections import OrderedDict
from .__init__ import ForceBalanceTestCase
from .__init__ import ForceBalanceTestCase, check_for_openmm

# Set SAVEDATA to True and run the tests in order to save data
# to a file for future reference. This is easier to use for troubleshooting
Expand Down Expand Up @@ -86,12 +86,12 @@ def setup_class(cls):
if gmxpath != '':
cls.engines['GMX'] = GMX(coords="all.gro", gmx_top="topol.top", gmx_mdp="shot.mdp", gmxpath=gmxpath, gmxsuffix=gmxsuffix)
else:
logger.warn("GROMACS cannot be found, skipping GMX tests.")
logger.warning("GROMACS cannot be found, skipping GMX tests.")
# Set up TINKER engine
if tinkerpath != '':
cls.engines['TINKER'] = TINKER(coords="all.arc", tinker_key="alaglu.key", tinkerpath=tinkerpath)
else:
logger.warn("TINKER cannot be found, skipping TINKER tests.")
logger.warning("TINKER cannot be found, skipping TINKER tests.")
# Set up OpenMM engine
try:
try:
Expand All @@ -100,7 +100,7 @@ def setup_class(cls):
import simtk.openmm
cls.engines['OpenMM'] = OpenMM(coords="all.gro", pdb="conf.pdb", ffxml="a99sb.xml", platname="Reference", precision="double")
except:
logger.warn("OpenMM cannot be imported, skipping OpenMM tests.")
logger.warning("OpenMM cannot be imported, skipping OpenMM tests.")

@classmethod
def teardown_class(cls):
Expand Down Expand Up @@ -351,6 +351,7 @@ class TestAmoebaWater6(ForceBalanceTestCase):
"""
@classmethod
def setup_class(cls):
if not check_for_openmm(): pytest.skip("No OpenMM modules found.")
super(TestAmoebaWater6, cls).setup_class()
#self.logger.debug("\nBuilding options for target...\n")
cls.cwd = os.path.dirname(os.path.realpath(__file__))
Expand Down
3 changes: 2 additions & 1 deletion src/tests/test_liquid.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,11 @@
from forcebalance.forcefield import FF
from forcebalance.objective import Objective
from forcebalance.optimizer import Optimizer
from .__init__ import ForceBalanceTestCase
from .__init__ import ForceBalanceTestCase, check_for_openmm

class TestWaterTutorial(ForceBalanceTestCase):
def setup_method(self, method):
if not check_for_openmm(): pytest.skip("No OpenMM modules found.")
super(TestWaterTutorial, self).setup_method(method)
self.cwd = os.path.dirname(os.path.realpath(__file__))
# copy folder 'files/test_liquid' into a new folder 'files/test_liquid.run'
Expand Down
28 changes: 18 additions & 10 deletions src/tests/test_openmmio.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,21 @@
import numpy as np

try:
# Try importing openmm using >=7.6 namespace
from openmm import app
import openmm as mm
from openmm import unit
try:
# Try importing openmm using >=7.6 namespace
from openmm import app
import openmm as mm
from openmm import unit
except ImportError:
# Try importing openmm using <7.6 namespace
import simtk.openmm as mm
from simtk.openmm import app
from simtk import unit
no_openmm = False
except ImportError:
# Try importing openmm using <7.6 namespace
import simtk.openmm as mm
from simtk.openmm import app
from simtk import unit

# If OpenMM classes cannot be imported, then set this flag
# so the testing classes/functions can use to skip.
no_openmm = True

import os
import shutil
Expand All @@ -26,6 +31,7 @@

class TestLiquid_OpenMM(TargetTests):
def setup_method(self, method):
if no_openmm: pytest.skip("No OpenMM modules found.")
super(TestLiquid_OpenMM, self).setup_method(method)
self.check_grad_fd = False
# settings specific to this target
Expand Down Expand Up @@ -53,6 +59,7 @@ def teardown_method(self):
class TestInteraction_OpenMM(TargetTests):

def setup_method(self, method):
if no_openmm: pytest.skip("No OpenMM modules found.")
super(TestInteraction_OpenMM, self).setup_method(method)
# TargetTests.setup_class(cls)
# settings specific to this target
Expand All @@ -77,9 +84,10 @@ def teardown_method(self):
shutil.rmtree('temp')
super(TestInteraction_OpenMM, self).teardown_method()


def test_local_coord_sites():
"""Make sure that the internal prep of vs positions matches that given by OpenMM."""
if no_openmm: pytest.skip("No OpenMM modules found.")
# make a system
mol = app.PDBFile(os.path.join("files", "vs_mol.pdb"))
modeller = app.Modeller(topology=mol.topology, positions=mol.positions)
Expand Down
7 changes: 4 additions & 3 deletions src/tests/test_system.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
from builtins import str
import os, shutil
import tarfile
from .__init__ import ForceBalanceTestCase
from .__init__ import ForceBalanceTestCase, check_for_openmm
from forcebalance.parser import parse_inputs
from forcebalance.forcefield import FF
from forcebalance.objective import Objective
Expand Down Expand Up @@ -181,7 +181,7 @@ def test_thermo_bromine_study(self):

class TestEvaluatorBromineStudy(ForceBalanceSystemTest):
def setup_method(self, method):
pytest.importorskip("evaluator")
pytest.importorskip("openff.evaluator")
super(TestEvaluatorBromineStudy, self).setup_method(method)
cwd = os.path.dirname(os.path.realpath(__file__))
os.chdir(os.path.join(cwd, '..', '..', 'studies', '003d_evaluator_liquid_bromine'))
Expand Down Expand Up @@ -213,7 +213,7 @@ def test_bromine_study(self):
msgX="\nCalculated objective function is outside expected range.\n If this seems reasonable, update EXPECTED_EVALUATOR_BROMINE_OBJECTIVE in test_system.py with these values"
np.testing.assert_allclose(EXPECTED_EVALUATOR_BROMINE_OBJECTIVE, X, atol=120, err_msg=msgX)
msgG="\nCalculated gradient is outside expected range.\n If this seems reasonable, update EXPECTED_EVALUATOR_BROMINE_GRADIENT in test_system.py with these values"
np.testing.assert_allclose(EXPECTED_EVALUATOR_BROMINE_GRADIENT, G, atol=2000, err_msg=msgG)
np.testing.assert_allclose(EXPECTED_EVALUATOR_BROMINE_GRADIENT, G, atol=4000, err_msg=msgG)

class TestLipidStudy(ForceBalanceSystemTest):
def setup_method(self, method):
Expand All @@ -232,6 +232,7 @@ def test_lipid_study(self):

class TestImplicitSolventHFEStudy(ForceBalanceSystemTest):
def setup_method(self, method):
if not check_for_openmm(): pytest.skip("No OpenMM modules found.")
super(TestImplicitSolventHFEStudy, self).setup_method(method)
cwd = os.path.dirname(os.path.realpath(__file__))
os.chdir(os.path.join(cwd, '..', '..', 'studies', '012_implicit_solvent_hfe'))
Expand Down

0 comments on commit 78a48d0

Please sign in to comment.