source: src/Parser/Psi3Parser_Parameters.cpp@ 42f2f0

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 42f2f0 was 42f2f0, checked in by Frederik Heber <heber@…>, 12 years ago

FIX: MpqcParser_Parameter now simply uses Parameter<string> instead of <bool>.

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