source: src/Parser/MpqcParser_Parameters.cpp@ 47d041

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
Last change on this file since 47d041 was 47d041, checked in by Frederik Heber <heber@…>, 13 years ago

HUGE: Removed all calls to Log(), eLog(), replaced by LOG() and ELOG().

  • Replaced DoLog(.) && (Log() << Verbose(.) << ... << std::endl) by Log(., ...).
  • Replaced Log() << Verbose(.) << .. << by Log(., ...)
  • on multiline used stringstream to generate and message which was finally used in LOG(., output.str())
  • there should be no more occurence of Log(). LOG() and ELOG() must be used instead.
  • Eventually, this will allow for storing all errors and re-printing them on program exit which would be very helpful to ascertain error-free runs for the user.
  • Property mode set to 100644
File size: 5.4 KB
Line 
1/*
2 * Project: MoleCuilder
3 * Description: creates and alters molecular systems
4 * Copyright (C) 2010 University of Bonn. All rights reserved.
5 * Please see the LICENSE file or "Copyright notice" in builder.cpp for details.
6 */
7
8/*
9 * MpqcParser_Parameters.cpp
10 *
11 * Created on: Feb 3, 2011
12 * Author: heber
13 */
14
15// include config.h
16#ifdef HAVE_CONFIG_H
17#include <config.h>
18#endif
19
20#include "CodePatterns/MemDebug.hpp"
21
22#include <string>
23
24#include "CodePatterns/Log.hpp"
25
26#include "MpqcParser.hpp"
27#include "MpqcParser_Parameters.hpp"
28
29#include "Parser/Parameters/ContinuousParameter.hpp"
30#include "Parser/Parameters/DiscreteParameter.hpp"
31#include "Parser/Parameters/StringParameter.hpp"
32
33template <>
34const std::string ContinuousValue<bool>::get() const
35{
36 ASSERT(ValueSet,
37 "ContinuousValue<bool>::get() - requesting unset value.");
38 if (value)
39 return std::string("yes");
40 else
41 return std::string("no");
42}
43
44template <>
45void ContinuousValue<bool>::set(const std::string _value)
46{
47 if (_value == std::string("yes")) {
48 setValue(true);
49 } else if (_value == std::string("no")) {
50 setValue(false);
51 } else {
52 ASSERT(0,
53 "void ContinuousValue<bool>::set() - value "+_value+" is neither yes or no.");
54 }
55}
56
57
58MpqcParser_Parameters::MpqcParser_Parameters()
59{
60 Init();
61}
62
63void MpqcParser_Parameters::Init()
64{
65 // add all known basis
66 initBasis();
67
68 // add all parameter names
69 {
70 ParamNames.clear();
71 ParamNames.resize(unknownParam);
72 ParamNames[hessianParam] = "Hessian";
73 ParamNames[savestateParam] = "savestate";
74 ParamNames[do_gradientParam] = "do_gradient";
75 ParamNames[maxiterParam] = "maxiter";
76 ParamNames[memoryParam] = "memory";
77 ParamNames[stdapproxParam] = "stdapprox";
78 ParamNames[nfzcParam] = "nfzc";
79 ParamNames[basisParam] = "basis";
80 ParamNames[aux_basisParam] = "aux_basis";
81 ParamNames[integrationParam] = "integration";
82 ParamNames[theoryParam] = "theory";
83 }
84
85 // create theory parameter
86 {
87 ValidTheories.clear();
88 ValidTheories.resize(unknownTheory);
89 ValidTheories[CLHF]="CLHF";
90 ValidTheories[CLKS]="CLKS";
91 ValidTheories[MBPT2]="MBPT2";
92 ValidTheories[MBPT2_R12]="MBPT2_R12";
93 appendParameter(
94 new DiscreteParameter<std::string>(
95 ParamNames[theoryParam],
96 ValidTheories,
97 ValidTheories[MBPT2]));
98 }
99 //InvertMap<TheoryNamesType,TheoryLookupType>(TheoryNames,TheoryLookup);
100
101 // create integration parameter
102 {
103 ValidIntegrationMethods.clear();
104 ValidIntegrationMethods.resize(unknownIntegration);
105 ValidIntegrationMethods[IntegralCints] = "IntegralCints";
106 appendParameter(
107 new DiscreteParameter<std::string>(
108 ParamNames[integrationParam],
109 ValidIntegrationMethods,
110 ValidIntegrationMethods[IntegralCints]));
111 }
112
113 // add all continuous parameters
114 {
115 appendParameter(new ContinuousParameter<bool>(ParamNames[hessianParam], false));
116 appendParameter(new ContinuousParameter<bool>(ParamNames[savestateParam], false));
117 appendParameter(new ContinuousParameter<bool>(ParamNames[do_gradientParam], true));
118 appendParameter(new ContinuousParameter<int>(ParamNames[maxiterParam], 1000));
119 appendParameter(new ContinuousParameter<int>(ParamNames[memoryParam], 16000000));
120 appendParameter(new StringParameter(ParamNames[stdapproxParam], "A'"));
121 appendParameter(new ContinuousParameter<int>(ParamNames[nfzcParam], 1));
122 appendParameter(new StringParameter(ParamNames[basisParam], "3-21G"));
123 appendParameter(new StringParameter(ParamNames[aux_basisParam], "aug-cc-pVDZ"));
124 }
125}
126
127MpqcParser_Parameters::~MpqcParser_Parameters()
128{}
129
130/** Getter for a specific Parameter.
131 *
132 * @param param index among enum Parameters
133 * @return value of the desired Parameters
134 */
135const std::string MpqcParser_Parameters::getParameter(const enum Parameters param) const
136{
137 return FormatParser_Parameters::getParameter(ParamNames[param])->get();
138}
139
140/** Setter for a specific Parameter.
141 *
142 * @param param index among enum Parameters
143 * @param _value value to set desired Parameter to
144 */
145void MpqcParser_Parameters::setParameter(const enum Parameters param, const std::string &_value)
146{
147 const std::string &name = getParameterName(param);
148 FormatParser_Parameters::getParameter(name)->set(_value);
149}
150
151/** Getter for name of a specific Parameter.
152 *
153 * @param param index among enum Parameters
154 * @return name of the desired Parameter
155 */
156const std::string &MpqcParser_Parameters::getParameterName(const enum Parameters param) const
157{
158 return ParamNames[param];
159}
160
161/** Getter for name of a specific Parameter.
162 *
163 * @param param index among enum Theory
164 * @return name of the desired Theory
165 */
166const std::string &MpqcParser_Parameters::getTheoryName(const enum Theory theory) const
167{
168 return ValidTheories[theory];
169}
170
171/** Getter for the name of specific of IntegrationMethod.
172 *
173 * @param param index among enum IntegrationMethod
174 * @return value of the desired IntegrationMethod
175 */
176const std::string &MpqcParser_Parameters::getIntegrationMethodName(const enum IntegrationMethod integration) const
177{
178 return ValidIntegrationMethods[integration];
179}
180
181/** Checks whether all elements in the world also have parameters in the basis.
182 *
183 * @return true - all elements parametrized, false - at least one element is missing.
184 */
185bool MpqcParser_Parameters::checkWorldElementsAgainstCurrentBasis() const
186{
187 ELOG(0, "MpqcParser_Parameters::checkWorldElementsAgainstCurrentBasis() - not implemented yet.");
188
189 return false;
190}
191
Note: See TracBrowser for help on using the repository browser.