#include <limits.h>Go to the source code of this file.
Classes | |
| struct | IMDEnergies |
Typedefs | |
| typedef short | int32 |
Enumerations | |
| enum | IMDType { IMD_DISCONNECT, IMD_ENERGIES, IMD_FCOORDS, IMD_GO, IMD_HANDSHAKE, IMD_KILL, IMD_MDCOMM, IMD_PAUSE, IMD_TRATE, IMD_IOERROR } |
Functions | |
| int | imd_disconnect (void *) |
| int | imd_pause (void *) |
| int | imd_kill (void *) |
| int | imd_handshake (void *) |
| int | imd_trate (void *, int32) |
| int | imd_send_mdcomm (void *, int32, const int32 *, const float *) |
| int | imd_send_energies (void *, const IMDEnergies *) |
| int | imd_send_fcoords (void *, int32, const float *) |
| int | imd_recv_handshake (void *) |
| Receive header and data. | |
| IMDType | imd_recv_header (void *, int32 *) |
| int | imd_recv_mdcomm (void *, int32, int32 *, float *) |
| int | imd_recv_energies (void *, IMDEnergies *) |
| int | imd_recv_fcoords (void *, int32, float *) |
|
|
|
|
|
Definition at line 13 of file imd.h. Referenced by GlobalMasterIMD::get_vmd_forces(), imd_recv_handshake(), imd_recv_header(), and imd_recv_header_nolengthswap(). 00013 {
00014 IMD_DISCONNECT,
00015 IMD_ENERGIES,
00016 IMD_FCOORDS,
00017 IMD_GO,
00018 IMD_HANDSHAKE,
00019 IMD_KILL,
00020 IMD_MDCOMM,
00021 IMD_PAUSE,
00022 IMD_TRATE,
00023 IMD_IOERROR
00024 };
|
|
|
Definition at line 108 of file imd.C. References fill_header(), HEADERSIZE, IMD_DISCONNECT, and imd_writen(). 00108 {
00109 IMDheader header;
00110 fill_header(&header, IMD_DISCONNECT, 0);
00111 return (imd_writen(s, (char *)&header, HEADERSIZE) != HEADERSIZE);
00112 }
|
|
|
Definition at line 133 of file imd.C. References fill_header(), HEADERSIZE, IMD_HANDSHAKE, imd_writen(), and IMDheader::length. Referenced by my_imd_connect(). 00133 {
00134 IMDheader header;
00135 fill_header(&header, IMD_HANDSHAKE, 1);
00136 header.length = IMDVERSION; // Not byteswapped!
00137 return (imd_writen(s, (char *)&header, HEADERSIZE) != HEADERSIZE);
00138 }
|
|
|
Definition at line 120 of file imd.C. References fill_header(), HEADERSIZE, IMD_KILL, and imd_writen(). 00120 {
00121 IMDheader header;
00122 fill_header(&header, IMD_KILL, 0);
00123 return (imd_writen(s, (char *)&header, HEADERSIZE) != HEADERSIZE);
00124 }
|
|
|
Definition at line 114 of file imd.C. References fill_header(), HEADERSIZE, IMD_PAUSE, and imd_writen(). 00114 {
00115 IMDheader header;
00116 fill_header(&header, IMD_PAUSE, 0);
00117 return (imd_writen(s, (char *)&header, HEADERSIZE) != HEADERSIZE);
00118 }
|
|
||||||||||||
|
Definition at line 231 of file imd.C. References imd_readn(). Referenced by GlobalMasterIMD::get_vmd_forces(). 00231 {
00232 return (imd_readn(s, (char *)energies, sizeof(IMDEnergies))
00233 != sizeof(IMDEnergies));
00234 }
|
|
||||||||||||||||
|
Definition at line 236 of file imd.C. References imd_readn(). Referenced by GlobalMasterIMD::get_vmd_forces(). 00236 {
00237 return (imd_readn(s, (char *)coords, 12*n) != 12*n);
00238 }
|
|
|
Receive header and data.
Definition at line 191 of file imd.C. References imd_go(), imd_recv_header_nolengthswap(), IMDType, int32, swap4(), and vmdsock_selread(). 00191 {
00192 // Wait 5 seconds for the handshake to come
00193 if (vmdsock_selread(s, 5) != 1) return -1;
00194
00195 // Check to see that a valid handshake was received
00196 int32 buf;
00197 IMDType type = imd_recv_header_nolengthswap(s, &buf);
00198 if (type != IMD_HANDSHAKE) return -1;
00199
00200 // Check its endianness, as well as the IMD version.
00201 if (buf == IMDVERSION) {
00202 if (!imd_go(s)) return 0;
00203 return -1;
00204 }
00205 swap4((char *)&buf, 4);
00206 if (buf == IMDVERSION) {
00207 if (!imd_go(s)) return 1;
00208 }
00209
00210 // We failed to determine endianness.
00211 return -1;
00212 }
|
|
||||||||||||
|
Definition at line 214 of file imd.C. References HEADERSIZE, imd_readn(), IMDType, IMDheader::length, and swap_header(). Referenced by GlobalMasterIMD::get_vmd_forces(), and my_imd_connect(). 00214 {
00215 IMDheader header;
00216 if (imd_readn(s, (char *)&header, HEADERSIZE) != HEADERSIZE)
00217 return IMD_IOERROR;
00218 int i;
00219 char *ch = (char*)(&header);
00220 swap_header(&header);
00221 *length = header.length;
00222 return IMDType(header.type);
00223 }
|
|
||||||||||||||||||||
|
Definition at line 225 of file imd.C. References imd_readn(). Referenced by GlobalMasterIMD::get_vmd_forces(). 00225 {
00226 if (imd_readn(s, (char *)indices, 4*n) != 4*n) return 1;
00227 if (imd_readn(s, (char *)forces, 12*n) != 12*n) return 1;
00228 return 0;
00229 }
|
|
||||||||||||
|
Definition at line 159 of file imd.C. References fill_header(), HEADERSIZE, IMD_ENERGIES, imd_writen(), and int32. Referenced by GlobalMasterIMD::send_energies(). 00159 {
00160 int32 size = HEADERSIZE+sizeof(IMDEnergies);
00161 char *buf = new char[size];
00162 fill_header((IMDheader *)buf, IMD_ENERGIES, 1);
00163 memcpy((void *)(buf+HEADERSIZE), (const void *)energies, sizeof(IMDEnergies));
00164 int rc = (imd_writen(s, buf, size) != size);
00165 delete [] buf;
00166 return rc;
00167 }
|
|
||||||||||||||||
|
Definition at line 169 of file imd.C. References fill_header(), HEADERSIZE, IMD_FCOORDS, imd_writen(), and int32. Referenced by GlobalMasterIMD::send_fcoords(). 00169 {
00170 int32 size = HEADERSIZE+12*n;
00171 char *buf = new char[size];
00172 fill_header((IMDheader *)buf, IMD_FCOORDS, n);
00173 memcpy((void *)(buf+HEADERSIZE), (const void *)coords, 12*n);
00174 int rc = (imd_writen(s, buf, size) != size);
00175 delete [] buf;
00176 return rc;
00177 }
|
|
||||||||||||||||||||
|
Definition at line 148 of file imd.C. References fill_header(), HEADERSIZE, IMD_MDCOMM, imd_writen(), and int32. 00148 {
00149 int32 size = HEADERSIZE+16*n;
00150 char *buf = new char[size];
00151 fill_header((IMDheader *)buf, IMD_MDCOMM, n);
00152 memcpy((void *)(buf+HEADERSIZE), (const void *)indices, 4*n);
00153 memcpy((void *)(buf+HEADERSIZE+4*n), (const void *)forces, 12*n);
00154 int rc = (imd_writen(s, buf, size) != size);
00155 delete [] buf;
00156 return rc;
00157 }
|
|
||||||||||||
|
Definition at line 140 of file imd.C. References fill_header(), HEADERSIZE, IMD_TRATE, and imd_writen(). 00140 {
00141 IMDheader header;
00142 fill_header(&header, IMD_TRATE, rate);
00143 return (imd_writen(s, (char *)&header, HEADERSIZE) != HEADERSIZE);
00144 }
|
1.3.9.1