- Home
- CHARMM Documentation
- Version c50b1
- pycharmm
pycharmm (c50b1)
The pycharmm Python interface to CHARMM
This module describes the interface of CHARMM with the Python
programming language. The pycharmm Python package for CHARMM is
compatible with Python versions 3.6 and greater. The package requires
Python installed on the machine. Please see Python documentation for
the basic procedures to set-up and install Python.
The pycharmm interface is under continuing development with
new CHARMM features being added all of the time. The current
implementation supports dynamics and energy calculations.
Special Notice: The pycharmm interface is an evolving interface.
The interface and associated modules have been well
tested, but are likely to contain yet undiscovered limitations,
compared with the full functionality in CHARMM. Users are forewarned to
carry out some pre-testing on their system prior to initiating long
runs. As new features and methods are added to the interface they will be
described in the updated documentation.
* Setup | Building CHARMM and installing pycharmm
* Use | Use and functional support of pycharmm
* Examples | Examples of pycharmm use
This module describes the interface of CHARMM with the Python
programming language. The pycharmm Python package for CHARMM is
compatible with Python versions 3.6 and greater. The package requires
Python installed on the machine. Please see Python documentation for
the basic procedures to set-up and install Python.
The pycharmm interface is under continuing development with
new CHARMM features being added all of the time. The current
implementation supports dynamics and energy calculations.
Special Notice: The pycharmm interface is an evolving interface.
The interface and associated modules have been well
tested, but are likely to contain yet undiscovered limitations,
compared with the full functionality in CHARMM. Users are forewarned to
carry out some pre-testing on their system prior to initiating long
runs. As new features and methods are added to the interface they will be
described in the updated documentation.
* Setup | Building CHARMM and installing pycharmm
* Use | Use and functional support of pycharmm
* Examples | Examples of pycharmm use
Top
BUILDING CHARMM AND INSTALLING PYCHARMM
===========================================
There are two steps to setup pycharmm and CHARMM for use in Python programming.
The first step is to build CHARMM as a shared object. Next, pycharmm must be
installed as a python package using pip.
To interface with pycharmm, CHARMM is built as shared object. To access
the pycharmm pip package. If the necessary prerequisits are present, CMake
will automatically install the pycharmm pip package. CMake will check for a
working python interpreter and use this python to install the pycharmm package.
Be sure to activate the appropriate virtual environment before running the
configure script.
If the CMake output from the configure script indicates the wrong python
interpreter, try putting the correct one first in the PATH environment variable
before running configure, or make sure that the virtual environment is using
the latest version of python. Usually, this will not be necessary.
For example, if using conda,
$ conda activate <desired environment name>
$ ./configure
$ make -j 2 -C build/cmake install
After a build completes successfully, the shared object should be in the lib
subdirectory of the install directory as libchmm.so or libchmm.dylib.
By default, pycharmm will use this library.
To install pycharmm, Python and the Python package installer pip must be
present. Please see Python documentation for the basic procedures to setup and
install Python.
At run time, it is possible to use a libchmm.so or libchmm.dylib diffrent from
the default by setting the environment variable CHARMM_LIB_DIR
to the path of the desired CHARMM shared object. However,
under ordinary circumstances, setting CHARMM_LIB_DIR is unnecessary.
For example,
bash shell: export CHARMM_LIB_DIR=/usr/local/charmm/lib
csh shell: setenv CHARMM_LIB_DIR /usr/local/charmm/lib
If the python package pdoc is installed in the active environment at
configure time, html documentation will be produced and installed in
the install prefix under the subdirectory html_doc/pycharmm.
BUILDING CHARMM AND INSTALLING PYCHARMM
===========================================
There are two steps to setup pycharmm and CHARMM for use in Python programming.
The first step is to build CHARMM as a shared object. Next, pycharmm must be
installed as a python package using pip.
To interface with pycharmm, CHARMM is built as shared object. To access
the pycharmm pip package. If the necessary prerequisits are present, CMake
will automatically install the pycharmm pip package. CMake will check for a
working python interpreter and use this python to install the pycharmm package.
Be sure to activate the appropriate virtual environment before running the
configure script.
If the CMake output from the configure script indicates the wrong python
interpreter, try putting the correct one first in the PATH environment variable
before running configure, or make sure that the virtual environment is using
the latest version of python. Usually, this will not be necessary.
For example, if using conda,
$ conda activate <desired environment name>
$ ./configure
$ make -j 2 -C build/cmake install
After a build completes successfully, the shared object should be in the lib
subdirectory of the install directory as libchmm.so or libchmm.dylib.
By default, pycharmm will use this library.
To install pycharmm, Python and the Python package installer pip must be
present. Please see Python documentation for the basic procedures to setup and
install Python.
At run time, it is possible to use a libchmm.so or libchmm.dylib diffrent from
the default by setting the environment variable CHARMM_LIB_DIR
to the path of the desired CHARMM shared object. However,
under ordinary circumstances, setting CHARMM_LIB_DIR is unnecessary.
For example,
bash shell: export CHARMM_LIB_DIR=/usr/local/charmm/lib
csh shell: setenv CHARMM_LIB_DIR /usr/local/charmm/lib
If the python package pdoc is installed in the active environment at
configure time, html documentation will be produced and installed in
the install prefix under the subdirectory html_doc/pycharmm.
Top
USE
===
In a python interpreter or script, pycharmm modules must be loaded.
In most cases, for each CHARMM command, there is a corresponding Python module
containing a set of functions to do the task of the original command
but from the Python environment.
For example, to do an energy calculation, a portion of a script might look like the
following.
#!/bin/env python3
import os
import sys
try:
charmm_data_dir = os.environ['CHARMM_DATA_DIR']
except KeyError:
print('please set environment variable CHARMM_DATA_DIR',
file=sys.stderr)
sys.exit(1)
from pycharmm import *
rtf_fn = charmm_data_dir + '/top_all36_prot.rtf'
read.rtf(rtf_fn)
prm_fn = charmm_data_dir + '/par_all36_prot.prm'
read.prm(prm_fn, flex=True)
energy.show()
USE
===
In a python interpreter or script, pycharmm modules must be loaded.
In most cases, for each CHARMM command, there is a corresponding Python module
containing a set of functions to do the task of the original command
but from the Python environment.
For example, to do an energy calculation, a portion of a script might look like the
following.
#!/bin/env python3
import os
import sys
try:
charmm_data_dir = os.environ['CHARMM_DATA_DIR']
except KeyError:
print('please set environment variable CHARMM_DATA_DIR',
file=sys.stderr)
sys.exit(1)
from pycharmm import *
rtf_fn = charmm_data_dir + '/top_all36_prot.rtf'
read.rtf(rtf_fn)
prm_fn = charmm_data_dir + '/par_all36_prot.prm'
read.prm(prm_fn, flex=True)
energy.show()
Top
Examples
========
In the tool/pycharmm/tests directory, there is an example script aldidpep_build.inp
written in traditional CHARMM commands that has been ported to Python as aldidpep_build.py.
This pair of files serves as an extended example of using pycharmm.
Examples
========
In the tool/pycharmm/tests directory, there is an example script aldidpep_build.inp
written in traditional CHARMM commands that has been ported to Python as aldidpep_build.py.
This pair of files serves as an extended example of using pycharmm.