From: John Stone (johns_at_ks.uiuc.edu)
Date: Fri Sep 12 2003 - 14:10:51 CDT

Hey Marc, VMD-L,
  I spent a while today on updating the IMD interface header files
with more useful comments, documentation, and then changing the code
to plain C so that it'll be easier for people to build and include into
other programs. I posted the updated code along with a slightly improved
version of your test code on our IMD page, 5th link from the top:
  http://www.ks.uiuc.edu/Research/vmd/imd/

Let me know if you have further suggestions etc. Hopefully this will
make it much easier for people to add IMD into their simulation packages.
I'll probably spend a little more effort on updating the main() routine
so it handles more IMD message types etc, but this ought to get the ball
rolling.

Anyone interested in adding IMD to Amber, Charmm, or Gromacs??
Gromacs would probably be the easiest of those three. I'd be
curious to see how it performs since its known to be one of the
faster MD programs.

Marc, Thanks again for sharing your efforts with the VMD community.

  John Stone
  vmd_at_ks.uiuc.edu

On Fri, May 30, 2003 at 03:39:14PM +0200, Marc Baaden wrote:
>
> John and dear list members,
>
> thanks for all the help. I have meanwhile figured out what the problem
> was (a simple typo). Finally I thought it would be helpful to have a
> minimal program to test imd connection to VMD, so I post my very humble
> first step. It randomly creates position data for a system comprising
> one single atom.
>
> It needs the imd.C, imd.h, vmdsock.C and vmdsock.h files from namd.
> Compilation eg
>
> g++ -DSOCKLEN_T=socklen_t -static -g -Wall -c -o imd.o imd.C
> g++ -DSOCKLEN_T=socklen_t -static -g -Wall -c -o vmdsock.o vmdsock.C
> g++ -g -Wall testimd.c imd.o vmdsock.o -o testimd
>
> I also post a simple one-atom PDB to go with it. To test the program,
> one runs ./testimd, then starts VMD, load unat.pdb and connect via
> imd connect localhost 54321
>
> Cheers,
> Marc
>
>
>

Content-Description: unat.pdb
> HEADER A simple test atom
> ATOM 1 N GLN A 1 1.000 1.000 1.000 1.00 0.00
> TER

> Content-Type: text/x-csrc ; name="testimd.c"; charset=iso-8859-1
> Content-Description: testimd.c
> Content-Transfer-Encoding: quoted-printable
> Content-Disposition: attachment; filename="testimd.c"
>
>
> #include "vmdsock.h"
> #include "imd.h"
> #include <stdlib.h>
> #include <unistd.h>
>
> int main ()
> {
> int port =3D 54321;
> void *sock;
> void *clientsock;
> int length;
> IMDEnergies energies;
> float coords[3];
> float tmp;
> =
>
> vmdsock_init();
> sock =3D vmdsock_create();
> clientsock =3D NULL;
> vmdsock_bind(sock, port);
> vmdsock_listen(sock);
> tmp =3D 0.23234;
> while (!clientsock) {
> if (vmdsock_selread(sock, 0) > 0) {
> clientsock =3D vmdsock_accept(sock);
> if (imd_handshake(clientsock)) {
> clientsock =3D NULL;
> };
> }
> }
> sleep(1);
> if (vmdsock_selread(clientsock, 0) !=3D 1 || =
>
> imd_recv_header(clientsock, &length) !=3D IMD_GO) {
> clientsock =3D NULL;
> }
> while (clientsock) {
> imd_send_energies(clientsock, &energies);
> tmp =3D ( (double)rand() / (double)(RAND_MAX) );
> coords[0] =3D tmp ; /* coordonn=E9e x */
> coords[1] =3D (tmp -1); /* coordonn=E9e y */
> coords[2] =3D (-tmp + 0.8); /* coordonn=E9e z */
> imd_send_fcoords(clientsock, 1, coords);
> }
> }
>

> Dr. Marc Baaden - Institut de Biologie Physico-Chimique, Paris
> mailto:baaden_at_smplinux.de - http://www.marc-baaden.de
> FAX: +49 697912 39550 - Tel: +33 15841 5176 ou +33 609 843217

-- 
NIH Resource for Macromolecular Modeling and Bioinformatics
Beckman Institute for Advanced Science and Technology
University of Illinois, 405 N. Mathews Ave, Urbana, IL 61801
Email: johns_at_ks.uiuc.edu                 Phone: 217-244-3349              
  WWW: http://www.ks.uiuc.edu/~johns/      Fax: 217-244-6078