| [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";
 | 
|---|
| [e3c4c5] | 71 |     ParamNames[jobtypeParam] = "jobtype";
 | 
|---|
| [ee50c1] | 72 |   }
 | 
|---|
| [61d69a4] | 73 | 
 | 
|---|
| [ee50c1] | 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(
 | 
|---|
| [118f1e] | 83 |         new Parameter<std::string>(
 | 
|---|
| [ee50c1] | 84 |             ParamNames[theoryParam],
 | 
|---|
 | 85 |             ValidTheories,
 | 
|---|
 | 86 |             ValidTheories[MBPT2]));
 | 
|---|
 | 87 |   }
 | 
|---|
 | 88 |   //InvertMap<TheoryNamesType,TheoryLookupType>(TheoryNames,TheoryLookup);
 | 
|---|
 | 89 | 
 | 
|---|
| [e3c4c5] | 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 | 
 | 
|---|
| [ee50c1] | 103 |   // create integration parameter
 | 
|---|
 | 104 |   {
 | 
|---|
 | 105 |     ValidIntegrationMethods.clear();
 | 
|---|
 | 106 |     ValidIntegrationMethods.resize(unknownIntegration);
 | 
|---|
 | 107 |     ValidIntegrationMethods[IntegralCints] = "IntegralCints";
 | 
|---|
 | 108 |     appendParameter(
 | 
|---|
| [118f1e] | 109 |         new Parameter<std::string>(
 | 
|---|
| [ee50c1] | 110 |             ParamNames[integrationParam],
 | 
|---|
 | 111 |             ValidIntegrationMethods,
 | 
|---|
 | 112 |             ValidIntegrationMethods[IntegralCints]));
 | 
|---|
 | 113 |   }
 | 
|---|
| [44fce5] | 114 | 
 | 
|---|
| [42f2f0] | 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 | 
 | 
|---|
| [ee50c1] | 138 |   // add all continuous parameters
 | 
|---|
 | 139 |   {
 | 
|---|
| [118f1e] | 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"));
 | 
|---|
| [ee50c1] | 146 |   }
 | 
|---|
| [61d69a4] | 147 | }
 | 
|---|
 | 148 | 
 | 
|---|
| [ee50c1] | 149 | MpqcParser_Parameters::~MpqcParser_Parameters()
 | 
|---|
 | 150 | {}
 | 
|---|
| [c1db05] | 151 | 
 | 
|---|
| [ee50c1] | 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 | {
 | 
|---|
| [118f1e] | 159 |   return FormatParser_Parameters::getParameter(ParamNames[param])->getAsString();
 | 
|---|
| [c1db05] | 160 | }
 | 
|---|
 | 161 | 
 | 
|---|
| [ee50c1] | 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)
 | 
|---|
| [c1db05] | 168 | {
 | 
|---|
| [ee50c1] | 169 |   const std::string &name = getParameterName(param);
 | 
|---|
| [118f1e] | 170 |   FormatParser_Parameters::getParameter(name)->setAsString(_value);
 | 
|---|
| [c1db05] | 171 | }
 | 
|---|
 | 172 | 
 | 
|---|
| [ee50c1] | 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
 | 
|---|
| [c1db05] | 179 | {
 | 
|---|
| [ee50c1] | 180 |   return ParamNames[param];
 | 
|---|
| [c1db05] | 181 | }
 | 
|---|
 | 182 | 
 | 
|---|
| [ee50c1] | 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
 | 
|---|
| [c1db05] | 189 | {
 | 
|---|
| [ee50c1] | 190 |   return ValidTheories[theory];
 | 
|---|
| [c1db05] | 191 | }
 | 
|---|
 | 192 | 
 | 
|---|
| [e3c4c5] | 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 | 
 | 
|---|
| [ee50c1] | 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
 | 
|---|
| [61d69a4] | 209 | {
 | 
|---|
| [ee50c1] | 210 |   return ValidIntegrationMethods[integration];
 | 
|---|
| [61d69a4] | 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 | {
 | 
|---|
| [47d041] | 219 |   ELOG(0, "MpqcParser_Parameters::checkWorldElementsAgainstCurrentBasis() - not implemented yet.");
 | 
|---|
| [61d69a4] | 220 | 
 | 
|---|
 | 221 |   return false;
 | 
|---|
 | 222 | }
 | 
|---|
 | 223 | 
 | 
|---|