Changeset 631dcb for src/config.cpp


Ignore:
Timestamp:
Jul 23, 2009, 11:23:59 AM (16 years ago)
Author:
Frederik Heber <heber@…>
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, 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:
71e7c7
Parents:
b38b64 (diff), fcbfc8 (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.
Message:

Merge branch 'Thermostat'

Conflicts:

.gitignore
Makefile.am
molecuilder/src/analyzer.cpp
molecuilder/src/builder.cpp
molecuilder/src/config.cpp
molecuilder/src/moleculelist.cpp
molecuilder/src/molecules.cpp
molecuilder/src/molecules.hpp

  • config::SaveMPQC() has different call parameters
  • analyzer and joiner had conflicts due to Chi and ChiPAS values
  • molecule::VerletForceIntegration() is slightly different too, but Thermostat supposedly is old version
File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/config.cpp

    rb38b64 r631dcb  
    1818  configpath = (char *) MallocString(sizeof(char)*MAXSTRINGSIZE,"config constructor: mainname");
    1919  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;
    2028  strcpy(mainname,"pcp");
    2129  strcpy(defaultpath,"not specified");
     
    2533  basis="3-21G";
    2634 
     35
     36  strcpy(ThermostatNames[0],"None");
     37  ThermostatImplemented[0] = 1;
     38  strcpy(ThermostatNames[1],"Woodcock");
     39  ThermostatImplemented[1] = 1;
     40  strcpy(ThermostatNames[2],"Gaussian");
     41  ThermostatImplemented[2] = 1;
     42  strcpy(ThermostatNames[3],"Langevin");
     43  ThermostatImplemented[3] = 1;
     44  strcpy(ThermostatNames[4],"Berendsen");
     45  ThermostatImplemented[4] = 1;
     46  strcpy(ThermostatNames[5],"NoseHoover");
     47  ThermostatImplemented[5] = 1;
     48
    2749  FastParsing = false;
    2850  ProcPEGamma=8;
     
    3658  DoFullCurrent=0;
    3759  DoWannier=0;
     60  DoConstrainedMD=0;
    3861  CommonWannier=0;
    3962  SawtoothStart=0.01;
     
    4265  UseAddGramSch=1;
    4366  Seed=1;
    44  
    4567  MaxOuterStep=0;
    46   Deltat=1;
     68  Deltat=0.01;
    4769  OutVisStep=10;
    4870  OutSrcStep=5;
     
    96118  Free((void **)&configname, "config::~config: *configname");
    97119};
     120
     121/** Readin of Thermostat related values from parameter file.
     122 * \param *source parameter file
     123 */
     124void config::InitThermostats(ifstream *source)
     125{
     126  char *thermo = MallocString(12, "IonsInitRead: thermo");
     127  int verbose = 0;
     128
     129  // read desired Thermostat from file along with needed additional parameters
     130  if (ParseForParameter(verbose,source,"Thermostat", 0, 1, 1, string_type, thermo, 1, optional)) {
     131    if (strcmp(thermo, ThermostatNames[0]) == 0) { // None
     132      if (ThermostatImplemented[0] == 1) {
     133        Thermostat = None;
     134      } else {
     135        cout << Verbose(1) << "Warning: " << ThermostatNames[0] << " thermostat not implemented, falling back to None." << endl;
     136        Thermostat = None;
     137      }
     138    } else if (strcmp(thermo, ThermostatNames[1]) == 0) { // Woodcock
     139      if (ThermostatImplemented[1] == 1) {
     140        Thermostat = Woodcock;
     141        ParseForParameter(verbose,source,"Thermostat", 0, 2, 1, int_type, &ScaleTempStep, 1, critical); // read scaling frequency
     142      } else {
     143        cout << Verbose(1) << "Warning: " << ThermostatNames[0] << " thermostat not implemented, falling back to None." << endl;
     144        Thermostat = None;
     145      }
     146    } else if (strcmp(thermo, ThermostatNames[2]) == 0) { // Gaussian
     147      if (ThermostatImplemented[2] == 1) {
     148        Thermostat = Gaussian;
     149        ParseForParameter(verbose,source,"Thermostat", 0, 2, 1, int_type, &ScaleTempStep, 1, critical); // read collision rate
     150      } else {
     151        cout << Verbose(1) << "Warning: " << ThermostatNames[0] << " thermostat not implemented, falling back to None." << endl;
     152        Thermostat = None;
     153      }
     154    } else if (strcmp(thermo, ThermostatNames[3]) == 0) { // Langevin
     155      if (ThermostatImplemented[3] == 1) {
     156        Thermostat = Langevin;
     157        ParseForParameter(verbose,source,"Thermostat", 0, 2, 1, double_type, &TempFrequency, 1, critical); // read gamma
     158        if (ParseForParameter(verbose,source,"Thermostat", 0, 3, 1, double_type, &alpha, 1, optional)) {
     159          cout << Verbose(2) << "Extended Stochastic Thermostat detected with interpolation coefficient " << alpha << "." << endl;
     160        } else {
     161          alpha = 1.;
     162        }
     163      } else {
     164        cout << Verbose(1) << "Warning: " << ThermostatNames[0] << " thermostat not implemented, falling back to None." << endl;
     165        Thermostat = None;
     166      }
     167    } else if (strcmp(thermo, ThermostatNames[4]) == 0) { // Berendsen
     168      if (ThermostatImplemented[4] == 1) {
     169        Thermostat = Berendsen;
     170        ParseForParameter(verbose,source,"Thermostat", 0, 2, 1, double_type, &TempFrequency, 1, critical); // read \tau_T
     171      } else {
     172        cout << Verbose(1) << "Warning: " << ThermostatNames[0] << " thermostat not implemented, falling back to None." << endl;
     173        Thermostat = None;
     174      }
     175    } else if (strcmp(thermo, ThermostatNames[5]) == 0) { // Nose-Hoover
     176      if (ThermostatImplemented[5] == 1) {
     177        Thermostat = NoseHoover;
     178        ParseForParameter(verbose,source,"Thermostat", 0, 2, 1, double_type, &HooverMass, 1, critical); // read Hoovermass
     179        alpha = 0.;
     180      } else {
     181        cout << Verbose(1) << "Warning: " << ThermostatNames[0] << " thermostat not implemented, falling back to None." << endl;
     182        Thermostat = None;
     183      }
     184    } else {
     185      cout << Verbose(1) << " Warning: thermostat name was not understood!" << endl;
     186      Thermostat = None;
     187    }
     188  } else {
     189    if ((MaxOuterStep > 0) && (TargetTemp != 0))
     190      cout << Verbose(2) <<  "No thermostat chosen despite finite temperature MD, falling back to None." << endl;
     191    Thermostat = None;
     192  }
     193  Free((void **)&thermo, "InitThermostats: thermo");
     194};
     195
    98196
    99197/** Displays menu for editing each entry of the config file.
     
    465563  double value[3];
    466564 
     565  InitThermostats(file);
     566 
    467567  /* Namen einlesen */
    468568
     
    518618  }
    519619 
     620  if (ParseForParameter(verbose,file,"DoConstrainedMD", 0, 1, 1, int_type, &(config::DoConstrainedMD), 1, optional))
     621    if (config::DoConstrainedMD < 0)
     622      config::DoConstrainedMD = 0;
    520623  ParseForParameter(verbose,file,"MaxOuterStep", 0, 1, 1, int_type, &(config::MaxOuterStep), 1, critical);
    521624  if (!ParseForParameter(verbose,file,"Deltat", 0, 1, 1, double_type, &(config::Deltat), 1, optional))
     
    9991102    *output << "DoPerturbation\t" << config::DoPerturbation << "\t# Do perturbation calculate and determine susceptibility and shielding" << endl;
    10001103    *output << "DoFullCurrent\t" << config::DoFullCurrent << "\t# Do full perturbation" << endl;
     1104    *output << "DoConstrainedMD\t" << config::DoConstrainedMD << "\t# Do perform a constrained (>0, relating to current MD step) instead of unconstrained (0) MD" << endl;
     1105    *output << "Thermostat\t" << ThermostatNames[Thermostat] << "\t";
     1106    switch(Thermostat) {
     1107      default:
     1108      case None:
     1109        break;
     1110      case Woodcock:
     1111        *output << ScaleTempStep;
     1112        break;
     1113      case Gaussian:
     1114        *output << ScaleTempStep;
     1115        break;
     1116      case Langevin:
     1117        *output << TempFrequency << "\t" << alpha;
     1118        break;
     1119      case Berendsen:
     1120        *output << TempFrequency;
     1121        break;
     1122      case NoseHoover:
     1123        *output << HooverMass;
     1124        break;
     1125    };
     1126    *output << "\t# Which Thermostat and its parameters to use in MD case." << endl;
    10011127    *output << "CommonWannier\t" << config::CommonWannier << "\t# Put virtual centers at indivual orbits, all common, merged by variance, to grid point, to cell center" << endl;
    10021128    *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.