Git Product home page Git Product logo

openmoltools's Introduction

GH Actions Status

openmoltools: Tools for Small Molecules, Antechamber, OpenMM, and More.

This set of tools allows users to automate various tasks related to simulating small molecules using various molecules dynamics techniques. It also contains several python tools for working with small molecules, packing boxes (python wrappers for packmol), and parameterizing small molecules. It also contains tools for creating OpenMM XML forcefield files for small molecules, although we currently focus on the use of AMBER prmtop and inpcrd files due to their widespread use.

Our goal with this project is to have modular components that are both documented and well-tested.

This tool is in BETA testing: use at your own risk!

MolTools is a meant to be used with a number of companion tools: ParmEd, MDTraj, OpenMM, PackMol, OpenEye.

Installation:

python setup.py install

or

conda install -c conda-forge openmoltools

To test your installation, use the following command:

nosetests openmoltools -v --exe

Python 2.7 builds are deprecated

Version 0.8.3 will be the last version of this package to build with Python 2.7. With the OpenEye toolkits no longer being depolyed on Python 2.7 as of 2018.2.1, we have decided to deprecate support for that Python version as well. Version 0.8.3 was tested against the 2017.10.1 version of the OpenEye Toolkits for compatibility.

openmoltools's People

Contributors

andrrizzi avatar bas-rustenburg avatar chayast avatar davidlmobley avatar gduarter avatar hannahbrucemacdonald avatar jaimergp avatar jchodera avatar kyleabeauchamp avatar leeping avatar lnaden avatar mikemhenry avatar pgrinaway avatar richardjgowers avatar rmcgibbo avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

openmoltools's Issues

Move to ChoderaLab

We should move this to ChoderaLab, as it's presently a bit hard to find.

Discuss what formats gaff2xml should accept

We should discuss what formats gaff2xml should accept to build an output ffxml file.

We often deal with the following formats:

  • A Tripos mol2 file containing one or more ligands
  • An sdf file containing one or more ligands
  • A pdb file containing one or more ligands as HETATM records
    • These files may not have corresponding CONECT records

We may also want to support additional formats for omnia tool interoperability, such as:

  • OpenMM Topology objects
  • mdtrajTopology objects

Any others I'm forgetting?

Set up Travis

This is a somewhat major undertaking that we should do eventually, but not right now. The issues are:

  1. Building OpenMM on Travis
  2. Building AmberTools on Travis

We ideally would want to come up with a single "recipe" for doing this that is shared among several projects (OpenMM, Yank, Repex, MDTraj, gaff2xml, and others).

Create RPM package from AmberTools (or at least Antechamber) to facilitate automated testing

It would be useful to build RPM package(s) for AmberTools (or at least Antechamber) to facilitate automated CI testing via travis.ci, etc.

AmberTools is licensed under GPLv3.

Here are some useful pages that may help in this process:

Fedora Project: How to create an RPM package
http://fedoraproject.org/wiki/How_to_create_an_RPM_package

How to build RPM packages on Fedora
http://www.g-loaded.eu/2006/04/05/how-to-build-rpm-packages-on-fedora/

Fedora packager's handbook
http://koti.welho.com/vskytta/packagers-handbook/packagers-handbook.html

RPM HOWTO
http://en.tldp.org/HOWTO/RPM-HOWTO/index.html

Building cross-distro RPMs:
http://en.opensuse.org/Build_Service/cross_distribution_package_how_to

Building an RPM package: A guide for the unwilling
http://stereochro.me/ideas/rpm-for-the-unwilling

Mock and Koji are used by Fedora to package RPMs
http://fedoraproject.org/wiki/Projects/Mock
https://fedoraproject.org/wiki/Koji

Tools like Effing Package Management (fpm) may help make this easier:
https://github.com/jordansissel/fpm

Packaging from git repos:
https://github.com/dgoodwin/tito

Fix remaining issues with full drugs test

So it appears that there are still some issues with the all drugs test. I have confirmed that they issues appear to be:

  1. Primarily energy differences
  2. Accompanied by differences in forces (e.g. not just a trivial energy offset)
  3. Are probably caused by some of the "nastier" force components (e.g. non-obvious origin)
  4. Are independent of whether we use the OChem or the MDTraj loading path.

Switch to logging

Using the logger for output control would be a major win here, particularly for system_checker--we could control several levels of detail, allowing careful dissection if issues when necessary.

Avoid hand-named files in favor of tmp files

We've had some issues with spaces in names.

  1. Use tempfiles everywhere to avoid cluttering workspace
  2. Ideally, we would like some way to still optionally report the paper trail of all intermediate files, as there are lots of moving parts at play

