- Timestamp:
- Jun 12, 2010, 1:12:51 PM (15 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, 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)
- Location:
- src
- Files:
-
- 2 added
- 12 edited
Legend:
- Unmodified
- Added
- Removed
-
src/Actions/CmdAction/BondLengthTableAction.cpp
r88104f ra3fded 7 7 8 8 #include "Actions/CmdAction/BondLengthTableAction.hpp" 9 #include "bondgraph.hpp" 9 10 #include "config.hpp" 10 11 #include "log.hpp" -
src/Actions/FragmentationAction/DepthFirstSearchAction.cpp
r88104f ra3fded 8 8 #include "Actions/FragmentationAction/DepthFirstSearchAction.hpp" 9 9 #include "atom.hpp" 10 #include "bondgraph.hpp" 10 11 #include "config.hpp" 11 12 #include "log.hpp" -
src/Actions/FragmentationAction/FragmentationAction.cpp
r88104f ra3fded 8 8 #include "Actions/FragmentationAction/FragmentationAction.hpp" 9 9 #include "atom.hpp" 10 #include "bondgraph.hpp" 10 11 #include "config.hpp" 11 12 #include "log.hpp" -
src/ConfigFileBuffer.cpp
r88104f ra3fded 59 59 ConfigFileBuffer::ConfigFileBuffer(const char * const filename) : buffer(NULL), LineMapping(NULL), CurrentLine(0), NoLines(0) 60 60 { 61 InitFileBuffer(filename); 62 } 63 64 void ConfigFileBuffer::InitFileBuffer(const char * const filename) 65 { 61 66 ifstream *file = NULL; 62 67 char line[MAXSTRINGSIZE]; 68 69 RemoveMapping(); 63 70 64 71 // prescan number of lines … … 102 109 file->clear(); 103 110 delete(file); 111 112 InitMapping(); 104 113 } 105 114 … … 108 117 ConfigFileBuffer::~ConfigFileBuffer() 109 118 { 110 for(int i=0;i<NoLines;++i) 111 delete[](buffer[i]); 112 delete[](buffer); 113 delete[](LineMapping); 119 RemoveBuffer(); 120 RemoveMapping(); 114 121 } 115 122 … … 122 129 for (int i=0;i<NoLines;i++) 123 130 LineMapping[i] = i; 131 MappingAllocated = true; 124 132 } 133 134 /** Remove allocated mapping. 135 */ 136 void ConfigFileBuffer::RemoveMapping() 137 { 138 delete[](LineMapping); 139 MappingAllocated = false; 140 } 141 142 /** Remove allocated mapping. 143 */ 144 void ConfigFileBuffer::RemoveBuffer() 145 { 146 for(int i=0;i<NoLines;++i) 147 delete[](buffer[i]); 148 delete[](buffer); 149 } 150 125 151 126 152 /** Creates a mapping for the \a *FileBuffer's lines containing the Ion_Type keyword such that they are sorted. … … 134 160 { 135 161 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(); 140 164 } 141 165 … … 156 180 } 157 181 } 158 -
src/ConfigFileBuffer.hpp
r88104f ra3fded 33 33 ~ConfigFileBuffer(); 34 34 35 void InitFileBuffer(const char * const filename); 36 void MapIonTypesInBuffer(const int NoAtoms); 37 38 private: 39 40 /* 41 * Whether LineMapping is allocated or not. 42 */ 43 bool MappingAllocated; 44 35 45 void InitMapping(); 36 void MapIonTypesInBuffer(const int NoAtoms); 46 void RemoveMapping(); 47 void RemoveBuffer(); 37 48 }; 38 49 -
src/Makefile.am
r88104f ra3fded 178 178 tesselation.cpp \ 179 179 tesselationhelpers.cpp \ 180 ThermoStatContainer.cpp \ 180 181 triangleintersectionlist.cpp \ 181 182 vector.cpp \ … … 221 222 tesselation.hpp \ 222 223 tesselationhelpers.hpp \ 224 ThermoStatContainer.hpp \ 223 225 triangleintersectionlist.hpp \ 224 226 verbose.hpp \ -
src/atom_trajectoryparticle.cpp
r88104f ra3fded 13 13 #include "log.hpp" 14 14 #include "parser.hpp" 15 #include "ThermoStatContainer.hpp" 15 16 #include "verbose.hpp" 16 17 … … 195 196 void TrajectoryParticle::Thermostat_Langevin(int Step, gsl_rng * r, double *ekin, config *configuration) 196 197 { 197 double sigma = sqrt(configuration->T argetTemp/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) 198 199 Vector &U = Trajectory.U.at(Step); 199 200 if (FixedIon == 0) { // even FixedIon moves, only not by other's forces 200 201 // throw a dice to determine whether it gets hit by a heat bath particle 201 if (((((rand()/(double)RAND_MAX))*configuration->T empFrequency) < 1.)) {202 if (((((rand()/(double)RAND_MAX))*configuration->Thermostats->TempFrequency) < 1.)) { 202 203 DoLog(3) && (Log() << Verbose(3) << "Particle " << *this << " was hit (sigma " << sigma << "): " << sqrt(U[0]*U[0]+U[1]*U[1]+U[2]*U[2]) << " -> "); 203 204 // pick three random numbers from a Boltzmann distribution around the desired temperature T for each momenta axis … … 223 224 if (FixedIon == 0) { // even FixedIon moves, only not by other's forces 224 225 for (int d=0; d<NDIM; d++) { 225 U[d] *= sqrt(1+(configuration->Deltat/configuration->T empFrequency)*(ScaleTempFactor-1));226 U[d] *= sqrt(1+(configuration->Deltat/configuration->Thermostats->TempFrequency)*(ScaleTempFactor-1)); 226 227 *ekin += 0.5*type->mass * U[d]*U[d]; 227 228 } … … 253 254 if (FixedIon == 0) { // even FixedIon moves, only not by other's forces 254 255 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)); 256 257 *ekin += (0.5*type->mass) * U[d]*U[d]; 257 258 } -
src/config.cpp
r88104f ra3fded 10 10 #include "atom.hpp" 11 11 #include "bond.hpp" 12 #include "bondgraph.hpp" 12 13 #include "config.hpp" 14 #include "ConfigFileBuffer.hpp" 13 15 #include "element.hpp" 14 16 #include "helpers.hpp" … … 20 22 #include "molecule.hpp" 21 23 #include "periodentafel.hpp" 24 #include "ThermoStatContainer.hpp" 22 25 #include "World.hpp" 23 26 … … 26 29 /** Constructor for config file class. 27 30 */ 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), 31 config::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), 31 33 DoOutVis(0), DoOutMes(1), DoOutNICS(0), DoOutOrbitals(0), DoOutCurrent(0), DoFullCurrent(0), DoPerturbation(0), DoWannier(0), CommonWannier(0), SawtoothStart(0.01), 32 34 VectorPlane(0), VectorCut(0.), UseAddGramSch(1), Seed(1), OutVisStep(10), OutSrcStep(5), MaxPsiStep(0), EpsWannier(1e-7), MaxMinStep(100), RelEpsTotalEnergy(1e-7), … … 40 42 configpath = new char[MAXSTRINGSIZE]; 41 43 configname = new char[MAXSTRINGSIZE]; 44 Thermostats = new ThermoStatContainer(); 42 45 strcpy(mainname,"pcp"); 43 46 strcpy(defaultpath,"not specified"); … … 46 49 configname[0]='\0'; 47 50 basis = "3-21G"; 48 49 InitThermostats();50 51 }; 51 52 … … 60 61 delete[](configpath); 61 62 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); 66 65 67 66 if (BG != NULL) 68 67 delete(BG); 69 68 }; 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 file96 */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 parameters103 if (ParseForParameter(verbose,fb,"Thermostat", 0, 1, 1, string_type, thermo, 1, optional)) {104 if (strcmp(thermo, ThermostatNames[0]) == 0) { // None105 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) { // Woodcock112 if (ThermostatImplemented[1] == 1) {113 Thermostat = Woodcock;114 ParseForParameter(verbose,fb,"Thermostat", 0, 2, 1, int_type, &ScaleTempStep, 1, critical); // read scaling frequency115 } 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) { // Gaussian120 if (ThermostatImplemented[2] == 1) {121 Thermostat = Gaussian;122 ParseForParameter(verbose,fb,"Thermostat", 0, 2, 1, int_type, &ScaleTempStep, 1, critical); // read collision rate123 } 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) { // Langevin128 if (ThermostatImplemented[3] == 1) {129 Thermostat = Langevin;130 ParseForParameter(verbose,fb,"Thermostat", 0, 2, 1, double_type, &TempFrequency, 1, critical); // read gamma131 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) { // Berendsen141 if (ThermostatImplemented[4] == 1) {142 Thermostat = Berendsen;143 ParseForParameter(verbose,fb,"Thermostat", 0, 2, 1, double_type, &TempFrequency, 1, critical); // read \tau_T144 } 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-Hoover149 if (ThermostatImplemented[5] == 1) {150 Thermostat = NoseHoover;151 ParseForParameter(verbose,fb,"Thermostat", 0, 2, 1, double_type, &HooverMass, 1, critical); // read Hoovermass152 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 169 69 170 70 /** Displays menu for editing each entry of the config file. … … 508 408 }; 509 409 510 /** Initializes ConfigFileBuffer from a file.511 * \param *file input file stream being the opened config file512 * \param *FileBuffer pointer to FileBuffer on return, should point to NULL513 */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 525 410 /** Loads a molecule from a ConfigFileBuffer. 526 411 * \param *mol molecule to load … … 719 604 720 605 // ParseParameterFile 721 struct ConfigFileBuffer *FileBuffer = NULL; 722 PrepareFileBuffer(filename,FileBuffer); 606 class ConfigFileBuffer *FileBuffer = new ConfigFileBuffer(filename); 723 607 724 608 /* Oeffne Hauptparameterdatei */ … … 729 613 int verbose = 0; 730 614 731 ParseThermostats(FileBuffer); 615 //TODO: This is actually sensible?: if (MaxOuterStep > 0) 616 Thermostats->ParseThermostats(FileBuffer); 732 617 733 618 /* Namen einlesen */ … … 793 678 ParseForParameter(verbose,FileBuffer,"OutVisStep", 0, 1, 1, int_type, &(config::OutVisStep), 1, optional); 794 679 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); 796 681 //ParseForParameter(verbose,FileBuffer,"Thermostat", 0, 1, 1, int_type, &(config::ScaleTempStep), 1, optional); 797 682 if (!ParseForParameter(verbose,FileBuffer,"EpsWannier", 0, 1, 1, double_type, &(config::EpsWannier), 1, optional)) … … 1002 887 ParseForParameter(verbose,file,"VisOuterStep", 0, 1, 1, int_type, &(config::OutVisStep), 1, optional); 1003 888 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); 1006 891 config::EpsWannier = 1e-8; 1007 892 … … 1191 1076 *output << "DoFullCurrent\t" << config::DoFullCurrent << "\t# Do full perturbation" << endl; 1192 1077 *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" << Thermostat Names[Thermostat] << "\t";1194 switch(Thermostat ) {1078 *output << "Thermostat\t" << Thermostats->ThermostatNames[Thermostats->Thermostat] << "\t"; 1079 switch(Thermostats->Thermostat) { 1195 1080 default: 1196 1081 case None: 1197 1082 break; 1198 1083 case Woodcock: 1199 *output << ScaleTempStep;1084 *output << Thermostats->ScaleTempStep; 1200 1085 break; 1201 1086 case Gaussian: 1202 *output << ScaleTempStep;1087 *output << Thermostats->ScaleTempStep; 1203 1088 break; 1204 1089 case Langevin: 1205 *output << T empFrequency << "\t" <<alpha;1090 *output << Thermostats->TempFrequency << "\t" << Thermostats->alpha; 1206 1091 break; 1207 1092 case Berendsen: 1208 *output << T empFrequency;1093 *output << Thermostats->TempFrequency; 1209 1094 break; 1210 1095 case NoseHoover: 1211 *output << HooverMass;1096 *output << Thermostats->HooverMass; 1212 1097 break; 1213 1098 }; … … 1224 1109 *output << "OutVisStep\t" << config::OutVisStep << "\t# Output visual data every ...th step" << endl; 1225 1110 *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; 1227 1112 *output << "MaxPsiStep\t" << config::MaxPsiStep << "\t# number of Minimisation steps per state (0 - default)" << endl; 1228 1113 *output << "EpsWannier\t" << config::EpsWannier << "\t# tolerance value for spread minimisation of orbitals" << endl; -
src/config.hpp
r88104f ra3fded 20 20 #include <string> 21 21 22 #include "bondgraph.hpp"23 #include "ConfigFileBuffer.hpp"24 25 22 /****************************************** forward declarations *****************************/ 26 23 24 class BondGraph; 25 class ConfigFileBuffer; 27 26 class molecule; 28 27 class MoleculeListClass; 29 28 class periodentafel; 29 class ThermoStatContainer; 30 30 31 31 /********************************************** declarations *******************************/ … … 37 37 public: 38 38 class BondGraph *BG; 39 class ThermoStatContainer *Thermostats; 39 40 40 41 int PsiType; … … 56 57 int DoConstrainedMD; 57 58 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;66 59 67 60 private: … … 138 131 char *GetDefaultPath() const; 139 132 void SetDefaultPath(const char * const path); 140 void InitThermostats();141 void ParseThermostats(class ConfigFileBuffer * const fb);142 133 }; 143 134 -
src/molecule.hpp
r88104f ra3fded 80 80 double *PenaltyConstants; //!< penalty constant in front of each term 81 81 }; 82 83 #define MaxThermostats 6 //!< maximum number of thermostat entries in Ions#ThermostatNames and Ions#ThermostatImplemented84 enum thermostats { None, Woodcock, Gaussian, Langevin, Berendsen, NoseHoover }; //!< Thermostat names for output85 86 82 87 83 /** The complete molecule. -
src/molecule_dynamics.cpp
r88104f ra3fded 16 16 #include "parser.hpp" 17 17 #include "Plane.hpp" 18 #include "ThermoStatContainer.hpp" 18 19 19 20 /************************************* Functions for class molecule *********************************/ … … 641 642 642 643 // calculate scale configuration 643 ScaleTempFactor = configuration.T argetTemp/ActualTemp;644 ScaleTempFactor = configuration.Thermostats->TargetTemp/ActualTemp; 644 645 645 646 // differentating between the various thermostats … … 649 650 break; 650 651 case Woodcock: 651 if ((configuration. ScaleTempStep > 0) && ((MDSteps-1) % configuration.ScaleTempStep == 0)) {652 if ((configuration.Thermostats->ScaleTempStep > 0) && ((MDSteps-1) % configuration.Thermostats->ScaleTempStep == 0)) { 652 653 DoLog(2) && (Log() << Verbose(2) << "Applying Woodcock thermostat..." << endl); 653 654 ActOnAllAtoms( &atom::Thermostat_Woodcock, sqrt(ScaleTempFactor), MDSteps, &ekin ); … … 682 683 delta_alpha = 0.; 683 684 ActOnAllAtoms( &atom::Thermostat_NoseHoover_init, MDSteps, &delta_alpha ); 684 delta_alpha = (delta_alpha - (3.*getAtomCount()+1.) * configuration.T argetTemp)/(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); 687 688 // apply updated alpha as additional force 688 689 ActOnAllAtoms( &atom::Thermostat_NoseHoover_scale, MDSteps, &ekin, &configuration ); -
src/moleculelist.cpp
r88104f ra3fded 10 10 #include "atom.hpp" 11 11 #include "bond.hpp" 12 #include "bondgraph.hpp" 12 13 #include "boundary.hpp" 13 14 #include "config.hpp"
Note:
See TracChangeset
for help on using the changeset viewer.