Changeset 14c57a for src/Parser


Ignore:
Timestamp:
Aug 25, 2010, 12:04:11 PM (15 years ago)
Author:
Tillmann Crueger <crueger@…>
Branches:
Action_Thermostats, Add_AtomRandomPerturbation, Add_FitFragmentPartialChargesAction, Add_RotateAroundBondAction, Add_SelectAtomByNameAction, Added_ParseSaveFragmentResults, AddingActions_SaveParseParticleParameters, Adding_Graph_to_ChangeBondActions, Adding_MD_integration_tests, Adding_ParticleName_to_Atom, Adding_StructOpt_integration_tests, AtomFragments, Automaking_mpqc_open, AutomationFragmentation_failures, Candidate_v1.5.4, Candidate_v1.6.0, Candidate_v1.6.1, ChangeBugEmailaddress, ChangingTestPorts, ChemicalSpaceEvaluator, CombiningParticlePotentialParsing, Combining_Subpackages, Debian_Package_split, Debian_package_split_molecuildergui_only, Disabling_MemDebug, Docu_Python_wait, EmpiricalPotential_contain_HomologyGraph, EmpiricalPotential_contain_HomologyGraph_documentation, Enable_parallel_make_install, Enhance_userguide, Enhanced_StructuralOptimization, Enhanced_StructuralOptimization_continued, Example_ManyWaysToTranslateAtom, Exclude_Hydrogens_annealWithBondGraph, FitPartialCharges_GlobalError, Fix_BoundInBox_CenterInBox_MoleculeActions, Fix_ChargeSampling_PBC, Fix_ChronosMutex, Fix_FitPartialCharges, Fix_FitPotential_needs_atomicnumbers, Fix_ForceAnnealing, Fix_IndependentFragmentGrids, Fix_ParseParticles, Fix_ParseParticles_split_forward_backward_Actions, Fix_PopActions, Fix_QtFragmentList_sorted_selection, Fix_Restrictedkeyset_FragmentMolecule, Fix_StatusMsg, Fix_StepWorldTime_single_argument, Fix_Verbose_Codepatterns, Fix_fitting_potentials, Fixes, ForceAnnealing_goodresults, ForceAnnealing_oldresults, ForceAnnealing_tocheck, ForceAnnealing_with_BondGraph, ForceAnnealing_with_BondGraph_continued, ForceAnnealing_with_BondGraph_continued_betteresults, ForceAnnealing_with_BondGraph_contraction-expansion, FragmentAction_writes_AtomFragments, FragmentMolecule_checks_bonddegrees, GeometryObjects, Gui_Fixes, Gui_displays_atomic_force_velocity, ImplicitCharges, IndependentFragmentGrids, IndependentFragmentGrids_IndividualZeroInstances, IndependentFragmentGrids_IntegrationTest, IndependentFragmentGrids_Sole_NN_Calculation, JobMarket_RobustOnKillsSegFaults, JobMarket_StableWorkerPool, JobMarket_unresolvable_hostname_fix, MoreRobust_FragmentAutomation, ODR_violation_mpqc_open, PartialCharges_OrthogonalSummation, PdbParser_setsAtomName, PythonUI_with_named_parameters, QtGui_reactivate_TimeChanged_changes, Recreated_GuiChecks, Rewrite_FitPartialCharges, RotateToPrincipalAxisSystem_UndoRedo, SaturateAtoms_findBestMatching, SaturateAtoms_singleDegree, StoppableMakroAction, Subpackage_CodePatterns, Subpackage_JobMarket, Subpackage_LinearAlgebra, Subpackage_levmar, Subpackage_mpqc_open, Subpackage_vmg, Switchable_LogView, ThirdParty_MPQC_rebuilt_buildsystem, TrajectoryDependenant_MaxOrder, TremoloParser_IncreasedPrecision, TremoloParser_MultipleTimesteps, TremoloParser_setsAtomName, Ubuntu_1604_changes, stable
Children:
51c3e4
Parents:
8d1dd4
Message:

