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 "Parser/Parameters/ContinuousParameter.hpp"
|
---|
30 | #include "Parser/Parameters/DiscreteParameter.hpp"
|
---|
31 | #include "Parser/Parameters/StringParameter.hpp"
|
---|
32 |
|
---|
33 | template <>
|
---|
34 | const 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 |
|
---|
44 | template <>
|
---|
45 | void 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 |
|
---|
58 | MpqcParser_Parameters::MpqcParser_Parameters()
|
---|
59 | {
|
---|
60 | Init();
|
---|
61 | }
|
---|
62 |
|
---|
63 | void 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 |
|
---|
127 | MpqcParser_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 | */
|
---|
135 | const 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 | */
|
---|
145 | void 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 | */
|
---|
156 | const 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 | */
|
---|
166 | const 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 | */
|
---|
176 | const 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 | */
|
---|
185 | bool MpqcParser_Parameters::checkWorldElementsAgainstCurrentBasis() const
|
---|
186 | {
|
---|
187 | ELOG(0, "MpqcParser_Parameters::checkWorldElementsAgainstCurrentBasis() - not implemented yet.");
|
---|
188 |
|
---|
189 | return false;
|
---|
190 | }
|
---|
191 |
|
---|