28 #define MIN_DEBUG_LEVEL 1
33 const Vector direction,
int output_frequency,
34 int first_timestep,
const char *filename,
36 DebugM(3,
"initialize called\n");
39 outputFreq = output_frequency;
41 k2 = transverse_spring_constant;
42 currentTime = first_timestep;
44 parseAtoms(filename,numAtoms);
46 DebugM(1,
"done with initialize\n");
49 void GlobalMasterSMD::parseAtoms(
const char *file,
int numTotalAtoms) {
50 DebugM(3,
"parseAtoms called\n");
54 NAMD_die(
"No atoms found in SMDFile\n");
55 if (numatoms != numTotalAtoms)
56 NAMD_die(
"The number of atoms in SMDFile must be equal to the total number of atoms in the structure!");
64 cm.
x = cm.
y = cm.
z = 0;
69 #ifdef MEM_OPT_VERSION
70 PDBCoreData *atom = smdpdb.atom(i);
80 cm.
x += atom->
xcoor()*mass;
81 cm.
y += atom->
ycoor()*mass;
82 cm.
z += atom->
zcoor()*mass;
87 NAMD_die(
"SMDFile contained no SMD atoms (atoms w/ nonzero occupancy)\n");
91 DebugM(1,
"done with parseAtoms\n");
96 void GlobalMasterSMD::calculate() {
97 DebugM(3,
"calculate called\n");
101 NAMD_die(
"Internal error: uninitialized!");
105 DebugM(1,
"Current CM "<<cm<<
"\n");
106 BigReal diff = (curcm - cm)*moveDir;
109 Force f = k*(moveVel*currentTime - diff)*moveDir + k2*(diff*moveDir - (curcm - cm));
114 if (currentTime % outputFreq == 0)
115 output(currentTime, curcm, f);
120 DebugM(1,
"done with calculate: force: "<<f<<
"\n");
124 DebugM(3,
"output called\n");
126 if (t % (100*outputFreq) == 0)
127 iout <<
"SMDTITLE: TS CURRENT_POSITION FORCE\n" <<
endi;
130 DebugM(1,
"done with output\n");
std::ostream & iINFO(std::ostream &s)
std::ostream & endi(std::ostream &s)
const ResizeArray< AtomIDList > & requestedGroups()
GlobalMasterSMD(BigReal spring_constant, BigReal transverse_spring_constant, BigReal velocity, const Vector direction, int output_frequency, int first_timestep, const char *filename, int)
ResizeArray< AtomIDList > & modifyRequestedGroups()
void NAMD_die(const char *err_msg)
ForceList & modifyGroupForces()
Real atommass(int anum) const
PositionList::const_iterator getGroupPositionBegin()