Made all parts of the programm use the new thermostat structure

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/Parser/PcpParser.cpp

    r8d1dd4 r14c57a  
    402402    *file << "DoConstrainedMD\t" << Switches.DoConstrainedMD << "\t# Do perform a constrained (>0, relating to current MD step) instead of unconstrained (0) MD" << endl;
    403403    ASSERT(Thermostats != NULL, "PcpParser::save() - Thermostats not initialized!");
    404     ASSERT(Thermostats->ThermostatNames != NULL, "PcpParser::save() - Thermostats not initialized!");
    405     *file << "Thermostat\t" << Thermostats->ThermostatNames[Thermostats->Thermostat] << "\t";
    406     switch(Thermostats->Thermostat) {
    407       default:
    408       case None:
    409         break;
    410       case Woodcock:
    411         *file << Thermostats->ScaleTempStep;
    412         break;
    413       case Gaussian:
    414         *file << Thermostats->ScaleTempStep;
    415         break;
    416       case Langevin:
    417         *file << Thermostats->TempFrequency << "\t" << Thermostats->alpha;
    418         break;
    419       case Berendsen:
    420         *file << Thermostats->TempFrequency;
    421         break;
    422       case NoseHoover:
    423         *file << Thermostats->HooverMass;
    424         break;
    425     };
     404    *file << "Thermostat\t" << Thermostats->activeThermostat->name() << "\t";
     405    *file << Thermostats->activeThermostat->writeParams();
    426406    *file << "\t# Which Thermostat and its parameters to use in MD case." << endl;
    427407    *file << "CommonWannier\t" << LocalizedOrbitals.CommonWannier << "\t# Put virtual centers at indivual orbits, all common, merged by variance, to grid point, to cell center" << endl;
     
    588568  // read desired Thermostat from file along with needed additional parameters
    589569  if (ParseForParameter(verbose,fb,"Thermostat", 0, 1, 1, string_type, thermo, 1, optional)) {
    590     if (strcmp(thermo, Thermostats->ThermostatNames[0]) == 0) { // None
    591       if (Thermostats->ThermostatImplemented[0] == 1) {
    592         Thermostats->Thermostat = None;
    593       } else {
    594         DoLog(1) && (Log() << Verbose(1) << "Warning: " << Thermostats->ThermostatNames[0] << " thermostat not implemented, falling back to None." << endl);
    595         Thermostats->Thermostat = None;
    596       }
    597     } else if (strcmp(thermo, Thermostats->ThermostatNames[1]) == 0) { // Woodcock
    598       if (Thermostats->ThermostatImplemented[1] == 1) {
    599         Thermostats->Thermostat = Woodcock;
    600         ParseForParameter(verbose,fb,"Thermostat", 0, 2, 1, int_type, &Thermostats->ScaleTempStep, 1, critical); // read scaling frequency
    601       } else {
    602         DoLog(1) && (Log() << Verbose(1) << "Warning: " << Thermostats->ThermostatNames[0] << " thermostat not implemented, falling back to None." << endl);
    603         Thermostats->Thermostat = None;
    604       }
    605     } else if (strcmp(thermo, Thermostats->ThermostatNames[2]) == 0) { // Gaussian
    606       if (Thermostats->ThermostatImplemented[2] == 1) {
    607         Thermostats->Thermostat = Gaussian;
    608         ParseForParameter(verbose,fb,"Thermostat", 0, 2, 1, int_type, &Thermostats->ScaleTempStep, 1, critical); // read collision rate
    609       } else {
    610         DoLog(1) && (Log() << Verbose(1) << "Warning: " << Thermostats->ThermostatNames[0] << " thermostat not implemented, falling back to None." << endl);
    611         Thermostats->Thermostat = None;
    612       }
    613     } else if (strcmp(thermo, Thermostats->ThermostatNames[3]) == 0) { // Langevin
    614       if (Thermostats->ThermostatImplemented[3] == 1) {
    615         Thermostats->Thermostat = Langevin;
    616         ParseForParameter(verbose,fb,"Thermostat", 0, 2, 1, double_type, &Thermostats->TempFrequency, 1, critical); // read gamma
    617         if (ParseForParameter(verbose,fb,"Thermostat", 0, 3, 1, double_type, &Thermostats->alpha, 1, optional)) {
    618           DoLog(2) && (Log() << Verbose(2) << "Extended Stochastic Thermostat detected with interpolation coefficient " << Thermostats->alpha << "." << endl);
    619         } else {
    620           Thermostats->alpha = 1.;
    621         }
    622       } else {
    623         DoLog(1) && (Log() << Verbose(1) << "Warning: " << Thermostats->ThermostatNames[0] << " thermostat not implemented, falling back to None." << endl);
    624         Thermostats->Thermostat = None;
    625       }
    626     } else if (strcmp(thermo, Thermostats->ThermostatNames[4]) == 0) { // Berendsen
    627       if (Thermostats->ThermostatImplemented[4] == 1) {
    628         Thermostats->Thermostat = Berendsen;
    629         ParseForParameter(verbose,fb,"Thermostat", 0, 2, 1, double_type, &Thermostats->TempFrequency, 1, critical); // read \tau_T
    630       } else {
    631         DoLog(1) && (Log() << Verbose(1) << "Warning: " << Thermostats->ThermostatNames[0] << " thermostat not implemented, falling back to None." << endl);
    632         Thermostats->Thermostat = None;
    633       }
    634     } else if (strcmp(thermo, Thermostats->ThermostatNames[5]) == 0) { // Nose-Hoover
    635       if (Thermostats->ThermostatImplemented[5] == 1) {
    636         Thermostats->Thermostat = NoseHoover;
    637         ParseForParameter(verbose,fb,"Thermostat", 0, 2, 1, double_type, &Thermostats->HooverMass, 1, critical); // read Hoovermass
    638         Thermostats->alpha = 0.;
    639       } else {
    640         DoLog(1) && (Log() << Verbose(1) << "Warning: " << Thermostats->ThermostatNames[0] << " thermostat not implemented, falling back to None." << endl);
    641         Thermostats->Thermostat = None;
    642       }
    643     } else {
    644       DoLog(1) && (Log() << Verbose(1) << " Warning: thermostat name was not understood!" << endl);
    645       Thermostats->Thermostat = None;
    646     }
     570    Thermostats->makeActive(thermo,fb);
    647571  } else {
    648572    if ((Thermostats->TargetTemp != 0))
    649573      DoLog(2) && (Log() << Verbose(2) <<  "No thermostat chosen despite finite temperature MD, falling back to None." << endl);
    650     Thermostats->Thermostat = None;
     574    Thermostats->chooseNone();
    651575  }
    652576  delete[](thermo);
Note: See TracChangeset for help on using the changeset viewer.