[61d69a4] | 1 | /*
|
---|
| 2 | * Project: MoleCuilder
|
---|
| 3 | * Description: creates and alters molecular systems
|
---|
[0aa122] | 4 | * Copyright (C) 2010-2012 University of Bonn. All rights reserved.
|
---|
[61d69a4] | 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 |
|
---|
[7f570c] | 22 | #include <string>
|
---|
| 23 |
|
---|
[61d69a4] | 24 | #include "CodePatterns/Log.hpp"
|
---|
| 25 |
|
---|
| 26 | #include "MpqcParser.hpp"
|
---|
| 27 | #include "MpqcParser_Parameters.hpp"
|
---|
| 28 |
|
---|
[118f1e] | 29 | #include "Parameters/Parameter.hpp"
|
---|
[61d69a4] | 30 |
|
---|
[ee50c1] | 31 | template <>
|
---|
[118f1e] | 32 | const std::string Value<bool>::getAsString() const
|
---|
[c1db05] | 33 | {
|
---|
[ee50c1] | 34 | ASSERT(ValueSet,
|
---|
[118f1e] | 35 | "Value<bool>::getAsString() - requesting unset value.");
|
---|
[ee50c1] | 36 | if (value)
|
---|
| 37 | return std::string("yes");
|
---|
| 38 | else
|
---|
| 39 | return std::string("no");
|
---|
[c1db05] | 40 | }
|
---|
| 41 |
|
---|
[ee50c1] | 42 | template <>
|
---|
[118f1e] | 43 | void Value<bool>::setAsString(const std::string _value)
|
---|
[d3d6c6] | 44 | {
|
---|
[ee50c1] | 45 | if (_value == std::string("yes")) {
|
---|
[118f1e] | 46 | set(true);
|
---|
[ee50c1] | 47 | } else if (_value == std::string("no")) {
|
---|
[118f1e] | 48 | set(false);
|
---|
[ee50c1] | 49 | } else {
|
---|
| 50 | ASSERT(0,
|
---|
[118f1e] | 51 | "void Value<bool>::setAsString() - value "+_value+" is neither yes or no.");
|
---|
[d3d6c6] | 52 | }
|
---|
| 53 | }
|
---|
| 54 |
|
---|
[ee50c1] | 55 |
|
---|
| 56 | MpqcParser_Parameters::MpqcParser_Parameters()
|
---|
| 57 | {
|
---|
| 58 | Init();
|
---|
| 59 | }
|
---|
| 60 |
|
---|
[c1db05] | 61 | void MpqcParser_Parameters::Init()
|
---|
[61d69a4] | 62 | {
|
---|
| 63 | // add all known basis
|
---|
| 64 | initBasis();
|
---|
| 65 |
|
---|
[ee50c1] | 66 | // add all parameter names
|
---|
| 67 | {
|
---|
| 68 | ParamNames.clear();
|
---|
| 69 | ParamNames.resize(unknownParam);
|
---|
| 70 | ParamNames[hessianParam] = "Hessian";
|
---|
| 71 | ParamNames[savestateParam] = "savestate";
|
---|
| 72 | ParamNames[do_gradientParam] = "do_gradient";
|
---|
| 73 | ParamNames[maxiterParam] = "maxiter";
|
---|
| 74 | ParamNames[memoryParam] = "memory";
|
---|
| 75 | ParamNames[stdapproxParam] = "stdapprox";
|
---|
| 76 | ParamNames[nfzcParam] = "nfzc";
|
---|
| 77 | ParamNames[basisParam] = "basis";
|
---|
| 78 | ParamNames[aux_basisParam] = "aux_basis";
|
---|
| 79 | ParamNames[integrationParam] = "integration";
|
---|
| 80 | ParamNames[theoryParam] = "theory";
|
---|
| 81 | }
|
---|
[61d69a4] | 82 |
|
---|
[ee50c1] | 83 | // create theory parameter
|
---|
| 84 | {
|
---|
| 85 | ValidTheories.clear();
|
---|
| 86 | ValidTheories.resize(unknownTheory);
|
---|
| 87 | ValidTheories[CLHF]="CLHF";
|
---|
| 88 | ValidTheories[CLKS]="CLKS";
|
---|
| 89 | ValidTheories[MBPT2]="MBPT2";
|
---|
| 90 | ValidTheories[MBPT2_R12]="MBPT2_R12";
|
---|
| 91 | appendParameter(
|
---|
[118f1e] | 92 | new Parameter<std::string>(
|
---|
[ee50c1] | 93 | ParamNames[theoryParam],
|
---|
| 94 | ValidTheories,
|
---|
| 95 | ValidTheories[MBPT2]));
|
---|
| 96 | }
|
---|
| 97 | //InvertMap<TheoryNamesType,TheoryLookupType>(TheoryNames,TheoryLookup);
|
---|
| 98 |
|
---|
| 99 | // create integration parameter
|
---|
| 100 | {
|
---|
| 101 | ValidIntegrationMethods.clear();
|
---|
| 102 | ValidIntegrationMethods.resize(unknownIntegration);
|
---|
| 103 | ValidIntegrationMethods[IntegralCints] = "IntegralCints";
|
---|
| 104 | appendParameter(
|
---|
[118f1e] | 105 | new Parameter<std::string>(
|
---|
[ee50c1] | 106 | ParamNames[integrationParam],
|
---|
| 107 | ValidIntegrationMethods,
|
---|
| 108 | ValidIntegrationMethods[IntegralCints]));
|
---|
| 109 | }
|
---|
[44fce5] | 110 |
|
---|
[ee50c1] | 111 | // add all continuous parameters
|
---|
| 112 | {
|
---|
[118f1e] | 113 | appendParameter(new Parameter<bool>(ParamNames[hessianParam], false));
|
---|
| 114 | appendParameter(new Parameter<bool>(ParamNames[savestateParam], false));
|
---|
| 115 | appendParameter(new Parameter<bool>(ParamNames[do_gradientParam], true));
|
---|
| 116 | appendParameter(new Parameter<int>(ParamNames[maxiterParam], 1000));
|
---|
| 117 | appendParameter(new Parameter<int>(ParamNames[memoryParam], 16000000));
|
---|
| 118 | appendParameter(new Parameter<std::string>(ParamNames[stdapproxParam], "A'"));
|
---|
| 119 | appendParameter(new Parameter<int>(ParamNames[nfzcParam], 1));
|
---|
| 120 | appendParameter(new Parameter<std::string>(ParamNames[basisParam], "3-21G"));
|
---|
| 121 | appendParameter(new Parameter<std::string>(ParamNames[aux_basisParam], "aug-cc-pVDZ"));
|
---|
[ee50c1] | 122 | }
|
---|
[61d69a4] | 123 | }
|
---|
| 124 |
|
---|
[ee50c1] | 125 | MpqcParser_Parameters::~MpqcParser_Parameters()
|
---|
| 126 | {}
|
---|
[c1db05] | 127 |
|
---|
[ee50c1] | 128 | /** Getter for a specific Parameter.
|
---|
| 129 | *
|
---|
| 130 | * @param param index among enum Parameters
|
---|
| 131 | * @return value of the desired Parameters
|
---|
| 132 | */
|
---|
| 133 | const std::string MpqcParser_Parameters::getParameter(const enum Parameters param) const
|
---|
| 134 | {
|
---|
[118f1e] | 135 | return FormatParser_Parameters::getParameter(ParamNames[param])->getAsString();
|
---|
[c1db05] | 136 | }
|
---|
| 137 |
|
---|
[ee50c1] | 138 | /** Setter for a specific Parameter.
|
---|
| 139 | *
|
---|
| 140 | * @param param index among enum Parameters
|
---|
| 141 | * @param _value value to set desired Parameter to
|
---|
| 142 | */
|
---|
| 143 | void MpqcParser_Parameters::setParameter(const enum Parameters param, const std::string &_value)
|
---|
[c1db05] | 144 | {
|
---|
[ee50c1] | 145 | const std::string &name = getParameterName(param);
|
---|
[118f1e] | 146 | FormatParser_Parameters::getParameter(name)->setAsString(_value);
|
---|
[c1db05] | 147 | }
|
---|
| 148 |
|
---|
[ee50c1] | 149 | /** Getter for name of a specific Parameter.
|
---|
| 150 | *
|
---|
| 151 | * @param param index among enum Parameters
|
---|
| 152 | * @return name of the desired Parameter
|
---|
| 153 | */
|
---|
| 154 | const std::string &MpqcParser_Parameters::getParameterName(const enum Parameters param) const
|
---|
[c1db05] | 155 | {
|
---|
[ee50c1] | 156 | return ParamNames[param];
|
---|
[c1db05] | 157 | }
|
---|
| 158 |
|
---|
[ee50c1] | 159 | /** Getter for name of a specific Parameter.
|
---|
| 160 | *
|
---|
| 161 | * @param param index among enum Theory
|
---|
| 162 | * @return name of the desired Theory
|
---|
| 163 | */
|
---|
| 164 | const std::string &MpqcParser_Parameters::getTheoryName(const enum Theory theory) const
|
---|
[c1db05] | 165 | {
|
---|
[ee50c1] | 166 | return ValidTheories[theory];
|
---|
[c1db05] | 167 | }
|
---|
| 168 |
|
---|
[ee50c1] | 169 | /** Getter for the name of specific of IntegrationMethod.
|
---|
| 170 | *
|
---|
| 171 | * @param param index among enum IntegrationMethod
|
---|
| 172 | * @return value of the desired IntegrationMethod
|
---|
| 173 | */
|
---|
| 174 | const std::string &MpqcParser_Parameters::getIntegrationMethodName(const enum IntegrationMethod integration) const
|
---|
[61d69a4] | 175 | {
|
---|
[ee50c1] | 176 | return ValidIntegrationMethods[integration];
|
---|
[61d69a4] | 177 | }
|
---|
| 178 |
|
---|
| 179 | /** Checks whether all elements in the world also have parameters in the basis.
|
---|
| 180 | *
|
---|
| 181 | * @return true - all elements parametrized, false - at least one element is missing.
|
---|
| 182 | */
|
---|
| 183 | bool MpqcParser_Parameters::checkWorldElementsAgainstCurrentBasis() const
|
---|
| 184 | {
|
---|
[47d041] | 185 | ELOG(0, "MpqcParser_Parameters::checkWorldElementsAgainstCurrentBasis() - not implemented yet.");
|
---|
[61d69a4] | 186 |
|
---|
| 187 | return false;
|
---|
| 188 | }
|
---|
| 189 |
|
---|