- Timestamp:
- Dec 11, 2008, 3:23:01 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:
- e4ea46
- Parents:
- f714979
- Location:
- src
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
src/boundary.cpp
rf714979 rcaf5d6 1018 1018 }; 1019 1019 1020 1021 1022 1023 1024 1025 //==================================================================================================================== 1026 // 1027 // ab hier habe ich das verzapft. 1028 // 1029 //==================================================================================================================== 1020 void Tesselation::AddTrianglePoint(atom* Candidate, int n) 1021 { 1022 PointTestPair InsertUnique; 1023 TPS[n] = new class BoundaryPointSet(Candidate); 1024 InsertUnique = PointsOnBoundary.insert( PointPair(Candidate->nr, TPS[n]) ); 1025 if (InsertUnique.second) // if new point was not present before, increase counter 1026 { 1027 PointsOnBoundaryCount++; 1028 } 1029 else 1030 { 1031 delete TPS[n]; 1032 cout << Verbose(2) << "Atom " << *((InsertUnique.first)->second->node) << " gibt's schon in der PointMap." << endl; 1033 TPS[n] = (InsertUnique.first)->second; 1034 } 1035 }; 1036 1037 /* 1038 * Function tries to add line from current Points in BPS to BoundaryLineSet. 1039 * If succesfull it raises the line count and iserts the new line into the BLS, 1040 * if unsuccesfull, it writes the line which had been present into the BLS, deleting the new constructed one. 1041 */ 1042 1043 void Tesselation::AddTriangleLine(int n) 1044 { 1045 LineMap::iterator LineWalker; 1046 BLS[n] = new class BoundaryLineSet(BPS, BPS[1]->node->nr); 1047 if ((BPS[0]->lines.find(BPS[1]->node->nr))->second->endpoints[0] == BLS[n]->endpoints[0] 1048 and (BPS[0]->lines.find(BPS[1]->node->nr))->second->endpoints[1] == BLS[n]->endpoints[1]) 1049 //If a line is there, how do I recognize that beyond a shadow of a doubt? 1050 { 1051 delete BLS[n]; 1052 cout << Verbose(2) << "Tried to add an existing line, handled it." << endl; 1053 LineWalker = LinesOnBoundary.end(); 1054 1055 while(LineWalker->second->endpoints[0] != BLS[n]->endpoints[0] or LineWalker->second->endpoints[1] != BLS[n]->endpoints[1]) 1056 { 1057 cout << Verbose(1) << "Looking for line which already exists"<< endl; 1058 LineWalker--; 1059 } 1060 BLS[n]=LineWalker->second; 1061 } 1062 else 1063 { 1064 cout << Verbose(2) << "Adding line which has not been used before." << endl; 1065 BPS[1]->lines.insert( LinePair(BPS[0]->node->nr, BLS[n]) ); 1066 BPS[2]->lines.insert( LinePair(BPS[1]->node->nr, BLS[n]) ); 1067 1068 LinesOnBoundary.insert( LinePair(LinesOnBoundaryCount, BLS[n])); 1069 LinesOnBoundaryCount++; 1070 1071 } 1072 }; 1073 1074 /* 1075 * Function tries to add Triangle just created to Triangle and remarks if already existent (Failure of algorithm). 1076 * Furthermore it adds the triangle to all of its lines, in order to recognize those which are saturated later. 1077 */ 1078 1079 void Tesselation::AddTriangleToLines() 1080 { 1081 cout <<Verbose(1) << "Adding triangle to its lines" <<endl; 1082 int i=0; 1083 TrianglesOnBoundary.insert(TrianglePair(TrianglesOnBoundaryCount, BTS)); 1084 TrianglesOnBoundaryCount++; 1085 for (i=0; i<3; i++) 1086 { 1087 BLS[i]->AddTriangle(BTS); 1088 } 1089 }; 1090 1091 1030 1092 1031 1093 /*! … … 1039 1101 * with all neighbours of the candidate. 1040 1102 */ 1041 void Find_next_suitable_point(atom* a, atom* b, atom* Candidate, int n, Vector *Chord, Vector *d1, Vector *OldNormal, atom*& Opt_Candidate, double *Storage, const double RADIUS, molecule* mol, bool problem)1103 void Find_next_suitable_point(atom* a, atom* b, atom* Candidate, atom* Parent, int n, Vector *Chord, Vector *d1, Vector *OldNormal, atom*& Opt_Candidate, double *Storage, const double RADIUS, molecule* mol, bool problem) 1042 1104 { 1043 1105 /* OldNormal is normal vector on the old triangle … … 1108 1170 { 1109 1171 Walker = mol->ListOfBondsPerAtom[Candidate->nr][i]->GetOtherAtom(Candidate); 1110 1111 Find_next_suitable_point(a, b, Walker, n+1, Chord, d1, OldNormal, Opt_Candidate, Storage, RADIUS, mol, problem); //call function again 1172 if (Walker->nr == Parent->nr){ 1173 continue; 1174 } 1175 else{ 1176 Find_next_suitable_point(a, b, Walker, Candidate, n+1, Chord, d1, OldNormal, Opt_Candidate, Storage, RADIUS, mol, problem); //call function again 1177 } 1112 1178 } 1113 1179 } … … 1123 1189 Vector helper; 1124 1190 Vector Chord; 1125 atom* Walker;1191 //atom* Walker; 1126 1192 1127 1193 double Storage[2]; … … 1156 1222 1157 1223 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 (N>-1) 1224 Find_next_suitable_point(Line.endpoints[0]->node, Line.endpoints[1]->node, Line.endpoints[0]->node, Line.endpoints[1]->node, 0, &Chord, &direction1, &(T.NormalVector), Opt_Candidate, Storage, RADIUS, mol,0); 1225 Find_next_suitable_point(Line.endpoints[0]->node, Line.endpoints[1]->node, Line.endpoints[1]->node, Line.endpoints[0]->node, 0, &Chord, &direction1, &(T.NormalVector), Opt_Candidate, Storage, RADIUS, mol,0); 1226 1227 if (N>7) 1161 1228 { 1162 1229 cout << Verbose(1) << "No new Atom found, triangle construction will crash" << endl; 1163 1230 write_tecplot_file(out, tecplot, this, mol); 1164 1231 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 1232 Find_next_suitable_point(Line.endpoints[0]->node, Line.endpoints[1]->node, Line.endpoints[0]->node, Line.endpoints[1]->node, 0, &Chord, &direction1, &(T.NormalVector), Opt_Candidate, Storage, RADIUS, mol, 1); 1233 Find_next_suitable_point(Line.endpoints[0]->node, Line.endpoints[1]->node, Line.endpoints[1]->node, Line.endpoints[0]->node, 0, &Chord, &direction1, &(T.NormalVector), Opt_Candidate, Storage, RADIUS, mol, 1); 1167 1234 } 1168 1235 // Konstruiere nun neues Dreieck am Ende der Liste der Dreiecke … … 1170 1237 cout << Verbose(1) << "Adding exactly one Walker for reasons completely unknown to me ... " << endl; 1171 1238 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;1177 BPS[ 1] = new class BoundaryPointSet(Line.endpoints[0]->node);1178 cout << " Optimal candidate is " << *Opt_Candidate << endl;1179 BLS[0] = new class BoundaryLineSet(BPS , LinesOnBoundaryCount);1180 cout << " Optimal candidate is " << *Opt_Candidate << endl;1181 BPS[ 0] = new class BoundaryPointSet(Opt_Candidate);1182 1183 BPS[ 1] = new class BoundaryPointSet(Line.endpoints[1]->node);1184 B LS[1] = new class BoundaryLineSet(BPS , LinesOnBoundaryCount);1185 BLS[2] = new class BoundaryLineSet(Line);1239 1240 AddTrianglePoint(Opt_Candidate, 0); 1241 AddTrianglePoint(Line.endpoints[0]->node, 1); 1242 AddTrianglePoint(Line.endpoints[1]->node, 2); 1243 1244 BPS[0] = TPS[0]; 1245 BPS[1] = TPS[1]; 1246 AddTriangleLine(0); 1247 BPS[0] = TPS[0]; 1248 BPS[1] = TPS[2]; 1249 AddTriangleLine(1); 1250 BPS[0] = TPS[1]; 1251 BPS[1] = TPS[2]; 1252 AddTriangleLine(2); 1186 1253 1187 1254 BTS = new class BoundaryTriangleSet(BLS, TrianglesOnBoundaryCount); 1188 TrianglesOnBoundary.insert( TrianglePair(TrianglesOnBoundaryCount, BTS) ); 1189 TrianglesOnBoundaryCount++; 1190 1191 cout << Verbose(1) << "Checking for already present lines ... " << endl; 1192 for(int i=0; i<NDIM; i++) // sind Linien bereits vorhanden ??? 1193 { 1194 if ( (LinesOnBoundary.insert( LinePair(LinesOnBoundaryCount, BTS->lines[i]))).second); 1195 { 1196 LinesOnBoundaryCount++; 1197 } 1198 } 1255 AddTriangleToLines(); 1256 1257 1199 1258 cout << Verbose(1) << "Constructing normal vector for this triangle ... " << endl; 1200 1259 … … 1210 1269 1211 1270 1212 void Find_second_point_for_Tesselation(atom* a, atom* Candidate, int n, Vector Oben, atom*& Opt_Candidate, double Storage[2], molecule* mol, double RADIUS)1271 void Find_second_point_for_Tesselation(atom* a, atom* Candidate, atom* Parent, int n, Vector Oben, atom*& Opt_Candidate, double Storage[2], molecule* mol, double RADIUS) 1213 1272 { 1214 1273 cout << Verbose(1) << "Looking for second point of starting triangle, recursive level "<< n <<endl;; … … 1234 1293 } 1235 1294 else{ 1236 cout << Verbose(1) << "Supposedly looses to better candidate" << Opt_Candidate->nr << endl;1295 cout << Verbose(1) << "Supposedly looses to a better candidate" << Opt_Candidate->nr << endl; 1237 1296 } 1238 1297 } … … 1244 1303 { 1245 1304 Walker = mol->ListOfBondsPerAtom[Candidate->nr][i]->GetOtherAtom(Candidate); 1246 Find_second_point_for_Tesselation(a, Walker, n+1, Oben, Opt_Candidate, Storage, mol, RADIUS); 1305 if (Walker->nr == Parent->nr) 1306 continue; 1307 else 1308 Find_second_point_for_Tesselation(a, Walker, Candidate, n+1, Oben, Opt_Candidate, Storage, mol, RADIUS); 1247 1309 }; 1248 1310 }; … … 1306 1368 cout << Verbose(1) << "Number of Bonds: " << mol->NumberOfBondsPerAtom[FirstPoint->nr] << endl; 1307 1369 1308 Find_second_point_for_Tesselation(FirstPoint, mol->ListOfBondsPerAtom[FirstPoint->nr][0]->GetOtherAtom(FirstPoint), 0, Oben, Opt_Candidate, Storage, mol, RADIUS);1370 Find_second_point_for_Tesselation(FirstPoint, mol->ListOfBondsPerAtom[FirstPoint->nr][0]->GetOtherAtom(FirstPoint), FirstPoint, 0, Oben, Opt_Candidate, Storage, mol, RADIUS); 1309 1371 1310 1372 … … 1322 1384 1323 1385 cout << Verbose(1) << "Looking for third point candidates \n"; 1324 Find_next_suitable_point(FirstPoint, SecondPoint, mol->ListOfBondsPerAtom[FirstPoint->nr][0]->GetOtherAtom(FirstPoint), 0, &Chord, &helper, &Oben, Opt_Candidate, Storage, RADIUS, mol, 0);1386 Find_next_suitable_point(FirstPoint, SecondPoint, SecondPoint, FirstPoint, 0, &Chord, &helper, &Oben, Opt_Candidate, Storage, RADIUS, mol, 0); 1325 1387 1326 1388 1327 1389 //Starting Triangle is Walker, SecondPoint, Opt_Candidate 1328 1390 1329 AddPoint(FirstPoint);1330 AddPoint(SecondPoint); 1331 Add Point(Opt_Candidate);1332 1333 cout << Verbose(1) << "The found starting triangle consists of " << *FirstPoint << ", " << *SecondPoint << " and " << *Opt_Candidate << "." << endl;1334 1335 BPS[0] = new class BoundaryPointSet(FirstPoint);1336 BPS[1] = new class BoundaryPointSet(SecondPoint);1391 cout << Verbose(1) << "The found starting triangle consists of " << *FirstPoint << ", " << *SecondPoint << " and " << *Opt_Candidate << "." << endl; 1392 1393 AddTrianglePoint(FirstPoint, 0); 1394 AddTrianglePoint(SecondPoint, 1); 1395 AddTrianglePoint(Opt_Candidate, 2); 1396 1397 BPS[0] = TPS[0]; 1398 BPS[1] = TPS[1]; 1337 1399 BLS[0] = new class BoundaryLineSet(BPS , LinesOnBoundaryCount); 1338 BPS[0] = new class BoundaryPointSet(FirstPoint);1339 BPS[1] = new class BoundaryPointSet(Opt_Candidate);1400 BPS[0] = TPS[1]; 1401 BPS[1] = TPS[2]; 1340 1402 BLS[1] = new class BoundaryLineSet(BPS , LinesOnBoundaryCount); 1341 BPS[0] = new class BoundaryPointSet(Opt_Candidate);1342 BPS[1] = new class BoundaryPointSet(SecondPoint);1403 BPS[0] = TPS[0]; 1404 BPS[1] = TPS[2]; 1343 1405 BLS[2] = new class BoundaryLineSet(BPS , LinesOnBoundaryCount); 1344 1406 … … 1366 1428 int N =0; 1367 1429 struct Tesselation *Tess = new Tesselation; 1368 cout << Verbose(1) << "Entering finding ofnon convex hull. " << endl;1430 cout << Verbose(1) << "Entering search for non convex hull. " << endl; 1369 1431 cout << flush; 1370 1432 const double RADIUS =6.; -
src/boundary.hpp
rf714979 rcaf5d6 82 82 void GuessStartingTriangle(ofstream *out); 83 83 void AddPoint(atom * Walker); 84 void AddTrianglePoint(atom* Candidate, int n); 85 void AddTriangleLine(int n); 86 void AddTriangleToLines(); 84 87 void Find_starting_triangle(molecule* mol, const double RADIUS); 85 88 void Find_next_suitable_triangle(ofstream *out, ofstream *tecplot, molecule* mol, BoundaryLineSet &Line, BoundaryTriangleSet &T, const double& RADIUS, int N); … … 88 91 LineMap LinesOnBoundary; 89 92 TriangleMap TrianglesOnBoundary; 93 class BoundaryPointSet *TPS[3]; //this is a Storage for pointers to triangle points, this and BPS[2] needed due to AddLine restrictions 90 94 class BoundaryPointSet *BPS[2]; 91 95 class BoundaryLineSet *BLS[3]; -
src/molecules.cpp
rf714979 rcaf5d6 1518 1518 { 1519 1519 atom *walker = NULL; 1520 int No = 0;1520 int AtomNo = 0, ElementNo; 1521 1521 time_t now; 1522 element *runner = NULL; 1522 1523 1523 1524 now = time((time_t *)NULL); // Get the system time and put it into 'now' as 'calender time' … … 1525 1526 while (walker->next != end) { // go through every atom and count 1526 1527 walker = walker->next; 1527 No++;1528 AtomNo++; 1528 1529 } 1529 1530 if (out != NULL) { 1530 *out << No << "\n\tCreated by molecuilder on " << ctime(&now); 1531 walker = start; 1532 while (walker->next != end) { // go through every atom of this element 1533 walker = walker->next; 1534 walker->OutputXYZLine(out); 1531 *out << AtomNo << "\n\tCreated by molecuilder on " << ctime(&now); 1532 ElementNo = 0; 1533 runner = elemente->start; 1534 while (runner->next != elemente->end) { // go through every element 1535 runner = runner->next; 1536 if (ElementsInMolecule[runner->Z]) { // if this element got atoms 1537 ElementNo++; 1538 walker = start; 1539 while (walker->next != end) { // go through every atom of this element 1540 walker = walker->next; 1541 if (walker->type == runner) { // if this atom fits to element 1542 walker->OutputXYZLine(out); 1543 } 1544 } 1545 } 1535 1546 } 1536 1547 return true; … … 1716 1727 }; 1717 1728 AddBond(Walker, OtherWalker); //Add the bond between the two atoms with respective indices. 1718 BondCount++; //Increase bond count of molecule1729 1719 1730 } 1720 1731
Note:
See TracChangeset
for help on using the changeset viewer.