Changeset 2c536c
- Timestamp:
- Aug 29, 2008, 10:12:00 AM (17 years ago)
- Children:
- ff74f7
- Parents:
- 7d6f65
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
molecuilder/src/config.cpp
r7d6f65 r2c536c 652 652 atom *neues = NULL; 653 653 while (status) { 654 cout << "Currently parsing MD step " << repetition << "." << endl; 654 655 for (int i=0; i < config::MaxTypes; i++) { 655 656 sprintf(name,"Ion_Type%i",i+1); … … 1060 1061 }; 1061 1062 1063 /** Stores all elements in a MPQC input file. 1064 * Note that this format cannot be parsed again. 1065 * \param output open output *file stream to write to 1066 * \param *mol pointer to molecule containing all atoms of the molecule 1067 */ 1068 bool config::SaveMPQC(ofstream *output, molecule *mol) const 1069 { 1070 int ElementNo; 1071 int AtomNo; 1072 atom *Walker = NULL; 1073 element *runner; 1074 Vector center; 1075 1076 *output << "% Created by MoleCuilder" << endl; 1077 *output << "mpqc: (" << endl; 1078 *output << "\tsavestate = no" << endl; 1079 *output << "\tdo_gradient = yes" << endl; 1080 *output << "\tmole<CLHF>: (" << endl; 1081 *output << "\t\tmolecule<Molecule>: (" << endl; 1082 *output << "\t\t\tunit = " << (IsAngstroem ? "angstrom" : "bohr" ) << endl; 1083 *output << "\t\t\t{ atoms geometry } = {" << endl; 1084 mol->DetermineCenter(center); 1085 // output of atoms 1086 ElementNo = 0; 1087 runner = mol->elemente->start; 1088 while (runner->next != mol->elemente->end) { // go through every element 1089 runner = runner->next; 1090 if (mol->ElementsInMolecule[runner->Z]) { // if this element got atoms 1091 ElementNo++; 1092 AtomNo = 0; 1093 Walker = mol->start; 1094 while (Walker->next != mol->end) { // go through every atom of this element 1095 Walker = Walker->next; 1096 if (Walker->type == runner) { // if this atom fits to element 1097 AtomNo++; 1098 *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; 1099 } 1100 } 1101 } 1102 } 1103 *output << "\t\t\t}" << endl; 1104 *output << "\t\t)" << endl; 1105 *output << "\t\tbasis<GaussianBasisSet>: (" << endl; 1106 *output << "\t\t\tname = \"STO-3G\"" << endl; 1107 *output << "\t\t\tmolecule = $:mpqc:mole:molecule" << endl; 1108 *output << "\t\t)" << endl; 1109 *output << "\t)" << endl; 1110 *output << ")" << endl; 1111 return true; 1112 }; 1113 1062 1114 /** Reads parameter from a parsed file. 1063 1115 * The file is either parsed for a certain keyword or if null is given for … … 1103 1155 Free((void **)&free_dummy, "config::ParseForParameter: *free_dummy"); 1104 1156 //Error(InitReading, name); 1105 fprintf(stderr,"Error:InitReading, critical %s not found\n", name);1157 //fprintf(stderr,"Error:InitReading, critical %s not found\n", name); 1106 1158 exit(255); 1107 1159 } else { … … 1114 1166 } 1115 1167 line++; 1116 } while ( ((dummy1[0] == '#') || (dummy1[0] == '\n')) && dummy != NULL); // skip commentary and empty lines1168 } while (dummy != NULL && dummy1 != NULL && ((dummy1[0] == '#') || (dummy1[0] == '\0'))); // skip commentary and empty lines 1117 1169 1118 1170 // C++ getline removes newline at end, thus re-add … … 1122 1174 dummy1[i+1] = '\0'; 1123 1175 } 1124 //fprintf(stderr,"line ends at %i, newline at %i\n", strlen(dummy1), strchr(dummy1,'\n')-free_dummy); 1176 //fprintf(stderr,"line %i ends at %i, newline at %i\n", line, strlen(dummy1), strchr(dummy1,'\n')-free_dummy); 1177 1125 1178 if (dummy1 == NULL) { 1126 1179 if (verbose) fprintf(stderr,"Error reading line %i\n",line); 1127 1180 } else { 1128 //fprintf(stderr," Reading nextline %i: %s\n", line, dummy1);1181 //fprintf(stderr,"Now parsing the line %i: %s\n", line, dummy1); 1129 1182 } 1130 1183 // Seek for possible end of keyword on line if given ... … … 1204 1257 if (dummy == NULL) 1205 1258 dummy = strchr(dummy1, ' '); // if not found seek for space 1206 while ((dummy != NULL) && ((*dummy == '\t') || (*dummy == ' '))) // skip some more tabs and spaces if necessary1207 dummy++;1208 /* while ((dummy != NULL) && ((*dummy == '\t') || (*dummy == ' '))) // skip some more tabs and spaces if necessary1209 dummy++;*/1210 1259 if (dummy == NULL) { // if still zero returned ... 1211 1260 dummy = strchr(dummy1, '\n'); // ... at line end then
Note:
See TracChangeset
for help on using the changeset viewer.