Changeset c3a303 for molecuilder/src/config.cpp
- Timestamp:
- Jul 24, 2009, 10:38:32 AM (16 years ago)
- Children:
- 53d153
- Parents:
- a048fa (diff), 47548d (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the(diff)links above to see all the changes relative to each parent. - git-author:
- Frederik Heber <heber@…> (07/23/09 14:23:32)
- git-committer:
- Frederik Heber <heber@…> (07/24/09 10:38:32)
- File:
-
- 1 edited
-
molecuilder/src/config.cpp (modified) (10 diffs)
Legend:
- Unmodified
- Added
- Removed
-
molecuilder/src/config.cpp
ra048fa rc3a303 169 169 configpath = (char *) MallocString(sizeof(char)*MAXSTRINGSIZE,"config constructor: configpath"); 170 170 configname = (char *) MallocString(sizeof(char)*MAXSTRINGSIZE,"config constructor: configname"); 171 ThermostatImplemented = (int *) Malloc((MaxThermostats)*(sizeof(int)), "config constructor: *ThermostatImplemented"); 172 ThermostatNames = (char **) Malloc((MaxThermostats)*(sizeof(char *)), "config constructor: *ThermostatNames"); 173 for (int j=0;j<MaxThermostats;j++) 174 ThermostatNames[j] = (char *) MallocString(12*(sizeof(char)), "config constructor: ThermostatNames[]"); 175 Thermostat = 4; 176 alpha = 0.; 177 ScaleTempStep = 25; 178 TempFrequency = 2.5; 171 179 strcpy(mainname,"pcp"); 172 180 strcpy(defaultpath,"not specified"); … … 175 183 configname[0]='\0'; 176 184 basis = "3-21G"; 185 186 strcpy(ThermostatNames[0],"None"); 187 ThermostatImplemented[0] = 1; 188 strcpy(ThermostatNames[1],"Woodcock"); 189 ThermostatImplemented[1] = 1; 190 strcpy(ThermostatNames[2],"Gaussian"); 191 ThermostatImplemented[2] = 1; 192 strcpy(ThermostatNames[3],"Langevin"); 193 ThermostatImplemented[3] = 1; 194 strcpy(ThermostatNames[4],"Berendsen"); 195 ThermostatImplemented[4] = 1; 196 strcpy(ThermostatNames[5],"NoseHoover"); 197 ThermostatImplemented[5] = 1; 177 198 178 199 FastParsing = false; … … 187 208 DoFullCurrent=0; 188 209 DoWannier=0; 210 DoConstrainedMD=0; 189 211 CommonWannier=0; 190 212 SawtoothStart=0.01; … … 195 217 196 218 MaxOuterStep=0; 197 Deltat= 1;219 Deltat=0.01; 198 220 OutVisStep=10; 199 221 OutSrcStep=5; … … 247 269 Free((void **)&configpath, "config::~config: *configpath"); 248 270 Free((void **)&configname, "config::~config: *configname"); 271 Free((void **)&ThermostatImplemented, "config::~config: *ThermostatImplemented"); 272 for (int j=0;j<MaxThermostats;j++) 273 Free((void **)&ThermostatNames[j], "config::~config: *ThermostatNames[]"); 274 Free((void **)&ThermostatNames, "config::~config: **ThermostatNames"); 249 275 }; 276 277 /** Readin of Thermostat related values from parameter file. 278 * \param *source parameter file 279 */ 280 void config::InitThermostats(ifstream *source) 281 { 282 char *thermo = MallocString(12, "IonsInitRead: thermo"); 283 int verbose = 0; 284 285 // read desired Thermostat from file along with needed additional parameters 286 if (ParseForParameter(verbose,source,"Thermostat", 0, 1, 1, string_type, thermo, 1, optional)) { 287 if (strcmp(thermo, ThermostatNames[0]) == 0) { // None 288 if (ThermostatImplemented[0] == 1) { 289 Thermostat = None; 290 } else { 291 cout << Verbose(1) << "Warning: " << ThermostatNames[0] << " thermostat not implemented, falling back to None." << endl; 292 Thermostat = None; 293 } 294 } else if (strcmp(thermo, ThermostatNames[1]) == 0) { // Woodcock 295 if (ThermostatImplemented[1] == 1) { 296 Thermostat = Woodcock; 297 ParseForParameter(verbose,source,"Thermostat", 0, 2, 1, int_type, &ScaleTempStep, 1, critical); // read scaling frequency 298 } else { 299 cout << Verbose(1) << "Warning: " << ThermostatNames[0] << " thermostat not implemented, falling back to None." << endl; 300 Thermostat = None; 301 } 302 } else if (strcmp(thermo, ThermostatNames[2]) == 0) { // Gaussian 303 if (ThermostatImplemented[2] == 1) { 304 Thermostat = Gaussian; 305 ParseForParameter(verbose,source,"Thermostat", 0, 2, 1, int_type, &ScaleTempStep, 1, critical); // read collision rate 306 } else { 307 cout << Verbose(1) << "Warning: " << ThermostatNames[0] << " thermostat not implemented, falling back to None." << endl; 308 Thermostat = None; 309 } 310 } else if (strcmp(thermo, ThermostatNames[3]) == 0) { // Langevin 311 if (ThermostatImplemented[3] == 1) { 312 Thermostat = Langevin; 313 ParseForParameter(verbose,source,"Thermostat", 0, 2, 1, double_type, &TempFrequency, 1, critical); // read gamma 314 if (ParseForParameter(verbose,source,"Thermostat", 0, 3, 1, double_type, &alpha, 1, optional)) { 315 cout << Verbose(2) << "Extended Stochastic Thermostat detected with interpolation coefficient " << alpha << "." << endl; 316 } else { 317 alpha = 1.; 318 } 319 } else { 320 cout << Verbose(1) << "Warning: " << ThermostatNames[0] << " thermostat not implemented, falling back to None." << endl; 321 Thermostat = None; 322 } 323 } else if (strcmp(thermo, ThermostatNames[4]) == 0) { // Berendsen 324 if (ThermostatImplemented[4] == 1) { 325 Thermostat = Berendsen; 326 ParseForParameter(verbose,source,"Thermostat", 0, 2, 1, double_type, &TempFrequency, 1, critical); // read \tau_T 327 } else { 328 cout << Verbose(1) << "Warning: " << ThermostatNames[0] << " thermostat not implemented, falling back to None." << endl; 329 Thermostat = None; 330 } 331 } else if (strcmp(thermo, ThermostatNames[5]) == 0) { // Nose-Hoover 332 if (ThermostatImplemented[5] == 1) { 333 Thermostat = NoseHoover; 334 ParseForParameter(verbose,source,"Thermostat", 0, 2, 1, double_type, &HooverMass, 1, critical); // read Hoovermass 335 alpha = 0.; 336 } else { 337 cout << Verbose(1) << "Warning: " << ThermostatNames[0] << " thermostat not implemented, falling back to None." << endl; 338 Thermostat = None; 339 } 340 } else { 341 cout << Verbose(1) << " Warning: thermostat name was not understood!" << endl; 342 Thermostat = None; 343 } 344 } else { 345 if ((MaxOuterStep > 0) && (TargetTemp != 0)) 346 cout << Verbose(2) << "No thermostat chosen despite finite temperature MD, falling back to None." << endl; 347 Thermostat = None; 348 } 349 Free((void **)&thermo, "InitThermostats: thermo"); 350 }; 351 250 352 251 353 /** Displays menu for editing each entry of the config file. … … 597 699 void config::Load(char *filename, periodentafel *periode, molecule *mol) 598 700 { 701 ifstream *file = new ifstream(filename); 702 if (file == NULL) { 703 cerr << "ERROR: config file " << filename << " missing!" << endl; 704 return; 705 } 599 706 RetrieveConfigPathAndName(filename); 600 707 … … 614 721 int verbose = 0; 615 722 double value[3]; 616 723 724 InitThermostats(file); 725 617 726 /* Namen einlesen */ 618 727 … … 667 776 if (config::SawtoothStart > 1.) config::SawtoothStart = 1.; 668 777 } 669 778 779 if (ParseForParameter(verbose,FileBuffer,"DoConstrainedMD", 0, 1, 1, int_type, &(config::DoConstrainedMD), 1, optional)) 780 if (config::DoConstrainedMD < 0) 781 config::DoConstrainedMD = 0; 670 782 ParseForParameter(verbose,FileBuffer,"MaxOuterStep", 0, 1, 1, int_type, &(config::MaxOuterStep), 1, critical); 671 783 if (!ParseForParameter(verbose,FileBuffer,"Deltat", 0, 1, 1, double_type, &(config::Deltat), 1, optional)) … … 1168 1280 *output << "DoPerturbation\t" << config::DoPerturbation << "\t# Do perturbation calculate and determine susceptibility and shielding" << endl; 1169 1281 *output << "DoFullCurrent\t" << config::DoFullCurrent << "\t# Do full perturbation" << endl; 1282 *output << "DoConstrainedMD\t" << config::DoConstrainedMD << "\t# Do perform a constrained (>0, relating to current MD step) instead of unconstrained (0) MD" << endl; 1283 *output << "Thermostat\t" << ThermostatNames[Thermostat] << "\t"; 1284 switch(Thermostat) { 1285 default: 1286 case None: 1287 break; 1288 case Woodcock: 1289 *output << ScaleTempStep; 1290 break; 1291 case Gaussian: 1292 *output << ScaleTempStep; 1293 break; 1294 case Langevin: 1295 *output << TempFrequency << "\t" << alpha; 1296 break; 1297 case Berendsen: 1298 *output << TempFrequency; 1299 break; 1300 case NoseHoover: 1301 *output << HooverMass; 1302 break; 1303 }; 1304 *output << "\t# Which Thermostat and its parameters to use in MD case." << endl; 1170 1305 *output << "CommonWannier\t" << config::CommonWannier << "\t# Put virtual centers at indivual orbits, all common, merged by variance, to grid point, to cell center" << endl; 1171 1306 *output << "SawtoothStart\t" << config::SawtoothStart << "\t# Absolute value for smooth transition at cell border " << endl; … … 1305 1440 *output << ")" << endl; 1306 1441 *output << "basis<GaussianBasisSet>: (" << endl; 1307 *output << "\tname = \"" << basis << "\"" << endl;1442 *output << "\tname = \"" << basis << "\"" << endl; 1308 1443 *output << "\tmolecule = $:molecule" << endl; 1309 1444 *output << ")" << endl;
Note:
See TracChangeset
for help on using the changeset viewer.
