Moltemplate is a general cross-platform text-based molecule builder for LAMMPS and (the TCL version of) ESPResSo. Moltemplate was intended for building custom coarse-grained molecular models, but it can be used to prepare realistic all-atom simulations as well. It currently supports the OPLSAA, OPLSUA, AMBER(GAFF,GAFF2), DREIDING, COMPASS, TraPPE(1998) force fields, the ATB molecule database, and the MOLC, mW, ELBA(water), oxDNA2, and EFF molecular models (and others). Moltemplate is inter-operable with ATB, VMD/topotools, PACKMOL, Open Babel, EMC, CellPACK, LigParGen, Vipster, struc2lammpsdf, and any other program that reads or generates LAMMPS data (.lmpdat) files. (New force fields and examples are added continually by users.)
This repository contains 3 folders:
- moltemplate: source code and force fields
- doc: documentation for moltemplate.sh, ltemplify.py, genpoly_lt.py, etc..
- examples: examples built with moltemplate
The best way to learn how to use moltemplate is to find an example which is similar to the system that you wish to simulate and modify it. This repository includes approximately 50 examples. Some of the moltemplate examples are also demonstrated (with pictures) here.
All moltemplate users should probably read chapter 4 of the reference manual (It's only a few pages long. The first 3 chapters are optional.) In addition, there are also several talks/tutorials online.
Moltemplate does not choose atom types automatically ("atom typing"), and currently cannot be used to build all-atom proteins from scratch. 3rd-party tools may be needed to calculate atomic partial charges accurately. Some suggestions for selecting the appropriate atom types for your molecules are provided here. (Users who are unsure how to choose atom types are encouraged to use the ATB database, or use the DREIDING force field which has simple atom type rules, or use a 3rd-party molecule-builder that supports atom typing (such as EMC). If necessary, you can then convert the molecular simulation files created earlier into LAMMPS format using OpenBabel. You can then use ltemplify.py, to extract individual molecules from the LAMMPS DATA file, and modify them or combine them with other molecules using moltemplate.)
moltemplate.sh [-atomstyle style] [-pdb/-xyz coord_file] [-vmd] system.lt
Moltemplate depends on other software to work (such as BASH, python, pip, or python3, and pip3). Once these dependencies have been met, installing moltemplate is relatively easy. However many users find it difficult to install these prerequisites correctly. A detailed installation guide is located here.
Once you have installed the prerequesites mentioned above, run the following command from within the directory where this README file is located:
pip3 install . # (or "pip", if that fails)
If that fails (with both "pip" and "pip3"), then try this instead:
pip3 install . --user # (or "pip", if that fails)
This will install moltemplate for a single user. If you are on a shared computer and you want to install moltemplate system-wide, then use:
sudo pip3 install . # (or "pip", if that fails)
Later, you can uninstall moltemplate using:
pip3 uninstall moltemplate
# (use "pip" and/or prepend "sudo" if you did that earlier)
If this fails then read the installation troubleshooting guide. This guide will offer several different installation methods and explain how to install the prerequisites needed.
Additional suggestions and supporting code can be found at:
Moltemplate requires the Bourne-shell, and a recent version of python (3.5 or higher recommended), and can run on MacOS, linux, or windows, if a suitable shell environment has been installed. (Note that python 2.7 may also work, but you must edit your PATH to install moltemplate instead of using pip. Pip no longer works with old versions of python.)
The numpy python module is also required.
To use LAMMPS and moltemplate, you will also need to install (and learn how to use) a (unix-style) text editor. (Word, Wordpad, and Notepad will not work.) Popular graphical text editors include Atom, Sublime, Notepad++, and VSCode. Older, non-graphical programs include vim, emacs, nano, ne, and jove. (Apple's TextEdit can be used if you save the file as plain text.)
With the exception of one file (ttree_lex.py), moltemplate is available under the terms of the MIT license.
The remaining file, (ttree_lex.py), is a modified version of the shlex.py module, which was released using the PSF license. Hence ttree_lex.py must also use this license. (The PSF is not a copyleft license. It is similar to the BSD and MIT licenses and is compatible with the the GPL license.)
If you find this program useful, please cite:
"Moltemplate: A Tool for Coarse-Grained Modeling of Complex Biological Matter and Soft Condensed Matter Physics", J. Mol. Biol., 2021, 433(11):166841, Jewett AI, Stelter D, Lambert J, Saladi SM, Roscioni OM; Ricci M, Autin L, Maritan M, Bashusqeh SM, Keyes T, Dame RT; Shea J-E, Jensen GJ, Goodsell DS https://doi.org/10.1016/j.jmb.2021.166841