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

Interactive simulation #129

Open
wants to merge 50 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
50 commits
Select commit Hold shift + click to select a range
0a1e163
integrating LAMMPS into MDT
dane1122 Jan 31, 2017
d3c20d6
hello
dane1122 Feb 1, 2017
f47049a
Created Dockerfile for LAMMPS
dane1122 Feb 1, 2017
a4beceb
added exmaples folder to test LAMMPS integration
dane1122 Feb 1, 2017
7ef8548
Modified models file in accordance with the code review
dane1122 Feb 1, 2017
c53274e
example for lammps usage
dane1122 Feb 2, 2017
26c0bdf
LAMMPS integration into model integrator
dane1122 Feb 2, 2017
b694311
Added docstring for describing functions inside LAMMPS integrator
dane1122 Feb 2, 2017
1941f51
Modified model and integrator
dane1122 Feb 2, 2017
80f74e4
Merge branch 'workflow_fixes' into interactive_simulation
dane1122 Feb 2, 2017
b680740
example
dane1122 Feb 2, 2017
4f7ad81
Remove it
dane1122 Feb 2, 2017
b7d66bf
Merged with lammps branch to get yml file in this repository
dane1122 Feb 2, 2017
902f015
Modified LAMMPS model
dane1122 Feb 2, 2017
0d1ebb6
Cleanup
dane1122 Feb 2, 2017
526d24f
Specified units
dane1122 Feb 3, 2017
8507817
Modified model and integrator. TODO: Trajectory for integrator. It se…
dane1122 Feb 3, 2017
6ade6dd
Modified example files
dane1122 Feb 3, 2017
38fdc70
example
dane1122 Feb 3, 2017
0345f16
Merge branch 'master' into interactive_simulation
dane1122 Feb 3, 2017
85fb4cf
Modified integrator and model
dane1122 Feb 4, 2017
aa2ddbe
Modified. TODO: Fix LAMMPS simulation error
dane1122 Feb 4, 2017
0487c04
Modified docker makefile for lammps
dane1122 Feb 6, 2017
a5082a0
Modified example
dane1122 Feb 6, 2017
0fc2b0d
Modified xlo, xhi, ylo, yhi, zlo, zhi since the molecule wrapped arou…
dane1122 Feb 6, 2017
7e309f9
Modified shake
dane1122 Feb 7, 2017
55242fa
Merge remote-tracking branch 'origin/master' into interactive_simulation
dane1122 Feb 7, 2017
992dfb8
Modified integrator and model
dane1122 Feb 7, 2017
15ddfcf
Created model for interactive simulation
dane1122 Feb 9, 2017
8952f7c
Modified lammps model so the user can apply force
dane1122 Feb 9, 2017
c6f8f26
Modified force equation
dane1122 Feb 10, 2017
5b850ee
Modified model
dane1122 Feb 13, 2017
06707ab
Interactive slide bar
dane1122 Feb 13, 2017
2a7fe6f
Trajectory way
dane1122 Feb 14, 2017
a408c99
Stretch factor for nearby atoms
dane1122 Feb 14, 2017
7566047
Removed print that was used for debugging
dane1122 Feb 14, 2017
c994e54
Modified model for better visual effects
dane1122 Feb 14, 2017
9b1118d
Fixed model
dane1122 Feb 17, 2017
0f5e422
Modified for web assembly usage
dane1122 Feb 18, 2017
23a22b5
Removed export since not required anymore
dane1122 Feb 22, 2017
4e8813e
fixed simulation boz
dane1122 Mar 3, 2017
51cd6df
Create a function to possibly use for LAMMPS-related workflows
Apr 3, 2017
4454121
Lammps model and integrator
Apr 7, 2017
bc562c3
Set simulation box larger than atom xlo, xhi, ylo, yhi, zlo, zhi coor…
Apr 7, 2017
ae97b6b
Revert "Set simulation box larger than atom xlo, xhi, ylo, yhi, zlo, …
Apr 10, 2017
418f022
Fixed bug: can still run dynamics with potential model
Apr 11, 2017
674d66f
Removed moldesign-examples directory since examples should be in mold…
Apr 11, 2017
0e4f1f4
Updated test
Apr 11, 2017
842c637
Merge branch 'master' into interactive_simulation
Apr 11, 2017
7210046
Fixed error caused by merging master.
Apr 11, 2017
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: 2 additions & 2 deletions DockerMakefiles/DockerMake.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ _SOURCES_:
- PySCF.yml
- PythonTools.yml
- SymMol.yml

- LAMMPS.yml

_ALL_:
- ambertools
Expand All @@ -24,7 +24,7 @@ _ALL_:
- moldesign_complete
- moldesign_notebook
- moldesign_minimal

- lammps

##################################################
# Base image definitions
Expand Down
52 changes: 52 additions & 0 deletions DockerMakefiles/LAMMPS.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
lammps_requirements:
description: Base libraries for BOTH running and building LAMMPS
build: |
RUN apt-get -y update
RUN apt-get -y install \
bc \
ssh \
mpich2 \
python-dev \
libz-dev \
fftw3-dev

ENV PATH=${PATH}:/usr/lib
ENV PYTHONPATH=${PYTHONPATH}:/opt/lammps/python
ENV LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:/opt/lammps/src

lammps_build:
requires:
- buildbase
- lammps_requirements
description: Build image for LAMMPS. Based on https://github.com/malramsay64/lammps-docker/blob/master/Dockerfile
build: |

RUN git clone https://github.com/lammps/lammps.git /opt/lammps && \
cd /opt/lammps && \
git fetch && \
git checkout stable

