[61d69a4] | 1 | /*
|
---|
| 2 | * Project: MoleCuilder
|
---|
| 3 | * Description: creates and alters molecular systems
|
---|
[0aa122] | 4 | * Copyright (C) 2010-2012 University of Bonn. All rights reserved.
|
---|
[94d5ac6] | 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/>.
|
---|
[61d69a4] | 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 |
|
---|
[7f570c] | 37 | #include <string>
|
---|
| 38 |
|
---|
[61d69a4] | 39 | #include "CodePatterns/Log.hpp"
|
---|
| 40 |
|
---|
| 41 | #include "MpqcParser_Parameters.hpp"
|
---|
| 42 |
|
---|
[118f1e] | 43 | #include "Parameters/Parameter.hpp"
|
---|
[61d69a4] | 44 |
|
---|
[a2f5e5] | 45 |
|
---|
[ee50c1] | 46 | MpqcParser_Parameters::MpqcParser_Parameters()
|
---|
| 47 | {
|
---|
| 48 | Init();
|
---|
| 49 | }
|
---|
| 50 |
|
---|
[c1db05] | 51 | void MpqcParser_Parameters::Init()
|
---|
[61d69a4] | 52 | {
|
---|
| 53 | // add all known basis
|
---|
| 54 | initBasis();
|
---|
| 55 |
|
---|
[ee50c1] | 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 | }
|
---|
[61d69a4] | 72 |
|
---|
[ee50c1] | 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(
|
---|
[118f1e] | 82 | new Parameter<std::string>(
|
---|
[ee50c1] | 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(
|
---|
[118f1e] | 95 | new Parameter<std::string>(
|
---|
[ee50c1] | 96 | ParamNames[integrationParam],
|
---|
| 97 | ValidIntegrationMethods,
|
---|
| 98 | ValidIntegrationMethods[IntegralCints]));
|
---|
| 99 | }
|
---|
[44fce5] | 100 |
|
---|
[42f2f0] | 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 |
|
---|
[ee50c1] | 124 | // add all continuous parameters
|
---|
| 125 | {
|
---|
[118f1e] | 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"));
|
---|
[ee50c1] | 132 | }
|
---|
[61d69a4] | 133 | }
|
---|
| 134 |
|
---|
[ee50c1] | 135 | MpqcParser_Parameters::~MpqcParser_Parameters()
|
---|
| 136 | {}
|
---|
[c1db05] | 137 |
|
---|
[ee50c1] | 138 | /** Getter for a specific Parameter.
|
---|
| 139 | *
|
---|
| 140 | * @param param index among enum Parameters
|
---|
| 141 | * @return value of the desired Parameters
|
---|
| 142 | */
|
---|
| 143 | const std::string MpqcParser_Parameters::getParameter(const enum Parameters param) const
|
---|
| 144 | {
|
---|
[118f1e] | 145 | return FormatParser_Parameters::getParameter(ParamNames[param])->getAsString();
|
---|
[c1db05] | 146 | }
|
---|
| 147 |
|
---|
[ee50c1] | 148 | /** Setter for a specific Parameter.
|
---|
| 149 | *
|
---|
| 150 | * @param param index among enum Parameters
|
---|
| 151 | * @param _value value to set desired Parameter to
|
---|
| 152 | */
|
---|
| 153 | void MpqcParser_Parameters::setParameter(const enum Parameters param, const std::string &_value)
|
---|
[c1db05] | 154 | {
|
---|
[ee50c1] | 155 | const std::string &name = getParameterName(param);
|
---|
[118f1e] | 156 | FormatParser_Parameters::getParameter(name)->setAsString(_value);
|
---|
[c1db05] | 157 | }
|
---|
| 158 |
|
---|
[ee50c1] | 159 | /** Getter for name of a specific Parameter.
|
---|
| 160 | *
|
---|
| 161 | * @param param index among enum Parameters
|
---|
| 162 | * @return name of the desired Parameter
|
---|
| 163 | */
|
---|
| 164 | const std::string &MpqcParser_Parameters::getParameterName(const enum Parameters param) const
|
---|
[c1db05] | 165 | {
|
---|
[ee50c1] | 166 | return ParamNames[param];
|
---|
[c1db05] | 167 | }
|
---|
| 168 |
|
---|
[ee50c1] | 169 | /** Getter for name of a specific Parameter.
|
---|
| 170 | *
|
---|
| 171 | * @param param index among enum Theory
|
---|
| 172 | * @return name of the desired Theory
|
---|
| 173 | */
|
---|
| 174 | const std::string &MpqcParser_Parameters::getTheoryName(const enum Theory theory) const
|
---|
[c1db05] | 175 | {
|
---|
[ee50c1] | 176 | return ValidTheories[theory];
|
---|
[c1db05] | 177 | }
|
---|
| 178 |
|
---|
[ee50c1] | 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 | */
|
---|
| 184 | const std::string &MpqcParser_Parameters::getIntegrationMethodName(const enum IntegrationMethod integration) const
|
---|
[61d69a4] | 185 | {
|
---|
[ee50c1] | 186 | return ValidIntegrationMethods[integration];
|
---|
[61d69a4] | 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 | */
|
---|
| 193 | bool MpqcParser_Parameters::checkWorldElementsAgainstCurrentBasis() const
|
---|
| 194 | {
|
---|
[47d041] | 195 | ELOG(0, "MpqcParser_Parameters::checkWorldElementsAgainstCurrentBasis() - not implemented yet.");
|
---|
[61d69a4] | 196 |
|
---|
| 197 | return false;
|
---|
| 198 | }
|
---|
| 199 |
|
---|