[Chimera-users] Python code problem

Mahendra B Thapa thapamb at mail.uc.edu
Fri May 29 06:37:23 PDT 2015


Dear Chimera users,

                        The command I used was
                         chimera --nogui test.py
I tried two codes (following previous posts and tutorials in chimera) in
'test.py' as follows

(i)
import os
from chimera import runCommand as rc
from chimera import replyobj
rc("open " + 'test.pdb')
for i in [2011,2420]:
rc("""distance #0.2:2010.B at CB #0.1:%d.B at CB""" %i)

*This code gave the result as expected*:
Executing test.py...
Opening test.pdb...
60 models opened
Distance between #0.2:2010.B at CB and #0.1:2011.B at CB: 72.346
Distance between #0.2:2010.B at CB and #0.1:2420.B at CB: 92.979
Executed test.py

(ii)
import os
from chimera import runCommand as rc
from chimera import replyobj
rc("open " + 'test.pdb')
for i in range(2011,2420):
rc("""distance #0.2:2010.B at CB #0.1:%d.B at CB""" %i)

*This code gave the result as*
'  You selected %d.' % numSelected)
MidasError: Exactly two atoms/axes/planes must be selected.  You selected 1.
Error while processing test.py:
MidasError: Exactly two atoms/axes/planes must be selected.  You selected 1.

  File "/opt/UCSF/Chimera64-1.5.3/share/Midas/__init__.py", line 1266, in
distance
    '  You selected %d.' % numSelected)

What could be the error this code? Only difference between two codes is:
"for
* i in [2011,2420]:"  &  "for i in range(2011,2420):"*
That is, I am interested to use range operator in 2nd case instead of two
values as in the 1st case.

Thank you for help,
Mahendra Thapa
University of Cincinnati,OH
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://plato.cgl.ucsf.edu/pipermail/chimera-users/attachments/20150529/b3f7feb4/attachment.html>


More information about the Chimera-users mailing list