Atom type name issues for GB

In parameterizing a molecule for simulation with GB, I am running into this problem:

Traceback (most recent call last):
  File "tests/test_alchemy.py", line 578, in <module>
    test_systembuilder_lysozyme_pdb_mol2()
  File "tests/test_alchemy.py", line 533, in test_systembuilder_lysozyme_pdb_mol2
    print "%s has %d particles" % (name, thing.system.getNumParticles())
  File "/Users/choderaj/code/yank/install/lib/python2.7/site-packages/yank-0.9.0-py2.7.egg/yank/systembuilder.py", line 176, in system
    self._create_system()
  File "/Users/choderaj/code/yank/install/lib/python2.7/site-packages/yank-0.9.0-py2.7.egg/yank/systembuilder.py", line 164, in _create_system
    self._system = forcefield.createSystem(self._topology, **self.system_creation_parameters)
  File "/Users/choderaj/code/yank/install/lib/python2.7/site-packages/simtk/openmm/app/forcefield.py", line 507, in createSystem
    force.createForce(sys, data, nonbondedMethod, nonbondedCutoff, args)
  File "/Users/choderaj/code/yank/install/lib/python2.7/site-packages/simtk/openmm/app/forcefield.py", line 1245, in createForce
    raise ValueError('No GBSAOBC parameters defined for atom type '+t)
ValueError: No GBSAOBC parameters defined for atom type MOL-C1

Specification of total charge

How is the total charge specified in the gaff2xml interface? antechamber takes a -nc argument to specify the net charge. This is needed in addition to the charge method.

Change travis-ci binstar package upload from gaff2xml-dev to gaff2xml

I think we should be just uploading to a gaff2xml package, with the version string set to dev. It doesn't seem to make sense to have both gaff2xml with the version string set to release numbers and a separate gaff2xml-dev with the version string set to dev, since we can simply specify the dev version with conda install gaff2xml=dev

Fails for catechol?

This seems to fail:

import gaff2xml.openeye
import simtk.openmm as mm
from simtk.openmm import app

iupac_name = 'catechol'
molecule = gaff2xml.openeye.iupac_to_oemol(iupac_name)
import openeye.oeomega as om
omega = om.OEOmega()
omega.SetMaxConfs(1)
omega(molecule)
trajs, ffxmls = gaff2xml.openeye.oemols_to_ffxml([molecule])
ff = app.ForceField(ffxmls)
topology = trajs[0].top.to_openmm()
system = ff.createSystem(topology) 
[LSKI1497:~/projects/expanded-ensembles] choderaj% python create_relative_transformation.py
LOG: benzene-1,2-diol
LOG: methoxymethylbenzene
/Users/choderaj/projects/expanded-ensembles
LOG: benzene-1,2-diol
LOG: antechamber -i ./lig-0-0.mol2 -fi mol2 -o lig-0-0.gaff.mol2 -fo mol2 -s 2
LOG: Running: /Users/choderaj/anaconda/bin/../bin/bondtype -j full -i ANTECHAMBER_BOND_TYPE.AC0 -o ANTECHAMBER_BOND_TYPE.AC -f ac

Running: /Users/choderaj/anaconda/bin/../bin/atomtype -i ANTECHAMBER_AC.AC0 -o ANTECHAMBER_AC.AC -p gaff

LOG: parmchk2 -i lig-0-0.gaff.mol2 -f mol2 -o lig-0-0.frcmod
LOG: 
Traceback (most recent call last):
  File "create_relative_transformation.py", line 680, in <module>
    [system1, topology1, positions1] = generate_openmm_system(molecule1)
  File "create_relative_transformation.py", line 20, in generate_openmm_system
    system = ff.createSystem(topology)
  File "/Users/choderaj/anaconda/lib/python2.7/site-packages/simtk/openmm/app/forcefield.py", line 519, in createSystem
    force.createForce(sys, data, nonbondedMethod, nonbondedCutoff, args)
  File "/Users/choderaj/anaconda/lib/python2.7/site-packages/simtk/openmm/app/forcefield.py", line 1174, in createForce
    raise ValueError('No nonbonded parameters defined for atom type '+t)
ValueError: No nonbonded parameters defined for atom type lig-0-H5

Implement more informative nosetest descriptions?

For some reason, the same information is repeated multiple times:
https://travis-ci.org/choderalab/gaff2xml/jobs/34636834#L961-L984

