Skip to content

Commit

Permalink
Merge pull request #288 from choderalab/atomIndices
Browse files Browse the repository at this point in the history
fixing forcefield_generators to be compatible with openmm 7.4
  • Loading branch information
hannahbrucemacdonald authored Aug 21, 2019
2 parents c15f617 + 44b3023 commit 1473c93
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 4 deletions.
14 changes: 11 additions & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,24 @@ sudo: false

# Will only test on Linux be default, special includes are needed for OSX
python:
- 3.5
- 3.6
- 3.7

matrix:
include:
# Extra includes for OSX since python language is not available by default on OSX
- os: osx
language: generic
env: PYTHON_VER=3.5
env: PYTHON_VER=3.6 OPENMM_CHANNEL=omnia OPENMM_VERSION=7.3
- os: osx
language: generic
env: PYTHON_VER=3.6
env: PYTHON_VER=3.7 OPENMM_CHANNEL=omnia OPENMM_VERSION=7.3
- os: osx
language: generic
env: PYTHON_VER=3.6 OPENMM_CHANNEL="omnia/label/beta" OPENMM_VERSION=7.4
- os: osx
language: generic
env: PYTHON_VER=3.7 OPENMM_CHANNEL="omnia/label/beta" OPENMM_VERSION=7.4

env:
global:
Expand Down Expand Up @@ -50,6 +56,7 @@ install:
- conda install --yes -c openeye openeye-toolkits && python -c "import openeye; print(openeye.__version__)"
# Install other testing dependencies
- conda install --yes --quiet nose nose-timer
- conda install --yes --quiet -c $OPENMM_CHANNEL openmm==$OPENMM_VERSION
- conda install --yes --quiet openmmtools
- conda install --yes --quiet packmol
- conda install --yes --quiet rdkit
Expand All @@ -58,6 +65,7 @@ install:
- conda install --yes --use-local openmoltools-dev

script:
- nosetests --nocapture openmoltools/tests/test_forcefield_generators.py
- pytest -v --cov=openmoltools --cov-config setup.cfg openmoltools/tests/

notifications:
Expand Down
2 changes: 2 additions & 0 deletions devtools/conda-recipe/meta.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ requirements:
- pandas
- six
- mdtraj
- lxml
- pymbar
- numpy
- numpydoc
- scipy
Expand Down
8 changes: 7 additions & 1 deletion openmoltools/forcefield_generators.py
Original file line number Diff line number Diff line change
Expand Up @@ -328,7 +328,13 @@ def generateResidueTemplate(molecule, residue_atoms=None, normalize=True, gaff_v
charge = atom.GetPartialCharge()
parameters = { 'charge' : charge }
atom_template = ForceField._TemplateAtomData(atomname, typename, element, parameters)
template.atoms.append(atom_template)
if hasattr(template, 'atomIndices'):
# OpenMM 7.4 and later
template.addAtom(atom_template)
else:
# OpenMM 7.3 and earlier
template.atoms.append(atom_template)

for bond in molecule.GetBonds():
if (bond.GetBgn() in residue_atoms) and (bond.GetEnd() in residue_atoms):
template.addBondByName(bond.GetBgn().GetName(), bond.GetEnd().GetName())
Expand Down

0 comments on commit 1473c93

Please sign in to comment.