source: src/Parser/MpqcParser_Parameters.cpp@ 97dff0

Last change on this file since 97dff0 was a2f5e5, checked in by Frederik Heber <heber@…>, 12 years ago

FIX: Cleaned up includes in Psi3Parser_Parameters.

  • Property mode set to 100644
File size: 5.7 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 *
6 *
7 * This file is part of MoleCuilder.
8 *
9 * MoleCuilder is free software: you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation, either version 2 of the License, or
12 * (at your option) any later version.
13 *
14 * MoleCuilder is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
18 *
19 * You should have received a copy of the GNU General Public License
20 * along with MoleCuilder. If not, see <http://www.gnu.org/licenses/>.
21 */
22
23/*
24 * MpqcParser_Parameters.cpp
25 *
26 * Created on: Feb 3, 2011
27 * Author: heber
28 */
29
30// include config.h
31#ifdef HAVE_CONFIG_H
32#include <config.h>
33#endif
34
35#include "CodePatterns/MemDebug.hpp"
36
37#include <string>
38
39#include "CodePatterns/Log.hpp"
40
41#include "MpqcParser_Parameters.hpp"
42
43#include "Parameters/Parameter.hpp"
44
45
46MpqcParser_Parameters::MpqcParser_Parameters()
47{
48 Init();
49}
50
51void MpqcParser_Parameters::Init()
52{
53 // add all known basis
54 initBasis();
55
56 // add all parameter names
57 {
58 ParamNames.clear();
59 ParamNames.resize(unknownParam);
60 ParamNames[hessianParam] = "Hessian";
61 ParamNames[savestateParam] = "savestate";
62 ParamNames[do_gradientParam] = "do_gradient";
63 ParamNames[maxiterParam] = "maxiter";
64 ParamNames[memoryParam] = "memory";
65 ParamNames[stdapproxParam] = "stdapprox";
66 ParamNames[nfzcParam] = "nfzc";
67 ParamNames[basisParam] = "basis";
68 ParamNames[aux_basisParam] = "aux_basis";
69 ParamNames[integrationParam] = "integration";
70 ParamNames[theoryParam] = "theory";
71 }
72
73 // create theory parameter
74 {
75 ValidTheories.clear();
76 ValidTheories.resize(unknownTheory);
77 ValidTheories[CLHF]="CLHF";
78 ValidTheories[CLKS]="CLKS";
79 ValidTheories[MBPT2]="MBPT2";
80 ValidTheories[MBPT2_R12]="MBPT2_R12";
81 appendParameter(
82 new Parameter<std::string>(
83 ParamNames[theoryParam],
84 ValidTheories,
85 ValidTheories[MBPT2]));
86 }
87 //InvertMap<TheoryNamesType,TheoryLookupType>(TheoryNames,TheoryLookup);
88
89 // create integration parameter
90 {
91 ValidIntegrationMethods.clear();
92 ValidIntegrationMethods.resize(unknownIntegration);
93 ValidIntegrationMethods[IntegralCints] = "IntegralCints";
94 appendParameter(
95 new Parameter<std::string>(
96 ParamNames[integrationParam],
97 ValidIntegrationMethods,
98 ValidIntegrationMethods[IntegralCints]));
99 }
100
101 // create hessian, savestate, do_gradient parameter
102 {
103 ValidBools.clear();
104 ValidBools.resize(unknownBool);
105 ValidBools[no]="no";
106 ValidBools[yes]="yes";
107 appendParameter(
108 new Parameter<std::string>(
109 ParamNames[hessianParam],
110 ValidBools,
111 ValidBools[no]));
112 appendParameter(
113 new Parameter<std::string>(
114 ParamNames[savestateParam],
115 ValidBools,
116 ValidBools[no]));
117 appendParameter(
118 new Parameter<std::string>(
119 ParamNames[do_gradientParam],
120 ValidBools,
121 ValidBools[true]));
122 }
123
124 // add all continuous parameters
125 {
126 appendParameter(new Parameter<int>(ParamNames[maxiterParam], 1000));
127 appendParameter(new Parameter<int>(ParamNames[memoryParam], 16000000));
128 appendParameter(new Parameter<std::string>(ParamNames[stdapproxParam], "A'"));
129 appendParameter(new Parameter<int>(ParamNames[nfzcParam], 1));
130 appendParameter(new Parameter<std::string>(ParamNames[basisParam], "3-21G"));
131 appendParameter(new Parameter<std::string>(ParamNames[aux_basisParam], "aug-cc-pVDZ"));
132 }
133}
134
135MpqcParser_Parameters::~MpqcParser_Parameters()
136{}
137
138/** Getter for a specific Parameter.
139 *
140 * @param param index among enum Parameters
141 * @return value of the desired Parameters
142 */
143const std::string MpqcParser_Parameters::getParameter(const enum Parameters param) const
144{
145 return FormatParser_Parameters::getParameter(ParamNames[param])->getAsString();
146}
147
148/** Setter for a specific Parameter.
149 *
150 * @param param index among enum Parameters
151 * @param _value value to set desired Parameter to
152 */
153void MpqcParser_Parameters::setParameter(const enum Parameters param, const std::string &_value)
154{
155 const std::string &name = getParameterName(param);
156 FormatParser_Parameters::getParameter(name)->setAsString(_value);
157}
158
159/** Getter for name of a specific Parameter.
160 *
161 * @param param index among enum Parameters
162 * @return name of the desired Parameter
163 */
164const std::string &MpqcParser_Parameters::getParameterName(const enum Parameters param) const
165{
166 return ParamNames[param];
167}
168
169/** Getter for name of a specific Parameter.
170 *
171 * @param param index among enum Theory
172 * @return name of the desired Theory
173 */
174const std::string &MpqcParser_Parameters::getTheoryName(const enum Theory theory) const
175{
176 return ValidTheories[theory];
177}
178
179/** Getter for the name of specific of IntegrationMethod.
180 *
181 * @param param index among enum IntegrationMethod
182 * @return value of the desired IntegrationMethod
183 */
184const std::string &MpqcParser_Parameters::getIntegrationMethodName(const enum IntegrationMethod integration) const
185{
186 return ValidIntegrationMethods[integration];
187}
188
189/** Checks whether all elements in the world also have parameters in the basis.
190 *
191 * @return true - all elements parametrized, false - at least one element is missing.
192 */
193bool MpqcParser_Parameters::checkWorldElementsAgainstCurrentBasis() const
194{
195 ELOG(0, "MpqcParser_Parameters::checkWorldElementsAgainstCurrentBasis() - not implemented yet.");
196
197 return false;
198}
199
Note: See TracBrowser for help on using the repository browser.