test_drugs_no_oechem.test_drugs ... ok
test_drugs_no_oechem.test_drugs ... ok
test_drugs_no_oechem.test_drugs ... ok
test_drugs_no_oechem.test_drugs ... ok
test_drugs_no_oechem.test_drugs ... ok
test_drugs_no_oechem.test_drugs ... ok
test_drugs_no_oechem.test_drugs ... ok
test_drugs_no_oechem.test_drugs ... ok
test_drugs_no_oechem.test_drugs ... ok
test_drugs_no_oechem.test_drugs ... ok
test_drugs_no_oechem.test_drugs ... ok
test_drugs_no_oechem.test_drugs ... ok
test_drugs_no_oechem.test_drugs ... ok
test_drugs_no_oechem.test_drugs ... ok
test_drugs_no_oechem.test_drugs ... ok
test_drugs_no_oechem.test_drugs ... ok
test_drugs_no_oechem.test_drugs ... ok
test_drugs_no_oechem.test_drugs ... ok
test_drugs_no_oechem.test_drugs ... ok
test_drugs_no_oechem.test_drugs ... ok
test_drugs_no_oechem.test_drugs ... ok
test_drugs_no_oechem.test_drugs ... ok
test_drugs_no_oechem.test_drugs ... ok

Throw an Exception when a subprocess fails

gaff2xml should parse the output of the tools it calls to see if any of them fail, and then throw an appropriate Exception. For example, a critical sqm failure just causes a warning to be printed right now:

Running: /Users/choderaj/code/amber/amber12/bin/sqm -O -i sqm.in -o sqm.out
Error: cannot run "/Users/choderaj/code/amber/amber12/bin/sqm -O -i sqm.in -o sqm.out" of bcc() in charge.c properly, exit
DEBUG:gaff2xml.utils:parmchk2 -i MOL.gaff.mol2 -f mol2 -o MOL.frcmod
DEBUG:gaff2xml.utils:Cannot open file MOL.gaff.mol2 to read in rmol2(), exit

Add support for 'oeante'

It would be useful to add (optional) support for the pure-Python 'oeante' alternative to Antechamber: https://simtk.org/home/oeante

It does, however, require the OpenEye tools be installed, but this is fine since it will be optional.

I'm happy to work on this.

Issue with jenkins build of conda package

The Jenkins build of the conda package seems to be failing:
https://jenkins.choderalab.org/job/conda-omnia-release-linux-vagrant/56/

*** Error compiling '/home/vagrant/miniconda/envs/_build/lib/python3.3/site-packages/gaff2xml-0.1-py3.3.egg/EGG-INFO/scripts/processAmberForceField.py'...
  File "/home/vagrant/miniconda/envs/_build/lib/python3.3/site-packages/gaff2xml-0.1-py3.3.egg/EGG-INFO/scripts/processAmberForceField.py", line 13
    print stream.read()
               ^
SyntaxError: invalid syntax

Errors with gaff2xml.utils.create_ffxml_file()

I'm trying to debug the yank systembuilder.py, and am running into this with the doctests (see below).

I think there are a number of (possibly irrelevant) warnings, but any ideas what these exceptions mean?

[LSKI1497:~/code/yank/yank.jchodera] choderaj% python -m doctest yank/systembuilder.py
/Users/choderaj/anaconda/lib/python2.7/site-packages/pandas/io/parsers.py:639: ParserWarning: Falling back to the 'python' engine because the 'c' engine does not support regex separators; you can avoid this warning by specifying engine='python'.
  ParserWarning)
/Users/choderaj/code/yank/install/lib/python2.7/site-packages/mdtraj-0.9.1-py2.7-macosx-10.5-x86_64.egg/mdtraj/formats/mol2.py:94: SettingWithCopyWarning: 
A value is trying to be set on a copy of a slice from a DataFrame.
Try using .loc[row_indexer,col_indexer] = value instead

See the the caveats in the documentation: http://pandas.pydata.org/pandas-docs/stable/indexing.html#indexing-view-versus-copy
  atoms_mdtraj["serial"] = atoms.index
/Users/choderaj/code/yank/install/lib/python2.7/site-packages/mdtraj-0.9.1-py2.7-macosx-10.5-x86_64.egg/mdtraj/formats/mol2.py:98: SettingWithCopyWarning: 
A value is trying to be set on a copy of a slice from a DataFrame.
Try using .loc[row_indexer,col_indexer] = value instead

See the the caveats in the documentation: http://pandas.pydata.org/pandas-docs/stable/indexing.html#indexing-view-versus-copy
  atoms_mdtraj["element"] = atoms.atype.map(gaff_elements)  # IF this is a GAFF mol2, this line should work without issues
