Hi,<br><br>I added a little bit wrapper code to easily access the atom information in tpx. I attached the version. It is backward compatible and allows:<br>f = tpxfile("test/topol.tpr")<br>#iterate over atoms<br>
for a in f:<br> print a.x[0],a.x[1],a.x[2],a.m,a.atomname,a.atomtype,a.type,a.resname,a.q,a.chain,a.radius<br>#you can also access atoms by index<br>print f[9].m #mass just as example<br><br>It would be great if you could put your code under some open source license. And a software repository would be great too (so we don't have to send around tgz files) ;-).<br>
<br>Answers to your points below.<br><br><div class="gmail_quote">On Sun, Mar 29, 2009 at 7:14 AM, Martin Höfling <span dir="ltr"><<a href="mailto:martin.hoefling@gmx.de">martin.hoefling@gmx.de</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">Am Samstag, den 28.03.2009, 17:55 -0400 schrieb Roland Schulz<div class="im"><br>
<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
I would be interested in collaborating in extending it to make it<br>
pytonic by e.g. creating classes , writing iterators, and converting<br>
all c data structures into best fitting NumPy/Python data structure,<br>
writing __str__ methods, raising exceptions instead of returning<br>
errorcode,...<br>
<br>
I think this can be done pretty quickly because the number of function<br>
which make sense to export is not that large.<br>
<br>
Is someone else interested in that?<br>
</blockquote>
<br></div>
Besides me - Daniel Seeliger who wrote pymacs might be. He also has more<br>
expertise in writing ugly c-wrappers for python objects. I only did it<br>
the ctypes way so far and numpy is a different story...</blockquote><div><br>I'm open to Daniel's library approach. My atom wrapper can be easily also used for a c-wrapper. I just thing ctypes is most convenient. <br>
<br></div><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Apart from that, the embedding of a python interpreter into mdrun would be very interesting, which actually shouldn't be too hard.<br>
<br>
then start mdrun with something like:<br>
<br>
mpirun -np 64 mdrun_mpi -v -npy 10000 -py do_nasty_things_in_python.py<br>
<br>
Doing a normal mdrun and calls an external script every 10000 steps.<br>
</blockquote><div><br>I don't think you can use ctypes for that, can you? Of course (indepement of the python wrapper method) you would as easily segv mdrun as by adding C-code ;-). <br><br>Roland<br></div></div><br>
<br clear="all"><br>-- <br>ORNL/UT Center for Molecular Biophysics <a href="http://cmb.ornl.gov">cmb.ornl.gov</a><br>865-241-1537, ORNL PO BOX 2008 MS6309<br>