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 | * Psi3Parser_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 "Psi3Parser_Parameters.hpp"
|
---|
42 |
|
---|
43 | #include "Parameters/Parameter.hpp"
|
---|
44 |
|
---|
45 |
|
---|
46 | Psi3Parser_Parameters::Psi3Parser_Parameters()
|
---|
47 | {
|
---|
48 | Init();
|
---|
49 | }
|
---|
50 |
|
---|
51 | void Psi3Parser_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[labelParam] = "label";
|
---|
61 | ParamNames[jobtypeParam] = "jobtype";
|
---|
62 | ParamNames[wavefunctionParam] = "wfn";
|
---|
63 | ParamNames[maxiterParam] = "maxiter";
|
---|
64 | ParamNames[referenceParam] = "reference";
|
---|
65 | ParamNames[basisParam] = "basis";
|
---|
66 | ParamNames[freeze_coreParam] = "freeze_core";
|
---|
67 | ParamNames[unitsParam] = "units";
|
---|
68 | ParamNames[dertypeParam] = "dertype";
|
---|
69 | ParamNames[originParam] = "origin";
|
---|
70 | ParamNames[multiplicityParam] = "multp";
|
---|
71 | ParamNames[chargeParam] = "charge";
|
---|
72 | ParamNames[soccParam] = "socc";
|
---|
73 | ParamNames[doccParam] = "docc";
|
---|
74 | ParamNames[subgroupParam] = "subgroup";
|
---|
75 | ParamNames[unique_axisParam] = "unique_axis";
|
---|
76 | }
|
---|
77 |
|
---|
78 | // create freeze_core parameter
|
---|
79 | {
|
---|
80 | ValidFreezeCore.clear();
|
---|
81 | ValidFreezeCore.resize(unknownFreezeCore);
|
---|
82 | ValidFreezeCore[YES]="yes";
|
---|
83 | ValidFreezeCore[TRUE]="true";
|
---|
84 | ValidFreezeCore[NO]="no";
|
---|
85 | ValidFreezeCore[FALSE]="false";
|
---|
86 | ValidFreezeCore[SMALL]="small";
|
---|
87 | ValidFreezeCore[LARGE]="large";
|
---|
88 | appendParameter(
|
---|
89 | new Parameter<std::string>(
|
---|
90 | ParamNames[freeze_coreParam],
|
---|
91 | ValidFreezeCore,
|
---|
92 | ValidFreezeCore[YES]));
|
---|
93 | }
|
---|
94 |
|
---|
95 | // create units parameter
|
---|
96 | {
|
---|
97 | ValidUnits.clear();
|
---|
98 | ValidUnits.resize(unknownUnits);
|
---|
99 | ValidUnits[angstrom]="angstrom";
|
---|
100 | ValidUnits[bohr]="bohr";
|
---|
101 | appendParameter(
|
---|
102 | new Parameter<std::string>(
|
---|
103 | ParamNames[unitsParam],
|
---|
104 | ValidUnits,
|
---|
105 | ValidUnits[angstrom]));
|
---|
106 | }
|
---|
107 |
|
---|
108 | // create dertype parameter
|
---|
109 | {
|
---|
110 | ValidDerivativeType.clear();
|
---|
111 | ValidDerivativeType.resize(unknownDerivativeType);
|
---|
112 | ValidDerivativeType[NONE]="none";
|
---|
113 | appendParameter(
|
---|
114 | new Parameter<std::string>(
|
---|
115 | ParamNames[dertypeParam],
|
---|
116 | ValidDerivativeType,
|
---|
117 | ValidDerivativeType[NONE]));
|
---|
118 | }
|
---|
119 |
|
---|
120 | // create unique_axis parameter
|
---|
121 | {
|
---|
122 | ValidUniqueAxis.clear();
|
---|
123 | ValidUniqueAxis.resize(unknownUniqueAxis);
|
---|
124 | ValidUniqueAxis[X]="x";
|
---|
125 | ValidUniqueAxis[Y]="y";
|
---|
126 | ValidUniqueAxis[Z]="z";
|
---|
127 | appendParameter(
|
---|
128 | new Parameter<std::string>(
|
---|
129 | ParamNames[unique_axisParam],
|
---|
130 | ValidUniqueAxis,
|
---|
131 | ValidUniqueAxis[X]));
|
---|
132 | }
|
---|
133 |
|
---|
134 | // create jobtype parameter
|
---|
135 | {
|
---|
136 | ValidJobtypes.clear();
|
---|
137 | ValidJobtypes.resize(unknownJobtype);
|
---|
138 | ValidJobtypes[SP]="sp";
|
---|
139 | ValidJobtypes[OPT]="opt";
|
---|
140 | ValidJobtypes[DISP]="disp";
|
---|
141 | ValidJobtypes[FREQ]="freq";
|
---|
142 | ValidJobtypes[SYMM_FREQ]="symm_freq";
|
---|
143 | ValidJobtypes[DBOC]="dboc";
|
---|
144 | ValidJobtypes[RESPONSE]="response";
|
---|
145 | appendParameter(
|
---|
146 | new Parameter<std::string>(
|
---|
147 | ParamNames[jobtypeParam],
|
---|
148 | ValidJobtypes,
|
---|
149 | ValidJobtypes[SP]));
|
---|
150 | }
|
---|
151 |
|
---|
152 | // create wavefunction parameter
|
---|
153 | {
|
---|
154 | ValidWavefunction.clear();
|
---|
155 | ValidWavefunction.resize(unknownWavefunction);
|
---|
156 | ValidWavefunction[SCF]="scf";
|
---|
157 | ValidWavefunction[MP2]="mp2";
|
---|
158 | ValidWavefunction[MP2R12]="mp2r12";
|
---|
159 | ValidWavefunction[CIS]="cis";
|
---|
160 | ValidWavefunction[DETCI]="detci";
|
---|
161 | ValidWavefunction[CASSCF]="casscf";
|
---|
162 | ValidWavefunction[RASSCF]="rasscf";
|
---|
163 | ValidWavefunction[CCSD]="ccsd";
|
---|
164 | ValidWavefunction[CCSD_T]="ccsd_t";
|
---|
165 | ValidWavefunction[BCCD]="bccd";
|
---|
166 | ValidWavefunction[BCCD_T]="bccd_t";
|
---|
167 | ValidWavefunction[EOM_CCSD]="eom_ccsd";
|
---|
168 | ValidWavefunction[ZAPTN]="zaptn";
|
---|
169 | appendParameter(
|
---|
170 | new Parameter<std::string>(
|
---|
171 | ParamNames[wavefunctionParam],
|
---|
172 | ValidWavefunction,
|
---|
173 | ValidWavefunction[SCF]));
|
---|
174 | }
|
---|
175 |
|
---|
176 | // create reference parameter
|
---|
177 | {
|
---|
178 | ValidReference.clear();
|
---|
179 | ValidReference.resize(unknownReference);
|
---|
180 | ValidReference[RHF]="rhf";
|
---|
181 | ValidReference[ROHF]="rohf";
|
---|
182 | ValidReference[UHF]="uhf";
|
---|
183 | ValidReference[TWOCON]="twocon";
|
---|
184 | appendParameter(
|
---|
185 | new Parameter<std::string>(
|
---|
186 | ParamNames[referenceParam],
|
---|
187 | ValidReference,
|
---|
188 | ValidReference[RHF]));
|
---|
189 | }
|
---|
190 |
|
---|
191 | // add all continuous parameters
|
---|
192 | {
|
---|
193 | appendParameter(new Parameter<string>(ParamNames[labelParam], std::string("unknown job")));
|
---|
194 | appendParameter(new Parameter<int>(ParamNames[maxiterParam], 80));
|
---|
195 | appendParameter(new Parameter<string>(ParamNames[basisParam], std::string("cc-pVTZ")));
|
---|
196 | appendParameter(new Parameter<string>(ParamNames[originParam], std::string("(0.0\t0.0\t0.0)"))); // TODO: this should be a vector
|
---|
197 | appendParameter(new Parameter<int>(ParamNames[multiplicityParam], 1));
|
---|
198 | appendParameter(new Parameter<int>(ParamNames[chargeParam], 0));
|
---|
199 | appendParameter(new Parameter<string>(ParamNames[soccParam], std::string("()")));
|
---|
200 | appendParameter(new Parameter<string>(ParamNames[doccParam], std::string("()")));
|
---|
201 | appendParameter(new Parameter<string>(ParamNames[subgroupParam], std::string("")));
|
---|
202 | }
|
---|
203 | }
|
---|
204 |
|
---|
205 | Psi3Parser_Parameters::~Psi3Parser_Parameters()
|
---|
206 | {}
|
---|
207 |
|
---|
208 | /** Getter for a specific Parameter.
|
---|
209 | *
|
---|
210 | * @param param index among enum Parameters
|
---|
211 | * @return value of the desired Parameters
|
---|
212 | */
|
---|
213 | const std::string Psi3Parser_Parameters::getParameter(const enum Parameters param) const
|
---|
214 | {
|
---|
215 | return FormatParser_Parameters::getParameter(ParamNames[param])->getAsString();
|
---|
216 | }
|
---|
217 |
|
---|
218 | /** Setter for a specific Parameter.
|
---|
219 | *
|
---|
220 | * @param param index among enum Parameters
|
---|
221 | * @param _value value to set desired Parameter to
|
---|
222 | */
|
---|
223 | void Psi3Parser_Parameters::setParameter(const enum Parameters param, const std::string &_value)
|
---|
224 | {
|
---|
225 | const std::string &name = getParameterName(param);
|
---|
226 | FormatParser_Parameters::getParameter(name)->setAsString(_value);
|
---|
227 | }
|
---|
228 |
|
---|
229 | /** Getter for name of a specific Parameter.
|
---|
230 | *
|
---|
231 | * @param param index among enum Parameters
|
---|
232 | * @return name of the desired Parameter
|
---|
233 | */
|
---|
234 | const std::string &Psi3Parser_Parameters::getParameterName(const enum Parameters param) const
|
---|
235 | {
|
---|
236 | return ParamNames[param];
|
---|
237 | }
|
---|
238 |
|
---|
239 | /** Getter for name of a specific Reference.
|
---|
240 | *
|
---|
241 | * @param reference index among enum Reference
|
---|
242 | * @return name of the desired Reference
|
---|
243 | */
|
---|
244 | const std::string &Psi3Parser_Parameters::getReferenceName(const enum Reference reference) const
|
---|
245 | {
|
---|
246 | return ValidReference[reference];
|
---|
247 | }
|
---|
248 |
|
---|
249 | /** Checks whether all elements in the world also have parameters in the basis.
|
---|
250 | *
|
---|
251 | * @return true - all elements parametrized, false - at least one element is missing.
|
---|
252 | */
|
---|
253 | bool Psi3Parser_Parameters::checkWorldElementsAgainstCurrentBasis() const
|
---|
254 | {
|
---|
255 | ELOG(0, "Psi3Parser_Parameters::checkWorldElementsAgainstCurrentBasis() - not implemented yet.");
|
---|
256 |
|
---|
257 | return false;
|
---|
258 | }
|
---|
259 |
|
---|