/Users/choderaj/code/yank/install/lib/python2.7/site-packages/mdtraj-0.9.1-py2.7-macosx-10.5-x86_64.egg/mdtraj/formats/mol2.py:100: SettingWithCopyWarning: 
A value is trying to be set on a copy of a slice from a DataFrame.
Try using .loc[row_indexer,col_indexer] = value instead

See the the caveats in the documentation: http://pandas.pydata.org/pandas-docs/stable/indexing.html#indexing-view-versus-copy
  atoms_mdtraj["element"] = atoms.atype.apply(lambda x: x.strip(".")[0])  # If this is a sybyl mol2, I think this works generally.
/Users/choderaj/code/yank/install/lib/python2.7/site-packages/mdtraj-0.9.1-py2.7-macosx-10.5-x86_64.egg/mdtraj/formats/mol2.py:102: SettingWithCopyWarning: 
A value is trying to be set on a copy of a slice from a DataFrame.
Try using .loc[row_indexer,col_indexer] = value instead

See the the caveats in the documentation: http://pandas.pydata.org/pandas-docs/stable/indexing.html#indexing-view-versus-copy
  atoms_mdtraj["resSeq"] = np.ones(len(atoms), 'int')
/Users/choderaj/code/yank/install/lib/python2.7/site-packages/mdtraj-0.9.1-py2.7-macosx-10.5-x86_64.egg/mdtraj/formats/mol2.py:103: SettingWithCopyWarning: 
A value is trying to be set on a copy of a slice from a DataFrame.
Try using .loc[row_indexer,col_indexer] = value instead

See the the caveats in the documentation: http://pandas.pydata.org/pandas-docs/stable/indexing.html#indexing-view-versus-copy
  atoms_mdtraj["chainID"] = np.ones(len(atoms), 'int')
LOG: antechamber -i tripos.mol2 -fi mol2 -o MOL.gaff.mol2 -fo mol2 -s 2 -c bcc
LOG: 
Running: /Users/choderaj/anaconda/bin/../bin/atomtype -f ac -p bcc -o ANTECHAMBER_AM1BCC.AC -i ANTECHAMBER_AM1BCC_PRE.AC
Running: /Users/choderaj/anaconda/bin/../bin/bondtype -j full -i ANTECHAMBER_BOND_TYPE.AC0 -o ANTECHAMBER_BOND_TYPE.AC -f ac

Running: /Users/choderaj/anaconda/bin/../bin/atomtype -i ANTECHAMBER_AC.AC0 -o ANTECHAMBER_AC.AC -p gaff
Total number of electrons: 58; net charge: 0

Running: /Users/choderaj/anaconda/bin/../bin/sqm -O -i sqm.in -o sqm.out

Running: /Users/choderaj/anaconda/bin/../bin/am1bcc -i ANTECHAMBER_AM1BCC_PRE.AC -o ANTECHAMBER_AM1BCC.AC -f ac -p /Users/choderaj/anaconda/bin/../dat/antechamber/BCCPARM.DAT -s 2 -j 1

LOG: parmchk2 -i MOL.gaff.mol2 -f mol2 -o MOL.frcmod
LOG: 
**********************************************************************
File "yank/systembuilder.py", line 993, in systembuilder.ComplexSystemBuilder.__init__
Failed example:
    ligand = Mol2SystemBuilder(ligand_mol2_filename, charge=0)
Exception raised:
    Traceback (most recent call last):
      File "/Users/choderaj/anaconda/lib/python2.7/doctest.py", line 1315, in __run
        compileflags, 1) in test.globs
      File "<doctest systembuilder.ComplexSystemBuilder.__init__[4]>", line 1, in <module>
        ligand = Mol2SystemBuilder(ligand_mol2_filename, charge=0)
      File "yank/systembuilder.py", line 956, in __init__
        super(Mol2SystemBuilder, self).__init__(molecule, **kwargs)
      File "yank/systembuilder.py", line 438, in __init__
        self._parameterize_with_gaff2xml(molecule, parameterize_arguments)
      File "yank/systembuilder.py", line 485, in _parameterize_with_gaff2xml
        gaff2xml.utils.create_ffxml_file(gaff_mol2_filename, gaff_frcmod_filename, ffxml_filename)
      File "/Users/choderaj/anaconda/lib/python2.7/site-packages/gaff2xml/utils.py", line 198, in create_ffxml_file
        parser.parse_filenames(filenames)
      File "/Users/choderaj/anaconda/lib/python2.7/site-packages/gaff2xml/amber_parser.py", line 485, in parse_filenames
        self.process_frc_file(inputfile)
      File "/Users/choderaj/anaconda/lib/python2.7/site-packages/gaff2xml/amber_parser.py", line 298, in process_frc_file
        for line in open(inputfile):
    IOError: [Errno 2] No such file or directory: 'M'
