<html><head><meta http-equiv="Content-Type" content="text/html charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="">Hi Jiying,<div class=""><span class="Apple-tab-span" style="white-space:pre"> </span>This is kind of a bug and kind of a feature. Chimera remembers the adjustments made with the “adjust angle” command so that if you adjust the same angle several times, they are consistent in direction/magnitude. However if you adjust the angle without using the “adjust angle” command (e.g. via mcopy), then the remembered adjustments are no longer in sync and you get the weird results you’re seeing.</div><div class=""><span class="Apple-tab-span" style="white-space:pre"> </span>So, the easiest way for you to get the outcome you want is to instead of using mcopy, revert to the old angle simply by using “adjust angle” with the old value.</div><div class=""><br class=""></div><div class="">—Eric</div><div class=""><br class=""><div class="">
<div style="color: rgb(0, 0, 0); letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><div class=""><span class="Apple-tab-span" style="white-space: pre;"> </span>Eric Pettersen</div><div class=""><span class="Apple-tab-span" style="white-space: pre;"> </span>UCSF Computer Graphics Lab</div></div><br class="Apple-interchange-newline">
</div>
<br class=""><div><blockquote type="cite" class=""><div class="">On Nov 23, 2016, at 9:51 AM, Jiying Jia <<a href="mailto:jiajiyingxibei@gmail.com" class="">jiajiyingxibei@gmail.com</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><div dir="ltr" class="">Hi,<div class="">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 class="">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 class="">I hope anyone can solve my problem..</div><div class="">Below is the python script and init.mol2.</div><div class=""><br class=""></div><div class="">PYTHON SCRIPT:</div><div class=""><div class="">import os</div><div class="">import time</div><div class="">import chimera</div><div class="">import random</div><div class="">from chimera import runCommand as rc</div><div class="">from chimera.tkgui import saveReplyLog</div><div class="">import MoleculeTransform</div><div class="">from MoleculeTransform import transform_atom_coordinates</div><div class="">import numpy as np</div><div class="">import sys</div><div class="">import re</div><div class="">#open initial conformation init.mol2</div><div class="">opened = chimera.openModels.open("init.mol2")# opened as model 0 in chimera</div><div class="">chimera.openModels.open("init.mol2") # opened as model 1 in chimera, used to store old conformation in monte carlo simulation</div><div class="">rho = opened[0]</div><div class="">print "angleold anglenew angle_after_adjust"</div><div class="">for pdbi in range(0,20):</div><div class=""><span class="gmail-Apple-tab-span" style="white-space:pre"> </span>random_atom = 1</div><div class=""><span class="gmail-Apple-tab-span" style="white-space:pre"> </span>an0 = rho.atoms[random_atom-1]</div><div class=""><span class="gmail-Apple-tab-span" style="white-space:pre"> </span>an1 = rho.atoms[random_atom]</div><div class=""><span class="gmail-Apple-tab-span" style="white-space:pre"> </span>an2 = rho.atoms[random_atom+1]</div><div class=""><span class="gmail-Apple-tab-span" style="white-space:pre"> </span>angleold = chimera.angle(an0.xformCoord(),an1.xformCoord(),an2.xformCoord())</div><div class=""><span class="gmail-Apple-tab-span" style="white-space:pre"> </span>anglenew = random.random()*180</div><div class=""><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 class=""><span class="gmail-Apple-tab-span" style="white-space:pre"> </span>angleafter = chimera.angle(an0.xformCoord(),an1.xformCoord(),an2.xformCoord())</div><div class=""><span class="gmail-Apple-tab-span" style="white-space:pre"> </span>print str(angleold)+" "+str(anglenew)+" "+str(angleafter)</div><div class=""><span class="gmail-Apple-tab-span" style="white-space:pre"> </span>if anglenew>angleold:</div><div class=""><span class="gmail-Apple-tab-span" style="white-space:pre"> </span>rc("mcopy #0 #1 settings x")</div><div class=""><span class="gmail-Apple-tab-span" style="white-space:pre"> </span>else:</div><div class=""><span class="gmail-Apple-tab-span" style="white-space:pre"> </span>rc("mcopy #1 #0 settings x")</div><div class="">rc("close all")</div><div class="">rc("stop now")</div></div><div class=""><br class=""></div><div class=""><br class=""></div><div class="">INIT.MOL2:</div><div class=""><div class="">@<TRIPOS>MOLECULE</div><div class="">init.mol2</div><div class="">3 2 3 0 0</div><div class="">NUCLEIC_ACID</div><div class="">NO_CHARGES</div><div class=""><br class=""></div><div class=""><br class=""></div><div class="">@<TRIPOS>ATOM</div><div class=""> 1 C 1.7324 -0.5083 0.8663 C.3 1 DA 0.0000</div><div class=""> 2 C -0.6180 0.4940 -0.0060 C.3 2 DA 0.0000</div><div class=""> 3 C 1.2450 0.9460 1.8950 C.3 3 DA 0.0000</div><div class="">@<TRIPOS>BOND</div><div class=""> 1 1 2 1</div><div class=""> 2 2 3 1</div><div class="">@<TRIPOS>SUBSTRUCTURE</div><div class=""> 1 DA 1 RESIDUE 4 A DA 1 ROOT</div><div class=""> 2 DA 2 RESIDUE 4 A DA 2</div><div class=""> 3 DA 3 RESIDUE 4 A DA 1</div></div><div class=""><div class=""><div class="gmail_signature"><div dir="ltr" class=""><div class=""><div dir="ltr" class=""></div></div></div></div></div>
</div></div>
_______________________________________________<br class="">Chimera-users mailing list: <a href="mailto:Chimera-users@cgl.ucsf.edu" class="">Chimera-users@cgl.ucsf.edu</a><br class="">Manage subscription: <a href="http://plato.cgl.ucsf.edu/mailman/listinfo/chimera-users" class="">http://plato.cgl.ucsf.edu/mailman/listinfo/chimera-users</a><br class=""></div></blockquote></div><br class=""></div></body></html>