<div dir="ltr">Hi,<div>I want to use python script to adjust the bond angle randomly and only accept the case if the random new angle is larger than old one. </div><div>I use "mcopy" to recover the old angle if the new is smaller. But I encounter a problem: if I use "mcopy #old #new setting a" or "x" or "y", the after "adjust angle anglenew" command, the angle adjusted is not the anglenew, but a different one. I don't know why. </div><div>I hope anyone can solve my problem..</div><div>Below is the python script and init.mol2.</div><div><br></div><div>PYTHON SCRIPT:</div><div><div>import os</div><div>import time</div><div>import chimera</div><div>import random</div><div>from chimera import runCommand as rc</div><div>from chimera.tkgui import saveReplyLog</div><div>import MoleculeTransform</div><div>from MoleculeTransform import transform_atom_coordinates</div><div>import numpy as np</div><div>import sys</div><div>import re</div><div>#open initial conformation init.mol2</div><div>opened = chimera.openModels.open("init.mol2")# opened as model 0 in chimera</div><div>chimera.openModels.open("init.mol2") # opened as model 1 in chimera, used to store old conformation in monte carlo simulation</div><div>rho = opened[0]</div><div>print "angleold anglenew angle_after_adjust"</div><div>for pdbi in range(0,20):</div><div><span class="gmail-Apple-tab-span" style="white-space:pre"> </span>random_atom = 1</div><div><span class="gmail-Apple-tab-span" style="white-space:pre"> </span>an0 = rho.atoms[random_atom-1]</div><div><span class="gmail-Apple-tab-span" style="white-space:pre"> </span>an1 = rho.atoms[random_atom]</div><div><span class="gmail-Apple-tab-span" style="white-space:pre"> </span>an2 = rho.atoms[random_atom+1]</div><div><span class="gmail-Apple-tab-span" style="white-space:pre"> </span>angleold = chimera.angle(an0.xformCoord(),an1.xformCoord(),an2.xformCoord())</div><div><span class="gmail-Apple-tab-span" style="white-space:pre"> </span>anglenew = random.random()*180</div><div><span class="gmail-Apple-tab-span" style="white-space:pre"> </span>rc("adjust angle %f %s %s %s"%(anglenew,an0.oslIdent(),an1.oslIdent(),an2.oslIdent()))</div><div><span class="gmail-Apple-tab-span" style="white-space:pre"> </span>angleafter = chimera.angle(an0.xformCoord(),an1.xformCoord(),an2.xformCoord())</div><div><span class="gmail-Apple-tab-span" style="white-space:pre"> </span>print str(angleold)+" "+str(anglenew)+" "+str(angleafter)</div><div><span class="gmail-Apple-tab-span" style="white-space:pre"> </span>if anglenew>angleold:</div><div><span class="gmail-Apple-tab-span" style="white-space:pre"> </span>rc("mcopy #0 #1 settings x")</div><div><span class="gmail-Apple-tab-span" style="white-space:pre"> </span>else:</div><div><span class="gmail-Apple-tab-span" style="white-space:pre"> </span>rc("mcopy #1 #0 settings x")</div><div>rc("close all")</div><div>rc("stop now")</div></div><div><br></div><div><br></div><div>INIT.MOL2:</div><div><div>@<TRIPOS>MOLECULE</div><div>init.mol2</div><div>3 2 3 0 0</div><div>NUCLEIC_ACID</div><div>NO_CHARGES</div><div><br></div><div><br></div><div>@<TRIPOS>ATOM</div><div> 1 C 1.7324 -0.5083 0.8663 C.3 1 DA 0.0000</div><div> 2 C -0.6180 0.4940 -0.0060 C.3 2 DA 0.0000</div><div> 3 C 1.2450 0.9460 1.8950 C.3 3 DA 0.0000</div><div>@<TRIPOS>BOND</div><div> 1 1 2 1</div><div> 2 2 3 1</div><div>@<TRIPOS>SUBSTRUCTURE</div><div> 1 DA 1 RESIDUE 4 A DA 1 ROOT</div><div> 2 DA 2 RESIDUE 4 A DA 2</div><div> 3 DA 3 RESIDUE 4 A DA 1</div></div><div><div><div class="gmail_signature"><div dir="ltr"><div><div dir="ltr"></div></div></div></div></div>
</div></div>