[bcf653] | 1 | /*
|
---|
| 2 | * Project: MoleCuilder
|
---|
| 3 | * Description: creates and alters molecular systems
|
---|
[0aa122] | 4 | * Copyright (C) 2010-2012 University of Bonn. All rights reserved.
|
---|
[5aaa43] | 5 | * Copyright (C) 2013 Frederik Heber. All rights reserved.
|
---|
[94d5ac6] | 6 | *
|
---|
| 7 | *
|
---|
| 8 | * This file is part of MoleCuilder.
|
---|
| 9 | *
|
---|
| 10 | * MoleCuilder is free software: you can redistribute it and/or modify
|
---|
| 11 | * it under the terms of the GNU General Public License as published by
|
---|
| 12 | * the Free Software Foundation, either version 2 of the License, or
|
---|
| 13 | * (at your option) any later version.
|
---|
| 14 | *
|
---|
| 15 | * MoleCuilder is distributed in the hope that it will be useful,
|
---|
| 16 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
---|
| 17 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
---|
| 18 | * GNU General Public License for more details.
|
---|
| 19 | *
|
---|
| 20 | * You should have received a copy of the GNU General Public License
|
---|
| 21 | * along with MoleCuilder. If not, see <http://www.gnu.org/licenses/>.
|
---|
[bcf653] | 22 | */
|
---|
| 23 |
|
---|
[43dad6] | 24 | /*
|
---|
| 25 | * MpqcParser.cpp
|
---|
| 26 | *
|
---|
| 27 | * Created on: 12.06.2010
|
---|
| 28 | * Author: heber
|
---|
| 29 | */
|
---|
| 30 |
|
---|
[bf3817] | 31 | // include config.h
|
---|
| 32 | #ifdef HAVE_CONFIG_H
|
---|
| 33 | #include <config.h>
|
---|
| 34 | #endif
|
---|
| 35 |
|
---|
[52cac0] | 36 | #include <iomanip>
|
---|
[aa8ef2] | 37 | #include <iostream>
|
---|
[03a589] | 38 | #include <boost/foreach.hpp>
|
---|
[aa8ef2] | 39 | #include <boost/tokenizer.hpp>
|
---|
[52cac0] | 40 | #include <sstream>
|
---|
[aa8ef2] | 41 | #include <string>
|
---|
| 42 |
|
---|
[ad011c] | 43 | #include "CodePatterns/MemDebug.hpp"
|
---|
[bbbad5] | 44 |
|
---|
[1b2d30] | 45 | #include "MpqcParser.hpp"
|
---|
[c1db05] | 46 | #include "MpqcParser_Parameters.hpp"
|
---|
[1b2d30] | 47 |
|
---|
[6f0841] | 48 | #include "Atom/atom.hpp"
|
---|
[41a467] | 49 | #include "CodePatterns/Log.hpp"
|
---|
| 50 | #include "CodePatterns/toString.hpp"
|
---|
[1b2d30] | 51 | #include "config.hpp"
|
---|
[3bdb6d] | 52 | #include "Element/element.hpp"
|
---|
[41a467] | 53 | #include "Element/periodentafel.hpp"
|
---|
| 54 | #include "LinearAlgebra/Vector.hpp"
|
---|
[aa8ef2] | 55 | #include "molecule.hpp"
|
---|
[42127c] | 56 | #include "MoleculeListClass.hpp"
|
---|
[30f2815] | 57 | #include "Parser/Exceptions.hpp"
|
---|
[1b2d30] | 58 | #include "World.hpp"
|
---|
| 59 |
|
---|
[765f16] | 60 | // declare specialized static variables
|
---|
| 61 | const std::string FormatParserTrait<mpqc>::name = "mpqc";
|
---|
| 62 | const std::string FormatParserTrait<mpqc>::suffix = "in";
|
---|
| 63 | const ParserTypes FormatParserTrait<mpqc>::type = mpqc;
|
---|
[1b2d30] | 64 |
|
---|
[ee50c1] | 65 | // a converter we often need
|
---|
| 66 | ConvertTo<bool> FormatParser<mpqc>::Converter;
|
---|
[1b2d30] | 67 |
|
---|
| 68 | /** Constructor of MpqcParser.
|
---|
| 69 | *
|
---|
| 70 | */
|
---|
[765f16] | 71 | FormatParser< mpqc >::FormatParser() :
|
---|
| 72 | FormatParser_common(new MpqcParser_Parameters())
|
---|
| 73 | {}
|
---|
[1b2d30] | 74 |
|
---|
| 75 | /** Destructor of MpqcParser.
|
---|
| 76 | *
|
---|
| 77 | */
|
---|
[765f16] | 78 | FormatParser< mpqc >::~FormatParser()
|
---|
| 79 | {}
|
---|
[1b2d30] | 80 |
|
---|
| 81 | /** Load an MPQC config file into the World.
|
---|
| 82 | * \param *file input stream
|
---|
| 83 | */
|
---|
[765f16] | 84 | void FormatParser< mpqc >::load(istream *file)
|
---|
[1b2d30] | 85 | {
|
---|
[4cbca0] | 86 | bool MpqcSection = false;
|
---|
| 87 | bool MoleculeSection = false;
|
---|
| 88 | bool GeometrySection = false;
|
---|
[30f2815] | 89 | bool GeometrySection_n = false;
|
---|
[4cbca0] | 90 | bool BasisSection = false;
|
---|
| 91 | bool AuxBasisSection = false;
|
---|
[aa8ef2] | 92 | char line[MAXSTRINGSIZE];
|
---|
| 93 | typedef boost::tokenizer<boost::char_separator<char> > tokenizer;
|
---|
| 94 | boost::char_separator<char> sep("[]");
|
---|
[4cbca0] | 95 | boost::char_separator<char> angularsep("<>");
|
---|
[311da7b] | 96 | boost::char_separator<char> equalitysep(" =");
|
---|
[aa8ef2] | 97 | boost::char_separator<char> whitesep(" \t");
|
---|
| 98 | ConvertTo<double> toDouble;
|
---|
[30f2815] | 99 | int old_n = -1; // note down the last parsed "n" to ascertain it's ascending
|
---|
[aa8ef2] | 100 |
|
---|
| 101 | molecule *newmol = World::getInstance().createMolecule();
|
---|
| 102 | newmol->ActiveFlag = true;
|
---|
[4cbca0] | 103 | // TODO: Remove the insertion into molecule when saving does not depend on them anymore. Also, remove molecule.hpp include
|
---|
| 104 | World::getInstance().getMolecules()->insert(newmol);
|
---|
[aa8ef2] | 105 | while (file->good()) {
|
---|
| 106 | file->getline(line, MAXSTRINGSIZE-1);
|
---|
| 107 | std::string linestring(line);
|
---|
[30f2815] | 108 | if (((linestring.find("atoms") == string::npos)
|
---|
| 109 | || (linestring.find("geometry") == string::npos))
|
---|
| 110 | && (linestring.find("}") != string::npos)) {
|
---|
[4cbca0] | 111 | GeometrySection = false;
|
---|
[aa8ef2] | 112 | }
|
---|
[4cbca0] | 113 | if ((linestring.find(")") != string::npos)) { // ends a section which do not overlap
|
---|
| 114 | MpqcSection = false;
|
---|
| 115 | MoleculeSection = false;
|
---|
| 116 | BasisSection = false;
|
---|
| 117 | AuxBasisSection = false;
|
---|
| 118 | }
|
---|
| 119 | if (MoleculeSection) {
|
---|
| 120 | if (GeometrySection) { // we have an atom
|
---|
[30f2815] | 121 | // LOG(2, "DEBUG: Full line is '" << linestring << "'.");
|
---|
| 122 | // separate off [..] part
|
---|
[4cbca0] | 123 | tokenizer tokens(linestring, sep);
|
---|
[30f2815] | 124 | // split part prior to [..] into tokens
|
---|
| 125 | std::string prior_part(*tokens.begin());
|
---|
| 126 | tokenizer prefixtokens(prior_part, whitesep);
|
---|
| 127 | tokenizer::iterator tok_iter = prefixtokens.begin();
|
---|
| 128 | // LOG(2, "DEBUG: Current tok_iter is " << *tok_iter << ".");
|
---|
| 129 | if (GeometrySection_n) {
|
---|
| 130 | ASSERT(tok_iter != prefixtokens.end(),
|
---|
| 131 | "FormatParser< mpqc >::load() - missing n entry for MoleculeSection in line "
|
---|
| 132 | +linestring+"!");
|
---|
| 133 | // if additional n is given, parse and check but discard eventually
|
---|
| 134 | int n;
|
---|
| 135 | std::stringstream whitespacefilter(*tok_iter++);
|
---|
| 136 | whitespacefilter >> ws >> n;
|
---|
| 137 | if ((old_n != -1) && ((n-1) != old_n))
|
---|
| 138 | ELOG(2, "n index is not simply ascending by one but "
|
---|
| 139 | << n-old_n << ", specific ids are lost!");
|
---|
| 140 | if (old_n >= n) {
|
---|
| 141 | ELOG(1, "n index is not simply ascending, coordinates might get mixed!");
|
---|
| 142 | throw ParserException();
|
---|
| 143 | }
|
---|
| 144 | old_n = n;
|
---|
| 145 | }
|
---|
| 146 | ASSERT(tok_iter != prefixtokens.end(),
|
---|
| 147 | "FormatParser< mpqc >::load() - missing atoms entry for MoleculeSection in line "
|
---|
| 148 | +linestring+"!");
|
---|
| 149 | // LOG(2, "DEBUG: Current tok_iter is " << *tok_iter << ".");
|
---|
[4cbca0] | 150 | std::string element;
|
---|
[30f2815] | 151 | {
|
---|
| 152 | std::stringstream whitespacefilter(*tok_iter++);
|
---|
| 153 | whitespacefilter >> ws >> element;
|
---|
| 154 | }
|
---|
| 155 | // split [..] part and parse
|
---|
| 156 | tok_iter = (++tokens.begin());
|
---|
| 157 | ASSERT (tok_iter != tokens.end(),
|
---|
| 158 | "FormatParser< mpqc >::load() - missing geometry entry for MoleculeSection in line "
|
---|
| 159 | +linestring+"!");
|
---|
| 160 | // LOG(2, "DEBUG: Current tok_iter is " << *tok_iter << ".");
|
---|
| 161 | std::string vector(*tok_iter);
|
---|
[4cbca0] | 162 | tokenizer vectorcomponents(vector, whitesep);
|
---|
| 163 | Vector X;
|
---|
[30f2815] | 164 | // if (vectorcomponents.size() != NDIM)
|
---|
| 165 | // throw ParserException();
|
---|
[4cbca0] | 166 | tok_iter = vectorcomponents.begin();
|
---|
| 167 | for (int i=0; i<NDIM; ++i) {
|
---|
[30f2815] | 168 | // LOG(2, "DEBUG: Current tok_iter is " << *tok_iter << ".");
|
---|
[4cbca0] | 169 | X[i] = toDouble(*tok_iter++);
|
---|
| 170 | }
|
---|
| 171 | // create atom
|
---|
| 172 | atom *newAtom = World::getInstance().createAtom();
|
---|
| 173 | newAtom->setType(World::getInstance().getPeriode()->FindElement(element));
|
---|
| 174 | newAtom->setPosition(X);
|
---|
| 175 | newmol->AddAtom(newAtom);
|
---|
[47d041] | 176 | LOG(1, "Adding atom " << *newAtom);
|
---|
[4cbca0] | 177 | }
|
---|
| 178 | }
|
---|
| 179 | if (MpqcSection) {
|
---|
[311da7b] | 180 | if (linestring.find("mole<") != string::npos) { // get theory
|
---|
[4cbca0] | 181 | tokenizer tokens(linestring, angularsep);
|
---|
| 182 | tokenizer::iterator tok_iter = tokens.begin();
|
---|
[311da7b] | 183 | ++tok_iter;
|
---|
| 184 | ASSERT(tok_iter != tokens.end(),
|
---|
[765f16] | 185 | "FormatParser< mpqc >::load() - missing token in brackets<> for mole< in line "+linestring+"!");
|
---|
[311da7b] | 186 | std::string value(*tok_iter);
|
---|
[4cbca0] | 187 | std::stringstream linestream("theory = "+value);
|
---|
[c1db05] | 188 | linestream >> getParams();
|
---|
[4cbca0] | 189 | } else if (linestring.find("integrals<") != string::npos) { // get theory
|
---|
| 190 | tokenizer tokens(linestring, angularsep);
|
---|
| 191 | tokenizer::iterator tok_iter = tokens.begin();
|
---|
[311da7b] | 192 | ++tok_iter;
|
---|
| 193 | ASSERT(tok_iter != tokens.end(),
|
---|
[765f16] | 194 | "FormatParser< mpqc >::load() - missing token in brackets<> for integrals< in line "+linestring+"!");
|
---|
[311da7b] | 195 | std::string value(*tok_iter);
|
---|
[4cbca0] | 196 | std::stringstream linestream("integration = "+value);
|
---|
[c1db05] | 197 | linestream >> getParams();
|
---|
[311da7b] | 198 | } else if ((linestring.find("molecule") == string::npos) && (linestring.find("basis") == string::npos)){
|
---|
| 199 | // molecule and basis must not be parsed in this section
|
---|
| 200 | tokenizer tokens(linestring, equalitysep);
|
---|
| 201 | tokenizer::iterator tok_iter = tokens.begin();
|
---|
| 202 | ASSERT(tok_iter != tokens.end(),
|
---|
[765f16] | 203 | "FormatParser< mpqc >::load() - missing token before '=' for MpqcSection in line "+linestring+"!");
|
---|
[311da7b] | 204 | std::stringstream whitespacefilter(*tok_iter);
|
---|
| 205 | std::string key;
|
---|
| 206 | whitespacefilter >> ws >> key;
|
---|
[ee50c1] | 207 | if (getParams().haveParameter(key)) {
|
---|
[311da7b] | 208 | std::stringstream linestream(linestring);
|
---|
[c1db05] | 209 | linestream >> getParams();
|
---|
[311da7b] | 210 | } else { // unknown keys are simply ignored as long as parser is incomplete
|
---|
[47d041] | 211 | LOG(2, "INFO: '"+key+"' is unknown and ignored.");
|
---|
[311da7b] | 212 | }
|
---|
[4cbca0] | 213 | }
|
---|
| 214 | }
|
---|
| 215 | if (BasisSection) {
|
---|
| 216 | tokenizer tokens(linestring, equalitysep);
|
---|
| 217 | tokenizer::iterator tok_iter = tokens.begin();
|
---|
[311da7b] | 218 | ASSERT(tok_iter != tokens.end(),
|
---|
[765f16] | 219 | "FormatParser< mpqc >::load() - missing token for BasisSection in line "+linestring+"!");
|
---|
[4cbca0] | 220 | std::string key(*tok_iter++);
|
---|
[311da7b] | 221 | ASSERT(tok_iter != tokens.end(),
|
---|
[765f16] | 222 | "FormatParser< mpqc >::load() - missing value for BasisSection after key "+key+" in line "+linestring+"!");
|
---|
[4cbca0] | 223 | std::string value(*tok_iter);
|
---|
[311da7b] | 224 | tok_iter++;
|
---|
[4cbca0] | 225 | // TODO: use exception instead of ASSERT
|
---|
| 226 | ASSERT(tok_iter == tokens.end(),
|
---|
[765f16] | 227 | "FormatParser< mpqc >::load() - more than (key = value) on line "+linestring+".");
|
---|
[4cbca0] | 228 | if (key == "name") {
|
---|
| 229 | std::stringstream linestream("basis = "+value);
|
---|
[c1db05] | 230 | linestream >> getParams();
|
---|
[4cbca0] | 231 | }
|
---|
| 232 | }
|
---|
| 233 | if (AuxBasisSection) {
|
---|
| 234 | tokenizer tokens(linestring, equalitysep);
|
---|
| 235 | tokenizer::iterator tok_iter = tokens.begin();
|
---|
[311da7b] | 236 | ASSERT(tok_iter != tokens.end(),
|
---|
[765f16] | 237 | "FormatParser< mpqc >::load() - missing token for AuxBasisSection in line "+linestring+"!");
|
---|
[4cbca0] | 238 | std::string key(*tok_iter++);
|
---|
[311da7b] | 239 | ASSERT(tok_iter != tokens.end(),
|
---|
[765f16] | 240 | "FormatParser< mpqc >::load() - missing value for BasisSection after key "+key+" in line "+linestring+"!");
|
---|
[4cbca0] | 241 | std::string value(*tok_iter);
|
---|
[311da7b] | 242 | tok_iter++;
|
---|
[4cbca0] | 243 | // TODO: use exception instead of ASSERT
|
---|
| 244 | ASSERT(tok_iter == tokens.end(),
|
---|
[765f16] | 245 | "FormatParser< mpqc >::load() - more than (key = value) on line "+linestring+".");
|
---|
[4cbca0] | 246 | if (key == "name") {
|
---|
| 247 | std::stringstream linestream("aux_basis = "+value);
|
---|
[c1db05] | 248 | linestream >> getParams();
|
---|
[aa8ef2] | 249 | }
|
---|
| 250 | }
|
---|
| 251 | // set some scan flags
|
---|
[4cbca0] | 252 | if (linestring.find("mpqc:") != string::npos) {
|
---|
| 253 | MpqcSection = true;
|
---|
| 254 | }
|
---|
| 255 | if (linestring.find("molecule<Molecule>:") != string::npos) {
|
---|
| 256 | MoleculeSection = true;
|
---|
| 257 | }
|
---|
[30f2815] | 258 | if ((linestring.find("atoms") != string::npos)
|
---|
| 259 | && (linestring.find("geometry") != string::npos)) {
|
---|
[4cbca0] | 260 | GeometrySection = true;
|
---|
[30f2815] | 261 | if (linestring.find("n") != string::npos) // neither atoms nor geometry contains a letter n
|
---|
| 262 | GeometrySection_n = true;
|
---|
[4cbca0] | 263 | }
|
---|
| 264 | if ((linestring.find("basis<GaussianBasisSet>:") != string::npos) && ((linestring.find("abasis<") == string::npos))) {
|
---|
| 265 | BasisSection = true;
|
---|
| 266 | }
|
---|
| 267 | if (linestring.find("abasis<") != string::npos) {
|
---|
| 268 | AuxBasisSection = true;
|
---|
[aa8ef2] | 269 | }
|
---|
| 270 | }
|
---|
[4afa46] | 271 | // refresh atom::nr and atom::name
|
---|
| 272 | newmol->getAtomCount();
|
---|
[1b2d30] | 273 | }
|
---|
| 274 |
|
---|
[03a589] | 275 | void FormatParser< mpqc >::OutputMPQCLine(ostream * const out, const atom &_atom, const Vector *center) const
|
---|
| 276 | {
|
---|
| 277 | Vector recentered(_atom.getPosition());
|
---|
| 278 | recentered -= *center;
|
---|
[52cac0] | 279 | *out << "\t\t" << _atom.getType()->getSymbol() << " [ ";
|
---|
| 280 | {
|
---|
| 281 | std::stringstream posstream;
|
---|
| 282 | posstream << std::setprecision(12) << recentered[0] << "\t" << recentered[1] << "\t" << recentered[2];
|
---|
| 283 | *out << posstream.str();
|
---|
| 284 | }
|
---|
| 285 | *out << " ]" << std::endl;
|
---|
[03a589] | 286 | };
|
---|
| 287 |
|
---|
| 288 |
|
---|
[f31edc] | 289 | /** Saves all atoms and data into a MPQC config file.
|
---|
[1b2d30] | 290 | * \param *file output stream
|
---|
[73916f] | 291 | * \param atoms atoms to store
|
---|
[1b2d30] | 292 | */
|
---|
[765f16] | 293 | void FormatParser< mpqc >::save(ostream *file, const std::vector<atom *> &atoms)
|
---|
[1b2d30] | 294 | {
|
---|
| 295 | Vector center;
|
---|
[f7c19e] | 296 | // vector<atom *> allatoms = World::getInstance().getAllAtoms();
|
---|
[1b2d30] | 297 |
|
---|
[d6b8e1] | 298 | // calculate center
|
---|
[e9dc19] | 299 | // for (std::vector<atom *>::const_iterator runner = atoms.begin();runner != atoms.end(); ++runner)
|
---|
| 300 | // center += (*runner)->getPosition();
|
---|
| 301 | // center.Scale(1./(double)atoms.size());
|
---|
| 302 | center.Zero();
|
---|
[d6b8e1] | 303 |
|
---|
[1b2d30] | 304 | // first without hessian
|
---|
| 305 | if (file->fail()) {
|
---|
[47d041] | 306 | ELOG(1, "Cannot open mpqc output file.");
|
---|
[1b2d30] | 307 | } else {
|
---|
| 308 | *file << "% Created by MoleCuilder" << endl;
|
---|
| 309 | *file << "mpqc: (" << endl;
|
---|
[ee50c1] | 310 | *file << "\tsavestate = " << getParams().getParameter(MpqcParser_Parameters::savestateParam) << endl;
|
---|
| 311 | *file << "\tdo_gradient = " << getParams().getParameter(MpqcParser_Parameters::do_gradientParam) << endl;
|
---|
| 312 | if (Converter(getParams().getParameter(MpqcParser_Parameters::hessianParam))) {
|
---|
[f31edc] | 313 | *file << "\tfreq<MolecularFrequencies>: (" << endl;
|
---|
| 314 | *file << "\t\tmolecule=$:molecule" << endl;
|
---|
| 315 | *file << "\t)" << endl;
|
---|
| 316 | }
|
---|
[ee50c1] | 317 | const std::string theory = getParams().getParameter(MpqcParser_Parameters::theoryParam);
|
---|
| 318 | if (theory == getParams().getTheoryName(MpqcParser_Parameters::CLHF)) {
|
---|
| 319 | *file << "\tmole<" << getParams().getParameter(MpqcParser_Parameters::theoryParam) << ">: (" << endl;
|
---|
| 320 | *file << "\t\tmolecule = $:molecule" << endl;
|
---|
| 321 | *file << "\t\t" << getParams().getParameterName(MpqcParser_Parameters::basisParam) << " = $:basis" << endl;
|
---|
| 322 | *file << "\t\t" << getParams().getParameterName(MpqcParser_Parameters::maxiterParam)
|
---|
| 323 | << " = " << getParams().getParameter(MpqcParser_Parameters::maxiterParam)<< endl;
|
---|
| 324 | *file << "\t\t" << getParams().getParameterName(MpqcParser_Parameters::memoryParam)
|
---|
| 325 | << " = " << getParams().getParameter(MpqcParser_Parameters::memoryParam) << endl;
|
---|
| 326 | *file << "\t)" << endl;
|
---|
| 327 | } else if (theory == getParams().getTheoryName(MpqcParser_Parameters::CLKS)) {
|
---|
| 328 | *file << "\tmole<" << getParams().getParameter(MpqcParser_Parameters::theoryParam) << ">: (" << endl;
|
---|
| 329 | *file << "\t\tfunctional<StdDenFunctional>:(name=B3LYP)" << endl;
|
---|
| 330 | *file << "\t\tmolecule = $:molecule" << endl;
|
---|
| 331 | *file << "\t\t" << getParams().getParameterName(MpqcParser_Parameters::basisParam) << " = $:basis" << endl;
|
---|
| 332 | *file << "\t\t" << getParams().getParameterName(MpqcParser_Parameters::maxiterParam)
|
---|
| 333 | << " = " << getParams().getParameter(MpqcParser_Parameters::maxiterParam)<< endl;
|
---|
| 334 | *file << "\t\t" << getParams().getParameterName(MpqcParser_Parameters::memoryParam)
|
---|
| 335 | << " = " << getParams().getParameter(MpqcParser_Parameters::memoryParam) << endl;
|
---|
| 336 | *file << "\t)" << endl;
|
---|
| 337 | } else if (theory == getParams().getTheoryName(MpqcParser_Parameters::MBPT2)) {
|
---|
| 338 | *file << "\tmole<" << getParams().getParameter(MpqcParser_Parameters::theoryParam) << ">: (" << endl;
|
---|
| 339 | *file << "\t\t" << getParams().getParameterName(MpqcParser_Parameters::basisParam) << " = $:basis" << endl;
|
---|
| 340 | *file << "\t\tmolecule = $:molecule" << endl;
|
---|
| 341 | *file << "\t\t" << getParams().getParameterName(MpqcParser_Parameters::memoryParam)
|
---|
| 342 | << " = " << getParams().getParameter(MpqcParser_Parameters::memoryParam) << endl;
|
---|
| 343 | *file << "\t\treference<CLHF>: (" << endl;
|
---|
| 344 | *file << "\t\t\t" << getParams().getParameterName(MpqcParser_Parameters::maxiterParam)
|
---|
| 345 | << " = " << getParams().getParameter(MpqcParser_Parameters::maxiterParam)<< endl;
|
---|
| 346 | *file << "\t\t\t" << getParams().getParameterName(MpqcParser_Parameters::basisParam) << " = $:basis" << endl;
|
---|
| 347 | *file << "\t\t\tmolecule = $:molecule" << endl;
|
---|
| 348 | *file << "\t\t\t" << getParams().getParameterName(MpqcParser_Parameters::memoryParam)
|
---|
| 349 | << " = " << getParams().getParameter(MpqcParser_Parameters::memoryParam) << endl;
|
---|
| 350 | *file << "\t\t)" << endl;
|
---|
| 351 | *file << "\t)" << endl;
|
---|
| 352 | } else if (theory == getParams().getTheoryName(MpqcParser_Parameters::MBPT2_R12)) {
|
---|
| 353 | *file << "\tmole<" << getParams().getParameter(MpqcParser_Parameters::theoryParam) << ">: (" << endl;
|
---|
| 354 | *file << "\t\tmolecule = $:molecule" << endl;
|
---|
| 355 | *file << "\t\t" << getParams().getParameterName(MpqcParser_Parameters::basisParam) << " = $:basis" << endl;
|
---|
| 356 | *file << "\t\t" << getParams().getParameterName(MpqcParser_Parameters::aux_basisParam) << " = $:abasis" << endl;
|
---|
| 357 | *file << "\t\t" << getParams().getParameterName(MpqcParser_Parameters::stdapproxParam)
|
---|
| 358 | << " = \"" << getParams().getParameter(MpqcParser_Parameters::stdapproxParam) << "\"" << endl;
|
---|
| 359 | *file << "\t\t" << getParams().getParameterName(MpqcParser_Parameters::nfzcParam)
|
---|
| 360 | << " = " << getParams().getParameter(MpqcParser_Parameters::nfzcParam) << endl;
|
---|
| 361 | *file << "\t\t" << getParams().getParameterName(MpqcParser_Parameters::memoryParam)
|
---|
| 362 | << " = " << getParams().getParameter(MpqcParser_Parameters::memoryParam) << endl;
|
---|
| 363 | *file << "\t\tintegrals<IntegralCints>:()" << endl;
|
---|
| 364 | *file << "\t\treference<CLHF>: (" << endl;
|
---|
| 365 | *file << "\t\t\tmolecule = $:molecule" << endl;
|
---|
| 366 | *file << "\t\t\t" << getParams().getParameterName(MpqcParser_Parameters::basisParam) << " = $:basis" << endl;
|
---|
| 367 | *file << "\t\t\tmaxiter = " << getParams().getParameter(MpqcParser_Parameters::maxiterParam) << endl;
|
---|
| 368 | *file << "\t\t\tmemory = " << getParams().getParameter(MpqcParser_Parameters::memoryParam) << endl;
|
---|
| 369 | *file << "\t\t\tintegrals<" << getParams().getParameter(MpqcParser_Parameters::integrationParam) << ">:()" << endl;
|
---|
| 370 | *file << "\t\t)" << endl;
|
---|
| 371 | *file << "\t)" << endl;
|
---|
| 372 | } else {
|
---|
[47d041] | 373 | ELOG(0, "Unknown level of theory requested for MPQC output file.");
|
---|
[1b2d30] | 374 | }
|
---|
| 375 | *file << ")" << endl;
|
---|
| 376 | *file << "molecule<Molecule>: (" << endl;
|
---|
| 377 | *file << "\tunit = " << (World::getInstance().getConfig()->GetIsAngstroem() ? "angstrom" : "bohr" ) << endl;
|
---|
| 378 | *file << "\t{ atoms geometry } = {" << endl;
|
---|
| 379 | // output of atoms
|
---|
[03a589] | 380 | BOOST_FOREACH(const atom *_atom, atoms) {
|
---|
| 381 | OutputMPQCLine(file, *_atom, ¢er);
|
---|
[1b2d30] | 382 | }
|
---|
| 383 | *file << "\t}" << endl;
|
---|
| 384 | *file << ")" << endl;
|
---|
| 385 | *file << "basis<GaussianBasisSet>: (" << endl;
|
---|
[ee50c1] | 386 | *file << "\tname = \"" << getParams().getParameter(MpqcParser_Parameters::basisParam) << "\"" << endl;
|
---|
[1b2d30] | 387 | *file << "\tmolecule = $:molecule" << endl;
|
---|
| 388 | *file << ")" << endl;
|
---|
[ee50c1] | 389 | if (theory == getParams().getTheoryName(MpqcParser_Parameters::MBPT2_R12)) {
|
---|
[f31edc] | 390 | *file << "% auxiliary basis set specification" << endl;
|
---|
| 391 | *file << "\tabasis<GaussianBasisSet>: (" << endl;
|
---|
[ee50c1] | 392 | *file << "\tname = \"" << getParams().getParameter(MpqcParser_Parameters::aux_basisParam) << "\"" << endl;
|
---|
[f31edc] | 393 | *file << "\tmolecule = $:molecule" << endl;
|
---|
| 394 | *file << ")" << endl;
|
---|
| 395 | }
|
---|
[1b2d30] | 396 | }
|
---|
| 397 | }
|
---|
| 398 |
|
---|
[963321a] | 399 |
|
---|