| 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 | * 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 |  | 
|---|
| 37 | #include <string> | 
|---|
| 38 |  | 
|---|
| 39 | #include "CodePatterns/Log.hpp" | 
|---|
| 40 |  | 
|---|
| 41 | #include "MpqcParser_Parameters.hpp" | 
|---|
| 42 |  | 
|---|
| 43 | #include "Parameters/Parameter.hpp" | 
|---|
| 44 |  | 
|---|
| 45 |  | 
|---|
| 46 | MpqcParser_Parameters::MpqcParser_Parameters() | 
|---|
| 47 | { | 
|---|
| 48 | Init(); | 
|---|
| 49 | } | 
|---|
| 50 |  | 
|---|
| 51 | void MpqcParser_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[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 | ParamNames[jobtypeParam] = "jobtype"; | 
|---|
| 72 | } | 
|---|
| 73 |  | 
|---|
| 74 | // create theory parameter | 
|---|
| 75 | { | 
|---|
| 76 | ValidTheories.clear(); | 
|---|
| 77 | ValidTheories.resize(unknownTheory); | 
|---|
| 78 | ValidTheories[CLHF]="CLHF"; | 
|---|
| 79 | ValidTheories[CLKS]="CLKS"; | 
|---|
| 80 | ValidTheories[MBPT2]="MBPT2"; | 
|---|
| 81 | ValidTheories[MBPT2_R12]="MBPT2_R12"; | 
|---|
| 82 | appendParameter( | 
|---|
| 83 | new Parameter<std::string>( | 
|---|
| 84 | ParamNames[theoryParam], | 
|---|
| 85 | ValidTheories, | 
|---|
| 86 | ValidTheories[MBPT2])); | 
|---|
| 87 | } | 
|---|
| 88 | //InvertMap<TheoryNamesType,TheoryLookupType>(TheoryNames,TheoryLookup); | 
|---|
| 89 |  | 
|---|
| 90 | // create Jobs parameter | 
|---|
| 91 | { | 
|---|
| 92 | ValidJobtypes.clear(); | 
|---|
| 93 | ValidJobtypes.resize(unknownJob); | 
|---|
| 94 | ValidJobtypes[Default]="Default"; | 
|---|
| 95 | ValidJobtypes[Optimization]="Optimization"; | 
|---|
| 96 | appendParameter( | 
|---|
| 97 | new Parameter<std::string>( | 
|---|
| 98 | ParamNames[jobtypeParam], | 
|---|
| 99 | ValidJobtypes, | 
|---|
| 100 | ValidJobtypes[Default])); | 
|---|
| 101 | } | 
|---|
| 102 |  | 
|---|
| 103 | // create integration parameter | 
|---|
| 104 | { | 
|---|
| 105 | ValidIntegrationMethods.clear(); | 
|---|
| 106 | ValidIntegrationMethods.resize(unknownIntegration); | 
|---|
| 107 | ValidIntegrationMethods[IntegralCints] = "IntegralCints"; | 
|---|
| 108 | appendParameter( | 
|---|
| 109 | new Parameter<std::string>( | 
|---|
| 110 | ParamNames[integrationParam], | 
|---|
| 111 | ValidIntegrationMethods, | 
|---|
| 112 | ValidIntegrationMethods[IntegralCints])); | 
|---|
| 113 | } | 
|---|
| 114 |  | 
|---|
| 115 | // create hessian, savestate, do_gradient parameter | 
|---|
| 116 | { | 
|---|
| 117 | ValidBools.clear(); | 
|---|
| 118 | ValidBools.resize(unknownBool); | 
|---|
| 119 | ValidBools[no]="no"; | 
|---|
| 120 | ValidBools[yes]="yes"; | 
|---|
| 121 | appendParameter( | 
|---|
| 122 | new Parameter<std::string>( | 
|---|
| 123 | ParamNames[hessianParam], | 
|---|
| 124 | ValidBools, | 
|---|
| 125 | ValidBools[no])); | 
|---|
| 126 | appendParameter( | 
|---|
| 127 | new Parameter<std::string>( | 
|---|
| 128 | ParamNames[savestateParam], | 
|---|
| 129 | ValidBools, | 
|---|
| 130 | ValidBools[no])); | 
|---|
| 131 | appendParameter( | 
|---|
| 132 | new Parameter<std::string>( | 
|---|
| 133 | ParamNames[do_gradientParam], | 
|---|
| 134 | ValidBools, | 
|---|
| 135 | ValidBools[true])); | 
|---|
| 136 | } | 
|---|
| 137 |  | 
|---|
| 138 | // add all continuous parameters | 
|---|
| 139 | { | 
|---|
| 140 | appendParameter(new Parameter<int>(ParamNames[maxiterParam], 1000)); | 
|---|
| 141 | appendParameter(new Parameter<int>(ParamNames[memoryParam], 16000000)); | 
|---|
| 142 | appendParameter(new Parameter<std::string>(ParamNames[stdapproxParam], "A'")); | 
|---|
| 143 | appendParameter(new Parameter<int>(ParamNames[nfzcParam], 1)); | 
|---|
| 144 | appendParameter(new Parameter<std::string>(ParamNames[basisParam], "3-21G")); | 
|---|
| 145 | appendParameter(new Parameter<std::string>(ParamNames[aux_basisParam], "aug-cc-pVDZ")); | 
|---|
| 146 | } | 
|---|
| 147 | } | 
|---|
| 148 |  | 
|---|
| 149 | MpqcParser_Parameters::~MpqcParser_Parameters() | 
|---|
| 150 | {} | 
|---|
| 151 |  | 
|---|
| 152 | /** Getter for a specific Parameter. | 
|---|
| 153 | * | 
|---|
| 154 | * @param param index among enum Parameters | 
|---|
| 155 | * @return value of the desired Parameters | 
|---|
| 156 | */ | 
|---|
| 157 | const std::string MpqcParser_Parameters::getParameter(const enum Parameters param) const | 
|---|
| 158 | { | 
|---|
| 159 | return FormatParser_Parameters::getParameter(ParamNames[param])->getAsString(); | 
|---|
| 160 | } | 
|---|
| 161 |  | 
|---|
| 162 | /** Setter for a specific Parameter. | 
|---|
| 163 | * | 
|---|
| 164 | * @param param index among enum Parameters | 
|---|
| 165 | * @param _value value to set desired Parameter to | 
|---|
| 166 | */ | 
|---|
| 167 | void MpqcParser_Parameters::setParameter(const enum Parameters param, const std::string &_value) | 
|---|
| 168 | { | 
|---|
| 169 | const std::string &name = getParameterName(param); | 
|---|
| 170 | FormatParser_Parameters::getParameter(name)->setAsString(_value); | 
|---|
| 171 | } | 
|---|
| 172 |  | 
|---|
| 173 | /** Getter for name of a specific Parameter. | 
|---|
| 174 | * | 
|---|
| 175 | * @param param index among enum Parameters | 
|---|
| 176 | * @return name of the desired Parameter | 
|---|
| 177 | */ | 
|---|
| 178 | const std::string &MpqcParser_Parameters::getParameterName(const enum Parameters param) const | 
|---|
| 179 | { | 
|---|
| 180 | return ParamNames[param]; | 
|---|
| 181 | } | 
|---|
| 182 |  | 
|---|
| 183 | /** Getter for name of a specific Parameter. | 
|---|
| 184 | * | 
|---|
| 185 | * @param param index among enum Theory | 
|---|
| 186 | * @return name of the desired Theory | 
|---|
| 187 | */ | 
|---|
| 188 | const std::string &MpqcParser_Parameters::getTheoryName(const enum Theory theory) const | 
|---|
| 189 | { | 
|---|
| 190 | return ValidTheories[theory]; | 
|---|
| 191 | } | 
|---|
| 192 |  | 
|---|
| 193 | /** Getter for name of a specific Parameter. | 
|---|
| 194 | * | 
|---|
| 195 | * @param param index among enum Jobtype | 
|---|
| 196 | * @return name of the desired Jobtype | 
|---|
| 197 | */ | 
|---|
| 198 | const std::string &MpqcParser_Parameters::getJobtypeName(const enum Jobtype jobtype) const | 
|---|
| 199 | { | 
|---|
| 200 | return ValidJobtypes[jobtype]; | 
|---|
| 201 | } | 
|---|
| 202 |  | 
|---|
| 203 | /** Getter for the name of specific of IntegrationMethod. | 
|---|
| 204 | * | 
|---|
| 205 | * @param param index among enum IntegrationMethod | 
|---|
| 206 | * @return value of the desired IntegrationMethod | 
|---|
| 207 | */ | 
|---|
| 208 | const std::string &MpqcParser_Parameters::getIntegrationMethodName(const enum IntegrationMethod integration) const | 
|---|
| 209 | { | 
|---|
| 210 | return ValidIntegrationMethods[integration]; | 
|---|
| 211 | } | 
|---|
| 212 |  | 
|---|
| 213 | /** Checks whether all elements in the world also have parameters in the basis. | 
|---|
| 214 | * | 
|---|
| 215 | * @return true - all elements parametrized, false - at least one element is missing. | 
|---|
| 216 | */ | 
|---|
| 217 | bool MpqcParser_Parameters::checkWorldElementsAgainstCurrentBasis() const | 
|---|
| 218 | { | 
|---|
| 219 | ELOG(0, "MpqcParser_Parameters::checkWorldElementsAgainstCurrentBasis() - not implemented yet."); | 
|---|
| 220 |  | 
|---|
| 221 | return false; | 
|---|
| 222 | } | 
|---|
| 223 |  | 
|---|