PyCHARMM.CharmmWrapper
index
/home/aurelien/workspace/pycharmm/src/PyCHARMM/CharmmWrapper.py

Created on Jul 11, 2009
 
@author: aurelien

 
Modules
       
PyCHARMM
os
re
sys
threading
time

 
Classes
       
threading.Thread(threading._Verbose)
CharmmWrapper
StreamGobbler
OutStreamGobbler

 
class CharmmWrapper(threading.Thread)
    Provides access to an instance of CHARMM. The CharmmWrapper is able to launch and
pilot an instance of CHARMM through the stdin, stdout and stderr of the latter. It
allows a seamless integration of CHARMM operations in Python pipelines, and also
simplifies the CHARMM syntax by trying to guess what should be done. More details are
given for each method.
 
 
Method resolution order:
CharmmWrapper
threading.Thread
threading._Verbose
__builtin__.object

Methods defined here:
appendPar(self, parFilename)
Appends the desired parameter file to the current parameters.
appendPdb(self, pdbFilename, segid=None, offset=None)
Read the desired PDB file. If omitted, SEGID and OFFSET
are automagically handeld. The SEGID is set to the first part
of the file name (before the first dot).
appendRtf(self, rtfFilename)
Appends the desired topology file to the current topologies.
autoStart(self, charmmBinary=None, charmmTopology=None, charmmParameters=None, inputFilename='charmm.inp', outputFilename='charmm.out')
Starts a CHARMM instance, from user parameters. Every parameters can be omitted.
If so, the CharmmWrapper is able to initialize a CHARMM instance from environment
variables pointing to CHARMM binary (CHARMMBINARY), CHARMM topology (CHARMMTOPOLOGY)
and CHARMM parameter (CHARMMPARAMETERS). Extra parameter (*.par)  and topology files
(*.rtf) in the current directory are also automatically loaded, as well as the PSF
file (if present), and all CRD files.
The CHARMM input stream will be dumped in ./charmm.inp and the corresponding output
stream in ./charmm.out.
executeAndForget(self, cmd)
Executes the specified CHARMM command.
executeAndKeep(self, cmd)
Executes the specified CHARMM command. Once called, its output can be
retrieved using either the getResultAsArray() or getResultAsString()
methods.
getCCAsArray(self, set='', selection='ALL')
Returns the cartesian coordinates of the specified selection/set as a list
getCCAsString(self, set='', selection='ALL')
Returns the cartesian coordinates of the specified selection/set as a string.
getResultAsArray(self)
Returns the CHARMM output generated by the last executeAndKeep()
call, as an array of string.
getResultAsString(self)
Returns the CHARMM output generated by the last executeAndKeep()
call, as a string.
initialize(self, title_p, bomLev=-1, topologyFilename=None, parameterFilename=None)
Sets the title for the current CHARMM session, the BOMLEV, and load toology
and parameter files. Automatically handeled by the autoStart() method.
loadCrd(self, crdFilename)
Loads a CRD file
loadPar(self, parFilename)
Loads the desired parameter file.
loadPsf(self, psfFilename)
Loads a PSF file.
loadRtf(self, rtfFilename)
Loads the desired topology file.
setCC(self, cc, set='')
Sets the cartesian coordinates of the specified set.
setTitle(self, title_p)
Sets a title for the current CHARMM session. Automatically handeled by the
autoStart() method.
start(self, charmmBinary, inputFilename, outputFilename)
Starts an instance of CHARMM binary, dumping its input the file
inputFilename and its output in outputFilename. It is probably more
convenient to use the autoStart() wrapper.
stop(self)
Stops the CHARMM instance
sync(self)
Force synchronisation between the CHARMM instance and the CharmmWrapper.
It must be called to make sure that CHARMM has finished all the operations
that have been asked for. Otherwise, it may sleep until a sufficient number of
commands have been issued, then start over, which is not a problem 99.99%
of the time. The method executeAndKeep() and stop() force this synchronisation
implicitely.
test(self)
Test method: launch autoStart() without parameters, calculated energy,
call "COOR STAT" on all the system, and print the corresponding output.
writeCrd(self, crdFilename, charmmSelection='ALL')
Writes a crd file
writePdb(self, pdbFilename, charmmSelection='ALL')
Writes PDB file for the desired selection.
writePsf(self, psfFilename)
Writes a PSF file

Data and other attributes defined here:
startTag = 'WRAPPERSTART'
stopTag = 'WRAPPERSTOP'

Methods inherited from threading.Thread:
__init__(self, group=None, target=None, name=None, args=(), kwargs=None, verbose=None)
__repr__(self)
getName(self)
isAlive(self)
isDaemon(self)
is_alive = isAlive(self)
join(self, timeout=None)
run(self)
setDaemon(self, daemonic)
setName(self, name)

Data descriptors inherited from threading.Thread:
daemon
ident
name

Data descriptors inherited from threading._Verbose:
__dict__
dictionary for instance variables (if defined)
__weakref__
list of weak references to the object (if defined)

 
class OutStreamGobbler(StreamGobbler)
    Read and manage the standard out of CHARMM.
Management includes
- the return of CHARMM output to CharmmWrapper
- the monitoring of WARNINGS (that are printed out),
- the dump of the output of CHARMM to a file
 
 
Method resolution order:
OutStreamGobbler
StreamGobbler
threading.Thread
threading._Verbose
__builtin__.object

Methods defined here:
__init__(self, stream_p, startTag_p, stopTag_p, mainThreadCondition_p, outputFilename)
getValue(self)
run(self)

Methods inherited from threading.Thread:
__repr__(self)
getName(self)
isAlive(self)
isDaemon(self)
is_alive = isAlive(self)
join(self, timeout=None)
setDaemon(self, daemonic)
setName(self, name)
start(self)

Data descriptors inherited from threading.Thread:
daemon
ident
name

Data descriptors inherited from threading._Verbose:
__dict__
dictionary for instance variables (if defined)
__weakref__
list of weak references to the object (if defined)

 
class StreamGobbler(threading.Thread)
    Read a stream and print its output
 
 
Method resolution order:
StreamGobbler
threading.Thread
threading._Verbose
__builtin__.object

Methods defined here:
__init__(self, stream_p)
run(self)

Methods inherited from threading.Thread:
__repr__(self)
getName(self)
isAlive(self)
isDaemon(self)
is_alive = isAlive(self)
join(self, timeout=None)
setDaemon(self, daemonic)
setName(self, name)
start(self)

Data descriptors inherited from threading.Thread:
daemon
ident
name

Data descriptors inherited from threading._Verbose:
__dict__
dictionary for instance variables (if defined)
__weakref__
list of weak references to the object (if defined)

 
Data
        PIPE = -1
STDOUT = -2