**********************************************************************

A failure in FreeSolv

Are you sure you tested gaff2xml on the whole FreeSolv database? And on the Tripos files?

I am seeing a failure here on 1-ethyl-4-methyl-benzene:

  1-ethyl-4-methyl-benzene
LOG: antechamber -i molecule.tripos.mol2 -fi mol2 -o molecule.gaff.mol2 -fo mol2 -s 2 -c bcc -nc 0
LOG: Running: /Users/choderaj/code/amber/amber12/bin/bondtype -j full -i ANTECHAMBER_BOND_TYPE.AC0 -o ANTECHAMBER_BOND_TYPE.AC -f ac

Running: /Users/choderaj/code/amber/amber12/bin/atomtype -i ANTECHAMBER_AC.AC0 -o ANTECHAMBER_AC.AC -p gaff
Total number of electrons: 66; net charge: 0

Running: /Users/choderaj/code/amber/amber12/bin/sqm -O -i sqm.in -o sqm.out
Error: cannot run "/Users/choderaj/code/amber/amber12/bin/sqm -O -i sqm.in -o sqm.out" of bcc() in charge.c properly, exit

Fix OEMol / OEGraphMol issue

So somewhere we are passing an OEGraphMol when we need a three-dimensional OEMol, leading to the following test failure:

kyleb@kyleb-DX4870:~$ nosetests gaff2xml -v
Failure: AttributeError ('OEGraphMol' object has no attribute 'GetConfs') ... ERROR
Failure: AttributeError ('OEGraphMol' object has no attribute 'GetConfs') ... ERROR
Testing drugs molecule_0 with charge method bcc ... ^C
======================================================================
ERROR: Failure: AttributeError ('OEGraphMol' object has no attribute 'GetConfs')
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/kyleb/opt/lib/python2.7/site-packages/nose/loader.py", line 251, in generate
    for test in g():
  File "/home/kyleb/opt/lib/python2.7/site-packages/gaff2xml-0.1-py2.7.egg/gaff2xml/tests/test_drugs.py", line 26, in test_drugs
    molecule_name, tripos_mol2_filename = utils.molecule_to_mol2(molecule)
  File "/home/kyleb/opt/lib/python2.7/site-packages/gaff2xml-0.1-py2.7.egg/gaff2xml/utils.py", line 418, in molecule_to_mol2
    return gaff2xml.openeye.molecule_to_mol2(*args, **kwargs)
  File "/home/kyleb/opt/lib/python2.7/site-packages/gaff2xml-0.1-py2.7.egg/gaff2xml/openeye.py", line 253, in molecule_to_mol2
    for k, mol in enumerate(molecule.GetConfs()):
AttributeError: 'OEGraphMol' object has no attribute 'GetConfs'
-------------------- >> begin captured logging << --------------------
gaff2xml.openeye: DEBUG: ZINC03873936
--------------------- >> end captured logging << ---------------------

======================================================================
ERROR: Failure: AttributeError ('OEGraphMol' object has no attribute 'GetConfs')
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/kyleb/opt/lib/python2.7/site-packages/nose/loader.py", line 251, in generate
    for test in g():
  File "/home/kyleb/opt/lib/python2.7/site-packages/gaff2xml-0.1-py2.7.egg/gaff2xml/tests/test_drugs.py", line 36, in test_drug
    molecule_name, tripos_mol2_filename = utils.molecule_to_mol2(molecule)
  File "/home/kyleb/opt/lib/python2.7/site-packages/gaff2xml-0.1-py2.7.egg/gaff2xml/utils.py", line 418, in molecule_to_mol2
    return gaff2xml.openeye.molecule_to_mol2(*args, **kwargs)
  File "/home/kyleb/opt/lib/python2.7/site-packages/gaff2xml-0.1-py2.7.egg/gaff2xml/openeye.py", line 253, in molecule_to_mol2
    for k, mol in enumerate(molecule.GetConfs()):
AttributeError: 'OEGraphMol' object has no attribute 'GetConfs'
-------------------- >> begin captured logging << --------------------
gaff2xml.openeye: DEBUG: ZINC03873936
--------------------- >> end captured logging << ---------------------

----------------------------------------------------------------------
Ran 3 tests in 1.921s

Cleanup system_checker

So there are lots of places where SystemChecker could use more "uniformity".

  1. Look for instances of shared code to factor out
  2. Make the code look more uniform. For example, with Bonds I check that f0.getNumBonds() == f1.getNumBonds()--but for angles, I compare the set of angle parameters in each force. It would be better if these sorts of things adhered to one well-defined scheme.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.