Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/config.cpp

    • Property mode changed from 100644 to 100755
    ra1fe77 r2746be  
    2323  configpath[0]='\0';
    2424  configname[0]='\0';
     25  basis="3-21G";
    2526 
    2627  FastParsing = false;
     
    3536  DoFullCurrent=0;
    3637  DoWannier=0;
    37   DoConstrainedMD=0;
    3838  CommonWannier=0;
    3939  SawtoothStart=0.01;
     
    518518  }
    519519 
    520   if (ParseForParameter(verbose,file,"DoConstrainedMD", 0, 1, 1, int_type, &(config::DoConstrainedMD), 1, optional))
    521     if (config::DoConstrainedMD < 0)
    522       config::DoConstrainedMD = 0;
    523520  ParseForParameter(verbose,file,"MaxOuterStep", 0, 1, 1, int_type, &(config::MaxOuterStep), 1, critical);
    524521  if (!ParseForParameter(verbose,file,"Deltat", 0, 1, 1, double_type, &(config::Deltat), 1, optional))
     
    975972
    976973/** Stores all elements of config structure from which they can be re-read.
    977  * \param output open output *file stream to write to
     974 * \param *filename name of file
    978975 * \param *periode pointer to a periodentafel class with all elements
    979976 * \param *mol pointer to molecule containing all atoms of the molecule
    980977 */
    981 bool config::Save(ofstream *output, periodentafel *periode, molecule *mol) const
     978bool config::Save(const char *filename, periodentafel *periode, molecule *mol) const
    982979{
    983980  bool result = true;
    984981        // bring MaxTypes up to date
    985982        mol->CountElements();
     983  ofstream *output = NULL;
     984  output = new ofstream(filename, ios::out);
    986985  if (output != NULL) {
    987986    *output << "# ParallelCarParinello - main configuration file - created with molecuilder" << endl;
     
    1000999    *output << "DoPerturbation\t" << config::DoPerturbation << "\t# Do perturbation calculate and determine susceptibility and shielding" << endl;
    10011000    *output << "DoFullCurrent\t" << config::DoFullCurrent << "\t# Do full perturbation" << endl;
    1002     *output << "DoConstrainedMD\t" << config::DoConstrainedMD << "\t# Do perform a constrained (>0, relating to current MD step) instead of unconstrained (0) MD" << endl;
    10031001    *output << "CommonWannier\t" << config::CommonWannier << "\t# Put virtual centers at indivual orbits, all common, merged by variance, to grid point, to cell center" << endl;
    10041002    *output << "SawtoothStart\t" << config::SawtoothStart << "\t# Absolute value for smooth transition at cell border " << endl;
     
    10721070    else
    10731071      result = result && mol->OutputTrajectories(output);
     1072    output->close();
     1073    output->clear();
     1074    delete(output);
    10741075    return result;
    10751076  } else
     
    10791080/** Stores all elements in a MPQC input file.
    10801081 * Note that this format cannot be parsed again.
    1081  * \param output open output *file stream to write to
     1082 * \param *filename name of file (without ".in" suffix!)
    10821083 * \param *mol pointer to molecule containing all atoms of the molecule
    10831084 */
    1084 bool config::SaveMPQC(ofstream *output, molecule *mol) const
     1085bool config::SaveMPQC(const char *filename, molecule *mol) const
    10851086{
    10861087  int ElementNo = 0;
    10871088  int AtomNo;
    10881089  atom *Walker = NULL;
    1089   element *runner = mol->elemente->start;
     1090  element *runner = NULL;
    10901091  Vector *center = NULL;
    1091 
     1092  ofstream *output = NULL;
     1093  stringstream *fname = NULL;
     1094 
     1095  // first without hessian
     1096  fname = new stringstream;
     1097  *fname << filename << ".in";
     1098  output = new ofstream(fname->str().c_str(), ios::out);
    10921099  *output << "% Created by MoleCuilder" << endl;
    10931100  *output << "mpqc: (" << endl;
     
    10951102  *output << "\tdo_gradient = yes" << endl;
    10961103  *output << "\tmole<CLHF>: (" << endl;
    1097   *output << "\t\tmolecule<Molecule>: (" << endl;
    1098   *output << "\t\t\tunit = " << (IsAngstroem ? "angstrom" : "bohr" ) << endl;
    1099   *output << "\t\t\t{ atoms geometry } = {" << endl;
     1104  *output << "\t\tmaxiter = 200" << endl;
     1105  *output << "\t\tbasis = $:basis" << endl;
     1106  *output << "\t\tmolecule = $:molecule" << endl;
     1107  *output << "\t)" << endl;
     1108  *output << ")" << endl;
     1109  *output << "molecule<Molecule>: (" << endl;
     1110  *output << "\tunit = " << (IsAngstroem ? "angstrom" : "bohr" ) << endl;
     1111  *output << "\t{ atoms geometry } = {" << endl;
    11001112  center = mol->DetermineCenterOfAll(output);
    11011113  // output of atoms
     1114  runner = mol->elemente->start;
    11021115  while (runner->next != mol->elemente->end) { // go through every element
    11031116    runner = runner->next;
     
    11101123        if (Walker->type == runner) { // if this atom fits to element
    11111124          AtomNo++;
    1112           *output << "\t\t\t\t" << Walker->type->symbol << " [ " << Walker->x.x[0]-center->x[0] << "\t" << Walker->x.x[1]-center->x[1] << "\t" << Walker->x.x[2]-center->x[2] << " ]" << endl;
     1125          *output << "\t\t" << Walker->type->symbol << " [ " << Walker->x.x[0]-center->x[0] << "\t" << Walker->x.x[1]-center->x[1] << "\t" << Walker->x.x[2]-center->x[2] << " ]" << endl;
    11131126        }
    11141127      }
     
    11161129  }
    11171130  delete(center);
    1118   *output << "\t\t\t}" << endl;
    1119   *output << "\t\t)" << endl;
    1120   *output << "\t\tbasis<GaussianBasisSet>: (" << endl;
    1121   *output << "\t\t\tname = \"STO-3G\"" << endl;
    1122   *output << "\t\t\tmolecule = $:mpqc:mole:molecule" << endl;
    1123   *output << "\t\t)" << endl;
     1131  *output << "\t}" << endl;
     1132  *output << ")" << endl;
     1133  *output << "basis<GaussianBasisSet>: (" << endl;
     1134  *output << "\tname = \"" << basis << "\"" << endl;
     1135  *output << "\tmolecule = $:molecule" << endl;
     1136  *output << ")" << endl;
     1137  output->close();
     1138  delete(output);
     1139  delete(fname);
     1140
     1141  // second with hessian
     1142  fname = new stringstream;
     1143  *fname << filename << ".hess.in";
     1144  output = new ofstream(fname->str().c_str(), ios::out);
     1145  *output << "% Created by MoleCuilder" << endl;
     1146  *output << "mpqc: (" << endl;
     1147  *output << "\tsavestate = no" << endl;
     1148  *output << "\tdo_gradient = yes" << endl;
     1149  *output << "\tmole<CLHF>: (" << endl;
     1150  *output << "\t\tmaxiter = 200" << endl;
     1151  *output << "\t\tbasis = $:basis" << endl;
     1152  *output << "\t\tmolecule = $:molecule" << endl;
     1153  *output << "\t)" << endl;
     1154  *output << "\tfreq<MolecularFrequencies>: (" << endl;
     1155  *output << "\t\tmolecule=$:molecule" << endl;
    11241156  *output << "\t)" << endl;
    11251157  *output << ")" << endl;
     1158  *output << "molecule<Molecule>: (" << endl;
     1159  *output << "\tunit = " << (IsAngstroem ? "angstrom" : "bohr" ) << endl;
     1160  *output << "\t{ atoms geometry } = {" << endl;
     1161  center = mol->DetermineCenterOfAll(output);
     1162  // output of atoms
     1163  runner = mol->elemente->start;
     1164  while (runner->next != mol->elemente->end) { // go through every element
     1165    runner = runner->next;
     1166    if (mol->ElementsInMolecule[runner->Z]) { // if this element got atoms
     1167      ElementNo++;
     1168      AtomNo = 0;
     1169      Walker = mol->start;
     1170      while (Walker->next != mol->end) { // go through every atom of this element
     1171        Walker = Walker->next;
     1172        if (Walker->type == runner) { // if this atom fits to element
     1173          AtomNo++;
     1174          *output << "\t\t" << Walker->type->symbol << " [ " << Walker->x.x[0]-center->x[0] << "\t" << Walker->x.x[1]-center->x[1] << "\t" << Walker->x.x[2]-center->x[2] << " ]" << endl;
     1175        }
     1176      }
     1177    }
     1178  }
     1179  delete(center);
     1180  *output << "\t}" << endl;
     1181  *output << ")" << endl;
     1182  *output << "basis<GaussianBasisSet>: (" << endl;
     1183  *output << "\tname = \"3-21G\"" << endl;
     1184  *output << "\tmolecule = $:molecule" << endl;
     1185  *output << ")" << endl;
     1186  output->close();
     1187  delete(output);
     1188  delete(fname);
     1189 
    11261190  return true;
    11271191};
Note: See TracChangeset for help on using the changeset viewer.