void SingleStep () { ++ stepCount; timeNow = stepCount * deltaT; PredictorStep (); PredictorStepQ (); GenSiteCoords (); ComputeSiteForces (); ComputeTorqs (); ComputeAccelsQ (); ApplyThermostat (); CorrectorStep (); CorrectorStepQ (); AdjustQuat (); ApplyBoundaryCond (); EvalProps (); if (stepCount % stepAdjustTemp == 0) AdjustTemp (); AccumProps (1); if (stepCount % stepAvg == 0) { AccumProps (2); PrintSummary (stdout); AccumProps (0); } if (stepCount >= stepEquil && (stepCount - stepEquil) % stepRdf == 0) EvalRdf (); }
void SingleStep () { ++ stepCount; timeNow = stepCount * deltaT; PredictorStep (); PredictorStepS (); ComputeForces (); ComputeForcesDipoleR (); ComputeForcesDipoleF (); ComputeDipoleAccel (); ApplyThermostat (); CorrectorStep (); CorrectorStepS (); AdjustDipole (); ApplyBoundaryCond (); EvalProps (); if (stepCount % stepAdjustTemp == 0) AdjustTemp (); AccumProps (1); if (stepCount % stepAvg == 0) { AccumProps (2); PrintSummary (stdout); AccumProps (0); } if (stepCount >= stepEquil && (stepCount - stepEquil) % stepRdf == 0) EvalRdf (); }
void SingleStep () { ++ stepCount; timeNow = stepCount * deltaT; LeapfrogStep (1); GenSiteCoords (); ComputeSiteForces (); ComputeTorqs (); ApplyThermostat (); LeapfrogStep (2); ApplyBoundaryCond (); EvalProps (); if (stepCount % stepAdjustTemp == 0 || stepCount < stepEquil && stepCount % 100 == 0) AdjustTemp (); AccumProps (1); if (stepCount % stepAvg == 0) { AccumProps (2); PrintSummary (stdout); AccumProps (0); } }
bool SimAnneal::EvaluateSTUN(long double bestval,long double curval) { double probability = 0; double deltaE = fSTUN(curval)-fSTUN(bestval); if(min(curval,bestval) < m_dbestsolution) { m_dbestsolution = min(curval,bestval); if(m_bdebugging) { rejfile << "New minimimum found - " << (double)m_dbestsolution << endl; debugfile << "New minimimum found - " << (double)m_dbestsolution << endl; } return true; } if(m_badaptive) { if(m_bdebugging) { debugfile << "Iteration - " << m_iIteration << endl; debugfile << (double)m_dbestsolution << " " << (double)bestval << " " << (double)curval << endl; debugfile << "fstun(curval) = " << 1.0+fSTUN(curval) << " fstun(bestval) = " << 1.0+fSTUN(bestval) << endl; debugfile << "deltaE = " << (double)deltaE << endl; debugfile << "ProbCalcE = " << ProbCalc(deltaE) << endl ; debugfile << "Temp = " << 1.0/(double)m_dTemp << endl; } if(Q.size() < m_iPlattime) Q.push_front(1.0+fSTUN(curval)); else { Q.pop_back(); Q.push_front(1.0+fSTUN(curval)); } if(Q.size() >= m_iPlattime) { m_daverageSTUNval = 0; for(int i = 0; i < Q.size(); i++) { m_daverageSTUNval += Q.at(i); } m_daverageSTUNval /= Q.size(); } m_iIteration++; if(m_iIteration % m_itempiter == 0 && Q.size() >= m_iPlattime) { if(m_bdebugging) { if(m_inumberpoorsol != 0) { debugfile << "PoorSolAccPerc - " << (double)m_ipoorsolutionacc*100.0/(double)m_inumberpoorsol << endl << endl; rejfile << (double)m_ipoorsolutionacc*100.0/(double)m_inumberpoorsol << " " << m_inumberpoorsol << endl; } else rejfile << "All solutions accepted" << endl; m_ipoorsolutionacc = 0; m_inumberpoorsol = 0; } AdjustTemp(m_daverageSTUNval); if(m_iIteration%m_iSTUNdec == 0) { m_dAveragefSTUN *= m_dgammadec; rejfile << "decreasing average fstun = " << (double)m_dAveragefSTUN << endl; } } probability = ProbCalc(deltaE); } else { if(m_bdebugging) { debugfile << "Iteration - " << m_iIteration << endl; debugfile << (double)m_dbestsolution << " " << (double)bestval << " " << (double)curval << endl; debugfile << "1.0+fstun(curval) = " << 1.0+fSTUN(curval) << " fstun(bestval) = " << 1.0+fSTUN(bestval) << endl; debugfile << "deltaE = " << (double)deltaE << endl; debugfile << "ProbCalcE = " << ProbCalc(deltaE) << endl ; debugfile << "Temp = " << 1.0/(double)m_dTemp << endl; } m_iIteration++; if(m_iIteration % m_iPlattime == 0) Schedule(); probability = ProbCalc(deltaE); } if(m_bdebugging) { if(probability < 100.0) m_inumberpoorsol++; } if(random(100.0,0.0) < probability) { if(m_bdebugging) { debugfile << "Accepted\n\n"; if(probability < 100) m_ipoorsolutionacc++; } return true; } else { if(m_bdebugging) debugfile << "Rejected\n\n"; return false; } }