source: src/Parser/Psi3Parser_Parameters.cpp@ 50e4e5

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 50e4e5 was c17091, checked in by Frederik Heber <heber@…>, 13 years ago

Added convenience function Psi3Parser_Parameters::getReferenceName().

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