GithubHelp home page GithubHelp logo

jewettaij / cellpack2moltemplate Goto Github PK

View Code? Open in Web Editor NEW
1.0 3.0 3.0 102 KB

A tool to run simulations of molecular assemblies created by CellPACK using moltemplate and LAMMPS

Home Page: http://www.cellpack.org

License: MIT License

Python 100.00%
cellpack moltemplate simulation lammps

cellpack2moltemplate's Introduction

GitHub

cellpack2moltemplate

Typical Usage

cellpack2lt.py -in HIV-1_0.1.cpr -out system.lt      # -- or --
cellpack2lt.py  <  HIV-1_0.1.cpr  >   system.lt

...where "HIV-1_0.1.cpr" is a file created by CellPACK, and "system.lt" is the corresponding file converted to moltemplate format.

Description

Initial test of cellpack2lt.py on an HIV virus structure created with CellPACK, converted into moltemplate format, and rendered using VMD

CellPACK is a tool for building models of huge biomolecular assemblies, organelles, viruses, and even whole cells. Moltemplate is a molecule builder and force field database system designed for building general coarse grained models of molecular machines. Moltemplate creates input files for the LAMMPS and ESPResSo molecular dynamics simulation engines.

The "cellpack2lt.py" script converts JSON files created by CellPACK into moltemplate format so that these systems can be simulated in LAMMPS. The files created by cellpack2lt.py can subsequently be converted into files which LAMMPS can read using the following command:

moltemplate system.lt

Then you can run a LAMMPS simulation using:

lmp_mpi -i run.in

(...where "lmp_mpi" is the name of your LAMMPS binary. It is also frequently named "lmp_ubuntu")

The "run.in" file contains several LAMMPS commands which control how the simulations will be carried out (including "rigid" constraints, Verlet timestep size, temperature, Langevin damping parameters, and simulation duration) (See the "examples" subdirectory for details.)

If VMD is installed, you can run moltemplate.sh with the additional "-vmd" argument to view the structure using VMD immediately. An optional file, "vmd_commands.tcl", is also created so that the radii of the particles are displayed correctly in VMD. (To get this to work, you will have to load the "vmd_commands.tcl" file from within VMD by selecting the "Extensions"->"Tk Console", and "File"->"Load File" menu options. Controlling other visual features such as color is planned for the future.) Instructions explaining how to visualize trajectories in VMD are included with the example(s).

Optional Arguments

   -in FILE_NAME     # Specify the name of the input file (as opposed to "<")
   -url URL          # Read the CellPACK JSON text from URL instead of a file
   -out FILE_NAME    # Specify the output file (as opposed to ">")
   -pairstyle STYLE  # Select force formula (eg. -pairstyle lj/cut/coul/debye)
                     #               (by default -pairstyle lj/cut)
   -debye            # Specify the Debye length (if applicable)
   -epsilon          # Specify the "Epsilon" Lennard-Jones coeff (default: 1)
   -deltaR           # Specify the resolution of particle radii (default 0.1)
   -name OBJECTNAME  # Create a moltemplate object which contains everything.
                     # (useful if you want multiple copies of the system later)

Forces between particles

As of 2017-10-23, the force field it uses is quite stupid. (I'm using purely repulsive Lennard-Jones spheres.) Not surprisingly, because there are no attractive forces or charges, the proteins in the system drift apart. (More accurately the components typically fly apart at high speed due to occasional modest overlap between nearby particles arranged by CellPACK. Protocols to relax the energy of the system beforehand will have to be developed because the "minimize" commands available in LAMMPS do not currently work with the rigid-body motion integrator we are using.)

In the future, it we will have to decide upon the kinds of forces and constraints we want to use, as well as make it possible for users to convey at least some of this information in CellPACK, and somehow convey this information to moltemplate inside the JSON files created by CellPACK.

Python interface

This program be imported as a module and run using "ConvertCellPACK()". However the list of arguments to this function has not been decided, and is likely to change radically in the future. Currently it is:

def ConvertCellPACK(file_in,        # this is typically sys.stdin
                    filename_in,    # optional input file name
                    file_out,       # this is typically sys.stdout
                    filename_out,   # optional output file name
                    out_obj_name,   # optional moltemplate object name
                    delta_r,        # radial resolution
                    pairstyle,      # which LAMMPS pair_style do you want?
                    pairstyle2docs, # documentation for these pair styles
                    pairstyle2args, # required arguments for these pair_styles
                    epsilon,        # Lennard-Jones parameter
                    debye)          # Debyle length (if applicable)

Usage Example:

import cellpack2lt
fin = open('HIV-1_0.1.cpr', 'r')
fout = open('system.lt', 'w')
ConvertCellPACK(fin,
                'HIV-1_0.1.cpr',
		fout,
		'system.lt',
		'',
                0.1,
                'lj/cut',
                {'lj/cut':'http://lammps.sandia.gov/doc/pair_lj.html',
		 'gauss':'http://lammps.sandia.gov/doc/pair_gauss.html'},
		{'lj/cut':'50.0',
		 'gauss':'50.0'},
                0.5961621,     # = k_B*temperature at 300K in kcal/mole
		1.0)

Installation Instructions

There are two ways to install cellpack2moltemplate:

Installation using pip

If you are familiar with pip, then run the following command from within the directory where this README file is located:

pip install .

Make sure that your default pip install bin directory is in your PATH. (This is usually something like ~/.local/bin/ or ~/anaconda3/bin/. If you have installed anaconda, this will be done for you automatically.) Later, you can uninstall cellpack2moltemplate using:

pip uninstall cellpack2moltemplate

Manual Installation method:

Alternatively, you can edit your PATH variable manually to include the subdirectory where the cellpack2lt.py script is located, as well as the subdirectory where most of the python scripts are located. Suppose the directory with this README file is named ``cellpack2moltemplate'' and is located in your home directory:

If you use the bash shell, typically you would edit your ~/.profile, ~/.bash_profile or ~/.bashrc files to contain the following lines:

export PATH="$PATH:$HOME/cellpack2moltemplate/cellpack2moltemplate"

Requirements

cellpack2moltemplate depends on numpy

License

cellpack2moltemplate is available under the terms of the MIT license.

Funding

CellPACK and Moltemplate are funded by NIH grant R01GM120604.

cellpack2moltemplate's People

Contributors

jewettaij avatar

Stargazers

 avatar

Watchers

 avatar  avatar  avatar

Forkers

mopolino8 corredd

cellpack2moltemplate's Issues

numeric instability due to overlap

LAMMPS currently is likely to crash when run on the files created by the initial versions of cellpack2lt.py because of slight atom overlap. You can often get around this problem by initiating your simulations using a very small time step, running short simulation for a few thousand timesteps, doubling the timestep, running another short simulation, etc until the timestep is something reasonable (0.005 seems somewhat reasonable). (See the "run.in" example file in the "doc" subdirectory for an example of a LAMMPS input file.) In the future I will implement other pair_style choices (soft gaussian forces) so that the consequence of two atoms slightly overlapping is not so catastrophic. We could also implement some better minimizers in lammps that work with rigid body constraints. Stuff to think about in the future...

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.