- Timestamp:
- Dec 4, 2008, 3:15:00 PM (16 years ago)
- Branches:
- Action_Thermostats, Add_AtomRandomPerturbation, Add_FitFragmentPartialChargesAction, Add_RotateAroundBondAction, Add_SelectAtomByNameAction, Added_ParseSaveFragmentResults, AddingActions_SaveParseParticleParameters, Adding_Graph_to_ChangeBondActions, Adding_MD_integration_tests, Adding_ParticleName_to_Atom, Adding_StructOpt_integration_tests, AtomFragments, Automaking_mpqc_open, AutomationFragmentation_failures, Candidate_v1.5.4, Candidate_v1.6.0, Candidate_v1.6.1, ChangeBugEmailaddress, ChangingTestPorts, ChemicalSpaceEvaluator, CombiningParticlePotentialParsing, Combining_Subpackages, Debian_Package_split, Debian_package_split_molecuildergui_only, Disabling_MemDebug, Docu_Python_wait, EmpiricalPotential_contain_HomologyGraph, EmpiricalPotential_contain_HomologyGraph_documentation, Enable_parallel_make_install, Enhance_userguide, Enhanced_StructuralOptimization, Enhanced_StructuralOptimization_continued, Example_ManyWaysToTranslateAtom, Exclude_Hydrogens_annealWithBondGraph, FitPartialCharges_GlobalError, Fix_BoundInBox_CenterInBox_MoleculeActions, Fix_ChargeSampling_PBC, Fix_ChronosMutex, Fix_FitPartialCharges, Fix_FitPotential_needs_atomicnumbers, Fix_ForceAnnealing, Fix_IndependentFragmentGrids, Fix_ParseParticles, Fix_ParseParticles_split_forward_backward_Actions, Fix_PopActions, Fix_QtFragmentList_sorted_selection, Fix_Restrictedkeyset_FragmentMolecule, Fix_StatusMsg, Fix_StepWorldTime_single_argument, Fix_Verbose_Codepatterns, Fix_fitting_potentials, Fixes, ForceAnnealing_goodresults, ForceAnnealing_oldresults, ForceAnnealing_tocheck, ForceAnnealing_with_BondGraph, ForceAnnealing_with_BondGraph_continued, ForceAnnealing_with_BondGraph_continued_betteresults, ForceAnnealing_with_BondGraph_contraction-expansion, FragmentAction_writes_AtomFragments, FragmentMolecule_checks_bonddegrees, GeometryObjects, Gui_Fixes, Gui_displays_atomic_force_velocity, ImplicitCharges, IndependentFragmentGrids, IndependentFragmentGrids_IndividualZeroInstances, IndependentFragmentGrids_IntegrationTest, IndependentFragmentGrids_Sole_NN_Calculation, JobMarket_RobustOnKillsSegFaults, JobMarket_StableWorkerPool, JobMarket_unresolvable_hostname_fix, MoreRobust_FragmentAutomation, ODR_violation_mpqc_open, PartialCharges_OrthogonalSummation, PdbParser_setsAtomName, PythonUI_with_named_parameters, QtGui_reactivate_TimeChanged_changes, Recreated_GuiChecks, Rewrite_FitPartialCharges, RotateToPrincipalAxisSystem_UndoRedo, SaturateAtoms_findBestMatching, SaturateAtoms_singleDegree, StoppableMakroAction, Subpackage_CodePatterns, Subpackage_JobMarket, Subpackage_LinearAlgebra, Subpackage_levmar, Subpackage_mpqc_open, Subpackage_vmg, Switchable_LogView, ThirdParty_MPQC_rebuilt_buildsystem, TrajectoryDependenant_MaxOrder, TremoloParser_IncreasedPrecision, TremoloParser_MultipleTimesteps, TremoloParser_setsAtomName, Ubuntu_1604_changes, stable
- Children:
- f714979
- Parents:
- f683fe
- Location:
- src
- Files:
-
- 1 deleted
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
TabularUnified src/boundary.cpp ¶
rf683fe ra8bcea6 456 456 457 457 458 /* 459 * This function creates the tecplot file, displaying the tesselation of the hull. 460 * \param *out output stream for debugging 461 * \param *tecplot output stream for tecplot data 462 */ 463 void write_tecplot_file(ofstream *out, ofstream *tecplot, class Tesselation *TesselStruct, class molecule *mol) 464 { 465 // 8. Store triangles in tecplot file 466 if (tecplot != NULL) { 467 *tecplot << "TITLE = \"3D CONVEX SHELL\"" << endl; 468 *tecplot << "VARIABLES = \"X\" \"Y\" \"Z\"" << endl; 469 *tecplot << "ZONE T=\"TRIANGLES\", N=" << TesselStruct->PointsOnBoundaryCount << ", E=" << TesselStruct->TrianglesOnBoundaryCount << ", DATAPACKING=POINT, ZONETYPE=FETRIANGLE" << endl; 470 int *LookupList = new int[mol->AtomCount]; 471 for (int i=0;i<mol->AtomCount;i++) 472 LookupList[i] = -1; 473 474 // print atom coordinates 475 *out << Verbose(2) << "The following triangles were created:"; 476 int Counter = 1; 477 atom *Walker = NULL; 478 for (PointMap::iterator target = TesselStruct->PointsOnBoundary.begin(); target != TesselStruct->PointsOnBoundary.end(); target++) { 479 Walker = target->second->node; 480 LookupList[Walker->nr] = Counter++; 481 *tecplot << Walker->x.x[0] << " " << Walker->x.x[1] << " " << Walker->x.x[2] << " " << endl; 482 } 483 *tecplot << endl; 484 // print connectivity 485 for (TriangleMap::iterator runner = TesselStruct->TrianglesOnBoundary.begin(); runner != TesselStruct->TrianglesOnBoundary.end(); runner++) { 486 *out << " " << runner->second->endpoints[0]->node->Name << "<->" << runner->second->endpoints[1]->node->Name << "<->" << runner->second->endpoints[2]->node->Name; 487 *tecplot << LookupList[runner->second->endpoints[0]->node->nr] << " " << LookupList[runner->second->endpoints[1]->node->nr] << " " << LookupList[runner->second->endpoints[2]->node->nr] << endl; 488 } 489 delete[](LookupList); 490 *out << endl; 491 } 492 } 493 458 494 /** Determines the volume of a cluster. 459 495 * Determines first the convex envelope, then tesselates it and calculates its volume. … … 478 514 double a,b,c; 479 515 480 Find_non_convex_border( *TesselStruct, mol);516 Find_non_convex_border(out, tecplot, *TesselStruct, mol); 481 517 /* 482 518 // 1. calculate center of gravity … … 560 596 561 597 562 563 // 8. Store triangles in tecplot file 564 if (tecplot != NULL) { 565 *tecplot << "TITLE = \"3D CONVEX SHELL\"" << endl; 566 *tecplot << "VARIABLES = \"X\" \"Y\" \"Z\"" << endl; 567 *tecplot << "ZONE T=\"TRIANGLES\", N=" << TesselStruct->PointsOnBoundaryCount << ", E=" << TesselStruct->TrianglesOnBoundaryCount << ", DATAPACKING=POINT, ZONETYPE=FETRIANGLE" << endl; 568 int *LookupList = new int[mol->AtomCount]; 569 for (int i=0;i<mol->AtomCount;i++) 570 LookupList[i] = -1; 571 572 // print atom coordinates 573 *out << Verbose(2) << "The following triangles were created:"; 574 int Counter = 1; 575 atom *Walker = NULL; 576 for (PointMap::iterator target = TesselStruct->PointsOnBoundary.begin(); target != TesselStruct->PointsOnBoundary.end(); target++) { 577 Walker = target->second->node; 578 LookupList[Walker->nr] = Counter++; 579 *tecplot << Walker->x.x[0] << " " << Walker->x.x[1] << " " << Walker->x.x[2] << " " << endl; 580 } 581 *tecplot << endl; 582 // print connectivity 583 for (TriangleMap::iterator runner = TesselStruct->TrianglesOnBoundary.begin(); runner != TesselStruct->TrianglesOnBoundary.end(); runner++) { 584 *out << " " << runner->second->endpoints[0]->node->Name << "<->" << runner->second->endpoints[1]->node->Name << "<->" << runner->second->endpoints[2]->node->Name; 585 *tecplot << LookupList[runner->second->endpoints[0]->node->nr] << " " << LookupList[runner->second->endpoints[1]->node->nr] << " " << LookupList[runner->second->endpoints[2]->node->nr] << endl; 586 } 587 delete[](LookupList); 588 *out << endl; 589 } 598 write_tecplot_file(out, tecplot, TesselStruct, mol); 599 590 600 591 601 // free reference lists … … 699 709 Tesselation::~Tesselation() 700 710 { 711 cout << Verbose(1) << "Free'ing TesselStruct ... " << endl; 701 712 for (TriangleMap::iterator runner = TrianglesOnBoundary.begin(); runner != TrianglesOnBoundary.end(); runner++) { 702 713 delete(runner->second); … … 1028 1039 * with all neighbours of the candidate. 1029 1040 */ 1030 void Find_next_suitable_point(atom* a, atom* b, atom* Candidate, int n, Vector *Chord, Vector *d1, Vector *d2, double *Storage, const double RADIUS, molecule* mol)1041 void Find_next_suitable_point(atom* a, atom* b, atom* Candidate, int n, Vector *Chord, Vector *d1, Vector *d2, atom*& Opt_Candidate, double *Storage, const double RADIUS, molecule* mol, bool problem) 1031 1042 { 1032 1043 /* d2 is normal vector on the triangle … … 1045 1056 AngleCheck.ProjectOntoPlane(Chord); 1046 1057 1047 if ( Chord->Norm()/(2*sin(dif_a.Angle(&dif_b)))<RADIUS) //Using Formula for relation of chord length with inner angle to find of Ball will touch atom1058 if (problem) 1048 1059 { 1049 1050 if (dif_a.ScalarProduct(d1)/fabs(dif_a.ScalarProduct(d1))>Storage[1]) //This will give absolute preference to those in "right-hand" quadrants 1060 cout << "Atom number" << Candidate->nr << endl; 1061 Candidate->x.Output((ofstream *)&cout); 1062 cout << "number of bonds " << mol->NumberOfBondsPerAtom[Candidate->nr] << endl; 1063 } 1064 1065 if (a != Candidate and b != Candidate) 1066 { 1067 1068 if (Chord->Norm()/(2*sin(dif_a.Angle(&dif_b)))<RADIUS) //Using Formula for relation of chord length with inner angle to find of Ball will touch atom 1069 { 1070 if (dif_a.ScalarProduct(d1)/fabs(dif_a.ScalarProduct(d1))>Storage[0]) //This will give absolute preference to those in "right-hand" quadrants 1071 { 1072 Opt_Candidate = Candidate; 1073 Storage[0]=dif_a.ScalarProduct(d1)/fabs(dif_a.ScalarProduct(d1)); 1074 Storage[1]=AngleCheck.Angle(d2); 1075 } 1076 else 1077 { 1078 if ((dif_a.ScalarProduct(d1)/fabs(dif_a.ScalarProduct(d1)) == Storage[0] && Storage[0]>0 && Storage[1]< AngleCheck.Angle(d2)) or \ 1079 (dif_a.ScalarProduct(d1)/fabs(dif_a.ScalarProduct(d1)) == Storage[0] && Storage[0]<0 && Storage[1]> AngleCheck.Angle(d2))) 1080 //Depending on quadrant we prefer higher or lower atom with respect to Triangle normal first. 1081 { 1082 Opt_Candidate = Candidate; 1083 Storage[0]=dif_a.ScalarProduct(d1)/fabs(dif_a.ScalarProduct(d1)); 1084 Storage[1]=AngleCheck.Angle(d2); 1085 } 1086 else 1087 { 1088 if (problem) 1089 cout << "Loses to better candidate" << endl; 1090 } 1091 } 1092 } 1093 else 1094 { 1095 if (problem) 1096 cout << "erfuellt Dreiecksbedingung fuer sehne nicht" <<endl; 1097 } 1098 } 1099 else 1100 { 1101 if (problem) 1102 cout << "identisch mit Ursprungslinie" << endl; 1103 } 1104 1105 if (n<5) // Five is the recursion level threshold. 1106 { 1107 for(int i=0; i<mol->NumberOfBondsPerAtom[Candidate->nr];i++) // go through all bond 1051 1108 { 1052 Storage[0]=(double)Candidate->nr;1053 Storage[1]=dif_a.ScalarProduct(d1)/fabs(dif_a.ScalarProduct(d1)); 1054 Storage[2]=AngleCheck.Angle(d2); 1109 Walker = mol->ListOfBondsPerAtom[Candidate->nr][i]->GetOtherAtom(Candidate); 1110 1111 Find_next_suitable_point(a, b, Walker, n+1, Chord, d1, d2, Opt_Candidate, Storage, RADIUS, mol, problem); //call function again 1055 1112 } 1056 else 1057 { 1058 if ((dif_a.ScalarProduct(d1)/fabs(dif_a.ScalarProduct(d1)) == Storage[1] && Storage[1]>0 && Storage[2]< AngleCheck.Angle(d2)) or \ 1059 (dif_a.ScalarProduct(d1)/fabs(dif_a.ScalarProduct(d1)) == Storage[1] && Storage[1]<0 && Storage[2]> AngleCheck.Angle(d2))) 1060 //Depending on quadrant we prefer higher or lower atom with respect to Triangle normal first. 1061 { 1062 Storage[0]=(double)Candidate->nr; 1063 Storage[1]=dif_a.ScalarProduct(d1)/fabs(dif_a.ScalarProduct(d1)); 1064 Storage[2]=AngleCheck.Angle(d2); 1065 } 1066 } 1067 } 1068 1069 if (n<5) // Five is the recursion level threshold. 1070 { 1071 for(int i=0; i<mol->NumberOfBondsPerAtom[Candidate->nr];i++) // go through all bond 1072 { 1073 Walker= mol->start; // go through all atoms 1074 1075 while (Walker->nr != (mol->ListOfBondsPerAtom[Candidate->nr][i]->leftatom->nr ==Candidate->nr ? mol->ListOfBondsPerAtom[Candidate->nr][i]->rightatom->nr : mol->ListOfBondsPerAtom[Candidate->nr][i]->leftatom->nr)) 1076 { // until atom found which belongs to bond 1077 Walker = Walker->next; 1078 } 1079 1080 1081 Find_next_suitable_point(a, b, Walker, n+1, Chord, d1, d2, Storage, RADIUS, mol); //call function again 1082 } 1083 } 1113 } 1084 1114 }; 1085 1115 … … 1087 1117 * this function fins a triangle to a line, adjacent to an existing one. 1088 1118 */ 1089 void Tesselation::Find_next_suitable_triangle( molecule* mol, BoundaryLineSet Line, BoundaryTriangleSetT, const double& RADIUS)1090 { 1091 printf("Looking for next suitable triangle \n");1119 void Tesselation::Find_next_suitable_triangle(ofstream *out, ofstream *tecplot, molecule* mol, BoundaryLineSet &Line, BoundaryTriangleSet &T, const double& RADIUS) 1120 { 1121 cout << Verbose(1) << "Looking for next suitable triangle \n"; 1092 1122 Vector direction1; 1093 1123 Vector helper; … … 1095 1125 atom* Walker; 1096 1126 1097 double *Storage;1098 Storage = new double[3];1099 Storage[ 0]=-1.; // Id must be positive, we see should nothing be done1100 Storage[1]=-1.; // This direction is either +1 or -1 one, so any result will take precedence over initial values1101 Storage[2]=-10.; // This is also lower then any value produced by an eligible atom, which are all positive 1102 1103 1127 double Storage[2]; 1128 Storage[0]=-2.; // This direction is either +1 or -1 one, so any result will take precedence over initial values 1129 Storage[1]=9999999.; // This is also lower then any value produced by an eligible atom, which are all positive 1130 atom* Opt_Candidate = NULL; 1131 1132 1133 cout << Verbose(1) << "Constructing helpful vectors ... " << endl; 1104 1134 helper.CopyVector(&(Line.endpoints[0]->node->x)); 1105 1135 for (int i =0; i<3; i++) … … 1115 1145 direction1.CopyVector(&Line.endpoints[0]->node->x); 1116 1146 direction1.SubtractVector(&Line.endpoints[1]->node->x); 1117 direction1.VectorProduct( T.NormalVector);1147 direction1.VectorProduct(&(T.NormalVector)); 1118 1148 1119 1149 if (direction1.ScalarProduct(&helper)>0) … … 1125 1155 Chord.SubtractVector(&(Line.endpoints[1]->node->x)); 1126 1156 1127 printf("Looking for third point candidates for triangle \n"); 1128 Find_next_suitable_point(Line.endpoints[0]->node, Line.endpoints[1]->node, Line.endpoints[0]->node, 0, &Chord, &direction1, T.NormalVector, Storage, RADIUS, mol); 1129 1157 cout << Verbose(1) << "Looking for third point candidates for triangle ... " << endl; 1158 Find_next_suitable_point(Line.endpoints[0]->node, Line.endpoints[1]->node, Line.endpoints[0]->node, 0, &Chord, &direction1, &(T.NormalVector), Opt_Candidate, Storage, RADIUS, mol,0); 1159 1160 if (Opt_Candidate==NULL) 1161 { 1162 cout << Verbose(1) << "No new Atom found, triangle construction will crash" << endl; 1163 write_tecplot_file(out, tecplot, this, mol); 1164 tecplot->flush(); 1165 Find_next_suitable_point(Line.endpoints[0]->node, Line.endpoints[1]->node, Line.endpoints[0]->node, 0, &Chord, &direction1, &(T.NormalVector), Opt_Candidate, Storage, RADIUS, mol, 1); 1166 1167 } 1130 1168 // Konstruiere nun neues Dreieck am Ende der Liste der Dreiecke 1131 // Next Triangle is Line, atom with number in Storage[0] 1132 1133 Walker= mol->start; 1134 while (Walker->nr != (int)Storage[0]) 1135 { 1136 Walker = Walker->next; 1137 } 1138 1139 AddPoint(Walker); 1140 1141 BPS[0] = new class BoundaryPointSet(Walker); 1169 1170 cout << Verbose(1) << "Adding exactly one Walker for reasons completely unknown to me ... " << endl; 1171 cout << " Optimal candidate is " << *Opt_Candidate << endl; 1172 AddPoint(Opt_Candidate); 1173 cout << " Optimal candidate is " << *Opt_Candidate << endl; 1174 1175 BPS[0] = new class BoundaryPointSet(Opt_Candidate); 1176 cout << " Optimal candidate is " << *Opt_Candidate << endl; 1142 1177 BPS[1] = new class BoundaryPointSet(Line.endpoints[0]->node); 1178 cout << " Optimal candidate is " << *Opt_Candidate << endl; 1143 1179 BLS[0] = new class BoundaryLineSet(BPS , LinesOnBoundaryCount); 1144 BPS[0] = new class BoundaryPointSet(Walker); 1180 cout << " Optimal candidate is " << *Opt_Candidate << endl; 1181 BPS[0] = new class BoundaryPointSet(Opt_Candidate); 1182 cout << " Optimal candidate is " << *Opt_Candidate << endl; 1145 1183 BPS[1] = new class BoundaryPointSet(Line.endpoints[1]->node); 1146 1184 BLS[1] = new class BoundaryLineSet(BPS , LinesOnBoundaryCount); … … 1151 1189 TrianglesOnBoundaryCount++; 1152 1190 1191 cout << Verbose(1) << "Checking for already present lines ... " << endl; 1153 1192 for(int i=0;i<NDIM;i++) // sind Linien bereits vorhanden ??? 1154 1193 { … … 1160 1199 } 1161 1200 } 1162 BTS->GetNormalVector(*BTS->NormalVector); 1163 1164 if( (BTS->NormalVector->ScalarProduct(T.NormalVector)<0 && Storage[1]>0) || \ 1165 (BTS->NormalVector->ScalarProduct(T.NormalVector)>0 && Storage[1]<0)) 1201 cout << Verbose(1) << "Constructing normal vector for this triangle ... " << endl; 1202 1203 BTS->GetNormalVector(BTS->NormalVector); 1204 1205 if ((BTS->NormalVector.ScalarProduct(&(T.NormalVector))<0 && Storage[0]>0) || 1206 ((BTS->NormalVector.ScalarProduct(&(T.NormalVector))>0 && Storage[0]<0)) ) 1166 1207 { 1167 BTS->NormalVector ->Scale(-1);1168 } 1169 1170 }; 1171 1172 1173 void Find_second_point_for_Tesselation(atom* a, atom* Candidate, int n, Vector Oben, double Storage[3], molecule* mol)1174 { 1175 printf("Looking for second point of starting triangle \n");1176 1177 Vector *AngleCheck;1178 1179 1180 AngleCheck->CopyVector(&(Candidate->x));1181 AngleCheck->SubtractVector(&(a->x));1182 if (AngleCheck->Angle(&Oben) < Storage[1])1208 BTS->NormalVector.Scale(-1); 1209 }; 1210 1211 }; 1212 1213 1214 void Find_second_point_for_Tesselation(atom* a, atom* Candidate, int n, Vector Oben, atom*& Opt_Candidate, double Storage[2], molecule* mol, double RADIUS) 1215 { 1216 cout << Verbose(1) << "Looking for second point of starting triangle, recursive level "<< n <<endl;; 1217 int i; 1218 Vector AngleCheck; 1219 atom* Walker; 1220 1221 AngleCheck.CopyVector(&(Candidate->x)); 1222 AngleCheck.SubtractVector(&(a->x)); 1223 if (AngleCheck.Norm() < RADIUS and AngleCheck.Angle(&Oben) < Storage[0]) 1183 1224 { 1184 // printf("Old values of Storage: %lf %lf \n", Storage[0], Storage[1]);1185 Storage[0]=(double)(Candidate->nr);1186 Storage[ 1]=AngleCheck->Angle(&Oben);1187 // printf("Changing something in Storage: %lf %lf. \n", Storage[0], Storage[1]);1225 //cout << Verbose(1) << "Old values of Storage: %lf %lf \n", Storage[0], Storage[1]); 1226 Opt_Candidate=Candidate; 1227 Storage[0]=AngleCheck.Angle(&Oben); 1228 //cout << Verbose(1) << "Changing something in Storage: %lf %lf. \n", Storage[0], Storage[1]); 1188 1229 }; 1189 printf("%d \n", n); 1190 if (n<5) 1230 if (n<5) 1191 1231 { 1192 1232 for (i = 0; i< mol->NumberOfBondsPerAtom[Candidate->nr]; i++) 1193 { 1194 Walker = mol->start; 1195 while (Candidate->nr != (mol->ListOfBondsPerAtom[Candidate->nr][i]->leftatom->nr ==Candidate->nr ? mol->ListOfBondsPerAtom[Candidate->nr][i]->leftatom->nr : mol->ListOfBondsPerAtom[Candidate->nr][i]->rightatom->nr)) 1196 { 1197 Walker = Walker->next; 1198 }; 1199 1200 Find_second_point_for_Tesselation(a, Walker, n+1, Oben, Storage, mol); 1201 }; 1233 { 1234 Walker = mol->ListOfBondsPerAtom[Candidate->nr][i]->GetOtherAtom(Candidate); 1235 Find_second_point_for_Tesselation(a, Walker, n+1, Oben, Opt_Candidate, Storage, mol, RADIUS); 1236 }; 1202 1237 }; 1203 1238 … … 1208 1243 void Tesselation::Find_starting_triangle(molecule* mol, const double RADIUS) 1209 1244 { 1210 printf("Looking for starting triangle \n");1245 cout << Verbose(1) << "Looking for starting triangle \n"; 1211 1246 int i=0; 1212 1247 atom* Walker; … … 1227 1262 max_coordinate[i] =-1; 1228 1263 } 1229 printf("Molecule mol is there and has %d Atoms \n", mol->AtomCount);1264 cout << Verbose(1) << "Molecule mol is there and has " << mol->AtomCount << " Atoms \n"; 1230 1265 Walker = mol->start; 1231 1266 while (Walker->next != mol->end) … … 1242 1277 } 1243 1278 1244 printf("Found starting atom \n");1279 cout << Verbose(1) << "Found starting atom \n"; 1245 1280 //Koennen dies fuer alle Richtungen, legen hier erstmal Richtung auf k=0 1246 1281 const int k=2; … … 1253 1288 Walker = Walker->next; 1254 1289 } 1255 printf("%d \n", Walker->nr);1256 double Storage[ 3];1257 Storage[0]=-1.; // Id must be positive, we see should nothing be done1258 Storage[ 1]=999999.; // This will contain the angle, which will be always positive (when looking for second point), when looking for third point this will be the quadrant.1259 Storage[ 2]=999999.; // This will be an angle looking for the third point.1260 printf("%d \n", mol->NumberOfBondsPerAtom[Walker->nr]);1290 cout << Verbose(1) << "Number of start atom: " << Walker->nr << endl; 1291 double Storage[2]; 1292 atom* Opt_Candidate = NULL; 1293 Storage[0]=999999.; // This will contain the angle, which will be always positive (when looking for second point), when looking for third point this will be the quadrant. 1294 Storage[1]=999999.; // This will be an angle looking for the third point. 1295 cout << Verbose(1) << "Number of Bonds: " << mol->NumberOfBondsPerAtom[Walker->nr] << endl; 1261 1296 1262 1297 for (i=1; i< (mol->NumberOfBondsPerAtom[Walker->nr]); i++) 1263 1298 { 1264 Walker2 = mol->start; 1265 Walker2 = Walker2->next; 1266 while (Walker2->nr != (mol->ListOfBondsPerAtom[Walker->nr][i]->leftatom->nr == Walker->nr ? mol->ListOfBondsPerAtom[Walker->nr][i]->rightatom->nr : mol->ListOfBondsPerAtom[Walker->nr][i]->leftatom->nr) ) 1267 { 1268 Walker2 = Walker2->next; 1269 } 1270 1271 Find_second_point_for_Tesselation(Walker, Walker2, 0, Oben, Storage, mol); 1272 } 1273 1274 Walker2 = mol->start; 1275 1276 while (Walker2->nr != int(Storage[0])) 1277 { 1278 Walker2 = Walker2->next; 1279 } 1280 1299 Walker2 = mol->ListOfBondsPerAtom[Walker->nr][i]->GetOtherAtom(Walker); 1300 Find_second_point_for_Tesselation(Walker, Walker2, 0, Oben, Opt_Candidate, Storage, mol, RADIUS); 1301 } 1302 1303 Walker2 = Opt_Candidate; 1304 Opt_Candidate=NULL; 1281 1305 helper.CopyVector(&(Walker->x)); 1282 1306 helper.SubtractVector(&(Walker2->x)); 1283 1307 Oben.ProjectOntoPlane(&helper); 1284 1308 helper.VectorProduct(&Oben); 1285 Storage[0]=-1.; // Id must be positive, we see should nothing be done 1286 Storage[1]=-2.; // This will contain the angle, which will be always positive (when looking for second point), when looking for third point this will be the quadrant. 1287 Storage[2]= -10.; // This will be an angle looking for the third point. 1309 Storage[0]=-2.; // This will indicate the quadrant. 1310 Storage[1]= 9999999.; // This will be an angle looking for the third point. 1288 1311 1289 1312 Chord.CopyVector(&(Walker->x)); // bring into calling function 1290 1313 Chord.SubtractVector(&(Walker2->x)); 1291 1314 1292 printf("Looking for third point candidates \n"); 1293 Find_next_suitable_point(Walker, Walker2, (mol->ListOfBondsPerAtom[Walker->nr][0]->leftatom->nr == Walker->nr ? mol->ListOfBondsPerAtom[Walker->nr][0]->rightatom : mol->ListOfBondsPerAtom[Walker->nr][0]->leftatom), 0, &Chord, &helper, &Oben, Storage, RADIUS, mol); 1294 Walker3 = mol->start; 1295 while (Walker3->nr != int(Storage[0])) 1296 { 1297 Walker3 = Walker3->next; 1298 } 1299 1300 //Starting Triangle is Walker, Walker2, index Storage[0] 1315 cout << Verbose(1) << "Looking for third point candidates \n"; 1316 Find_next_suitable_point(Walker, Walker2, mol->ListOfBondsPerAtom[Walker->nr][0]->GetOtherAtom(Walker), 0, &Chord, &helper, &Oben, Opt_Candidate, Storage, RADIUS, mol, 0); 1317 1318 1319 //Starting Triangle is Walker, Walker2, Opt_Candidate 1301 1320 1302 1321 AddPoint(Walker); 1303 1322 AddPoint(Walker2); 1304 AddPoint(Walker3); 1323 AddPoint(Opt_Candidate); 1324 1325 cout << Verbose(1) << "The found starting triangle consists of " << *Walker << ", " << *Walker2 << " and " << *Opt_Candidate << "." << endl; 1305 1326 1306 1327 BPS[0] = new class BoundaryPointSet(Walker); … … 1308 1329 BLS[0] = new class BoundaryLineSet(BPS , LinesOnBoundaryCount); 1309 1330 BPS[0] = new class BoundaryPointSet(Walker); 1310 BPS[1] = new class BoundaryPointSet( Walker3);1331 BPS[1] = new class BoundaryPointSet(Opt_Candidate); 1311 1332 BLS[1] = new class BoundaryLineSet(BPS , LinesOnBoundaryCount); 1312 1333 BPS[0] = new class BoundaryPointSet(Walker); … … 1314 1335 BLS[2] = new class BoundaryLineSet(BPS , LinesOnBoundaryCount); 1315 1336 1316 BTS = new class BoundaryTriangleSet(BLS, TrianglesOnBoundaryCount);1337 Tesselation::BTS = new class BoundaryTriangleSet(BLS, TrianglesOnBoundaryCount); 1317 1338 TrianglesOnBoundary.insert( TrianglePair(TrianglesOnBoundaryCount, BTS) ); 1318 1339 TrianglesOnBoundaryCount++; … … 1324 1345 }; 1325 1346 1326 BTS->GetNormalVector( *BTS->NormalVector);1327 1328 if( BTS->NormalVector ->ScalarProduct(&Oben)<0)1347 BTS->GetNormalVector(BTS->NormalVector); 1348 1349 if( BTS->NormalVector.ScalarProduct(&Oben)<0) 1329 1350 { 1330 BTS->NormalVector ->Scale(-1);1351 BTS->NormalVector.Scale(-1); 1331 1352 } 1332 1353 }; 1333 1354 1334 1355 1335 void Find_non_convex_border(Tesselation Tess, molecule* mol) 1336 { 1337 printf("Entering finding of non convex hull. \n"); 1356 void Find_non_convex_border(ofstream *out, ofstream *tecplot, Tesselation Tess, molecule* mol) 1357 { 1358 cout << Verbose(1) << "Entering finding of non convex hull. " << endl; 1359 cout << flush; 1338 1360 const double RADIUS =6; 1361 LineMap::iterator baseline; 1339 1362 Tess.Find_starting_triangle(mol, RADIUS); 1340 1363 1341 for (LineMap::iterator baseline = Tess.LinesOnBoundary.begin(); baseline != Tess.LinesOnBoundary.end(); baseline++) 1364 baseline = Tess.LinesOnBoundary.begin(); 1365 while (baseline != Tess.LinesOnBoundary.end()) { 1342 1366 if (baseline->second->TrianglesCount == 1) 1343 1367 { 1344 Tess.Find_next_suitable_triangle(mol, *(baseline->second), *(baseline->second->triangles.begin()->second), RADIUS); //the line is there, so there is a triangle, but only one. 1368 cout << Verbose(1) << "Begin of Tesselation ... " << endl; 1369 Tess.Find_next_suitable_triangle(out, tecplot, mol, *(baseline->second), *(baseline->second->triangles.begin()->second), RADIUS); //the line is there, so there is a triangle, but only one. 1370 cout << Verbose(1) << "End of Tesselation ... " << endl; 1345 1371 } 1346 1372 else 1347 1373 { 1348 printf("There is a line with %d triangles adjacent", baseline->second->TrianglesCount);1374 cout << Verbose(1) << "There is a line with " << baseline->second->TrianglesCount << " triangles adjacent"; 1349 1375 } 1350 }; 1376 baseline++; 1377 } 1378 1379 }; -
TabularUnified src/boundary.hpp ¶
rf683fe ra8bcea6 36 36 BoundaryPointSet(atom *Walker); 37 37 ~BoundaryPointSet(); 38 38 39 39 void AddLine(class BoundaryLineSet *line); 40 40 41 41 LineMap lines; 42 42 int LinesCount; … … 64 64 BoundaryTriangleSet(class BoundaryLineSet *line[3], int number); 65 65 ~BoundaryTriangleSet(); 66 66 67 67 void GetNormalVector(Vector &NormalVector); 68 68 69 69 class BoundaryPointSet *endpoints[3]; 70 70 class BoundaryLineSet *lines[3]; 71 Vector *NormalVector;71 Vector NormalVector; 72 72 int Nr; 73 73 }; … … 75 75 class Tesselation { 76 76 public: 77 77 78 78 Tesselation(); 79 79 ~Tesselation(); 80 80 81 81 void TesselateOnBoundary(ofstream *out, config *configuration, molecule *mol); 82 82 void GuessStartingTriangle(ofstream *out); 83 83 void AddPoint(atom * Walker); 84 84 void Find_starting_triangle(molecule* mol, const double RADIUS); 85 void Find_next_suitable_triangle( molecule* mol, BoundaryLineSet Line, BoundaryTriangleSetT, const double& RADIUS);86 85 void Find_next_suitable_triangle(ofstream *out, ofstream *tecplot, molecule* mol, BoundaryLineSet &Line, BoundaryTriangleSet &T, const double& RADIUS); 86 87 87 PointMap PointsOnBoundary; 88 88 LineMap LinesOnBoundary; … … 105 105 double * GetDiametersOfCluster(ofstream *out, Boundaries *BoundaryPtr, molecule *mol, bool IsAngstroem); 106 106 void PrepareClustersinWater(ofstream *out, config *configuration, molecule *mol, double ClusterVolume, double celldensity); 107 void Find_next_suitable_point(atom a, atom b, atom Candidate, int n, Vector *d1, Vector *d2, double *Storage, const double RADIUS, molecule *mol);108 void Find_non_convex_border( Tesselation Tess, molecule* mol);107 void Find_next_suitable_point(atom a, atom b, atom Candidate, int n, Vector *d1, Vector *d2, atom*& Opt_Candidate, double *Storage, const double RADIUS, molecule *mol, bool problem); 108 void Find_non_convex_border(ofstream *out, ofstream *tecplot, Tesselation Tess, molecule* mol); 109 109 110 110 -
TabularUnified src/builder.cpp ¶
rf683fe ra8bcea6 1 1 /** \file builder.cpp 2 * 2 * 3 3 * By stating absolute positions or binding angles and distances atomic positions of a molecule can be constructed. 4 4 * The output is the complete configuration file for PCP for direct use. … … 6 6 * -# Atomic data is retrieved from a file, if not found requested and stored there for later re-use 7 7 * -# step-by-step construction of the molecule beginning either at a centre of with a certain atom 8 * 8 * 9 9 */ 10 10 11 11 /*! \mainpage Molecuilder - a molecular set builder 12 * 12 * 13 13 * This introductory shall briefly make aquainted with the program, helping in installing and a first run. 14 * 14 * 15 15 * \section about About the Program 16 * 16 * 17 17 * Molecuilder is a short program, written in C++, that enables the construction of a coordinate set for the 18 18 * atoms making up an molecule by the successive statement of binding angles and distances and referencing to 19 19 * already constructed atoms. 20 * 20 * 21 21 * A configuration file may be written that is compatible to the format used by PCP - a parallel Car-Parrinello 22 22 * molecular dynamics implementation. 23 * 23 * 24 24 * \section install Installation 25 * 25 * 26 26 * Installation should without problems succeed as follows: 27 27 * -# ./configure (or: mkdir build;mkdir run;cd build; ../configure --bindir=../run) 28 28 * -# make 29 29 * -# make install 30 * 30 * 31 31 * Further useful commands are 32 32 * -# make clean uninstall: deletes .o-files and removes executable from the given binary directory\n 33 * -# make doxygen-doc: Creates these html pages out of the documented source 34 * 33 * -# make doxygen-doc: Creates these html pages out of the documented source 34 * 35 35 * \section run Running 36 * 36 * 37 37 * The program can be executed by running: ./molecuilder 38 * 38 * 39 39 * Note, that it uses a database, called "elements.db", in the executable's directory. If the file is not found, 40 40 * it is created and any given data on elements of the periodic table will be stored therein and re-used on 41 * later re-execution. 42 * 41 * later re-execution. 42 * 43 43 * \section ref References 44 * 44 * 45 45 * For the special configuration file format, see the documentation of pcp. 46 * 46 * 47 47 */ 48 48 … … 80 80 cout << Verbose(0) << "INPUT: "; 81 81 cin >> choice; 82 82 83 83 switch (choice) { 84 84 case 'a': // absolute coordinates of atom … … 89 89 mol->AddAtom(first); // add to molecule 90 90 break; 91 91 92 92 case 'b': // relative coordinates of atom wrt to reference point 93 93 first = new atom; … … 105 105 mol->AddAtom(first); // add to molecule 106 106 break; 107 107 108 108 case 'c': // relative coordinates of atom wrt to already placed atom 109 109 first = new atom; … … 111 111 do { 112 112 if (!valid) cout << Verbose(0) << "Resulting position out of cell." << endl; 113 second = mol->AskAtom("Enter atom number: "); 113 second = mol->AskAtom("Enter atom number: "); 114 114 cout << Verbose(0) << "Enter relative coordinates." << endl; 115 115 first->x.AskPosition(mol->cell_size, false); … … 121 121 mol->AddAtom(first); // add to molecule 122 122 break; 123 123 124 124 case 'd': // two atoms, two angles and a distance 125 125 first = new atom; … … 152 152 x.Copyvector(&fourth->x); 153 153 x.SubtractVector(&third->x); 154 154 155 155 if (!z.SolveSystem(&x,&y,&n, b, c, a)) { 156 156 cout << Verbose(0) << "Failure solving self-dependent linear system!" << endl; … … 167 167 cout << "x: ", 168 168 x.Output((ofstream *)&cout); 169 cout << endl; 169 cout << endl; 170 170 z.MakeNormalVector(&second->x,&third->x,&fourth->x); 171 171 cout << "z: ", 172 172 z.Output((ofstream *)&cout); 173 cout << endl; 173 cout << endl; 174 174 y.MakeNormalVector(&x,&z); 175 175 cout << "y: ", 176 176 y.Output((ofstream *)&cout); 177 cout << endl; 178 177 cout << endl; 178 179 179 // rotate vector around first angle 180 180 first->x.CopyVector(&x); … … 182 182 cout << "Rotated vector: ", 183 183 first->x.Output((ofstream *)&cout); 184 cout << endl; 184 cout << endl; 185 185 // remove the projection onto the rotation plane of the second angle 186 186 n.CopyVector(&y); … … 188 188 cout << "N1: ", 189 189 n.Output((ofstream *)&cout); 190 cout << endl; 190 cout << endl; 191 191 first->x.SubtractVector(&n); 192 192 cout << "Subtracted vector: ", 193 193 first->x.Output((ofstream *)&cout); 194 cout << endl; 194 cout << endl; 195 195 n.CopyVector(&z); 196 196 n.Scale(first->x.Projection(&z)); 197 197 cout << "N2: ", 198 198 n.Output((ofstream *)&cout); 199 cout << endl; 199 cout << endl; 200 200 first->x.SubtractVector(&n); 201 201 cout << "2nd subtracted vector: ", 202 202 first->x.Output((ofstream *)&cout); 203 cout << endl; 204 203 cout << endl; 204 205 205 // rotate another vector around second angle 206 206 n.CopyVector(&y); … … 208 208 cout << "2nd Rotated vector: ", 209 209 n.Output((ofstream *)&cout); 210 cout << endl; 211 210 cout << endl; 211 212 212 // add the two linear independent vectors 213 213 first->x.AddVector(&n); 214 first->x.Normalize(); 214 first->x.Normalize(); 215 215 first->x.Scale(a); 216 216 first->x.AddVector(&second->x); 217 217 218 218 cout << Verbose(0) << "resulting coordinates: "; 219 219 first->x.Output((ofstream *)&cout); … … 241 241 } while ((j != -1) && (i<128)); 242 242 if (i >= 2) { 243 first->x.LSQdistance(atoms, i); 243 first->x.LSQdistance(atoms, i); 244 244 245 245 first->x.Output((ofstream *)&cout); … … 261 261 Vector x, y; 262 262 char choice; // menu choice char 263 263 264 264 cout << Verbose(0) << "===========CENTER ATOMS=========================" << endl; 265 265 cout << Verbose(0) << " a - on origin" << endl; … … 271 271 cout << Verbose(0) << "INPUT: "; 272 272 cin >> choice; 273 273 274 274 switch (choice) { 275 275 default: … … 327 327 cout << Verbose(0) << "INPUT: "; 328 328 cin >> choice; 329 329 330 330 switch (choice) { 331 331 default: … … 346 346 second = mol->AskAtom("Enter second atom: "); 347 347 348 n.CopyVector((const Vector *)&first->x); 349 n.SubtractVector((const Vector *)&second->x); 348 n.CopyVector((const Vector *)&first->x); 349 n.SubtractVector((const Vector *)&second->x); 350 350 n.Normalize(); 351 break; 351 break; 352 352 case 'd': 353 353 char shorthand[4]; … … 363 363 x.x[i] = gsl_vector_get(param.x,i); 364 364 n.x[i] = gsl_vector_get(param.x,i+NDIM); 365 } 365 } 366 366 gsl_vector_free(param.x); 367 367 cout << Verbose(0) << "Offset vector: "; … … 369 369 cout << Verbose(0) << endl; 370 370 n.Normalize(); 371 break; 371 break; 372 372 }; 373 373 cout << Verbose(0) << "Alignment vector: "; … … 385 385 Vector n; 386 386 char choice; // menu choice char 387 387 388 388 cout << Verbose(0) << "===========MIRROR ATOMS=========================" << endl; 389 389 cout << Verbose(0) << " a - state three atoms defining mirror plane" << endl; … … 394 394 cout << Verbose(0) << "INPUT: "; 395 395 cin >> choice; 396 396 397 397 switch (choice) { 398 398 default: … … 413 413 second = mol->AskAtom("Enter second atom: "); 414 414 415 n.CopyVector((const Vector *)&first->x); 416 n.SubtractVector((const Vector *)&second->x); 415 n.CopyVector((const Vector *)&first->x); 416 n.SubtractVector((const Vector *)&second->x); 417 417 n.Normalize(); 418 break; 418 break; 419 419 }; 420 420 cout << Verbose(0) << "Normal vector: "; … … 433 433 double tmp1, tmp2; 434 434 char choice; // menu choice char 435 435 436 436 cout << Verbose(0) << "===========REMOVE ATOMS=========================" << endl; 437 437 cout << Verbose(0) << " a - state atom for removal by number" << endl; … … 442 442 cout << Verbose(0) << "INPUT: "; 443 443 cin >> choice; 444 444 445 445 switch (choice) { 446 446 default: … … 475 475 mol->RemoveAtom(first); 476 476 } 477 break; 477 break; 478 478 }; 479 479 //mol->Output((ofstream *)&cout); … … 492 492 int Z; 493 493 char choice; // menu choice char 494 494 495 495 cout << Verbose(0) << "===========MEASURE ATOMS=========================" << endl; 496 496 cout << Verbose(0) << " a - calculate bond length between one atom and all others" << endl; … … 514 514 for (int i=MAX_ELEMENTS;i--;) 515 515 min[i] = 0.; 516 517 second = mol->start; 516 517 second = mol->start; 518 518 while ((second->next != mol->end)) { 519 519 second = second->next; // advance … … 526 526 } 527 527 if ((tmp1 != 0.) && ((min[Z] == 0.) || (tmp1 < min[Z]))) min[Z] = tmp1; 528 //cout << Verbose(0) << "Bond length between Atom " << first->nr << " and " << second->nr << ": " << tmp1 << " a.u." << endl; 528 //cout << Verbose(0) << "Bond length between Atom " << first->nr << " and " << second->nr << ": " << tmp1 << " a.u." << endl; 529 529 } 530 530 for (int i=MAX_ELEMENTS;i--;) 531 531 if (min[i] != 0.) cout << Verbose(0) << "Minimum Bond length between " << first->type->name << " Atom " << first->nr << " and next Ion of type " << (periode->FindElement(i))->name << ": " << min[i] << " a.u." << endl; 532 532 break; 533 533 534 534 case 'b': 535 535 first = mol->AskAtom("Enter first atom: "); … … 556 556 y.SubtractVector((const Vector *)&second->x); 557 557 cout << Verbose(0) << "Bond angle between first atom Nr." << first->nr << ", central atom Nr." << second->nr << " and last atom Nr." << third->nr << ": "; 558 cout << Verbose(0) << (acos(x.ScalarProduct((const Vector *)&y)/(y.Norm()*x.Norm()))/M_PI*180.) << " degrees" << endl; 558 cout << Verbose(0) << (acos(x.ScalarProduct((const Vector *)&y)/(y.Norm()*x.Norm()))/M_PI*180.) << " degrees" << endl; 559 559 break; 560 560 case 'd': … … 600 600 int Order1; 601 601 clock_t start, end; 602 602 603 603 cout << Verbose(0) << "Fragmenting molecule with current connection matrix ..." << endl; 604 604 cout << Verbose(0) << "What's the desired bond order: "; … … 609 609 end = clock(); 610 610 cout << Verbose(0) << "Clocks for this operation: " << (end-start) << ", time: " << ((double)(end-start)/CLOCKS_PER_SEC) << "s." << endl; 611 } else 611 } else 612 612 cout << Verbose(0) << "Connection matrix has not yet been generated!" << endl; 613 613 }; … … 623 623 atom *Walker = mol->start; 624 624 int i, comp, counter=0; 625 625 626 626 // generate some KeySets 627 627 cout << "Generating KeySets." << endl; … … 637 637 cout << "Testing insertion of already present item in KeySets." << endl; 638 638 KeySetTestPair test; 639 test = TestSets[mol->AtomCount-1].insert(Walker->nr); 639 test = TestSets[mol->AtomCount-1].insert(Walker->nr); 640 640 if (test.second) { 641 641 cout << Verbose(1) << "Insertion worked?!" << endl; … … 646 646 TestSets[mol->AtomCount].insert(mol->end->previous->previous->previous->nr); 647 647 648 // constructing Graph structure 648 // constructing Graph structure 649 649 cout << "Generating Subgraph class." << endl; 650 650 Graph Subgraphs; … … 657 657 cout << "Testing insertion of already present item in Subgraph." << endl; 658 658 GraphTestPair test2; 659 test2 = Subgraphs.insert(GraphPair (TestSets[mol->AtomCount],pair<int, double>(counter++, 1.))); 659 test2 = Subgraphs.insert(GraphPair (TestSets[mol->AtomCount],pair<int, double>(counter++, 1.))); 660 660 if (test2.second) { 661 661 cout << Verbose(1) << "Insertion worked?!" << endl; … … 663 663 cout << Verbose(1) << "Insertion rejected: Present object is " << (*(test2.first)).second.first << "." << endl; 664 664 } 665 665 666 666 // show graphs 667 667 cout << "Showing Subgraph's contents, checking that it's sorted." << endl; … … 674 674 if ((*key) > comp) 675 675 cout << (*key) << " "; 676 else 676 else 677 677 cout << (*key) << "! "; 678 678 comp = (*key); … … 716 716 else 717 717 cout << "failed." << endl; 718 718 719 719 // and save to xyz file 720 720 if (ConfigFileName != NULL) { … … 727 727 strcat(filename, ".xyz"); 728 728 output.open(filename, ios::trunc); 729 } 729 } 730 730 cout << Verbose(0) << "Saving of XYZ file "; 731 731 if (mol->MDSteps <= 1) { … … 742 742 output.close(); 743 743 output.clear(); 744 744 745 745 // and save as MPQC configuration 746 746 if (ConfigFileName != NULL) … … 753 753 else 754 754 cout << "failed." << endl; 755 755 756 756 if (!strcmp(configuration->configpath, configuration->GetDefaultPath())) { 757 757 cerr << "WARNING: config is found under different path then stated in config file::defaultpath!" << endl; … … 785 785 int argptr; 786 786 PathToDatabases = LocalPath; 787 787 788 788 if (argc > 1) { // config file specified as option 789 789 // 1. : Parse options that just set variables or print help … … 798 798 case '?': 799 799 cout << "MoleCuilder suite" << endl << "==================" << endl << endl; 800 cout << "Usage: " << argv[0] << "[config file] [-{acefpsthH?vfrp}] [further arguments]" << endl; 800 cout << "Usage: " << argv[0] << "[config file] [-{acefpsthH?vfrp}] [further arguments]" << endl; 801 801 cout << "or simply " << argv[0] << " without arguments for interactive session." << endl; 802 802 cout << "\t-a Z x1 x2 x3\tAdd new atom of element Z at coordinates (x1,x2,x3)." << endl; 803 cout << "\t-A <source>\tCreate adjacenzy list from bonds parsed from 'dbond'-style file." <<endl; 803 804 cout << "\t-b x1 x2 x3\tCenter atoms in domain with given edge lengths of (x1,x2,x3)." << endl; 804 805 cout << "\t-c x1 x2 x3\tCenter atoms in domain with a minimum distance to boundary of (x1,x2,x3)." << endl; … … 812 813 cout << "\t-m <0/1>\tCalculate (0)/ Align in(1) PAS with greatest EV along z axis." << endl; 813 814 cout << "\t-n\tFast parsing (i.e. no trajectories are looked for)." << endl; 814 cout << "\t-o \tGet volume of the convex envelope (and store to tecplot file)." << endl;815 cout << "\t-o <out>\tGet volume of the convex envelope (and store to tecplot file)." << endl; 815 816 cout << "\t-p <file>\tParse given xyz file and create raw config file from it." << endl; 816 817 cout << "\t-P <file>\tParse given forces file and append as an MD step to config file via Verlet." << endl; 817 818 cout << "\t-r\t\tConvert file from an old pcp syntax." << endl; 818 819 cout << "\t-t x1 x2 x3\tTranslate all atoms by this vector (x1,x2,x3)." << endl; 819 cout << "\t-T <file> Store temperatures from the config file in <file>." << endl; 820 cout << "\t-T <file> Store temperatures from the config file in <file>." << endl; 820 821 cout << "\t-s x1 x2 x3\tScale all atom coordinates by this vector (x1,x2,x3)." << endl; 821 cout << "\t-u rho\tsuspend in water solution and output necessary cell lengths, average density rho and repetition." << endl; 822 cout << "\t-u rho\tsuspend in water solution and output necessary cell lengths, average density rho and repetition." << endl; 822 823 cout << "\t-v/-V\t\tGives version information." << endl; 823 824 cout << "Note: config files must not begin with '-' !" << endl; … … 854 855 argptr++; 855 856 } while (argptr < argc); 856 857 857 858 // 2. Parse the element database 858 859 if (periode->LoadPeriodentafel(PathToDatabases)) { … … 863 864 return 1; 864 865 } 865 866 866 867 // 3. Find config file name and parse if possible 867 868 if (argv[1][0] != '-') { … … 902 903 } else 903 904 config_present = absent; 904 905 905 906 // 4. parse again through options, now for those depending on elements db and config presence 906 907 argptr = 1; … … 946 947 config_present = present; 947 948 } else 948 cerr << Verbose(1) << "Could not find the specified element." << endl; 949 cerr << Verbose(1) << "Could not find the specified element." << endl; 949 950 argptr+=4; 950 951 } … … 956 957 if (config_present == present) { 957 958 switch(argv[argptr-1][1]) { 958 case 'D': 959 case 'D': 959 960 ExitFlag = 1; 960 961 { … … 1002 1003 } 1003 1004 break; 1005 case 'A': 1006 ExitFlag = 1; 1007 if ((argptr >= argc) || (argv[argptr][0] == '-')){ 1008 ExitFlag =255; 1009 cerr << "Missing source file for bonds in molecule: -A <bond sourcefile>" << endl; 1010 } 1011 else{ 1012 cout << "Parsing bonds from " << argv[argptr] << "." << endl; 1013 ifstream *input = new ifstream(argv[argptr]); 1014 mol->CreateAdjacencyList2((ofstream *)&cout, input); 1015 input->close(); 1016 } 1017 break; 1004 1018 case 'T': 1005 1019 ExitFlag = 1; … … 1168 1182 case 'o': 1169 1183 ExitFlag = 1; 1170 if ((argptr >= argc) || (argv[argptr][0] == '-')) 1184 if ((argptr >= argc) || (argv[argptr][0] == '-')){ 1171 1185 ExitFlag = 255; 1172 1186 cerr << "Not enough or invalid arguments given for convex envelope: -o <tecplot output file>" << endl; 1173 1187 } else { 1174 1188 cout << Verbose(0) << "Evaluating volume of the convex envelope."; 1189 ofstream *output = new ofstream(argv[argptr], ios::trunc); 1190 //$$$ 1175 1191 cout << Verbose(1) << "Storing tecplot data in " << argv[argptr] << "." << endl; 1176 ofstream *output = new ofstream(argv[argptr], ios::trunc);1177 1192 VolumeOfConvexEnvelope((ofstream *)&cout, output, &configuration, NULL, mol); 1178 1193 output->close(); … … 1269 1284 mol->Translate(&x); 1270 1285 } 1271 mol->cell_size[(abs(axis) == 2) ? 2 : ((abs(axis) == 3) ? 5 : 0)] *= faktor; 1286 mol->cell_size[(abs(axis) == 2) ? 2 : ((abs(axis) == 3) ? 5 : 0)] *= faktor; 1272 1287 } 1273 1288 } … … 1332 1347 if (j == 1) return 0; // just for -v and -h options 1333 1348 if (j) return j; // something went wrong 1334 1349 1335 1350 // General stuff 1336 1351 if (mol->cell_size[0] == 0.) { … … 1346 1361 // now the main construction loop 1347 1362 cout << Verbose(0) << endl << "Now comes the real construction..." << endl; 1348 do { 1363 do { 1349 1364 cout << Verbose(0) << endl << endl; 1350 1365 cout << Verbose(0) << "============Element list=======================" << endl; … … 1365 1380 cout << Verbose(0) << "-----------------------------------------------" << endl; 1366 1381 cout << Verbose(0) << "d - duplicate molecule/periodic cell" << endl; 1367 cout << Verbose(0) << "i - realign molecule" << endl; 1368 cout << Verbose(0) << "m - mirror all molecules" << endl; 1382 cout << Verbose(0) << "i - realign molecule" << endl; 1383 cout << Verbose(0) << "m - mirror all molecules" << endl; 1369 1384 cout << Verbose(0) << "t - translate molecule by vector" << endl; 1370 1385 cout << Verbose(0) << "c - scale by unit transformation" << endl; … … 1377 1392 cout << Verbose(0) << "Input: "; 1378 1393 cin >> choice; 1379 1394 1380 1395 switch (choice) { 1381 1396 default: 1382 1397 case 'a': // add atom 1383 1398 AddAtoms(periode, mol); 1384 choice = 'a'; 1385 break; 1386 1399 choice = 'a'; 1400 break; 1401 1387 1402 case 'b': // scale a bond 1388 1403 cout << Verbose(0) << "Scaling bond length between two atoms." << endl; … … 1400 1415 } 1401 1416 //cout << Verbose(0) << "New coordinates of Atom " << second->nr << " are: "; 1402 //second->Output(second->type->No, 1, (ofstream *)&cout); 1403 break; 1404 1405 case 'c': // unit scaling of the metric 1417 //second->Output(second->type->No, 1, (ofstream *)&cout); 1418 break; 1419 1420 case 'c': // unit scaling of the metric 1406 1421 cout << Verbose(0) << "Angstroem -> Bohrradius: 1.8897261\t\tBohrradius -> Angstroem: 0.52917721" << endl; 1407 1422 cout << Verbose(0) << "Enter three factors: "; … … 1414 1429 delete[](factor); 1415 1430 break; 1416 1431 1417 1432 case 'd': // duplicate the periodic cell along a given axis, given times 1418 1433 cout << Verbose(0) << "State the axis [(+-)123]: "; … … 1420 1435 cout << Verbose(0) << "State the factor: "; 1421 1436 cin >> faktor; 1422 1437 1423 1438 mol->CountAtoms((ofstream *)&cout); // recount atoms 1424 1439 if (mol->AtomCount != 0) { // if there is more than none … … 1461 1476 mol->Translate(&x); 1462 1477 } 1463 mol->cell_size[(abs(axis) == 2) ? 2 : ((abs(axis) == 3) ? 5 : 0)] *= faktor; 1478 mol->cell_size[(abs(axis) == 2) ? 2 : ((abs(axis) == 3) ? 5 : 0)] *= faktor; 1464 1479 } 1465 1480 break; 1466 1481 1467 1482 case 'e': // edit each field of the configuration 1468 1483 configuration.Edit(mol); 1469 1484 break; 1470 1485 1471 1486 case 'f': 1472 1487 FragmentAtoms(mol, &configuration); 1473 1488 break; 1474 1489 1475 1490 case 'g': // center the atoms 1476 1491 CenterAtoms(mol); 1477 1492 break; 1478 1479 case 'i': // align all atoms 1493 1494 case 'i': // align all atoms 1480 1495 AlignAtoms(periode, mol); 1481 1496 break; … … 1488 1503 MirrorAtoms(mol); 1489 1504 break; 1490 1505 1491 1506 case 'o': // create the connection matrix 1492 1507 { … … 1509 1524 } 1510 1525 break; 1511 1526 1512 1527 case 'p': // parse and XYZ file 1513 1528 cout << Verbose(0) << "Format should be XYZ with: ShorthandOfElement\tX\tY\tZ" << endl; … … 1518 1533 break; 1519 1534 1520 case 'q': // quit 1521 break; 1522 1535 case 'q': // quit 1536 break; 1537 1523 1538 case 'r': // remove atom 1524 RemoveAtoms(mol); 1525 break; 1526 1539 RemoveAtoms(mol); 1540 break; 1541 1527 1542 case 's': // save to config file 1528 1543 SaveConfig(ConfigFileName, &configuration, periode, mol); … … 1530 1545 1531 1546 case 't': // translate all atoms 1532 cout << Verbose(0) << "Enter translation vector." << endl; 1547 cout << Verbose(0) << "Enter translation vector." << endl; 1533 1548 x.AskPosition(mol->cell_size,0); 1534 1549 mol->Translate((const Vector *)&x); 1535 1550 break; 1536 1551 1537 1552 case 'T': 1538 1553 testroutine(mol); 1539 1554 break; 1540 1555 1541 1556 case 'u': // change an atom's element 1542 1557 first = NULL; … … 1545 1560 cin >> Z; 1546 1561 } while ((first = mol->FindAtom(Z)) == NULL); 1547 cout << Verbose(0) << "New element by atomic number Z: "; 1562 cout << Verbose(0) << "New element by atomic number Z: "; 1548 1563 cin >> Z; 1549 1564 first->type = periode->FindElement(Z); 1550 cout << Verbose(0) << "Atom " << first->nr << "'s element is " << first->type->name << "." << endl; 1565 cout << Verbose(0) << "Atom " << first->nr << "'s element is " << first->type->name << "." << endl; 1551 1566 break; 1552 1567 }; 1553 1568 } while (choice != 'q'); 1554 1569 1555 1570 // save element data base 1556 1571 if (periode->StorePeriodentafel(ElementsFileName)) //ElementsFileName
Note:
See TracChangeset
for help on using the changeset viewer.