Changeset a3fded


Ignore:
Timestamp:
Jun 12, 2010, 1:12:51 PM (15 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, 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:
43dad6
Parents:
88104f
git-author:
Frederik Heber <heber@…> (06/12/10 13:05:12)
git-committer:
Frederik Heber <heber@…> (06/12/10 13:12:51)
Message:

New class ThermoStatContainer containing all parameters and changes to ConfigFileBuffer.

Location:
src
Files:
2 added
12 edited

Legend:

Unmodified
Added
Removed
  • src/Actions/CmdAction/BondLengthTableAction.cpp

    r88104f ra3fded  
    77
    88#include "Actions/CmdAction/BondLengthTableAction.hpp"
     9#include "bondgraph.hpp"
    910#include "config.hpp"
    1011#include "log.hpp"
  • src/Actions/FragmentationAction/DepthFirstSearchAction.cpp

    r88104f ra3fded  
    88#include "Actions/FragmentationAction/DepthFirstSearchAction.hpp"
    99#include "atom.hpp"
     10#include "bondgraph.hpp"
    1011#include "config.hpp"
    1112#include "log.hpp"
  • src/Actions/FragmentationAction/FragmentationAction.cpp

    r88104f ra3fded  
    88#include "Actions/FragmentationAction/FragmentationAction.hpp"
    99#include "atom.hpp"
     10#include "bondgraph.hpp"
    1011#include "config.hpp"
    1112#include "log.hpp"
  • src/ConfigFileBuffer.cpp

    r88104f ra3fded  
    5959ConfigFileBuffer::ConfigFileBuffer(const char * const filename) : buffer(NULL), LineMapping(NULL), CurrentLine(0), NoLines(0)
    6060{
     61  InitFileBuffer(filename);
     62}
     63
     64void ConfigFileBuffer::InitFileBuffer(const char * const filename)
     65{
    6166  ifstream *file = NULL;
    6267  char line[MAXSTRINGSIZE];
     68
     69  RemoveMapping();
    6370
    6471  // prescan number of lines
     
    102109  file->clear();
    103110  delete(file);
     111
     112  InitMapping();
    104113}
    105114
     
    108117ConfigFileBuffer::~ConfigFileBuffer()
    109118{
    110   for(int i=0;i<NoLines;++i)
    111     delete[](buffer[i]);
    112   delete[](buffer);
    113   delete[](LineMapping);
     119  RemoveBuffer();
     120  RemoveMapping();
    114121}
    115122
     
    122129  for (int i=0;i<NoLines;i++)
    123130    LineMapping[i] = i;
     131  MappingAllocated = true;
    124132}
     133
     134/** Remove allocated mapping.
     135 */
     136void ConfigFileBuffer::RemoveMapping()
     137{
     138  delete[](LineMapping);
     139  MappingAllocated = false;
     140}
     141
     142/** Remove allocated mapping.
     143 */
     144void ConfigFileBuffer::RemoveBuffer()
     145{
     146  for(int i=0;i<NoLines;++i)
     147    delete[](buffer[i]);
     148  delete[](buffer);
     149}
     150
    125151
    126152/** Creates a mapping for the \a *FileBuffer's lines containing the Ion_Type keyword such that they are sorted.
     
    134160{
    135161  map<const char *, int, IonTypeCompare> IonTypeLineMap;
    136   if (LineMapping == NULL) {
    137     DoeLog(0) && (eLog()<< Verbose(0) << "map pointer is NULL: " << LineMapping << endl);
    138     performCriticalExit();
    139     return;
     162  if (!MappingAllocated) {
     163    InitMapping();
    140164  }
    141165
     
    156180  }
    157181}
    158 
  • src/ConfigFileBuffer.hpp

    r88104f ra3fded  
    3333    ~ConfigFileBuffer();
    3434
     35    void InitFileBuffer(const char * const filename);
     36    void MapIonTypesInBuffer(const int NoAtoms);
     37
     38private:
     39
     40    /*
     41     * Whether LineMapping is allocated or not.
     42     */
     43    bool MappingAllocated;
     44
    3545    void InitMapping();
    36     void MapIonTypesInBuffer(const int NoAtoms);
     46    void RemoveMapping();
     47    void RemoveBuffer();
    3748};
    3849
  • src/Makefile.am

    r88104f ra3fded  
    178178  tesselation.cpp \
    179179  tesselationhelpers.cpp \
     180  ThermoStatContainer.cpp \
    180181  triangleintersectionlist.cpp \
    181182  vector.cpp \
     
    221222  tesselation.hpp \
    222223  tesselationhelpers.hpp \
     224  ThermoStatContainer.hpp \
    223225  triangleintersectionlist.hpp \
    224226  verbose.hpp \
  • src/atom_trajectoryparticle.cpp

    r88104f ra3fded  
    1313#include "log.hpp"
    1414#include "parser.hpp"
     15#include "ThermoStatContainer.hpp"
    1516#include "verbose.hpp"
    1617
     
    195196void TrajectoryParticle::Thermostat_Langevin(int Step, gsl_rng * r, double *ekin, config *configuration)
    196197{
    197   double sigma  = sqrt(configuration->TargetTemp/type->mass); // sigma = (k_b T)/m (Hartree/atomicmass = atomiclength/atomictime)
     198  double sigma  = sqrt(configuration->Thermostats->TargetTemp/type->mass); // sigma = (k_b T)/m (Hartree/atomicmass = atomiclength/atomictime)
    198199  Vector &U = Trajectory.U.at(Step);
    199200  if (FixedIon == 0) { // even FixedIon moves, only not by other's forces
    200201    // throw a dice to determine whether it gets hit by a heat bath particle
    201     if (((((rand()/(double)RAND_MAX))*configuration->TempFrequency) < 1.)) {
     202    if (((((rand()/(double)RAND_MAX))*configuration->Thermostats->TempFrequency) < 1.)) {
    202203      DoLog(3) && (Log() << Verbose(3) << "Particle " << *this << " was hit (sigma " << sigma << "): " << sqrt(U[0]*U[0]+U[1]*U[1]+U[2]*U[2]) << " -> ");
    203204      // pick three random numbers from a Boltzmann distribution around the desired temperature T for each momenta axis
     
    223224  if (FixedIon == 0) { // even FixedIon moves, only not by other's forces
    224225    for (int d=0; d<NDIM; d++) {
    225       U[d] *= sqrt(1+(configuration->Deltat/configuration->TempFrequency)*(ScaleTempFactor-1));
     226      U[d] *= sqrt(1+(configuration->Deltat/configuration->Thermostats->TempFrequency)*(ScaleTempFactor-1));
    226227      *ekin += 0.5*type->mass * U[d]*U[d];
    227228    }
     
    253254  if (FixedIon == 0) { // even FixedIon moves, only not by other's forces
    254255    for (int d=0; d<NDIM; d++) {
    255         U[d] += configuration->Deltat/type->mass * (configuration->alpha * (U[d] * type->mass));
     256        U[d] += configuration->Deltat/type->mass * (configuration->Thermostats->alpha * (U[d] * type->mass));
    256257        *ekin += (0.5*type->mass) * U[d]*U[d];
    257258      }
  • src/config.cpp

    r88104f ra3fded  
    1010#include "atom.hpp"
    1111#include "bond.hpp"
     12#include "bondgraph.hpp"
    1213#include "config.hpp"
     14#include "ConfigFileBuffer.hpp"
    1315#include "element.hpp"
    1416#include "helpers.hpp"
     
    2022#include "molecule.hpp"
    2123#include "periodentafel.hpp"
     24#include "ThermoStatContainer.hpp"
    2225#include "World.hpp"
    2326
     
    2629/** Constructor for config file class.
    2730 */
    28 config::config() : BG(NULL), PsiType(0), MaxPsiDouble(0), PsiMaxNoUp(0), PsiMaxNoDown(0), MaxMinStopStep(1), InitMaxMinStopStep(1), ProcPEGamma(8), ProcPEPsi(1), configpath(NULL),
    29     configname(NULL), FastParsing(false), Deltat(0.01), basis(""), databasepath(NULL), DoConstrainedMD(0), MaxOuterStep(0), Thermostat(4), ThermostatImplemented(NULL),
    30     ThermostatNames(NULL), TempFrequency(2.5), alpha(0.), HooverMass(0.), TargetTemp(0.00095004455), ScaleTempStep(25),  mainname(NULL), defaultpath(NULL), pseudopotpath(NULL),
     31config::config() : BG(NULL), Thermostats(0), PsiType(0), MaxPsiDouble(0), PsiMaxNoUp(0), PsiMaxNoDown(0), MaxMinStopStep(1), InitMaxMinStopStep(1), ProcPEGamma(8), ProcPEPsi(1), configpath(NULL),
     32    configname(NULL), FastParsing(false), Deltat(0.01), basis(""), databasepath(NULL), DoConstrainedMD(0), MaxOuterStep(0), mainname(NULL), defaultpath(NULL), pseudopotpath(NULL),
    3133    DoOutVis(0), DoOutMes(1), DoOutNICS(0), DoOutOrbitals(0), DoOutCurrent(0), DoFullCurrent(0), DoPerturbation(0), DoWannier(0), CommonWannier(0), SawtoothStart(0.01),
    3234    VectorPlane(0), VectorCut(0.), UseAddGramSch(1), Seed(1), OutVisStep(10), OutSrcStep(5), MaxPsiStep(0), EpsWannier(1e-7), MaxMinStep(100), RelEpsTotalEnergy(1e-7),
     
    4042  configpath = new char[MAXSTRINGSIZE];
    4143  configname = new char[MAXSTRINGSIZE];
     44  Thermostats = new ThermoStatContainer();
    4245  strcpy(mainname,"pcp");
    4346  strcpy(defaultpath,"not specified");
     
    4649  configname[0]='\0';
    4750  basis = "3-21G";
    48 
    49   InitThermostats();
    5051};
    5152
     
    6061  delete[](configpath);
    6162  delete[](configname);
    62   delete[](ThermostatImplemented);
    63   for (int j=0;j<MaxThermostats;j++)
    64     delete[](ThermostatNames[j]);
    65   delete[](ThermostatNames);
     63  if (Thermostats != NULL)
     64    delete(Thermostats);
    6665
    6766  if (BG != NULL)
    6867    delete(BG);
    6968};
    70 
    71 /** Initialises variables in class config for Thermostats.
    72  */
    73 void config::InitThermostats()
    74 {
    75   ThermostatImplemented = new int[MaxThermostats];
    76   ThermostatNames = new char *[MaxThermostats];
    77   for (int j=0;j<MaxThermostats;j++)
    78     ThermostatNames[j] = new char[12];
    79 
    80   strcpy(ThermostatNames[0],"None");
    81   ThermostatImplemented[0] = 1;
    82   strcpy(ThermostatNames[1],"Woodcock");
    83   ThermostatImplemented[1] = 1;
    84   strcpy(ThermostatNames[2],"Gaussian");
    85   ThermostatImplemented[2] = 1;
    86   strcpy(ThermostatNames[3],"Langevin");
    87   ThermostatImplemented[3] = 1;
    88   strcpy(ThermostatNames[4],"Berendsen");
    89   ThermostatImplemented[4] = 1;
    90   strcpy(ThermostatNames[5],"NoseHoover");
    91   ThermostatImplemented[5] = 1;
    92 };
    93 
    94 /** Readin of Thermostat related values from parameter file.
    95  * \param *fb file buffer containing the config file
    96  */
    97 void config::ParseThermostats(class ConfigFileBuffer * const fb)
    98 {
    99   char * const thermo = new char[12];
    100   const int verbose = 0;
    101 
    102   // read desired Thermostat from file along with needed additional parameters
    103   if (ParseForParameter(verbose,fb,"Thermostat", 0, 1, 1, string_type, thermo, 1, optional)) {
    104     if (strcmp(thermo, ThermostatNames[0]) == 0) { // None
    105       if (ThermostatImplemented[0] == 1) {
    106         Thermostat = None;
    107       } else {
    108         DoLog(1) && (Log() << Verbose(1) << "Warning: " << ThermostatNames[0] << " thermostat not implemented, falling back to None." << endl);
    109         Thermostat = None;
    110       }
    111     } else if (strcmp(thermo, ThermostatNames[1]) == 0) { // Woodcock
    112       if (ThermostatImplemented[1] == 1) {
    113         Thermostat = Woodcock;
    114         ParseForParameter(verbose,fb,"Thermostat", 0, 2, 1, int_type, &ScaleTempStep, 1, critical); // read scaling frequency
    115       } else {
    116         DoLog(1) && (Log() << Verbose(1) << "Warning: " << ThermostatNames[0] << " thermostat not implemented, falling back to None." << endl);
    117         Thermostat = None;
    118       }
    119     } else if (strcmp(thermo, ThermostatNames[2]) == 0) { // Gaussian
    120       if (ThermostatImplemented[2] == 1) {
    121         Thermostat = Gaussian;
    122         ParseForParameter(verbose,fb,"Thermostat", 0, 2, 1, int_type, &ScaleTempStep, 1, critical); // read collision rate
    123       } else {
    124         DoLog(1) && (Log() << Verbose(1) << "Warning: " << ThermostatNames[0] << " thermostat not implemented, falling back to None." << endl);
    125         Thermostat = None;
    126       }
    127     } else if (strcmp(thermo, ThermostatNames[3]) == 0) { // Langevin
    128       if (ThermostatImplemented[3] == 1) {
    129         Thermostat = Langevin;
    130         ParseForParameter(verbose,fb,"Thermostat", 0, 2, 1, double_type, &TempFrequency, 1, critical); // read gamma
    131         if (ParseForParameter(verbose,fb,"Thermostat", 0, 3, 1, double_type, &alpha, 1, optional)) {
    132           DoLog(2) && (Log() << Verbose(2) << "Extended Stochastic Thermostat detected with interpolation coefficient " << alpha << "." << endl);
    133         } else {
    134           alpha = 1.;
    135         }
    136       } else {
    137         DoLog(1) && (Log() << Verbose(1) << "Warning: " << ThermostatNames[0] << " thermostat not implemented, falling back to None." << endl);
    138         Thermostat = None;
    139       }
    140     } else if (strcmp(thermo, ThermostatNames[4]) == 0) { // Berendsen
    141       if (ThermostatImplemented[4] == 1) {
    142         Thermostat = Berendsen;
    143         ParseForParameter(verbose,fb,"Thermostat", 0, 2, 1, double_type, &TempFrequency, 1, critical); // read \tau_T
    144       } else {
    145         DoLog(1) && (Log() << Verbose(1) << "Warning: " << ThermostatNames[0] << " thermostat not implemented, falling back to None." << endl);
    146         Thermostat = None;
    147       }
    148     } else if (strcmp(thermo, ThermostatNames[5]) == 0) { // Nose-Hoover
    149       if (ThermostatImplemented[5] == 1) {
    150         Thermostat = NoseHoover;
    151         ParseForParameter(verbose,fb,"Thermostat", 0, 2, 1, double_type, &HooverMass, 1, critical); // read Hoovermass
    152         alpha = 0.;
    153       } else {
    154         DoLog(1) && (Log() << Verbose(1) << "Warning: " << ThermostatNames[0] << " thermostat not implemented, falling back to None." << endl);
    155         Thermostat = None;
    156       }
    157     } else {
    158       DoLog(1) && (Log() << Verbose(1) << " Warning: thermostat name was not understood!" << endl);
    159       Thermostat = None;
    160     }
    161   } else {
    162     if ((MaxOuterStep > 0) && (TargetTemp != 0))
    163       DoLog(2) && (Log() << Verbose(2) <<  "No thermostat chosen despite finite temperature MD, falling back to None." << endl);
    164     Thermostat = None;
    165   }
    166   delete[](thermo);
    167 };
    168 
    16969
    17070/** Displays menu for editing each entry of the config file.
     
    508408};
    509409
    510 /** Initializes ConfigFileBuffer from a file.
    511  * \param *file input file stream being the opened config file
    512  * \param *FileBuffer pointer to FileBuffer on return, should point to NULL
    513  */
    514 void PrepareFileBuffer(const char * const filename, struct ConfigFileBuffer *&FileBuffer)
    515 {
    516   if (FileBuffer != NULL) {
    517     DoeLog(2) && (eLog()<< Verbose(2) << "deleting present FileBuffer in PrepareFileBuffer()." << endl);
    518     delete(FileBuffer);
    519   }
    520   FileBuffer = new ConfigFileBuffer(filename);
    521 
    522   FileBuffer->InitMapping();
    523 };
    524 
    525410/** Loads a molecule from a ConfigFileBuffer.
    526411 * \param *mol molecule to load
     
    719604
    720605  // ParseParameterFile
    721   struct ConfigFileBuffer *FileBuffer = NULL;
    722   PrepareFileBuffer(filename,FileBuffer);
     606  class ConfigFileBuffer *FileBuffer = new ConfigFileBuffer(filename);
    723607
    724608  /* Oeffne Hauptparameterdatei */
     
    729613  int verbose = 0;
    730614 
    731   ParseThermostats(FileBuffer);
     615  //TODO: This is actually sensible?: if (MaxOuterStep > 0)
     616  Thermostats->ParseThermostats(FileBuffer);
    732617 
    733618  /* Namen einlesen */
     
    793678  ParseForParameter(verbose,FileBuffer,"OutVisStep", 0, 1, 1, int_type, &(config::OutVisStep), 1, optional);
    794679  ParseForParameter(verbose,FileBuffer,"OutSrcStep", 0, 1, 1, int_type, &(config::OutSrcStep), 1, optional);
    795   ParseForParameter(verbose,FileBuffer,"TargetTemp", 0, 1, 1, double_type, &(config::TargetTemp), 1, optional);
     680  ParseForParameter(verbose,FileBuffer,"TargetTemp", 0, 1, 1, double_type, &(Thermostats->TargetTemp), 1, optional);
    796681  //ParseForParameter(verbose,FileBuffer,"Thermostat", 0, 1, 1, int_type, &(config::ScaleTempStep), 1, optional);
    797682  if (!ParseForParameter(verbose,FileBuffer,"EpsWannier", 0, 1, 1, double_type, &(config::EpsWannier), 1, optional))
     
    1002887  ParseForParameter(verbose,file,"VisOuterStep", 0, 1, 1, int_type, &(config::OutVisStep), 1, optional);
    1003888  ParseForParameter(verbose,file,"VisSrcOuterStep", 0, 1, 1, int_type, &(config::OutSrcStep), 1, optional);
    1004   ParseForParameter(verbose,file,"TargetTemp", 0, 1, 1, double_type, &(config::TargetTemp), 1, optional);
    1005   ParseForParameter(verbose,file,"ScaleTempStep", 0, 1, 1, int_type, &(config::ScaleTempStep), 1, optional);
     889  ParseForParameter(verbose,file,"TargetTemp", 0, 1, 1, double_type, &(Thermostats->TargetTemp), 1, optional);
     890  ParseForParameter(verbose,file,"ScaleTempStep", 0, 1, 1, int_type, &(Thermostats->ScaleTempStep), 1, optional);
    1006891  config::EpsWannier = 1e-8;
    1007892
     
    11911076    *output << "DoFullCurrent\t" << config::DoFullCurrent << "\t# Do full perturbation" << endl;
    11921077    *output << "DoConstrainedMD\t" << config::DoConstrainedMD << "\t# Do perform a constrained (>0, relating to current MD step) instead of unconstrained (0) MD" << endl;
    1193     *output << "Thermostat\t" << ThermostatNames[Thermostat] << "\t";
    1194     switch(Thermostat) {
     1078    *output << "Thermostat\t" << Thermostats->ThermostatNames[Thermostats->Thermostat] << "\t";
     1079    switch(Thermostats->Thermostat) {
    11951080      default:
    11961081      case None:
    11971082        break;
    11981083      case Woodcock:
    1199         *output << ScaleTempStep;
     1084        *output << Thermostats->ScaleTempStep;
    12001085        break;
    12011086      case Gaussian:
    1202         *output << ScaleTempStep;
     1087        *output << Thermostats->ScaleTempStep;
    12031088        break;
    12041089      case Langevin:
    1205         *output << TempFrequency << "\t" << alpha;
     1090        *output << Thermostats->TempFrequency << "\t" << Thermostats->alpha;
    12061091        break;
    12071092      case Berendsen:
    1208         *output << TempFrequency;
     1093        *output << Thermostats->TempFrequency;
    12091094        break;
    12101095      case NoseHoover:
    1211         *output << HooverMass;
     1096        *output << Thermostats->HooverMass;
    12121097        break;
    12131098    };
     
    12241109    *output << "OutVisStep\t" << config::OutVisStep << "\t# Output visual data every ...th step" << endl;
    12251110    *output << "OutSrcStep\t" << config::OutSrcStep << "\t# Output \"restart\" data every ..th step" << endl;
    1226     *output << "TargetTemp\t" << config::TargetTemp << "\t# Target temperature" << endl;
     1111    *output << "TargetTemp\t" << Thermostats->TargetTemp << "\t# Target temperature" << endl;
    12271112    *output << "MaxPsiStep\t" << config::MaxPsiStep << "\t# number of Minimisation steps per state (0 - default)" << endl;
    12281113    *output << "EpsWannier\t" << config::EpsWannier << "\t# tolerance value for spread minimisation of orbitals" << endl;
  • src/config.hpp

    r88104f ra3fded  
    2020#include <string>
    2121
    22 #include "bondgraph.hpp"
    23 #include "ConfigFileBuffer.hpp"
    24 
    2522/****************************************** forward declarations *****************************/
    2623
     24class BondGraph;
     25class ConfigFileBuffer;
    2726class molecule;
    2827class MoleculeListClass;
    2928class periodentafel;
     29class ThermoStatContainer;
    3030
    3131/********************************************** declarations *******************************/
     
    3737  public:
    3838    class BondGraph *BG;
     39    class ThermoStatContainer *Thermostats;
    3940
    4041    int PsiType;
     
    5657    int DoConstrainedMD;
    5758    int MaxOuterStep;
    58     int Thermostat;
    59     int *ThermostatImplemented;
    60     char **ThermostatNames;
    61     double TempFrequency;
    62     double alpha;
    63     double HooverMass;
    64     double TargetTemp;
    65     int ScaleTempStep;
    6659
    6760  private:
     
    138131  char *GetDefaultPath() const;
    139132  void SetDefaultPath(const char * const path);
    140   void InitThermostats();
    141   void ParseThermostats(class ConfigFileBuffer * const fb);
    142133};
    143134
  • src/molecule.hpp

    r88104f ra3fded  
    8080  double *PenaltyConstants;   //!<  penalty constant in front of each term
    8181};
    82 
    83 #define MaxThermostats 6      //!< maximum number of thermostat entries in Ions#ThermostatNames and Ions#ThermostatImplemented
    84 enum thermostats { None, Woodcock, Gaussian, Langevin, Berendsen, NoseHoover };   //!< Thermostat names for output
    85 
    8682
    8783/** The complete molecule.
  • src/molecule_dynamics.cpp

    r88104f ra3fded  
    1616#include "parser.hpp"
    1717#include "Plane.hpp"
     18#include "ThermoStatContainer.hpp"
    1819
    1920/************************************* Functions for class molecule *********************************/
     
    641642
    642643  // calculate scale configuration
    643   ScaleTempFactor = configuration.TargetTemp/ActualTemp;
     644  ScaleTempFactor = configuration.Thermostats->TargetTemp/ActualTemp;
    644645
    645646  // differentating between the various thermostats
     
    649650      break;
    650651     case Woodcock:
    651       if ((configuration.ScaleTempStep > 0) && ((MDSteps-1) % configuration.ScaleTempStep == 0)) {
     652      if ((configuration.Thermostats->ScaleTempStep > 0) && ((MDSteps-1) % configuration.Thermostats->ScaleTempStep == 0)) {
    652653        DoLog(2) && (Log() << Verbose(2) <<  "Applying Woodcock thermostat..." << endl);
    653654        ActOnAllAtoms( &atom::Thermostat_Woodcock, sqrt(ScaleTempFactor), MDSteps, &ekin );
     
    682683      delta_alpha = 0.;
    683684      ActOnAllAtoms( &atom::Thermostat_NoseHoover_init, MDSteps, &delta_alpha );
    684       delta_alpha = (delta_alpha - (3.*getAtomCount()+1.) * configuration.TargetTemp)/(configuration.HooverMass*Units2Electronmass);
    685       configuration.alpha += delta_alpha*configuration.Deltat;
    686       DoLog(3) && (Log() << Verbose(3) << "alpha = " << delta_alpha << " * " << configuration.Deltat << " = " << configuration.alpha << "." << endl);
     685      delta_alpha = (delta_alpha - (3.*getAtomCount()+1.) * configuration.Thermostats->TargetTemp)/(configuration.Thermostats->HooverMass*Units2Electronmass);
     686      configuration.Thermostats->alpha += delta_alpha*configuration.Deltat;
     687      DoLog(3) && (Log() << Verbose(3) << "alpha = " << delta_alpha << " * " << configuration.Deltat << " = " << configuration.Thermostats->alpha << "." << endl);
    687688      // apply updated alpha as additional force
    688689      ActOnAllAtoms( &atom::Thermostat_NoseHoover_scale, MDSteps, &ekin, &configuration );
  • src/moleculelist.cpp

    r88104f ra3fded  
    1010#include "atom.hpp"
    1111#include "bond.hpp"
     12#include "bondgraph.hpp"
    1213#include "boundary.hpp"
    1314#include "config.hpp"
Note: See TracChangeset for help on using the changeset viewer.