Control VMD from Python


In [1]:
%qtconsole

In [5]:
#set the pathway to find modules
import sys
sys.path.append('/home/chen/Downloads/pizza-11Sep13/src')

In [10]:
#import module for vmd
import vmd

In [12]:
vmd??

In [13]:
vmd.vmd()


Out[13]:
<vmd.vmd instance at 0x3204710>

In [25]:
v.stop()


---------------------------------------------------------------------------
EOF                                       Traceback (most recent call last)
<ipython-input-25-51de77bc4ffd> in <module>()
----> 1 v.stop()

/home/chen/Downloads/pizza-11Sep13/src/vmd.pyc in stop(self)
    110   # exit VMD
    111   def stop(self):
--> 112     self.__call__("quit")
    113     del self.VMD
    114 

/home/chen/Downloads/pizza-11Sep13/src/vmd.pyc in __call__(self, command)
    102     if self.VMD.isalive():
    103       self.VMD.sendline(command)
--> 104       self.VMD.expect('vmd >')
    105       if self.debugme:
    106         print "call+result:"+self.VMD.before

/usr/lib/python2.7/site-packages/pexpect.pyc in expect(self, pattern, timeout, searchwindowsize)
   1309 
   1310         compiled_pattern_list = self.compile_pattern_list(pattern)
-> 1311         return self.expect_list(compiled_pattern_list, timeout, searchwindowsize)
   1312 
   1313     def expect_list(self, pattern_list, timeout = -1, searchwindowsize = -1):

/usr/lib/python2.7/site-packages/pexpect.pyc in expect_list(self, pattern_list, timeout, searchwindowsize)
   1323         self.searchwindowsize value is used. """
   1324 
-> 1325         return self.expect_loop(searcher_re(pattern_list), timeout, searchwindowsize)
   1326 
   1327     def expect_exact(self, pattern_list, timeout = -1, searchwindowsize = -1):

/usr/lib/python2.7/site-packages/pexpect.pyc in expect_loop(self, searcher, timeout, searchwindowsize)
   1394                 self.match = None
   1395                 self.match_index = None
-> 1396                 raise EOF (str(e) + '\n' + str(self))
   1397         except TIMEOUT, e:
   1398             self.buffer = incoming

EOF: End Of File (EOF) in read_nonblocking(). Exception style platform.
<pexpect.spawn object at 0x31fc710>
version: 2.3 ($Revision: 399 $)
command: /usr/local/lib/vmd/vmd_LINUX
args: ['/usr/local/lib/vmd/vmd_LINUX']
searcher: searcher_re:
    0: re.compile("vmd >")
buffer (last 100 chars): 
before (last 100 chars):  quit
Info) VMD for LINUXAMD64, version 1.9.1 (February 1, 2012)
Info) Exiting normally.

after: <class 'pexpect.EOF'>
match: None
match_index: None
exitstatus: None
flag_eof: True
pid: 2369
child_fd: 51
closed: False
timeout: 30
delimiter: <class 'pexpect.EOF'>
logfile: None
logfile_read: None
logfile_send: None
maxread: 2000
ignorecase: False
searchwindowsize: None
delaybeforesend: 0.05
delayafterclose: 0.1
delayafterterminate: 0.1

In [ ]: