18 int ALambdaControl::m_CurrStep = 0;
28 m_Sum_dU_dLambda = 0.0;
30 m_MCTI_Integration = 0.0;
47 m_Task = PriorBlock.m_Task;
48 m_NumSteps = PriorBlock.m_NumSteps;
49 m_NumEquilSteps = PriorBlock.m_NumEquilSteps;
50 m_NumAccumSteps = PriorBlock.m_NumAccumSteps;
51 m_NumPrintSteps = PriorBlock.m_NumPrintSteps;
52 m_NumRepeats = PriorBlock.m_NumRepeats;
53 switch (PriorBlock.m_Task) {
55 case kUp: m_LambdaKf=1.0; m_LambdaRef=1.0;
break;
56 case kStepUp: m_LambdaKf=1.0; m_LambdaRef=1.0;
break;
57 case kDown: m_LambdaKf=1.0; m_LambdaRef=0.0;
break;
58 case kStepDown: m_LambdaKf=1.0; m_LambdaRef=0.0;
break;
59 case kStop: m_LambdaKf=1.0; m_LambdaRef=PriorBlock.m_LambdaRef;
break;
61 case kGrow: m_LambdaKf=1.0; m_LambdaRef=PriorBlock.m_LambdaRef;
break;
62 case kStepGrow: m_LambdaKf=1.0; m_LambdaRef=PriorBlock.m_LambdaRef;
break;
63 case kFade: m_LambdaKf=0.0; m_LambdaRef=PriorBlock.m_LambdaRef;
break;
64 case kStepFade: m_LambdaKf=0.0; m_LambdaRef=PriorBlock.m_LambdaRef;
break;
65 case kNoGrow: m_LambdaKf = PriorBlock.m_LambdaKf;
66 m_LambdaRef = PriorBlock.m_LambdaRef;
break;
70 m_StartStep = PriorBlock.GetLastStep();
78 m_NumSteps = PmfBlock.m_NumSteps;
79 m_NumEquilSteps = PmfBlock.m_NumEquilSteps;
80 m_NumAccumSteps = PmfBlock.m_NumAccumSteps;
81 m_NumRepeats = PmfBlock.m_NumRepeats;
82 m_NumPrintSteps = PmfBlock.m_NumPrintSteps;
83 m_StartStep = PmfBlock.m_StartStep;
84 m_StopStep = PmfBlock.m_StopStep;
85 m_LambdaKf = PmfBlock.m_LambdaKf;
86 m_LambdaRef = PmfBlock.m_LambdaRef;
87 m_Task = PmfBlock.m_Task;
103 m_Sum_dU_dLambda += dU_dLambda;
108 m_Sum_dU_dLambda += dU_dLambda / (double)m_NumSteps;
113 m_Sum_dU_dLambda -= dU_dLambda / (double)m_NumSteps;
156 return(m_MCTI_Integration);
169 ASSERT(m_Num_dU_dLambda != 0);
170 return(m_Sum_dU_dLambda / (
double)m_Num_dU_dLambda);
173 return(m_Sum_dU_dLambda);
192 Count = (m_CurrStep-m_StartStep) / (m_NumAccumSteps+m_NumEquilSteps);
193 Count *= m_NumAccumSteps;
194 Maybe = (m_CurrStep-m_StartStep) % (m_NumAccumSteps+m_NumEquilSteps);
195 Maybe -= m_NumEquilSteps;
210 return( (m_StopStep - m_StartStep) + 1 );
214 Bool_t ALambdaControl::IsLastStep() {
218 if (m_CurrStep == GetLastStep()) {
227 int ALambdaControl::GetLastStep() {
232 if (m_StopStep > 0) {
241 m_StopStep = m_StartStep +
242 (m_NumAccumSteps+m_NumEquilSteps) * m_NumRepeats;
245 m_StopStep = m_StartStep + m_NumSteps;
258 case kUp: strcpy(Str,
" Up");
break;
259 case kDown: strcpy(Str,
" Down");
break;
260 case kStop: strcpy(Str,
" Stop");
break;
261 case kGrow: strcpy(Str,
" Grow");
break;
262 case kFade: strcpy(Str,
" Fade");
break;
263 case kNoGrow: strcpy(Str,
" NoGrow");
break;
264 case kStepUp: strcpy(Str,
" StepUp");
break;
265 case kStepDown: strcpy(Str,
"StepDown");
break;
266 case kStepGrow: strcpy(Str,
"StepGrow");
break;
267 case kStepFade: strcpy(Str,
"StepFade");
break;
268 default: strcpy(Str,
"Bug Alert!!!");
break;
278 case kUp: strcpy(Str,
"Up");
break;
279 case kDown: strcpy(Str,
"Down");
break;
280 case kStop: strcpy(Str,
"Stop");
break;
281 case kGrow: strcpy(Str,
"Grow");
break;
282 case kFade: strcpy(Str,
"Fade");
break;
283 case kNoGrow: strcpy(Str,
"NoGrow");
break;
284 case kStepUp: strcpy(Str,
"StepUp");
break;
285 case kStepDown: strcpy(Str,
"StepDown");
break;
286 case kStepGrow: strcpy(Str,
"StepGrow");
break;
287 case kStepFade: strcpy(Str,
"StepFade");
break;
288 default: strcpy(Str,
"Bug Alert!!!");
break;
305 if (m_CurrStep == m_StartStep) {
311 if ( (m_CurrStep-(m_StartStep+m_NumEquilSteps)) %
312 (m_NumEquilSteps+m_NumAccumSteps) == 1) {
332 if (m_CurrStep == (m_StartStep+1)) {
347 if (m_NumPrintSteps > 0) {
351 if ( IsLastStep() || (((m_CurrStep-m_StartStep)%m_NumPrintSteps)==0) ) {
370 if (m_CurrStep == GetLastStep()) {
389 if (((m_CurrStep-m_StartStep)%(m_NumEquilSteps+m_NumAccumSteps))==0) {
406 if (m_NumPrintSteps > 0) {
410 if ( IsLastStep() || (((m_CurrStep-m_StartStep)%m_NumPrintSteps)==0) ) {
415 if ( ((m_CurrStep-m_StartStep-1) % (m_NumEquilSteps+m_NumAccumSteps))
440 iout <<
"FreeEnergy: ";
441 #if !defined(_VERBOSE_PMF)
442 iout <<
"nstep time(ps) ";
443 iout <<
" task lambdaKf lambdaRef delta-G #steps n*{value target |}" << std::endl;
444 iout <<
"FreeEnergy: ----- -------- ";
445 iout <<
"-------- -------- --------- ---------- ------ -------------------" << std::endl;
456 char Str[100], Str2[100];
459 Time = (double)m_CurrStep * dT;
461 #if defined(_VERBOSE_PMF)
462 iout <<
"FreeEnergy: " << std::endl <<
endi;
463 iout <<
"FreeEnergy: ";
464 iout <<
"Time Step = " << m_CurrStep <<
", ";
467 iout << Time/1000.0 <<
" ps, ";
468 iout <<
"Lambda_Kf = " << m_LambdaKf <<
", ";
469 iout <<
"Lambda_Ref = " << m_LambdaRef <<
" ";
471 iout <<
"(" << Str <<
")";
473 iout <<
"FreeEnergy: ";
474 iout <<
"------------------------------------------------";
475 iout <<
"-------------------";
478 sprintf(Str,
"%5d", m_CurrStep);
480 sprintf(Str2,
"%8.3f", Time/1000.0);
481 iout <<
"FreeEnergy: ";
482 iout << Str <<
" " << Str2 <<
" ";
485 sprintf(Str,
"%8.5f", m_LambdaKf);
487 sprintf(Str,
"%9.5f", m_LambdaRef);
497 if ( (m_CurrStep>=m_StartStep) && (m_CurrStep<=GetLastStep()) ) {
513 double CurrStep = m_CurrStep;
514 double StartStep = m_StartStep;
515 double NumSteps = m_NumSteps;
516 double NumEquilSteps = m_NumEquilSteps;
517 double NumAccumSteps = m_NumAccumSteps;
518 double NumRepeats = m_NumRepeats;
523 m_LambdaKf = (CurrStep-StartStep)/NumSteps;
526 m_LambdaKf = 1.0-(CurrStep-StartStep)/NumSteps;
529 N = (int) ( (CurrStep-StartStep-1) / (NumEquilSteps+NumAccumSteps) );
530 m_LambdaKf = (N+1)/NumRepeats;
533 N = (int) ( (CurrStep-StartStep-1) / (NumEquilSteps+NumAccumSteps) );
534 m_LambdaKf = 1.0 - (N+1)/NumRepeats;
557 double CurrStep = m_CurrStep;
558 double StartStep = m_StartStep;
559 double NumSteps = m_NumSteps;
560 double NumEquilSteps = m_NumEquilSteps;
561 double NumAccumSteps = m_NumAccumSteps;
562 double NumRepeats = m_NumRepeats;
567 m_LambdaRef = (CurrStep-StartStep)/NumSteps;
570 m_LambdaRef = 1.0-(CurrStep-StartStep)/NumSteps;
573 N = (int) ( (CurrStep-StartStep-1) / (NumEquilSteps+NumAccumSteps) );
574 m_LambdaRef = (N+1)/NumRepeats;
577 N = (int) ( (CurrStep-StartStep-1) / (NumEquilSteps+NumAccumSteps) );
578 m_LambdaRef = 1.0 - (N+1)/NumRepeats;
void GetPaddedTaskStr(char *Str)
void GetTaskStr(char *Str)
void PrintHeader(double dT)
Bool_t IsTimeToPrint_dU_dLambda()
std::ostream & endi(std::ostream &s)
void PrintLambdaHeader(double dT)
void Accumulate(double dU_dLambda)
int GetNumAccumStepsSoFar()
ALambdaControl & operator=(ALambdaControl &PmfBlock)
void Init(ALambdaControl &PriorBlock)
Bool_t IsTimeToClearAccumulator()
Bool_t IsEndOf_MCTI_Step()