-
Notifications
You must be signed in to change notification settings - Fork 37
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
0.7.3 release cleanup
- Loading branch information
Showing
29 changed files
with
564 additions
and
193 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,3 +11,5 @@ _test.py | |
/dist | ||
/build | ||
*.egg-info | ||
.cloudcomputecannon | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -27,7 +27,7 @@ | |
### What can I contribute? | ||
Contributions to this project are encouraged! Email the maintainers at `[email protected]` to become a contributor. | ||
|
||
If you're interested in getting started, here are some ideas: | ||
If you're interested in getting started, here are some general contributions that are always welcome. We also maintain a [wishlist of specific ideas on the wiki](https://github.com/Autodesk/molecular-design-toolkit/wiki/Contribution-ideas). | ||
|
||
**Tests**: This is one of the easiest ways to get started - see also `moldesign/tests/README.md` | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,6 +8,7 @@ _ALL_: | |
- python_install | ||
- moldesign_complete | ||
- moldesign_notebook | ||
- moldesign_minimal | ||
|
||
|
||
################################################## | ||
|
@@ -79,16 +80,21 @@ devtools: | |
############################################ | ||
# moldesign | ||
# Note - this image installs from github so we can test it before submitting to pypi | ||
# Note - this is built by CLONING the current repo, then building an sdist, then installing that. | ||
# It's convoluted, but it's to replicate what actually gets installed via PyPI | ||
moldesign: | ||
requires: # TODO: remove biopython dependency (it's in C ...) | ||
- python_install | ||
build_directory: moldesign | ||
- biopython | ||
build_directory: ../ | ||
build: | | ||
RUN apt-get update && apt-get install -y gcc gfortran python-dev git \ | ||
&& pip install biopython \ | ||
&& pip install git+https://github.com/Autodesk/[email protected] \ | ||
&& apt-get -y remove --purge gcc gfortran python-dev git \ | ||
COPY . /opt/molecular-design-toolkit | ||
RUN apt-get update && apt-get install -y git \ | ||
&& cd /opt && mv molecular-design-toolkit molecular-design-toolkit_dirty \ | ||
&& git clone molecular-design-toolkit_dirty molecular-design-toolkit \ | ||
&& cd molecular-design-toolkit && python setup.py sdist \ | ||
&& pip install dist/* \ | ||
&& apt-get -y remove --purge git \ | ||
&& apt-get -y autoremove --purge \ | ||
&& apt-get -y clean | ||
|
@@ -131,6 +137,20 @@ moldesign_complete: | |
CMD '' | ||
moldesign_minimal: | ||
description: | | ||
Same as moldesign_notebook, but *without* any dependencies (OpenBabel, OpenMM etc.). | ||
Used for testing remote execution environment | ||
requires: | ||
- notebook | ||
- moldesign | ||
build: | | ||
RUN cp -r /usr/local/lib/python2.7/dist-packages/moldesign/_notebooks /notebooks/moldesign_examples | ||
RUN jupyter nbextension enable --python --sys-prefix widgetsnbextension \ | ||
&& jupyter nbextension enable --python --sys-prefix nbmolviz | ||
ENTRYPOINT [] | ||
CMD '' | ||
######################################### | ||
# Command line chemistry | ||
opsin: | ||
|
@@ -226,14 +246,15 @@ notebook: | |
WORKDIR /notebooks | ||
COPY run_notebook.sh /run_notebook.sh | ||
openmm: # NEWFEATURE: add GPU support (opencl/cuda) | ||
description: Basic OpenMM install (CPU only) with python bindings | ||
build_directory: openmm | ||
requires: | ||
- python_install | ||
build: | | ||
RUN mkdir -p /src | ||
ADD OpenMM-7.0.0-Linux.zip /src/OpenMM.zip | ||
ADD OpenMM-7.0.1-Linux.zip /src/OpenMM.zip | ||
RUN apt-get update \ | ||
&& apt-get install -y \ | ||
gcc \ | ||
|
@@ -314,13 +335,24 @@ chem_python: | |
- openmm | ||
- pyscf | ||
- pdbfixer | ||
- biopython | ||
|
||
chem_notebook: | ||
requires: | ||
- notebook | ||
- chem_python | ||
|
||
|
||
biopython: | ||
requires: | ||
- python_install | ||
build: | | ||
RUN apt-get update && apt-get install -y gcc gfortran python-dev \ | ||
&& pip install biopython \ | ||
&& apt-get -y remove --purge gcc gfortran python-dev \ | ||
&& apt-get -y autoremove --purge \ | ||
&& apt-get -y clean | ||
######################## | ||
# Still being developed | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,90 @@ | ||
import random | ||
|
||
import pytest | ||
import numpy as np | ||
|
||
import moldesign as mdt | ||
from moldesign import units as u | ||
|
||
from . import helpers | ||
|
||
|
||
registered_types = {} | ||
|
||
def typedfixture(*types, **kwargs): | ||
"""This is a decorator that lets us associate fixtures with one or more arbitrary types. | ||
We'll later use this type to determine what tests to run on the result""" | ||
|
||
def fixture_wrapper(func): | ||
for t in types: | ||
registered_types.setdefault(t, []).append(func.__name__) | ||
return pytest.fixture(**kwargs)(func) | ||
|
||
return fixture_wrapper | ||
|
||
|
||
@pytest.fixture | ||
def small_molecule(): | ||
return mdt.from_smiles('CNCOS(=O)C') | ||
|
||
|
||
@typedfixture('mdready') | ||
def parameterize_zeros(small_molecule): | ||
params = mdt.parameterize(small_molecule, charges='zero') | ||
mol = mdt.assign_forcefield(small_molecule, parameters=params) | ||
mol.set_energy_model(mdt.models.ForceField) | ||
return mol | ||
|
||
|
||
@typedfixture('mdready') | ||
def parameterize_am1bcc(small_molecule): | ||
params = mdt.parameterize(small_molecule, charges='am1-bcc', ffname='gaff') | ||
mol = mdt.assign_forcefield(small_molecule, parameters=params) | ||
mol.set_energy_model(mdt.models.ForceField) | ||
return mol | ||
|
||
|
||
@typedfixture('mdready') | ||
def protein_default_amber_forcefield(): | ||
mol = mdt.from_pdb('1YU8') | ||
newmol = mdt.assign_forcefield(mol) | ||
newmol.set_energy_model(mdt.models.ForceField) | ||
return newmol | ||
|
||
|
||
@typedfixture('mdready') | ||
def gaff_model_gasteiger(small_molecule): | ||
small_molecule.set_energy_model(mdt.models.GAFF, charges='gasteiger') | ||
return small_molecule | ||
|
||
|
||
@pytest.mark.parametrize('objkey', registered_types['mdready']) | ||
def test_properties(objkey, request): | ||
mol = request.getfuncargvalue(objkey) | ||
energy = mol.calculate_potential_energy() | ||
forces = mol.calculate_forces() | ||
assert forces.shape == mol.positions.shape | ||
|
||
|
||
@pytest.mark.skipif(mdt.interfaces.openmm.force_remote, | ||
reason="Numerical derivatives need to be parallelized, " | ||
"otherwise this takes too long") | ||
@pytest.mark.parametrize('objkey', registered_types['mdready']) | ||
def test_forces(objkey, request): | ||
mol = request.getfuncargvalue(objkey) | ||
|
||
anagrad = -mol.calculate_forces().defunits_value() | ||
numgrad = helpers.num_grad(mol, | ||
mol.calculate_potential_energy, | ||
step=0.005*u.angstrom | ||
).defunits_value() | ||
assert np.sqrt(np.sum((anagrad-numgrad) ** 2))/(3.0*mol.num_atoms) <= 1.0e-4 # this isn't good | ||
|
||
|
||
@pytest.mark.parametrize('objkey', registered_types['mdready']) | ||
def test_minimize(objkey, request): | ||
mol = request.getfuncargvalue(objkey) | ||
e1 = mol.calculate_potential_energy() | ||
mol = request.getfuncargvalue(objkey) | ||
traj = mol.minimize() | ||
assert mol.calculate_potential_energy() < e1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.