Index: src/Parser/Psi3Parser.cpp
===================================================================
--- src/Parser/Psi3Parser.cpp	(revision 032f31cf80e8ee3e35032df0bfd39da32b7db018)
+++ src/Parser/Psi3Parser.cpp	(revision d640ea4f513e93f75000fdadbe0789cf1671a383)
@@ -160,106 +160,74 @@
 void FormatParser< psi3 >::save(ostream *file, const std::vector<atom *> &atoms)
 {
-//  Vector center;
-////  vector<atom *> allatoms = World::getInstance().getAllAtoms();
-//
-//  // calculate center
-//  for (std::vector<atom *>::const_iterator runner = atoms.begin();runner != atoms.end(); ++runner)
-//    center += (*runner)->getPosition();
-//  center.Scale(1./(double)atoms.size());
-//
-//  // first without hessian
-//  if (file->fail()) {
-//    DoeLog(1) && (eLog()<< Verbose(1) << "Cannot open psi3 output file." << endl);
-//  } else {
-//    *file << "% Created by MoleCuilder" << endl;
-//    *file << "psi3: (" << endl;
-//    *file << "\tsavestate = " << getParams().getParameter(Psi3Parser_Parameters::savestateParam) << endl;
-//    *file << "\tdo_gradient = " << getParams().getParameter(Psi3Parser_Parameters::do_gradientParam) << endl;
-//    if (Converter(getParams().getParameter(Psi3Parser_Parameters::hessianParam))) {
-//      *file << "\tfreq<MolecularFrequencies>: (" << endl;
-//      *file << "\t\tmolecule=$:molecule" << endl;
-//      *file << "\t)" << endl;
+  Vector center;
+//  vector<atom *> allatoms = World::getInstance().getAllAtoms();
+
+  // calculate center
+  for (std::vector<atom *>::const_iterator runner = atoms.begin();runner != atoms.end(); ++runner)
+    center += (*runner)->getPosition();
+  center.Scale(1./(double)atoms.size());
+
+  // first without hessian
+  if (file->fail()) {
+    DoeLog(1) && (eLog()<< Verbose(1) << "Cannot open psi3 output file." << std::endl);
+  } else {
+    *file << "% Created by MoleCuilder" << std::endl;
+    *file << "psi: (" << std::endl;
+    *file << "\t" << getParams().getParameterName(Psi3Parser_Parameters::labelParam)
+                  << " = \"" << getParams().getParameter(Psi3Parser_Parameters::labelParam) << "\"" << std::endl;
+    *file << "\t" << getParams().getParameterName(Psi3Parser_Parameters::jobtypeParam)
+                  << " = " << getParams().getParameter(Psi3Parser_Parameters::jobtypeParam) << std::endl;
+    *file << "\t" << getParams().getParameterName(Psi3Parser_Parameters::wavefunctionParam)
+                  << " = " << getParams().getParameter(Psi3Parser_Parameters::wavefunctionParam) << std::endl;
+    *file << "\t" << getParams().getParameterName(Psi3Parser_Parameters::maxiterParam)
+                  << " = " << getParams().getParameter(Psi3Parser_Parameters::maxiterParam) << std::endl;
+    *file << "\t" << getParams().getParameterName(Psi3Parser_Parameters::referenceParam)
+                  << " = " << getParams().getParameter(Psi3Parser_Parameters::referenceParam) << std::endl;
+    *file << "\t" << getParams().getParameterName(Psi3Parser_Parameters::basisParam)
+                  << " = \"" << getParams().getParameter(Psi3Parser_Parameters::basisParam) << "\"" << std::endl;
+    const std::string reference = getParams().getParameter(Psi3Parser_Parameters::referenceParam);
+//    if (reference == getParams().getReferenceName(Psi3Parser_Parameters::RHF)) {
 //    }
-//    const std::string theory = getParams().getParameter(Psi3Parser_Parameters::theoryParam);
-//    if (theory == getParams().getTheoryName(Psi3Parser_Parameters::CLHF)) {
-//      *file << "\tmole<" << getParams().getParameter(Psi3Parser_Parameters::theoryParam) << ">: (" << endl;
-//      *file << "\t\tmolecule = $:molecule" << endl;
-//      *file << "\t\t" << getParams().getParameterName(Psi3Parser_Parameters::basisParam) << " = $:basis" << endl;
-//      *file << "\t\t" << getParams().getParameterName(Psi3Parser_Parameters::maxiterParam)
-//          << " = " << getParams().getParameter(Psi3Parser_Parameters::maxiterParam)<< endl;
-//      *file << "\t\t" << getParams().getParameterName(Psi3Parser_Parameters::memoryParam)
-//          << " = " << getParams().getParameter(Psi3Parser_Parameters::memoryParam) << endl;
-//      *file << "\t)" << endl;
-//    } else if (theory == getParams().getTheoryName(Psi3Parser_Parameters::CLKS)) {
-//      *file << "\tmole<" << getParams().getParameter(Psi3Parser_Parameters::theoryParam) << ">: (" << endl;
-//      *file << "\t\tfunctional<StdDenFunctional>:(name=B3LYP)" << endl;
-//      *file << "\t\tmolecule = $:molecule" << endl;
-//      *file << "\t\t" << getParams().getParameterName(Psi3Parser_Parameters::basisParam) << " = $:basis" << endl;
-//      *file << "\t\t" << getParams().getParameterName(Psi3Parser_Parameters::maxiterParam)
-//          << " = " << getParams().getParameter(Psi3Parser_Parameters::maxiterParam)<< endl;
-//      *file << "\t\t" << getParams().getParameterName(Psi3Parser_Parameters::memoryParam)
-//          << " = " << getParams().getParameter(Psi3Parser_Parameters::memoryParam) << endl;
-//      *file << "\t)" << endl;
-//    } else if (theory == getParams().getTheoryName(Psi3Parser_Parameters::MBPT2)) {
-//      *file << "\tmole<" << getParams().getParameter(Psi3Parser_Parameters::theoryParam) << ">: (" << endl;
-//      *file << "\t\t" << getParams().getParameterName(Psi3Parser_Parameters::basisParam) << " = $:basis" << endl;
-//      *file << "\t\tmolecule = $:molecule" << endl;
-//      *file << "\t\t" << getParams().getParameterName(Psi3Parser_Parameters::memoryParam)
-//          << " = " << getParams().getParameter(Psi3Parser_Parameters::memoryParam) << endl;
-//      *file << "\t\treference<CLHF>: (" << endl;
-//      *file << "\t\t\t" << getParams().getParameterName(Psi3Parser_Parameters::maxiterParam)
-//          << " = " << getParams().getParameter(Psi3Parser_Parameters::maxiterParam)<< endl;
-//      *file << "\t\t\t" << getParams().getParameterName(Psi3Parser_Parameters::basisParam) << " = $:basis" << endl;
-//      *file << "\t\t\tmolecule = $:molecule" << endl;
-//      *file << "\t\t\t" << getParams().getParameterName(Psi3Parser_Parameters::memoryParam)
-//          << " = " << getParams().getParameter(Psi3Parser_Parameters::memoryParam) << endl;
-//      *file << "\t\t)" << endl;
-//      *file << "\t)" << endl;
-//    } else if (theory == getParams().getTheoryName(Psi3Parser_Parameters::MBPT2_R12)) {
-//      *file << "\tmole<" << getParams().getParameter(Psi3Parser_Parameters::theoryParam) << ">: (" << endl;
-//      *file << "\t\tmolecule = $:molecule" << endl;
-//      *file << "\t\t" << getParams().getParameterName(Psi3Parser_Parameters::basisParam) << " = $:basis" << endl;
-//      *file << "\t\t" << getParams().getParameterName(Psi3Parser_Parameters::aux_basisParam) << " = $:abasis" << endl;
-//      *file << "\t\t" << getParams().getParameterName(Psi3Parser_Parameters::stdapproxParam)
-//          << " = \"" << getParams().getParameter(Psi3Parser_Parameters::stdapproxParam) << "\"" << endl;
-//      *file << "\t\t" << getParams().getParameterName(Psi3Parser_Parameters::nfzcParam)
-//          << " = " << getParams().getParameter(Psi3Parser_Parameters::nfzcParam) << endl;
-//      *file << "\t\t" << getParams().getParameterName(Psi3Parser_Parameters::memoryParam)
-//          << " = " << getParams().getParameter(Psi3Parser_Parameters::memoryParam) << endl;
-//      *file << "\t\tintegrals<IntegralCints>:()" << endl;
-//      *file << "\t\treference<CLHF>: (" << endl;
-//      *file << "\t\t\tmolecule = $:molecule" << endl;
-//      *file << "\t\t\t" << getParams().getParameterName(Psi3Parser_Parameters::basisParam) << " = $:basis" << endl;
-//      *file << "\t\t\tmaxiter = " << getParams().getParameter(Psi3Parser_Parameters::maxiterParam) << endl;
-//      *file << "\t\t\tmemory = " << getParams().getParameter(Psi3Parser_Parameters::memoryParam) << endl;
-//      *file << "\t\t\tintegrals<" << getParams().getParameter(Psi3Parser_Parameters::integrationParam) << ">:()" << endl;
-//      *file << "\t\t)" << endl;
-//      *file << "\t)" << endl;
-//    } else {
-//      DoeLog(0) && (eLog() << Verbose(0)
-//          << "Unknown level of theory requested for MPQC output file." << std::endl);
+//    if (reference == getParams().getReferenceName(Psi3Parser_Parameters::ROHF)) {
 //    }
-//    *file << ")" << endl;
-//    *file << "molecule<Molecule>: (" << endl;
-//    *file << "\tunit = " << (World::getInstance().getConfig()->GetIsAngstroem() ? "angstrom" : "bohr" ) << endl;
-//    *file << "\t{ atoms geometry } = {" << endl;
-//    // output of atoms
-//    for (std::vector<atom *>::const_iterator AtomRunner = atoms.begin(); AtomRunner != atoms.end(); ++AtomRunner) {
-//      (*AtomRunner)->OutputMPQCLine(file, &center);
-//    }
-//    *file << "\t}" << endl;
-//    *file << ")" << endl;
-//    *file << "basis<GaussianBasisSet>: (" << endl;
-//    *file << "\tname = \"" << getParams().getParameter(Psi3Parser_Parameters::basisParam) << "\"" << endl;
-//    *file << "\tmolecule = $:molecule" << endl;
-//    *file << ")" << endl;
-//    if (theory == getParams().getTheoryName(Psi3Parser_Parameters::MBPT2_R12)) {
-//      *file << "% auxiliary basis set specification" << endl;
-//      *file << "\tabasis<GaussianBasisSet>: (" << endl;
-//      *file << "\tname = \"" << getParams().getParameter(Psi3Parser_Parameters::aux_basisParam) << "\"" << endl;
-//      *file << "\tmolecule = $:molecule" << endl;
-//      *file << ")" << endl;
-//    }
-//  }
+    if ((reference == getParams().getReferenceName(Psi3Parser_Parameters::UHF))
+        || (reference == getParams().getReferenceName(Psi3Parser_Parameters::TWOCON))) {
+      *file << "\t" << getParams().getParameterName(Psi3Parser_Parameters::multiplicityParam)
+                    << " = " << getParams().getParameter(Psi3Parser_Parameters::multiplicityParam) << std::endl;
+      *file << "\t" << getParams().getParameterName(Psi3Parser_Parameters::chargeParam)
+                    << " = " << getParams().getParameter(Psi3Parser_Parameters::chargeParam) << std::endl;
+    }
+    if (reference == getParams().getReferenceName(Psi3Parser_Parameters::TWOCON)) {
+      *file << "\t" << getParams().getParameterName(Psi3Parser_Parameters::soccParam)
+                    << " = " << getParams().getParameter(Psi3Parser_Parameters::soccParam) << std::endl;
+      *file << "\t" << getParams().getParameterName(Psi3Parser_Parameters::doccParam)
+                    << " = " << getParams().getParameter(Psi3Parser_Parameters::doccParam) << std::endl;
+      *file << "\t" << getParams().getParameterName(Psi3Parser_Parameters::subgroupParam)
+                    << " = " << getParams().getParameter(Psi3Parser_Parameters::subgroupParam) << std::endl;
+      *file << "\t" << getParams().getParameterName(Psi3Parser_Parameters::unique_axisParam)
+                    << " = " << getParams().getParameter(Psi3Parser_Parameters::unique_axisParam) << std::endl;
+    }
+    if ((reference != getParams().getReferenceName(Psi3Parser_Parameters::RHF))
+        && (reference != getParams().getReferenceName(Psi3Parser_Parameters::ROHF))
+        && (reference != getParams().getReferenceName(Psi3Parser_Parameters::UHF))
+        && (reference != getParams().getReferenceName(Psi3Parser_Parameters::TWOCON)))
+    {
+      DoeLog(0) && (eLog() << Verbose(0)
+          << "Unknown level of reference requested for Psi3 output file." << std::endl);
+    }
+    *file << "\t" << getParams().getParameterName(Psi3Parser_Parameters::freeze_coreParam)
+                  << " = " << getParams().getParameter(Psi3Parser_Parameters::freeze_coreParam) << std::endl;
+    *file << "\t" << getParams().getParameterName(Psi3Parser_Parameters::unitsParam)
+                  << " = " << getParams().getParameter(Psi3Parser_Parameters::unitsParam) << std::endl;
+    *file << "\tgeometry = (" << std::endl;
+    // output of atoms
+    for (std::vector<atom *>::const_iterator AtomRunner = atoms.begin(); AtomRunner != atoms.end(); ++AtomRunner) {
+      (*AtomRunner)->OutputPsi3Line(file, &center);
+    }
+    *file << "\t)" << std::endl;
+    *file << "\t" << getParams().getParameterName(Psi3Parser_Parameters::originParam)
+                  << " = " << getParams().getParameter(Psi3Parser_Parameters::originParam) << std::endl;
+    *file << ")" << std::endl;
+  }
 }
 
