source: src/Parser/MpqcParser_Parameters.cpp@ 118f1e

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 118f1e was 118f1e, checked in by Michael Ankele <ankele@…>, 13 years ago

ParameterStorage now uses ParameterAsString class

  • Property mode set to 100644
File size: 5.3 KB
Line 
1/*
2 * Project: MoleCuilder
3 * Description: creates and alters molecular systems
4 * Copyright (C) 2010-2012 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 "Parameters/Parameter.hpp"
30
31template <>
32const std::string Value<bool>::getAsString() const
33{
34 ASSERT(ValueSet,
35 "Value<bool>::getAsString() - requesting unset value.");
36 if (value)
37 return std::string("yes");
38 else
39 return std::string("no");
40}
41
42template <>
43void Value<bool>::setAsString(const std::string _value)
44{
45 if (_value == std::string("yes")) {
46 set(true);
47 } else if (_value == std::string("no")) {
48 set(false);
49 } else {
50 ASSERT(0,
51 "void Value<bool>::setAsString() - value "+_value+" is neither yes or no.");
52 }
53}
54
55
56MpqcParser_Parameters::MpqcParser_Parameters()
57{
58 Init();
59}
60
61void MpqcParser_Parameters::Init()
62{
63 // add all known basis
64 initBasis();
65
66 // add all parameter names
67 {
68 ParamNames.clear();
69 ParamNames.resize(unknownParam);
70 ParamNames[hessianParam] = "Hessian";
71 ParamNames[savestateParam] = "savestate";
72 ParamNames[do_gradientParam] = "do_gradient";
73 ParamNames[maxiterParam] = "maxiter";
74 ParamNames[memoryParam] = "memory";
75 ParamNames[stdapproxParam] = "stdapprox";
76 ParamNames[nfzcParam] = "nfzc";
77 ParamNames[basisParam] = "basis";
78 ParamNames[aux_basisParam] = "aux_basis";
79 ParamNames[integrationParam] = "integration";
80 ParamNames[theoryParam] = "theory";
81 }
82
83 // create theory parameter
84 {
85 ValidTheories.clear();
86 ValidTheories.resize(unknownTheory);
87 ValidTheories[CLHF]="CLHF";
88 ValidTheories[CLKS]="CLKS";
89 ValidTheories[MBPT2]="MBPT2";
90 ValidTheories[MBPT2_R12]="MBPT2_R12";
91 appendParameter(
92 new Parameter<std::string>(
93 ParamNames[theoryParam],
94 ValidTheories,
95 ValidTheories[MBPT2]));
96 }
97 //InvertMap<TheoryNamesType,TheoryLookupType>(TheoryNames,TheoryLookup);
98
99 // create integration parameter
100 {
101 ValidIntegrationMethods.clear();
102 ValidIntegrationMethods.resize(unknownIntegration);
103 ValidIntegrationMethods[IntegralCints] = "IntegralCints";
104 appendParameter(
105 new Parameter<std::string>(
106 ParamNames[integrationParam],
107 ValidIntegrationMethods,
108 ValidIntegrationMethods[IntegralCints]));
109 }
110
111 // add all continuous parameters
112 {
113 appendParameter(new Parameter<bool>(ParamNames[hessianParam], false));
114 appendParameter(new Parameter<bool>(ParamNames[savestateParam], false));
115 appendParameter(new Parameter<bool>(ParamNames[do_gradientParam], true));
116 appendParameter(new Parameter<int>(ParamNames[maxiterParam], 1000));
117 appendParameter(new Parameter<int>(ParamNames[memoryParam], 16000000));
118 appendParameter(new Parameter<std::string>(ParamNames[stdapproxParam], "A'"));
119 appendParameter(new Parameter<int>(ParamNames[nfzcParam], 1));
120 appendParameter(new Parameter<std::string>(ParamNames[basisParam], "3-21G"));
121 appendParameter(new Parameter<std::string>(ParamNames[aux_basisParam], "aug-cc-pVDZ"));
122 }
123}
124
125MpqcParser_Parameters::~MpqcParser_Parameters()
126{}
127
128/** Getter for a specific Parameter.
129 *
130 * @param param index among enum Parameters
131 * @return value of the desired Parameters
132 */
133const std::string MpqcParser_Parameters::getParameter(const enum Parameters param) const
134{
135 return FormatParser_Parameters::getParameter(ParamNames[param])->getAsString();
136}
137
138/** Setter for a specific Parameter.
139 *
140 * @param param index among enum Parameters
141 * @param _value value to set desired Parameter to
142 */
143void MpqcParser_Parameters::setParameter(const enum Parameters param, const std::string &_value)
144{
145 const std::string &name = getParameterName(param);
146 FormatParser_Parameters::getParameter(name)->setAsString(_value);
147}
148
149/** Getter for name of a specific Parameter.
150 *
151 * @param param index among enum Parameters
152 * @return name of the desired Parameter
153 */
154const std::string &MpqcParser_Parameters::getParameterName(const enum Parameters param) const
155{
156 return ParamNames[param];
157}
158
159/** Getter for name of a specific Parameter.
160 *
161 * @param param index among enum Theory
162 * @return name of the desired Theory
163 */
164const std::string &MpqcParser_Parameters::getTheoryName(const enum Theory theory) const
165{
166 return ValidTheories[theory];
167}
168
169/** Getter for the name of specific of IntegrationMethod.
170 *
171 * @param param index among enum IntegrationMethod
172 * @return value of the desired IntegrationMethod
173 */
174const std::string &MpqcParser_Parameters::getIntegrationMethodName(const enum IntegrationMethod integration) const
175{
176 return ValidIntegrationMethods[integration];
177}
178
179/** Checks whether all elements in the world also have parameters in the basis.
180 *
181 * @return true - all elements parametrized, false - at least one element is missing.
182 */
183bool MpqcParser_Parameters::checkWorldElementsAgainstCurrentBasis() const
184{
185 ELOG(0, "MpqcParser_Parameters::checkWorldElementsAgainstCurrentBasis() - not implemented yet.");
186
187 return false;
188}
189
Note: See TracBrowser for help on using the repository browser.