NAMD
Classes | Macros | Functions | Variables
GlobalMasterIMD.C File Reference
#include "InfoStream.h"
#include "vmdsock.h"
#include "Node.h"
#include "IMDOutput.h"
#include "imd.h"
#include "SimParameters.h"
#include "UniqueSortedArray.h"
#include "GlobalMaster.h"
#include "GlobalMasterIMD.h"
#include "Vector.h"
#include <errno.h>
#include "Debug.h"

Go to the source code of this file.

Classes

struct  vmdforce
 

Macros

#define MIN_DEBUG_LEVEL   1
 

Functions

static int find_free_port (void *sock, int defport)
 
static int my_imd_connect (void *s)
 

Variables

static UniqueSortedArray
< vmdforce
vmdforces
 

Macro Definition Documentation

#define MIN_DEBUG_LEVEL   1

Copyright (c) 1995, 1996, 1997, 1998, 1999, 2000 by The Board of Trustees of the University of Illinois. All rights reserved.

Definition at line 21 of file GlobalMasterIMD.C.

Function Documentation

static int find_free_port ( void sock,
int  defport 
)
static

Definition at line 46 of file GlobalMasterIMD.C.

References vmdsock_bind().

Referenced by GlobalMasterIMD::GlobalMasterIMD().

46  {
47  if (vmdsock_bind(sock, defport)==0) return defport; // success
48  for (int port=1025; port < 4096; port++)
49  if (vmdsock_bind(sock, port)==0) return port;
50  return -1;
51 }
int vmdsock_bind(void *v, int port)
Definition: vmdsock.C:114
static int my_imd_connect ( void s)
static

Definition at line 92 of file GlobalMasterIMD.C.

References endi(), IMD_GO, imd_handshake(), imd_recv_header(), iout, iWARN(), and vmdsock_selread().

Referenced by GlobalMasterIMD::calculate().

92  {
93  if (imd_handshake(s)) {
94  iout << iWARN << "IMD handshake failed\n" << endi;
95  return 0;
96  }
97 
98  // Wait a second, then see if VMD has responded.
99  int32 length;
100  if (vmdsock_selread(s,1) != 1 || imd_recv_header(s, &length) != IMD_GO) {
101  iout << iWARN << "Incompatible Interactive MD, use VMD v1.4b2 or higher\n"
102  << endi;
103  return 0;
104  }
105  return 1;
106 }
int vmdsock_selread(void *v, int sec)
Definition: vmdsock.C:177
short int32
Definition: dumpdcd.c:24
std::ostream & endi(std::ostream &s)
Definition: InfoStream.C:54
std::ostream & iWARN(std::ostream &s)
Definition: InfoStream.C:82
Definition: imd.h:17
#define iout
Definition: InfoStream.h:51
int imd_handshake(void *s)
Definition: imd.C:133
IMDType imd_recv_header(void *s, int32 *length)
Definition: imd.C:214

Variable Documentation

UniqueSortedArray<vmdforce> vmdforces
static

Definition at line 41 of file GlobalMasterIMD.C.