[61d69a4] | 1 | /*
|
---|
| 2 | * Project: MoleCuilder
|
---|
| 3 | * Description: creates and alters molecular systems
|
---|
| 4 | * Copyright (C) 2010 University of Bonn. All rights reserved.
|
---|
| 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 <iostream>
|
---|
| 21 | #include <boost/tokenizer.hpp>
|
---|
| 22 | #include <string>
|
---|
| 23 |
|
---|
| 24 | #include "CodePatterns/MemDebug.hpp"
|
---|
| 25 |
|
---|
| 26 | #include "CodePatterns/Log.hpp"
|
---|
| 27 | #include "CodePatterns/Verbose.hpp"
|
---|
| 28 |
|
---|
| 29 | #include "MpqcParser.hpp"
|
---|
| 30 |
|
---|
| 31 | #include "MpqcParser_Parameters.hpp"
|
---|
| 32 |
|
---|
| 33 |
|
---|
| 34 | using boost::any_cast;
|
---|
| 35 |
|
---|
| 36 | MpqcParser_Parameters::MpqcParser_Parameters()
|
---|
| 37 | {
|
---|
| 38 | // add all known basis
|
---|
| 39 | initBasis();
|
---|
| 40 |
|
---|
| 41 | // add all theory names
|
---|
| 42 | TheoryNames[CLHF]="CLHF";
|
---|
| 43 | TheoryNames[CLKS]="CLKS";
|
---|
| 44 | TheoryNames[MBPT2]="MBPT2";
|
---|
| 45 | TheoryNames[MBPT2_R12]="MBPT2_R12";
|
---|
| 46 |
|
---|
[44fce5] | 47 | {
|
---|
| 48 | // TODO: throw exception instead of eLog()
|
---|
| 49 | std::pair<TheoryLookupType::iterator, bool> inserter;
|
---|
| 50 | for (TheoryNamesType::iterator iter = TheoryNames.begin();
|
---|
| 51 | iter != TheoryNames.end();
|
---|
| 52 | ++iter) {
|
---|
| 53 | inserter = TheoryLookup.insert( make_pair(iter->second, iter->first) );
|
---|
| 54 | if (!inserter.second)
|
---|
| 55 | DoeLog(0) && (eLog() << Verbose(0)
|
---|
| 56 | << "MpqcParser_Parameters::MpqcParser_Parameters() - Theory name already present: "
|
---|
| 57 | << (inserter.first)->second << " and " << iter->first << "!"
|
---|
| 58 | << std::endl);
|
---|
| 59 | }
|
---|
| 60 | }
|
---|
| 61 |
|
---|
[61d69a4] | 62 | // add all integration names
|
---|
| 63 | IntegrationNames[IntegralCints] = "IntegralCints";
|
---|
[44fce5] | 64 | {
|
---|
| 65 | // TODO: throw exception instead of eLog()
|
---|
| 66 | std::pair<IntegrationLookupType::iterator, bool> inserter;
|
---|
| 67 | for (IntegrationNamesType::iterator iter = IntegrationNames.begin();
|
---|
| 68 | iter != IntegrationNames.end();
|
---|
| 69 | ++iter) {
|
---|
| 70 | inserter = IntegrationLookup.insert( make_pair(iter->second, iter->first) );
|
---|
| 71 | if (!inserter.second)
|
---|
| 72 | DoeLog(0) && (eLog() << Verbose(0)
|
---|
| 73 | << "MpqcParser_Parameters::MpqcParser_Parameters() - Integration name already present: "
|
---|
| 74 | << (inserter.first)->second << " and " << iter->first << "!"
|
---|
| 75 | << std::endl);
|
---|
| 76 | }
|
---|
| 77 | }
|
---|
[61d69a4] | 78 |
|
---|
| 79 | // have names for all parmaters
|
---|
[44fce5] | 80 | ParamNames[hessianParam] = "Hessian";
|
---|
[61d69a4] | 81 | ParamNames[savestateParam] = "savestate";
|
---|
| 82 | ParamNames[do_gradientParam] = "do_gradient";
|
---|
| 83 | ParamNames[maxiterParam] = "maxiter";
|
---|
| 84 | ParamNames[memoryParam] = "memory";
|
---|
| 85 | ParamNames[stdapproxParam] = "stdapprox";
|
---|
| 86 | ParamNames[nfzcParam] = "nfzc";
|
---|
| 87 | ParamNames[basisParam] = "basis";
|
---|
| 88 | ParamNames[aux_basisParam] = "aux_basis";
|
---|
| 89 | ParamNames[integrationParam] = "integration";
|
---|
| 90 | ParamNames[theoryParam] = "theory";
|
---|
| 91 |
|
---|
[44fce5] | 92 | {
|
---|
| 93 | // TODO: throw exception instead of eLog()
|
---|
| 94 | std::pair<ParamLookupType::iterator, bool> inserter;
|
---|
| 95 | for (ParamNamesType::iterator iter = ParamNames.begin();
|
---|
| 96 | iter != ParamNames.end();
|
---|
| 97 | ++iter) {
|
---|
| 98 | inserter = ParamLookup.insert( make_pair(iter->second, iter->first) );
|
---|
| 99 | if (!inserter.second)
|
---|
| 100 | DoeLog(0) && (eLog() << Verbose(0)
|
---|
| 101 | << "MpqcParser_Parameters::MpqcParser_Parameters() - parameter name already present: "
|
---|
| 102 | << (inserter.first)->second << " and " << iter->first << "!"
|
---|
| 103 | << std::endl);
|
---|
| 104 | }
|
---|
| 105 | }
|
---|
| 106 |
|
---|
[61d69a4] | 107 | initParameters();
|
---|
| 108 | }
|
---|
| 109 |
|
---|
| 110 | void MpqcParser_Parameters::initParameters()
|
---|
| 111 | {
|
---|
[44fce5] | 112 | appendParameter(hessianParam, bool(false));
|
---|
[61d69a4] | 113 | appendParameter(savestateParam, bool(false));
|
---|
| 114 | appendParameter(do_gradientParam, bool(true));
|
---|
| 115 | appendParameter(maxiterParam, int(1000));
|
---|
| 116 | appendParameter(memoryParam, int(16000000));
|
---|
| 117 | appendParameter(stdapproxParam, std::string("A'"));
|
---|
| 118 | appendParameter(nfzcParam, int(1));
|
---|
| 119 | appendParameter(basisParam, std::string("3-21G"));
|
---|
| 120 | appendParameter(aux_basisParam, std::string("aug-cc-pVDZ"));
|
---|
| 121 | appendParameter(integrationParam, IntegralCints);
|
---|
| 122 | appendParameter(theoryParam, MBPT2);
|
---|
| 123 | }
|
---|
| 124 |
|
---|
| 125 | MpqcParser_Parameters::~MpqcParser_Parameters()
|
---|
| 126 | {}
|
---|
| 127 |
|
---|
[963321a] | 128 | std::ostream & operator << (std::ostream& ost, MpqcParser_Parameters const &_mpqc_params)
|
---|
[61d69a4] | 129 | {
|
---|
[963321a] | 130 | // this is ugly, but with boost::any to safeguard const-ness is plain impossible
|
---|
| 131 | MpqcParser_Parameters &mpqc_params = const_cast<MpqcParser_Parameters &>(_mpqc_params);
|
---|
[61d69a4] | 132 | std::ostringstream output;
|
---|
[963321a] | 133 | output << "Hessian=" << mpqc_params.getBool(MpqcParser_Parameters::hessianParam) << ";";
|
---|
| 134 | output << "savestate=" << mpqc_params.getBool(MpqcParser_Parameters::savestateParam) << ";";
|
---|
| 135 | output << "do_gradient=" << mpqc_params.getBool(MpqcParser_Parameters::do_gradientParam) << ";";
|
---|
| 136 | output << "maxiter=" << mpqc_params.getInt(MpqcParser_Parameters::maxiterParam) << ";";
|
---|
| 137 | output << "memory=" << mpqc_params.getInt(MpqcParser_Parameters::memoryParam) << ";";
|
---|
[61d69a4] | 138 | output << "stdapprox=" << mpqc_params.getString(MpqcParser_Parameters::stdapproxParam) << ";";
|
---|
[963321a] | 139 | output << "nfzc=" << mpqc_params.getInt(MpqcParser_Parameters::nfzcParam) << ";";
|
---|
[61d69a4] | 140 | output << "basis=" << mpqc_params.getString(MpqcParser_Parameters::basisParam) << ";";
|
---|
| 141 | output << "aux_basis=" << mpqc_params.getString(MpqcParser_Parameters::aux_basisParam) << ";";
|
---|
| 142 | output << "integration=" << mpqc_params.getString(MpqcParser_Parameters::integrationParam) << ";";
|
---|
| 143 | output << "theory=" << mpqc_params.getString(MpqcParser_Parameters::theoryParam) << ";";
|
---|
| 144 | ost << output.str();
|
---|
| 145 | return ost;
|
---|
| 146 | }
|
---|
| 147 |
|
---|
| 148 | std::istream & operator >> (std::istream& ist, MpqcParser_Parameters ¶ms)
|
---|
| 149 | {
|
---|
| 150 | typedef boost::tokenizer<boost::char_separator<char> >
|
---|
| 151 | tokenizer;
|
---|
| 152 | boost::char_separator<char> semicolonsep(";");
|
---|
[44fce5] | 153 | boost::char_separator<char> equalitysep(" =");
|
---|
[311da7b] | 154 | boost::char_separator<char> ticksep("\"");
|
---|
[61d69a4] | 155 | std::string line;
|
---|
| 156 | std::getline( ist, line );
|
---|
| 157 | //DoLog(0) && (Log() << Verbose(0) << "INFO: full line of parameters is '" << line << "'" << std::endl);
|
---|
| 158 | tokenizer tokens(line, semicolonsep);
|
---|
| 159 | ASSERT(tokens.begin() != tokens.end(),
|
---|
[311da7b] | 160 | "operator<< on MpqcParser_Parameters - empty string, need at least ';' in line "+line+"!");
|
---|
[61d69a4] | 161 | for (tokenizer::iterator tok_iter = tokens.begin();
|
---|
| 162 | tok_iter != tokens.end(); ++tok_iter) {
|
---|
| 163 | tokenizer paramtokens(*tok_iter, equalitysep);
|
---|
| 164 | if (paramtokens.begin() != paramtokens.end()) {
|
---|
| 165 | tokenizer::iterator tok_paramiter = paramtokens.begin();
|
---|
| 166 | tokenizer::iterator tok_valueiter = tok_paramiter;
|
---|
| 167 | tokenizer::iterator tok_checkiter = ++tok_valueiter;
|
---|
| 168 | ++tok_checkiter;
|
---|
[311da7b] | 169 | // TODO: throw exception instead of ASSERT
|
---|
| 170 | ASSERT(tok_paramiter != paramtokens.end(),
|
---|
| 171 | "operator<< on MpqcParser_Parameters - missing value before ' =' in token "+*tok_iter+"!");
|
---|
| 172 | ASSERT(tok_valueiter != paramtokens.end(),
|
---|
| 173 | "operator<< on MpqcParser_Parameters - missing value after ' =' in token "+*tok_iter+"!");
|
---|
| 174 | ASSERT(tok_checkiter == paramtokens.end(),
|
---|
| 175 | "operator<< on MpqcParser_Parameters - still more tokens after ' =' in token "+*tok_iter+":"
|
---|
| 176 | +*tok_checkiter+"!");
|
---|
| 177 | std::stringstream keystream(*tok_paramiter);
|
---|
| 178 | std::string key;
|
---|
| 179 | keystream >> ws >> key;
|
---|
| 180 | tokenizer ticklesstokens(*tok_valueiter, ticksep);
|
---|
| 181 | ASSERT(ticklesstokens.begin() != ticklesstokens.end(),
|
---|
| 182 | "operator<< on MpqcParser_Parameters - no tokens present after removing ticks in token "+*tok_valueiter+"!");
|
---|
| 183 | std::stringstream valuestream(*(ticklesstokens.begin()));
|
---|
| 184 | DoLog(2) && (Log() << Verbose(2)
|
---|
| 185 | << "INFO: Token pair is " << key << "," << valuestream.str() << std::endl);
|
---|
[61d69a4] | 186 |
|
---|
[44fce5] | 187 | // TODO: throw exception instead of DoeLog()
|
---|
[311da7b] | 188 | ASSERT(params.haveParam(key),
|
---|
| 189 | "operator >> on MpqcParser_Parameters - unknown parameter name '"
|
---|
| 190 | +key+"' with value "+valuestream.str()+"!");
|
---|
| 191 | if (params.haveParam(key))
|
---|
| 192 | params.setter(params.getParam(key), valuestream);
|
---|
[61d69a4] | 193 | } else {
|
---|
| 194 | ist.setstate(std::ios::eofbit);
|
---|
| 195 | }
|
---|
| 196 | }
|
---|
| 197 | return ist;
|
---|
| 198 | }
|
---|
| 199 |
|
---|
| 200 |
|
---|
[44fce5] | 201 | /** Sets a desired value in the params from a string.
|
---|
| 202 | *
|
---|
| 203 | * This is due to strict typing of C++ very ugly and boost::any does not make
|
---|
| 204 | * it any better because it offers to functions to use values directly from
|
---|
| 205 | * stringstream. Probably, because value is unknown to is as well and hence
|
---|
| 206 | * the author could not implement it beautifully, so he dropped it altogether.
|
---|
| 207 | * Grrr ....
|
---|
| 208 | *
|
---|
| 209 | * @param _param param to set
|
---|
| 210 | * @param _desired stringstream containing value as next argument
|
---|
| 211 | * @return true - type ok, false - unknown type in params.
|
---|
[61d69a4] | 212 | */
|
---|
[44fce5] | 213 | bool MpqcParser_Parameters::setter(enum Parameters _param, std::stringstream& _desired) {
|
---|
| 214 | if (_param == integrationParam) {
|
---|
| 215 | std::string tmp;
|
---|
| 216 | _desired >> tmp;
|
---|
| 217 | params[_param] = IntegrationLookup[tmp];
|
---|
| 218 | } else if(_param == theoryParam) {
|
---|
| 219 | std::string tmp;
|
---|
| 220 | _desired >> tmp;
|
---|
| 221 | params[_param] = TheoryLookup[tmp];
|
---|
| 222 | } else if (params[_param].type() == typeid(std::string)) {
|
---|
| 223 | std::string tmp;
|
---|
| 224 | _desired >> tmp;
|
---|
| 225 | params[_param] = tmp;
|
---|
| 226 | } else if (params[_param].type() == typeid(int)) {
|
---|
| 227 | int tmp;
|
---|
| 228 | _desired >> tmp;
|
---|
| 229 | params[_param] = tmp;
|
---|
| 230 | } else if (params[_param].type() == typeid(double)) {
|
---|
| 231 | double tmp;
|
---|
| 232 | _desired >> tmp;
|
---|
| 233 | params[_param] = tmp;
|
---|
| 234 | } else if (params[_param].type() == typeid(bool)) {
|
---|
| 235 | std::string tmp;
|
---|
| 236 | _desired >> tmp;
|
---|
| 237 | if (tmp == "yes") {
|
---|
| 238 | params[_param] = bool(true);
|
---|
| 239 | } else if (tmp == "no") {
|
---|
| 240 | params[_param] = bool(false);
|
---|
| 241 | } else {
|
---|
| 242 | DoeLog(0) && (eLog() << Verbose(0)
|
---|
| 243 | << "MpqcParser_Parameters::setter() - unknown boolean key "
|
---|
| 244 | << tmp << "!" << std::endl);
|
---|
| 245 | }
|
---|
| 246 | } else {
|
---|
[61d69a4] | 247 | DoeLog(0) && (eLog() << Verbose(0)
|
---|
[44fce5] | 248 | << "MpqcParser_Parameters::setter() - unknown type!" << std::endl);
|
---|
| 249 | return false;
|
---|
[61d69a4] | 250 | }
|
---|
[44fce5] | 251 | return true;
|
---|
[61d69a4] | 252 | }
|
---|
| 253 |
|
---|
[44fce5] | 254 |
|
---|
[61d69a4] | 255 | void MpqcParser_Parameters::setTheory(enum Theory _theory)
|
---|
| 256 | {
|
---|
[44fce5] | 257 | // TODO: throw exception instead of eLog()
|
---|
[311da7b] | 258 | // try {
|
---|
[61d69a4] | 259 | params[theoryParam] = _theory;
|
---|
[311da7b] | 260 | // } catch(const boost::bad_any_cast &) {
|
---|
| 261 | // DoeLog(0) && (eLog() << Verbose(0)
|
---|
| 262 | // << "MpqcParser_Parameters::setTheory() - could not set boolean!" << std::endl);
|
---|
| 263 | // }
|
---|
[44fce5] | 264 | }
|
---|
| 265 |
|
---|
| 266 | void MpqcParser_Parameters::setIntegration(enum MpqcParser_Parameters::IntegrationMethod _integration){
|
---|
| 267 | // TODO: throw exception instead of eLog()
|
---|
[311da7b] | 268 | // try {
|
---|
[44fce5] | 269 | params[integrationParam] = _integration;
|
---|
[311da7b] | 270 | // } catch(const boost::bad_any_cast &) {
|
---|
| 271 | // DoeLog(0) && (eLog() << Verbose(0)
|
---|
| 272 | // << "MpqcParser_Parameters::setIntegration() - could not set boolean!" << std::endl);
|
---|
| 273 | // }
|
---|
[61d69a4] | 274 | }
|
---|
| 275 |
|
---|
[44fce5] | 276 | bool MpqcParser_Parameters::haveParam(std::string _name) const
|
---|
| 277 | {
|
---|
| 278 | return ParamLookup.count(_name) != 0;
|
---|
| 279 | }
|
---|
| 280 |
|
---|
| 281 | enum MpqcParser_Parameters::Parameters MpqcParser_Parameters::getParam(std::string _name)
|
---|
| 282 | {
|
---|
| 283 | return ParamLookup[_name];
|
---|
| 284 | }
|
---|
| 285 |
|
---|
[61d69a4] | 286 | enum MpqcParser_Parameters::IntegrationMethod MpqcParser_Parameters::getIntegration()
|
---|
| 287 | {
|
---|
| 288 | enum IntegrationMethod value;
|
---|
[44fce5] | 289 | // TODO: throw exception instead of eLog()
|
---|
[311da7b] | 290 | // try {
|
---|
[61d69a4] | 291 | value = boost::any_cast<enum IntegrationMethod>(params[integrationParam]);
|
---|
[311da7b] | 292 | // } catch(const boost::bad_any_cast &) {
|
---|
| 293 | // DoeLog(0) && (eLog() << Verbose(0)
|
---|
| 294 | // << "MpqcParser_Parameters::getIntegration() - could not convert "
|
---|
| 295 | // +ParamNames[integrationParam]+" to enum IntegrationMethod!" << std::endl);
|
---|
| 296 | // }
|
---|
[61d69a4] | 297 | return value;
|
---|
| 298 | }
|
---|
| 299 |
|
---|
| 300 | enum MpqcParser_Parameters::Theory MpqcParser_Parameters::getTheory()
|
---|
| 301 | {
|
---|
| 302 | enum Theory value;
|
---|
[44fce5] | 303 | // TODO: throw exception instead of eLog()
|
---|
[311da7b] | 304 | // try {
|
---|
[61d69a4] | 305 | value = boost::any_cast<enum Theory>(params[theoryParam]);
|
---|
[311da7b] | 306 | // } catch(const boost::bad_any_cast &) {
|
---|
| 307 | // DoeLog(0) && (eLog() << Verbose(0)
|
---|
| 308 | // << "MpqcParser_Parameters::getTheory() - could not convert "
|
---|
| 309 | // +ParamNames[theoryParam]+" to enum Theory!" << std::endl);
|
---|
| 310 | // }
|
---|
[61d69a4] | 311 | return value;
|
---|
| 312 | }
|
---|
| 313 |
|
---|
| 314 | std::string MpqcParser_Parameters::getString(enum Parameters _param)
|
---|
| 315 | {
|
---|
| 316 | std::string value;
|
---|
| 317 | enum IntegrationMethod Iindex;
|
---|
| 318 | enum Theory Tindex;
|
---|
| 319 | bool test;
|
---|
| 320 | switch (_param) {
|
---|
[44fce5] | 321 | case hessianParam:
|
---|
[61d69a4] | 322 | case savestateParam:
|
---|
| 323 | case do_gradientParam:
|
---|
| 324 | test = boost::any_cast<bool>(params[_param]);
|
---|
| 325 | if (test)
|
---|
| 326 | value = "yes";
|
---|
| 327 | else
|
---|
| 328 | value = "no";
|
---|
| 329 | break;
|
---|
| 330 | case integrationParam:
|
---|
[44fce5] | 331 | // TODO: throw exception instead of eLog()
|
---|
[311da7b] | 332 | // try {
|
---|
[61d69a4] | 333 | Iindex = boost::any_cast<enum IntegrationMethod>(params[_param]);
|
---|
[311da7b] | 334 | // } catch(const boost::bad_any_cast &) {
|
---|
| 335 | // DoeLog(0) && (eLog() << Verbose(0)
|
---|
| 336 | // << "MpqcParser_Parameters::getString() - could not convert "
|
---|
| 337 | // +ParamNames[_param]+" to string!" << std::endl);
|
---|
| 338 | // }
|
---|
[61d69a4] | 339 | value = IntegrationNames[Iindex];
|
---|
| 340 | break;
|
---|
| 341 | case theoryParam:
|
---|
[44fce5] | 342 | // TODO: throw exception instead of eLog()
|
---|
[311da7b] | 343 | // try {
|
---|
[61d69a4] | 344 | Tindex = boost::any_cast<enum Theory>(params[_param]);
|
---|
[311da7b] | 345 | // } catch(const boost::bad_any_cast &) {
|
---|
| 346 | // DoeLog(0) && (eLog() << Verbose(0)
|
---|
| 347 | // << "MpqcParser_Parameters::getString() - could not convert "
|
---|
| 348 | // +ParamNames[_param]+" to string!" << std::endl);
|
---|
| 349 | // }
|
---|
[61d69a4] | 350 | value = TheoryNames[(enum Theory)Tindex];
|
---|
| 351 | break;
|
---|
| 352 | default:
|
---|
[44fce5] | 353 | // TODO: throw exception instead of eLog()
|
---|
[311da7b] | 354 | // try {
|
---|
[61d69a4] | 355 | value = boost::any_cast<std::string>(params[_param]);
|
---|
[311da7b] | 356 | // } catch(const boost::bad_any_cast &) {
|
---|
| 357 | // DoeLog(0) && (eLog() << Verbose(0)
|
---|
| 358 | // << "MpqcParser_Parameters::getString() - could not convert "
|
---|
| 359 | // +ParamNames[_param]+" to string!" << std::endl);
|
---|
| 360 | // }
|
---|
[61d69a4] | 361 | break;
|
---|
| 362 | }
|
---|
| 363 |
|
---|
| 364 | return value;
|
---|
| 365 | }
|
---|
| 366 |
|
---|
| 367 | int MpqcParser_Parameters::getInt(enum Parameters _param)
|
---|
| 368 | {
|
---|
| 369 | int value;
|
---|
| 370 | switch (_param) {
|
---|
| 371 | default:
|
---|
[44fce5] | 372 | // TODO: throw exception instead of eLog()
|
---|
[311da7b] | 373 | // try {
|
---|
[61d69a4] | 374 | value = boost::any_cast<int>(params[_param]);
|
---|
[311da7b] | 375 | // } catch(const boost::bad_any_cast &) {
|
---|
| 376 | // DoeLog(0) && (eLog() << Verbose(0)
|
---|
| 377 | // << "MpqcParser_Parameters::getInt() - could not convert "
|
---|
| 378 | // +ParamNames[_param]+" to int!" << std::endl);
|
---|
| 379 | // }
|
---|
[61d69a4] | 380 | break;
|
---|
| 381 | }
|
---|
| 382 | return value;
|
---|
| 383 | }
|
---|
| 384 |
|
---|
| 385 | double MpqcParser_Parameters::getDouble(enum Parameters _param)
|
---|
[44fce5] | 386 | {
|
---|
[61d69a4] | 387 | double value;
|
---|
[44fce5] | 388 | // TODO: throw exception instead of eLog()
|
---|
[311da7b] | 389 | // try {
|
---|
[61d69a4] | 390 | value = boost::any_cast<double>(params[_param]);
|
---|
[311da7b] | 391 | // } catch(const boost::bad_any_cast &) {
|
---|
| 392 | // DoeLog(0) && (eLog() << Verbose(0)
|
---|
| 393 | // << "MpqcParser_Parameters::getDouble() - could not convert "
|
---|
| 394 | // +ParamNames[_param]+" to double!" << std::endl);
|
---|
| 395 | // }
|
---|
[61d69a4] | 396 | return value;
|
---|
| 397 | }
|
---|
| 398 |
|
---|
| 399 | bool MpqcParser_Parameters::getBool(enum Parameters _param)
|
---|
| 400 | {
|
---|
| 401 | bool value;
|
---|
[44fce5] | 402 | // TODO: throw exception instead of eLog()
|
---|
[311da7b] | 403 | // try {
|
---|
[61d69a4] | 404 | value = boost::any_cast<bool>(params[_param]);
|
---|
[311da7b] | 405 | // } catch(const boost::bad_any_cast &) {
|
---|
| 406 | // DoeLog(0) && (eLog() << Verbose(0)
|
---|
| 407 | // << "MpqcParser_Parameters::getBool() - could not convert "
|
---|
| 408 | // +ParamNames[_param]+" to bool!" << std::endl);
|
---|
| 409 | // }
|
---|
[61d69a4] | 410 | return value;
|
---|
| 411 | }
|
---|
| 412 |
|
---|
| 413 |
|
---|
| 414 | /** Checks whether all elements in the world also have parameters in the basis.
|
---|
| 415 | *
|
---|
| 416 | * @return true - all elements parametrized, false - at least one element is missing.
|
---|
| 417 | */
|
---|
| 418 | bool MpqcParser_Parameters::checkWorldElementsAgainstCurrentBasis() const
|
---|
| 419 | {
|
---|
| 420 | DoeLog(0) && (eLog() << Verbose(0)
|
---|
| 421 | << "MpqcParser_Parameters::checkWorldElementsAgainstCurrentBasis() - not implemented yet."
|
---|
| 422 | << std::endl);
|
---|
| 423 |
|
---|
| 424 | return false;
|
---|
| 425 | }
|
---|
| 426 |
|
---|