<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 Gordon,<div class=""><br class=""></div><div class=""> The Chimera mcopy command copies molecule colors, styles, visibility, position, atom coordinates...</div><div class=""><br class=""></div><div class=""><span class="Apple-tab-span" style="white-space:pre"> </span><a href="https://www.cgl.ucsf.edu/chimera/docs/UsersGuide/midas/mcopy.html" class="">https://www.cgl.ucsf.edu/chimera/docs/UsersGuide/midas/mcopy.html</a></div><div class=""><br class=""></div><div class="">and the equivalent Python function</div><div class=""><br class=""></div><div class=""><span class="Apple-tab-span" style="white-space:pre"> </span>from MoleculeCopy import molecule_copy</div><div class=""><span class="Apple-tab-span" style="white-space:pre"> </span>molecule_copy(from_atoms, to_atoms, settings = 'csv', matchResidues = True)</div><div class=""><br class=""></div><div class="">with code in</div><div class=""><br class=""></div><div class=""><span class="Apple-tab-span" style="white-space:pre"> </span>chimera/share/MoleculeCopy/mcopy.py</div><div class=""><br class=""></div><div class="">To use this in your Python script I suggest opening the new Tetr model before closing the old one. (You can open it with the same model id.) Then use molecule_copy() to copy the display attributes from the old molecule to the new one. The close the old molecule.</div><div class=""><br class=""></div><div class=""><span class="Apple-tab-span" style="white-space:pre"> </span>Tom</div><div class=""><br class=""></div><div class=""><br class=""></div><div class=""><br class=""><div><blockquote type="cite" class=""><div class="">On Feb 7, 2017, at 8:24 AM, Gordon Gibb wrote:</div><br class="Apple-interchange-newline"><div class=""><meta http-equiv="Content-Type" content="text/html charset=utf-8" class=""><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="">Dear developers,<div class=""><br class=""></div><div class="">I have been working on integrating Tetr (a command line tool to construct/modify molecular systems for use in computational chemistry codes such as CASTEP and CP2K - <a href="http://nms.kcl.ac.uk/lev.kantorovitch/codes/lev00/index.html" class="">http://nms.kcl.ac.uk/lev.kantorovitch/codes/lev00/index.html</a>) with Chimera. </div><div class=""><br class=""></div><div class="">To do this we have written a plugin to Chimera that runs an instance of Tetr in a console, with the user being able to type commands into Tetr. The aim is to have Chimera visualise the system being constructed in Tetr, and to update the visualisation based to changes made in Tetr. </div><div class=""><br class=""></div><div class="">At present whenever a command is send to Tetr (which in response to this command may re-write a file containing the molecular system), the plugin looks to see if this file has changed, and if so gets Chimera to reload this file and visualise it. As far as I can tell, there isn’t a ‘reload’ option in Chimera, so instead I close the model (saving its xform matrix first), then open the modified file, and set its xform matrix to restore the old viewing angle etc. For example:</div><div class=""><br class=""></div><div class=""><font face="Courier" class="">#save xform matrix and close model</font></div><div class=""><font face="Courier" class="">xf=model.openState.xform</font></div><div class=""><font face="Courier" class="">chimera.openModels.close(model)</font></div><div class=""><font face="Courier" class=""><br class=""></font></div><div class=""><font face="Courier" class="">#open updated file into model number baseId</font></div><div class=""><font face="Courier" class="">chimera.openModels.open(filename,baseId=baseId)</font></div><div class=""><font face="Courier" class=""><br class=""></font></div><div class=""><font face="Courier" class="">#retrieve model from the list of open models</font></div><div class=""><font face="Courier" class="">modlist=chimera.openModels.list()</font></div><div class=""><font face="Courier" class="">for mod in modlist:</font></div><div class=""><font face="Courier" class=""> if mod.id == baseId:</font></div><div class=""><font face="Courier" class=""> model=mod</font></div><div class=""><font face="Courier" class=""> break</font></div><div class=""><font face="Courier" class=""><br class=""></font></div><div class=""><font face="Courier" class="">#set the xform matrix</font></div><div class=""><font face="Courier" class="">model.openState.xform=xf</font></div><div class=""><br class=""></div><div class="">What I was wondering was 1) if this is a sensible way to go about things, and 2) if there is a way to retrieve and store visualisation information such as displaying the molecule as ball and stick, wireframe etc such that this can be re-applied to the newly opened model, since at present any visualisation information is not retained when re-opening a file.</div><div class=""><br class=""></div><div class="">Thanks in advance,</div><div class=""><br class=""></div><div class="">Gordon</div><div class=""><br class=""></div><div class=""> </div><div class=""><div class="">
<div style="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="">-----------------------------------------------</div><div class="">Dr Gordon P S Gibb</div><div class="">EPCC, The University of Edinburgh</div></div><br class="Apple-interchange-newline"><br class="Apple-interchange-newline">
</div>
<br class=""></div></div>The University of Edinburgh is a charitable body, registered in<br class="">Scotland, with registration number SC005336.<br class="">_______________________________________________<br class="">Chimera-dev mailing list<br class=""><a href="mailto:Chimera-dev@cgl.ucsf.edu" class="">Chimera-dev@cgl.ucsf.edu</a><br class="">http://plato.cgl.ucsf.edu/mailman/listinfo/chimera-dev<br class=""></div></blockquote></div><br class=""></div></body></html>