NAMD
GlobalMasterTest.C
Go to the documentation of this file.
1 
7 #include "NamdTypes.h"
8 #include "GlobalMaster.h"
9 #include "GlobalMasterTest.h"
10 
11 //#define DEBUGM
12 #define MIN_DEBUG_LEVEL 1
13 #include "Debug.h"
14 
16  DebugM(3,"Test calculate called\n");
17  if(requestedAtoms().size() != 2) {
18  DebugM(3,"putting two atoms into request list");
23 
24  int s = appliedForces().size();
26  modifyAppliedForces().item(s).x = 2;
27  modifyAppliedForces().item(s).y = 0;
28  modifyAppliedForces().item(s).z = 0;
29  return; // we can't expect to have the rights atoms yet, so go on
30  }
31 
32  const AtomID *atomID_ptr = getAtomIdBegin();
33  const AtomID *atomID_end = getAtomIdEnd();
34  const Position *position_ptr = getAtomPositionBegin();
35 
36  if(atomID_end - atomID_ptr != 2) {
37  DebugM(3,"found " << atomID_end - atomID_ptr << " atoms\n");
38  NAMD_die("Wrong number of atoms.");
39  }
40 
41  while(atomID_ptr != atomID_end) {
42  DebugM(2,"Atom " << *atomID_ptr << " is at "
43  << position_ptr->x << " " << position_ptr->y << " "
44  << position_ptr->z << "\n");
45  position_ptr ++;
46  atomID_ptr ++;
47  }
48 }
49 
ForceList & modifyAppliedForces()
Definition: GlobalMaster.C:162
AtomIDList & modifyRequestedAtoms()
Definition: GlobalMaster.C:127
int AtomID
Definition: NamdTypes.h:29
AtomIDList::const_iterator getAtomIdBegin()
Definition: GlobalMaster.C:190
Definition: Vector.h:64
#define DebugM(x, y)
Definition: Debug.h:59
BigReal z
Definition: Vector.h:66
Elem & item(int i)
Definition: ResizeArray.h:115
PositionList::const_iterator getAtomPositionBegin()
Definition: GlobalMaster.C:198
const ForceList & appliedForces()
Definition: GlobalMaster.C:137
BigReal x
Definition: Vector.h:66
AtomIDList & modifyForcedAtoms()
Definition: GlobalMaster.C:157
void NAMD_die(const char *err_msg)
Definition: common.C:83
virtual void calculate()
int add(const Elem &elem)
Definition: ResizeArray.h:97
void resize(int i)
Definition: ResizeArray.h:84
AtomIDList::const_iterator getAtomIdEnd()
Definition: GlobalMaster.C:194
BigReal y
Definition: Vector.h:66
int size(void) const
Definition: ResizeArray.h:127
const AtomIDList & requestedAtoms()
Definition: GlobalMaster.C:123