Changeset 62f793 for src/config.cpp
- Timestamp:
- Sep 25, 2008, 5:57:19 PM (17 years ago)
- 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, Candidate_v1.7.0, Candidate_v1.7.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:
- aa5702
- Parents:
- 16a52b
- File:
-
- 1 edited
-
src/config.cpp (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
-
src/config.cpp
r16a52b r62f793 18 18 configpath = (char *) MallocString(sizeof(char)*MAXSTRINGSIZE,"config constructor: mainname"); 19 19 configname = (char *) MallocString(sizeof(char)*MAXSTRINGSIZE,"config constructor: mainname"); 20 ThermostatImplemented = (int *) Malloc((MaxThermostats)*(sizeof(int)), "IonsInitRead: *ThermostatImplemented"); 21 ThermostatNames = (char **) Malloc((MaxThermostats)*(sizeof(char *)), "IonsInitRead: *ThermostatNames"); 22 for (int j=0;j<MaxThermostats;j++) 23 ThermostatNames[j] = (char *) MallocString(12*(sizeof(char)), "IonsInitRead: ThermostatNames[]"); 24 Thermostat = 4; 25 alpha = 0.; 26 ScaleTempStep = 25; 27 TempFrequency = 2.5; 20 28 strcpy(mainname,"pcp"); 21 29 strcpy(defaultpath,"not specified"); … … 23 31 configpath[0]='\0'; 24 32 configname[0]='\0'; 25 33 34 strcpy(ThermostatNames[0],"None"); 35 ThermostatImplemented[0] = 1; 36 strcpy(ThermostatNames[1],"Woodcock"); 37 ThermostatImplemented[1] = 1; 38 strcpy(ThermostatNames[2],"Gaussian"); 39 ThermostatImplemented[2] = 1; 40 strcpy(ThermostatNames[3],"Langevin"); 41 ThermostatImplemented[3] = 1; 42 strcpy(ThermostatNames[4],"Berendsen"); 43 ThermostatImplemented[4] = 1; 44 strcpy(ThermostatNames[5],"NoseHoover"); 45 ThermostatImplemented[5] = 1; 46 26 47 FastParsing = false; 27 48 ProcPEGamma=8; … … 96 117 Free((void **)&configname, "config::~config: *configname"); 97 118 }; 119 120 /** Readin of Thermostat related values from parameter file. 121 * \param *source parameter file 122 */ 123 void config::InitThermostats(ifstream *source) 124 { 125 char *thermo = MallocString(12, "IonsInitRead: thermo"); 126 int verbose = 0; 127 128 // read desired Thermostat from file along with needed additional parameters 129 if (ParseForParameter(verbose,source,"Thermostat", 0, 1, 1, string_type, thermo, 1, optional)) { 130 if (strcmp(thermo, ThermostatNames[0]) == 0) { // None 131 if (ThermostatImplemented[0] == 1) { 132 Thermostat = None; 133 } else { 134 cout << Verbose(1) << "Warning: " << ThermostatNames[0] << " thermostat not implemented, falling back to None." << endl; 135 Thermostat = None; 136 } 137 } else if (strcmp(thermo, ThermostatNames[1]) == 0) { // Woodcock 138 if (ThermostatImplemented[1] == 1) { 139 Thermostat = Woodcock; 140 ParseForParameter(verbose,source,"Thermostat", 0, 2, 1, int_type, &ScaleTempStep, 1, critical); // read scaling frequency 141 } else { 142 cout << Verbose(1) << "Warning: " << ThermostatNames[0] << " thermostat not implemented, falling back to None." << endl; 143 Thermostat = None; 144 } 145 } else if (strcmp(thermo, ThermostatNames[2]) == 0) { // Gaussian 146 if (ThermostatImplemented[2] == 1) { 147 Thermostat = Gaussian; 148 ParseForParameter(verbose,source,"Thermostat", 0, 2, 1, int_type, &ScaleTempStep, 1, critical); // read collision rate 149 } else { 150 cout << Verbose(1) << "Warning: " << ThermostatNames[0] << " thermostat not implemented, falling back to None." << endl; 151 Thermostat = None; 152 } 153 } else if (strcmp(thermo, ThermostatNames[3]) == 0) { // Langevin 154 if (ThermostatImplemented[3] == 1) { 155 Thermostat = Langevin; 156 ParseForParameter(verbose,source,"Thermostat", 0, 2, 1, double_type, &TempFrequency, 1, critical); // read gamma 157 if (ParseForParameter(verbose,source,"Thermostat", 0, 3, 1, double_type, &alpha, 1, optional)) { 158 cout << Verbose(2) << "Extended Stochastic Thermostat detected with interpolation coefficient " << alpha << "." << endl; 159 } else { 160 alpha = 1.; 161 } 162 } else { 163 cout << Verbose(1) << "Warning: " << ThermostatNames[0] << " thermostat not implemented, falling back to None." << endl; 164 Thermostat = None; 165 } 166 } else if (strcmp(thermo, ThermostatNames[4]) == 0) { // Berendsen 167 if (ThermostatImplemented[4] == 1) { 168 Thermostat = Berendsen; 169 ParseForParameter(verbose,source,"Thermostat", 0, 2, 1, double_type, &TempFrequency, 1, critical); // read \tau_T 170 } else { 171 cout << Verbose(1) << "Warning: " << ThermostatNames[0] << " thermostat not implemented, falling back to None." << endl; 172 Thermostat = None; 173 } 174 } else if (strcmp(thermo, ThermostatNames[5]) == 0) { // Nose-Hoover 175 if (ThermostatImplemented[5] == 1) { 176 Thermostat = NoseHoover; 177 ParseForParameter(verbose,source,"Thermostat", 0, 2, 1, double_type, &HooverMass, 1, critical); // read Hoovermass 178 alpha = 0.; 179 } else { 180 cout << Verbose(1) << "Warning: " << ThermostatNames[0] << " thermostat not implemented, falling back to None." << endl; 181 Thermostat = None; 182 } 183 } else { 184 cout << Verbose(1) << " Warning: thermostat name was not understood!" << endl; 185 Thermostat = None; 186 } 187 } else { 188 if ((MaxOuterStep > 0) && (TargetTemp != 0)) 189 cout << Verbose(2) << "No thermostat chosen despite finite temperature MD, falling back to None." << endl; 190 Thermostat = None; 191 } 192 Free((void **)&thermo, "InitThermostats: thermo"); 193 }; 194 98 195 99 196 /** Displays menu for editing each entry of the config file. … … 465 562 double value[3]; 466 563 564 InitThermostats(file); 565 467 566 /* Namen einlesen */ 468 567 … … 1001 1100 *output << "DoFullCurrent\t" << config::DoFullCurrent << "\t# Do full perturbation" << endl; 1002 1101 *output << "DoConstrainedMD\t" << config::DoConstrainedMD << "\t# Do perform a constrained (>0, relating to current MD step) instead of unconstrained (0) MD" << endl; 1102 *output << "Thermostat\t" << ThermostatNames[Thermostat] << "\t"; 1103 switch(Thermostat) { 1104 default: 1105 case None: 1106 break; 1107 case Woodcock: 1108 *output << ScaleTempStep; 1109 break; 1110 case Gaussian: 1111 *output << ScaleTempStep; 1112 break; 1113 case Langevin: 1114 *output << TempFrequency << "\t" << alpha; 1115 break; 1116 case Berendsen: 1117 *output << TempFrequency; 1118 break; 1119 case NoseHoover: 1120 *output << HooverMass; 1121 break; 1122 }; 1123 *output << "\t# Which Thermostat and its parameters to use in MD case." << endl; 1003 1124 *output << "CommonWannier\t" << config::CommonWannier << "\t# Put virtual centers at indivual orbits, all common, merged by variance, to grid point, to cell center" << endl; 1004 1125 *output << "SawtoothStart\t" << config::SawtoothStart << "\t# Absolute value for smooth transition at cell border " << endl;
Note:
See TracChangeset
for help on using the changeset viewer.
