Changes in src/config.cpp [2746be:a1fe77]
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/config.cpp
-
Property mode
changed from
100755
to100644
r2746be ra1fe77 23 23 configpath[0]='\0'; 24 24 configname[0]='\0'; 25 basis="3-21G";26 25 27 26 FastParsing = false; … … 36 35 DoFullCurrent=0; 37 36 DoWannier=0; 37 DoConstrainedMD=0; 38 38 CommonWannier=0; 39 39 SawtoothStart=0.01; … … 518 518 } 519 519 520 if (ParseForParameter(verbose,file,"DoConstrainedMD", 0, 1, 1, int_type, &(config::DoConstrainedMD), 1, optional)) 521 if (config::DoConstrainedMD < 0) 522 config::DoConstrainedMD = 0; 520 523 ParseForParameter(verbose,file,"MaxOuterStep", 0, 1, 1, int_type, &(config::MaxOuterStep), 1, critical); 521 524 if (!ParseForParameter(verbose,file,"Deltat", 0, 1, 1, double_type, &(config::Deltat), 1, optional)) … … 972 975 973 976 /** Stores all elements of config structure from which they can be re-read. 974 * \param *filename name of file977 * \param output open output *file stream to write to 975 978 * \param *periode pointer to a periodentafel class with all elements 976 979 * \param *mol pointer to molecule containing all atoms of the molecule 977 980 */ 978 bool config::Save( const char *filename, periodentafel *periode, molecule *mol) const981 bool config::Save(ofstream *output, periodentafel *periode, molecule *mol) const 979 982 { 980 983 bool result = true; 981 984 // bring MaxTypes up to date 982 985 mol->CountElements(); 983 ofstream *output = NULL;984 output = new ofstream(filename, ios::out);985 986 if (output != NULL) { 986 987 *output << "# ParallelCarParinello - main configuration file - created with molecuilder" << endl; … … 999 1000 *output << "DoPerturbation\t" << config::DoPerturbation << "\t# Do perturbation calculate and determine susceptibility and shielding" << endl; 1000 1001 *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; 1001 1003 *output << "CommonWannier\t" << config::CommonWannier << "\t# Put virtual centers at indivual orbits, all common, merged by variance, to grid point, to cell center" << endl; 1002 1004 *output << "SawtoothStart\t" << config::SawtoothStart << "\t# Absolute value for smooth transition at cell border " << endl; … … 1070 1072 else 1071 1073 result = result && mol->OutputTrajectories(output); 1072 output->close();1073 output->clear();1074 delete(output);1075 1074 return result; 1076 1075 } else … … 1080 1079 /** Stores all elements in a MPQC input file. 1081 1080 * Note that this format cannot be parsed again. 1082 * \param *filename name of file (without ".in" suffix!)1081 * \param output open output *file stream to write to 1083 1082 * \param *mol pointer to molecule containing all atoms of the molecule 1084 1083 */ 1085 bool config::SaveMPQC( const char *filename, molecule *mol) const1084 bool config::SaveMPQC(ofstream *output, molecule *mol) const 1086 1085 { 1087 1086 int ElementNo = 0; 1088 1087 int AtomNo; 1089 1088 atom *Walker = NULL; 1090 element *runner = NULL;1089 element *runner = mol->elemente->start; 1091 1090 Vector *center = NULL; 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); 1091 1099 1092 *output << "% Created by MoleCuilder" << endl; 1100 1093 *output << "mpqc: (" << endl; … … 1102 1095 *output << "\tdo_gradient = yes" << endl; 1103 1096 *output << "\tmole<CLHF>: (" << 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; 1097 *output << "\t\tmolecule<Molecule>: (" << endl; 1098 *output << "\t\t\tunit = " << (IsAngstroem ? "angstrom" : "bohr" ) << endl; 1099 *output << "\t\t\t{ atoms geometry } = {" << endl; 1112 1100 center = mol->DetermineCenterOfAll(output); 1113 1101 // output of atoms 1114 runner = mol->elemente->start;1115 1102 while (runner->next != mol->elemente->end) { // go through every element 1116 1103 runner = runner->next; … … 1123 1110 if (Walker->type == runner) { // if this atom fits to element 1124 1111 AtomNo++; 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;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; 1126 1113 } 1127 1114 } … … 1129 1116 } 1130 1117 delete(center); 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; 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; 1156 1124 *output << "\t)" << endl; 1157 1125 *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 atoms1163 runner = mol->elemente->start;1164 while (runner->next != mol->elemente->end) { // go through every element1165 runner = runner->next;1166 if (mol->ElementsInMolecule[runner->Z]) { // if this element got atoms1167 ElementNo++;1168 AtomNo = 0;1169 Walker = mol->start;1170 while (Walker->next != mol->end) { // go through every atom of this element1171 Walker = Walker->next;1172 if (Walker->type == runner) { // if this atom fits to element1173 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 1190 1126 return true; 1191 1127 }; -
Property mode
changed from
Note:
See TracChangeset
for help on using the changeset viewer.