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");
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");
98 void GlobalMasterSMD::calculate() {
99 DebugM(3,
"calculate called\n");
103 NAMD_die(
"Internal error: uninitialized!");
107 DebugM(1,
"Current CM "<<cm<<
"\n");
109 BigReal diff = diffCOM*moveDir;
110 BigReal preFactor = moveVel*currentTime - diff;
113 Force f = k*preFactor*moveDir + k2*(diff*moveDir - diffCOM);
118 BigReal energy = 0.5*k*preFactor*preFactor;
119 energy += 0.5*k2*(diffCOM.
length2() - diff*diff);
123 if (currentTime % outputFreq == 0)
124 output(currentTime, curcm, f);
129 DebugM(1,
"done with calculate: force: "<<f<<
"\n");
133 DebugM(3,
"output called\n");
135 if (t % (100*outputFreq) == 0)
136 iout <<
"SMDTITLE: TS CURRENT_POSITION FORCE\n" <<
endi;
139 DebugM(1,
"done with output\n");
std::ostream & iINFO(std::ostream &s)
std::ostream & endi(std::ostream &s)
SubmitReduction * willSubmit(int setID, int size=-1)
static ReductionMgr * Object(void)
Molecule stores the structural information for the system.
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)
NAMD_HOST_DEVICE BigReal length2(void) const
ResizeArray< AtomIDList > & modifyRequestedGroups()
void NAMD_die(const char *err_msg)
ForceList & modifyGroupForces()
Real atommass(int anum) const
PositionList::const_iterator getGroupPositionBegin()