<div dir="ltr"><div><div>
<span></span>
<p style="margin-bottom:0in;line-height:100%" align="justify"><font size="2">Dear
chimera lovers,</font></p><font size="2">
</font><p style="margin-bottom:0in;line-height:100%" align="justify">
</p><font size="2">
</font><p style="margin-bottom:0in;line-height:100%" align="justify"><font size="2">Good
day. I wrote a small script (pasted below) to monitor the dipole
vector of water molecules during MD. The script was adopted based available example.</font></p>
<p style="margin-bottom:0in;line-height:100%" align="justify">
</p>
<p style="margin-bottom:0in;line-height:100%" align="justify"><font size="1">rc('close
#1-500')</font></p><p style="margin-bottom:0in;line-height:100%" align="justify"><font size="1">m =
chimera.openModels.list()[0]</font></p><font size="1">
</font><p style="margin-bottom:0in;line-height:100%" align="justify"><font size="1">wat
= m.residues[2449]</font></p><font size="1">
</font><p style="margin-bottom:0in;line-height:100%" align="justify"><font size="1">com
= Point([a.coord() for a in wat.atoms], [a.element.mass for a in
wat.atoms])</font></p><font size="1">
</font><p style="margin-bottom:0in;line-height:100%" align="justify">
</p><font size="1">
</font><p style="margin-bottom:0in;line-height:100%" align="justify"><font size="1">#
dipl = Vector() No working, Use numpy instead</font></p><font size="1">
</font><p style="margin-bottom:0in;line-height:100%" align="justify"><font size="1">dipl
= np.array( [0.0,0.0,0.0] )</font></p><font size="1">
</font><p style="margin-bottom:0in;line-height:100%" align="justify">
</p><font size="1">
</font><p style="margin-bottom:0in;line-height:100%" align="justify"><font size="1">for
atm in wat.atoms: <br></font></p><p style="margin-bottom:0in;line-height:100%" align="justify"><font size="1"> #dipl
+= atm.charge * atm.coord()</font></p><p style="margin-bottom:0in;line-height:100%" align="justify"><font size="1"> dipl
+= atm.charge * np.array( atm.coord().data() )</font></p><font size="1">
</font><p style="margin-bottom:0in;line-height:100%" align="justify"><font size="1"></font>
</p><font size="1">
</font><p style="margin-bottom:0in;line-height:100%" align="justify"><font size="1">vend
= np.array(com) + 5 * dipl</font></p><font size="1">
</font><p style="margin-bottom:0in;line-height:100%" align="justify"><font size="1">of =
open('current.bild','w')</font></p><font size="1">
</font><p style="margin-bottom:0in;line-height:100%" align="justify"><font size="1">of.write('.color
green\n')</font></p><font size="1">
</font><p style="margin-bottom:0in;line-height:100%" align="justify"><font size="1">of.write('.cone
%f %f %f %f %f %f 0.5 \n' %
(com.x,com.y,com.z,vend[0],vend[1],vend[2]))</font></p><font size="1">
</font><p style="margin-bottom:0in;line-height:100%" align="justify"><font size="1">of.close()</font></p><font size="1">
</font><p style="margin-bottom:0in;line-height:100%" align="justify"><font size="1">rc('open
current.bild')</font></p>
<p style="margin-bottom:0in;line-height:100%" align="justify">
</p>
<p style="margin-bottom:0in;line-height:100%" align="justify"><font size="2">Query
1)</font></p><font size="2">
</font><p style="margin-bottom:0in;line-height:100%" align="justify"><font size="2">The
following syntax given in a example doesnt work. What is the chimera point object indeed, an array or list ?. How
to do math operations on point object.</font></p><font size="2">
</font><p style="margin-bottom:0in;line-height:100%" align="justify"><font size="2"></font>
</p><font size="2">
</font><p style="margin-bottom:0in;line-height:100%" align="justify"><font size="2">
dipl += atm.charge * a.coord()
</font></p><font size="2">
</font><p style="margin-bottom:0in;line-height:100%" align="justify"><font size="2">Error:</font></p><font size="2">
</font><p style="margin-bottom:0in;line-height:100%" align="justify"><font size="2">TypeError:
unsupported operand type(s) for *: 'float' and '_chimera.Point'</font></p><font size="2">
</font><p style="margin-bottom:0in;line-height:100%" align="justify"><font size="2"></font>
</p><font size="2">
</font><p style="margin-bottom:0in;line-height:100%" align="justify"><font size="2">Query
2) In my example, I choose a specific water molecule by residue index. I am looking for some way to select the
water (or get list of water residues) that satisfy a selection on the fly, lets
say that water within 3 A from a prot. residue.
</font></p><font size="2">
</font><p style="margin-bottom:0in;line-height:100%" align="justify"><font size="2"></font>
</p><font size="2">
</font><p style="margin-bottom:0in;line-height:100%" align="justify"><font size="2">In
short, how to handle selections inside python script in chimera
framework. I tried to play with chimera.selections but I didnt
succeed. Any example could be of help.</font></p><font size="2">
</font><p style="margin-bottom:0in;line-height:100%" align="justify"><font size="2"></font>
</p><font size="2">
</font><p style="margin-bottom:0in;line-height:100%" align="justify"><font size="2">Query
3) Invoke data calculated out of chimera inside a perframe script.
</font></p><font size="2">
</font><p style="margin-bottom:0in;line-height:100%" align="justify"><font size="2"></font>
</p><font size="2">
</font><p style="margin-bottom:0in;line-height:100%" align="justify"><font size="2">If I have say 100 frames. I can do the dipole vector
calculation outside chimera and write separate “.bild” files,
1.bild, 2.bild, …..n.bild. Then inside the perframe script, I can
invoke a particular .bild fine corresponding to the frame no. Please
help me with an syntax example if this is possible.</font></p><font size="2">
</font><br></div>Thanks in advance,<br></div>Bala<br clear="all"><div><div><br>-- <br><div class="gmail_signature" data-smartmail="gmail_signature">C. Balasubramanian<br></div>
</div></div></div>