RUN cd /opt/lammps/src && \
make yes-ASPHERE yes-BODY yes-CLASS2 yes-COLLOID yes-COMPRESS yes-CORESHELL yes-DIPOLE yes-GRANULAR yes-KSPACE yes-MANYBODY && \
make yes-MC yes-MOLECULE yes-OPT yes-PERI yes-PERI yes-PYTHON yes-REPLICA yes-RIGID yes-SHOCK yes-SNAP yes-SRD

# RUN cd /opt/lammps/src && \
# make serial mode=shlib -j4

RUN cd /opt/lammps/src && \
make mpi mode=shlib -j4 MPI_INC="-DMPICH_SKIP_MPICXX -I/usr/include/mpich" MPI_LIB="-Wl,-rpath,/usr/lib/mpich/lib -L/usr/lib/mpich/lib -lmpl -lmpich"

RUN cd /opt/lammps/python && \
python install.py

lammps:
description: Deployable LAMMPS image
build_directory: buildfiles/lammps/
requires:
- python_deploy_base
- lammps_requirements
copy_from:
lammps_build:
/usr/local/lib/python2.7/dist-packages: /usr/local/lib/python2.7/
/usr/lib: /usr
/opt/lammps: /opt
Original file line number Diff line number Diff line change
@@ -0,0 +1,150 @@
{
"cells": [
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"import moldesign as mdt\n",
"from moldesign import units as u\n",
"import ipywidgets as ipy"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"from moldesign.models.lammps_model import LAMMPSPotential\n",
"import parmed as med\n",
"# mdt.configure()"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"mol = mdt.from_pdb('1yu8')"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"mol = mdt.Molecule(mol.residues[0:10])"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"mdmol = mdt.assign_forcefield(mol)\n",
"atom = mdmol.atoms[13]\n",
"print \"Done parameterizing\""
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"print mdmol.write('pdb')"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"######### Create LAMMPSInteractive model and run NVT simulation #########\n",
"mdmol.set_energy_model(mdt.models.LAMMPSInteractive)\n",
"\n",
"data = mdmol.energy_model.get_lammps_data()\n",
"print"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"print data"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"mdmol.calculate()\n",
"mdmol.set_integrator(integrator=mdt.integrators.LAMMPSLangevin, timestep=1.0*u.fs,\n",
" temperature=300.0*u.kelvin, frame_interval=50.0*u.fs, constrain_hbonds=False, constrain_water=False)\n"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"\n",
"mdmol.energy_model.apply_force(mdmol.atoms[11:20], [10.0, 0.0, 3.0] * u.kcalpermol/u.angstrom)\n",
"mytraj = mdmol.run(200 * u.fs)\n"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 2",
"language": "python",
"name": "python2"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 2
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython2",
"version": "2.7.13"
}
},
"nbformat": 4,
"nbformat_minor": 0
}
51 changes: 51 additions & 0 deletions moldesign/_tests/test_mm.py
Original file line number Diff line number Diff line change
Expand Up @@ -122,3 +122,54 @@ def test_minimization_reduces_energy(objkey, request):
mol = request.getfuncargvalue(objkey)
traj = mol.minimize()
assert mol.calculate_potential_energy() < e1

@typedfixture('hasmodel')
def protein_stripped_amber_forcefield_lammps():
mol = mdt.from_pdb('1yu8')
mol = mdt.Molecule([res for res in mol.residues if res.type == "protein"])
newmol = mdt.assign_forcefield(mol)

# Set Potential energy model
newmol.set_energy_model(mdt.models.LAMMPSPotential)
newmol.calculate()

# Set Interactive energy model
newmol.set_energy_model(mdt.models.LAMMPSInteractive)
newmol.calculate()
newmol.energy_model.apply_force(atoms=newmol.atoms[11:20], vector=[10.0, 10.0, 0.0] * u.kcalpermol / u.angstrom)
newmol.energy_model.reset_force()
return newmol

@typedfixture('hasmodel')
def protein_amber_forcefield_lammps():
mol = mdt.from_pdb('1yu8')
newmol = mdt.assign_forcefield(mol)

# Set Potential energy model
newmol.set_energy_model(mdt.models.LAMMPSPotential)
newmol.calculate()

# Set Interactive energy model
newmol.set_energy_model(mdt.models.LAMMPSInteractive)
newmol.calculate()
newmol.energy_model.apply_force(atoms=newmol.atoms[11:20], vector=[10.0, 10.0, 0.0] * u.kcalpermol / u.angstrom)
newmol.energy_model.reset_force()
return newmol

def test_lammps_shake_constrain_hbonds(protein_stripped_amber_forcefield_lammps):
mdmol = protein_stripped_amber_forcefield_lammps
mol = mdt.from_pdb('1yu8')
newmol = mdt.assign_forcefield(mol)
newmol.set_energy_model(mdt.models.LAMMPSPotential)

# Test without constraints
mdmol.set_integrator(mdt.integrators.LAMMPSLangevin, timestep=2.0*u.fs, temperature=300*u.kelvin, frame_interval=10.0*u.fs, constrain_hbonds=False, constrain_water=False)
traj = mdmol.run(1000*u.fs)

assert len(traj) > 0

# Test with constraints. Should raise NotImplementedError
mdmol.set_integrator(mdt.integrators.LAMMPSLangevin, timestep=2.0*u.fs, temperature=300*u.kelvin, frame_interval=10.0*u.fs, constrain_hbonds=True, constrain_water=True)
with pytest.raises(NotImplementedError):
traj = mdmol.run(1000*u.fs);

1 change: 1 addition & 0 deletions moldesign/integrators/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
from . import base
from .verlet import *
from .openmm import *
from .lammps_integrator import *
Loading