<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 Lianheng,<div class=""><span class="Apple-tab-span" style="white-space:pre"> </span>One of our design goals for Chimera was to enable the development of extension for third parties, so obviously we’d be happy if you made an extension for running CP2K via Chimera. I believe all the capabilities you outline are available in Chimera.</div><div class=""><span class="Apple-tab-span" style="white-space:pre"> </span>The first thing I’d do if I were you is to look at the Chimera Programmer’s Guide, particularly the Examples. They <i class="">don’t</i> have enough detail to get you completely going, but they do cover the basic concepts of how things work under the hood in Chimera. Links:</div><div class=""><br class=""></div><div class=""><a href="http://www.cgl.ucsf.edu/chimera/docs/ProgrammersGuide/index.html" class="">http://www.cgl.ucsf.edu/chimera/docs/ProgrammersGuide/index.html</a></div><div class=""><a href="http://www.cgl.ucsf.edu/chimera/docs/ProgrammersGuide/Examples/index.html" class="">http://www.cgl.ucsf.edu/chimera/docs/ProgrammersGuide/Examples/index.html</a></div><div class=""><br class=""></div><div class=""><span class="Apple-tab-span" style="white-space:pre"> </span>The next thing would be to look at a couple of extensions that do things along the lines of what you want to do. The ones that come to my mind are the tools in the “Amber” tools category (Add Ions, Solvate, Write Prmtop) that present some kind of interface to the user and, based on the interface settings, deliver commands to various Amber executables on the back end, forward the text output of the commands to the reply log, and open the output files (for Solvate and Add Ions) and present their structures in the graphics window.</div><div class=""><span class="Apple-tab-span" style="white-space:pre"> </span>The code for these extensions are in <your Chimera app>/share/tool-name, so tool-name is either Solvate, WritePrmtop, or Addions. As detailed the Programmer’s Guide, each of these directories have a ChimeraExtension.py file, which contains code to tell Chimera where to put the tool in the Tools menu, and optionally what command to add for the tool, what file types it’s a reader for, and what button to add to the Model Panel for it. These tools put their non-GUI code into __init__.py and their GUI code in gui.py. This segregation makes it easier to offer a command version of the tool. To see how the tool drives the backend executable look at __init__.py for Solvate for example, in particular the initiateSolvate function. In general terms, that routine writes the input files that will be read by Amber’s <i class="">sleap</i> executable, forms the sleap command it wants to send, use’s Python’s subprocess.Popen to run the command, send the input command, and collect the output. As the command executes, it’s output is forwarded line by line to both the status line and the reply log. The routine then checks for the existence of the expected output file and raises an error if it’s missing. Otherwise it goes ahead and processes the file. The processing is pretty complicated as it tries to find the correspondences between the input, which has solvent added, and the original structure and I recommend you ignore that part of the code!</div><div class=""><span class="Apple-tab-span" style="white-space:pre"> </span>It’s not 100% clear from your mail if your desired expected interaction between Chimera and CP2K fits into this scheme of one-shot (or series of one-shot) executions of CP2K, or if you were thinking of some kind of “stateful” execution where Chimera stays in continuous communication with one instance of CP2K. The latter is also possible but in the interests of not turning this mail into a George R.R. Martin novel, I'll cover that if you ask about it. :-)</div><div class=""><span class="Apple-tab-span" style="white-space:pre"> </span>One of the points in your mail was getting info about what’s selected. It’s reasonably simple:</div><div class=""><br class=""></div><div class="">from chimera.selection import currentAtoms</div><div class="">selAtoms = currentAtoms()</div><div class=""><br class=""></div><div class="">There are various attributes of Atom you may be interested in, such as name, element, residue, coord() and/or xformCoord(), and attributes of Residue such as type, id.position, id.chainId, id.insertionCode. You may want to use help() on these classes (chimera.Atom, chimera.Residue) in the Python shell (Tools->General Controls->IDLE) to get more extensive info.</div><div class=""><span class="Apple-tab-span" style="white-space:pre"> </span>Lastly, asking on this mailing list is probably the quickest way to get turnaround on problems you run into. We’re happy to help!</div><div class=""><br class=""></div><div class="">—Eric</div><div class=""><span class="Apple-tab-span" style="white-space:pre"> </span><br class=""><div apple-content-edited="true" 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 class=""><br class=""></div></div>
</div>
<br class=""><div><blockquote type="cite" class=""><div class="">On Oct 21, 2015, at 5:36 AM, Lianheng Tong <<a href="mailto:lianheng.tong@kcl.ac.uk" class="">lianheng.tong@kcl.ac.uk</a>> 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=""><div class="">Dear Chimera developers,</div><div class=""><br class=""></div><div class="">I am a postdoc research associate working with Prof. Lev Kantorovich of King’s College London. I am currently a full time developer for the ab initio atomic simulation code CP2K, and as a part of our project funding, we are looking to develop a tool kit that would improve user friendliness that would allow the users to construct various bulk or molecular structures in an intuitive and graphically way.</div><div class=""><br class=""></div><div class="">We currently have a quite extensive tool-kit (tetr) developed by Prof. Kantorovich for generating, modifying structures—especially tailored for periodic systems, as well as post processing utilities on volume data (such as generating STM images etc). It is written in FORTRAN, and currently is command based only, with the user input being either interactive or by a batch file. The goal, is to be able to link to a visualisation package like Chimera, so that: </div><div class=""><br class=""></div><div class="">a) one is able to automatically update the visualisation when the user uses the tool interactively</div><div class="">b) allow the user to select atoms and fragments and use these selections as an input to the tool-kit.</div><div class=""><br class=""></div><div class="">Ideally, the took-kit can run as an independent code, with the extension providing an interface between Chimera and the tool-kit. The user would then control the tool-kit from within the Chimera command interface.</div><div class=""><br class=""></div><div class="">I have used Chimera a lot during my PhD, however, I have not yet written any extension for it. I do, however, have quite a number of years experiences with code development, especially in Fortran and in Python. I am wondering:</div><div class=""><br class=""></div><div class="">1) If you would mind if we develop an extension to link our took-kit with Chimera</div><div class="">2) If the functionalities I mentioned above would be possible to achieve</div><div class=""><br class=""></div><div class="">Any suggestions from you would be great. Thank you very much for your time, and I look forward to hearing from you soon.</div><div class=""><br class=""></div><div class="">Best regards,</div><div class=""><br class=""></div><div class="">Lianheng</div><div class=""><br class=""></div><div apple-content-edited="true" class="">
<span class="Apple-style-span" style="border-collapse: separate; border-spacing: 0px;"><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><span class="Apple-style-span" style="border-collapse: separate; font-family: Helvetica; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; border-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-stroke-width: 0px;"><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><span class="Apple-style-span" style="border-collapse: separate; font-family: Helvetica; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; border-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-stroke-width: 0px;"><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><span class="Apple-style-span" style="border-collapse: separate; font-family: Helvetica; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; border-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-stroke-width: 0px;"><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><span class="Apple-style-span" style="border-collapse: separate; font-family: Helvetica; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; border-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-stroke-width: 0px;"><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><span class="Apple-style-span" style="border-collapse: separate; font-family: Helvetica; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; border-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-stroke-width: 0px;"><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><span class="Apple-style-span" style="border-collapse: separate; font-family: Helvetica; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; border-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-stroke-width: 0px;"><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><span class="Apple-style-span" style="border-collapse: separate; font-family: Helvetica; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; border-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-stroke-width: 0px;"><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><span class="Apple-style-span" style="border-collapse: separate; font-family: Helvetica; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; border-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-stroke-width: 0px;"><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><div class=""><div class="">====================================</div><div class="">Lianheng Tong</div><div class="">Room S4.02, Strand Building</div><div class="">Department of Physics</div><div class="">Kings College London</div><div class="">Strand, London WC2R 2LS, U.K.</div><div class="">Tel: +44 20 7848 2064</div><div class="">Fax: +44 20 7848 2420</div><div class=""><a href="mailto:lianheng.tong@kcl.ac.uk" class="">lianheng.tong@kcl.ac.uk</a></div><div class="">====================================</div></div></div></span></div></span></div></span></div></span></div></span></div></span></div></span></div></span></div></span>
</div>
<br class=""></div>_______________________________________________<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>