GlobalMasterTest.C

Go to the documentation of this file.
00001 
00007 #include "NamdTypes.h"
00008 #include "GlobalMaster.h"
00009 #include "GlobalMasterTest.h"
00010 
00011 //#define DEBUGM
00012 #define MIN_DEBUG_LEVEL 1
00013 #include "Debug.h"
00014 
00015 void GlobalMasterTest::calculate() {
00016   DebugM(3,"Test calculate called\n");
00017   if(requestedAtoms().size() != 2) {
00018     DebugM(3,"putting two atoms into request list");
00019     modifyRequestedAtoms().resize(0);
00020     modifyRequestedAtoms().add(0);
00021     modifyRequestedAtoms().add(1);
00022     modifyForcedAtoms().add(0);
00023     
00024     int s = appliedForces().size();
00025     modifyAppliedForces().resize(s+1);
00026     modifyAppliedForces().item(s).x = 2;
00027     modifyAppliedForces().item(s).y = 0;
00028     modifyAppliedForces().item(s).z = 0;
00029     return; // we can't expect to have the rights atoms yet, so go on
00030   }
00031 
00032   const AtomID *atomID_ptr = getAtomIdBegin();
00033   const AtomID *atomID_end = getAtomIdEnd();
00034   const Position *position_ptr = getAtomPositionBegin();
00035   
00036   if(atomID_end - atomID_ptr != 2) {
00037     DebugM(3,"found " << atomID_end - atomID_ptr << " atoms\n");
00038     NAMD_die("Wrong number of atoms.");
00039   }
00040 
00041   while(atomID_ptr != atomID_end) {
00042     DebugM(2,"Atom " << *atomID_ptr << " is at "
00043            << position_ptr->x << " " << position_ptr->y << " "
00044            << position_ptr->z << "\n");
00045     position_ptr ++;
00046     atomID_ptr ++;
00047   }
00048 }
00049 

Generated on Mon Nov 20 01:17:12 2017 for NAMD by  doxygen 1.4.7