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