Project > Wrappers
Wrappers are libraries providing access to the functions of several well-known external programs related to molecular modeling. The most useful ones are certainly the CHARMM wrappers described below, available for Java and for Python.
PyCHARMM
The PyCHARMM allows a seamless integration of CHARMM in Python pipelines. While its features are not comparable yet to that of the historical CharmmWrapper (see below), it is already usable. The API is available here.
Here is a code example, with comments
#!/usr/bin/python # -*- coding: utf-8 -*- import PyCHARMM.CharmmWrapper try: charmm = PyCHARMM.CharmmWrapper.CharmmWrapper() # start the CHARMM instance : guess CHARMM binary, automatically load PAR, RTF, PSF and CRD charmm.autoStart() # calculate the energy charmm.executeAndForget("ENERGY") # call COOR STAT and print it output charmm.executeAndKeep("COOR STAT SELE ALL END") energy = charmm.getResultAsString() print energy except Exception: import traceback traceback.print_exc() exit(1) exit(0)
CHARMMWrapper
We implemented a Java library for driving an instance of CHARMM. This is similar to MMTSB, except that this latter is in Perl).
The following listing:
package sib.wrappers.md.charmm; public class Example { public static void main(String[] args) { // Execute CHARMM and look in the current directory for PSF(s), CRD(s), // extra parameters and topology files. CharmmExtendedWrapper cw = CharmmExtendedWrapper.autoStart(); // Calculate the energy System.out.println("Energy is "+cw.getEnergy()); // Example of free text commands cw.executeAndKeep("COOR STAT"); System.out.println("Output is : "+cw.getResultAsString()); // Stop CHARMM cw.stop(); System.exit(0); } }
Produces the following stdout/stderr
sib.wrappers.md.charmm.CharmmExtendedWrapper: Trying to find a built-in CHARMM binary. sib.wrappers.md.charmm.CharmmExtendedWrapper: Detected /charmm/binaries/charmm_linux_amd64. sib.wrappers.md.charmm.CharmmExtendedWrapper: Guessed parameters are: sib.wrappers.md.charmm.CharmmExtendedWrapper: CHARMM Binary: ./charmm/binaries/charmm_linux_amd64 sib.wrappers.md.charmm.CharmmExtendedWrapper: CHARMM topology main: ./charmm/toppar/top_all22_prot.inp sib.wrappers.md.charmm.CharmmExtendedWrapper: CHARMM topology extra: [ lig.rtf ] sib.wrappers.md.charmm.CharmmExtendedWrapper: CHARMM parameters main: ./charmm/toppar/par_all22_prot.inp sib.wrappers.md.charmm.CharmmExtendedWrapper: CHARMM parameters extra: [ lig.par ] sib.wrappers.md.charmm.CharmmExtendedWrapper: CHARMM PSF files : [ complex.psf ] sib.wrappers.md.charmm.CharmmExtendedWrapper: CHARMM CRD files : [ complex.crd ] Energy is -1928.56 Output is : STATISTICS FOR 1762 SELECTED ATOMS: XMIN = 22.453600 XMAX = 61.751530 XAVE = 44.692933 YMIN = 2.028490 YMAX = 32.707900 YAVE = 17.564850 ZMIN = 2.167050 ZMAX = 40.846670 ZAVE = 19.366133 WMIN = 0.224500 WMAX = 2.275000 WAVE = 1.521350 sib.wrappers.md.charmm.CharmmExtendedWrapper: CHARMM timers: CPU time: 0.33 seconds sib.wrappers.md.charmm.CharmmExtendedWrapper: CHARMM timers: Elapsed time: 0.356268 seconds.
Other softwares
Several other wrappers are under development: