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