Changeset 1024cb for src/boundary.cpp
- Timestamp:
- May 31, 2010, 5:32:27 PM (15 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:
- e08c46
- Parents:
- 42af9e (diff), a7b761b (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the(diff)
links above to see all the changes relative to each parent. - git-author:
- Frederik Heber <heber@…> (05/31/10 17:29:30)
- git-committer:
- Frederik Heber <heber@…> (05/31/10 17:32:27)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/boundary.cpp
r42af9e r1024cb 139 139 { 140 140 Info FunctionInfo(__func__); 141 atom *Walker = NULL;142 141 PointMap PointsOnBoundary; 143 142 LineMap LinesOnBoundary; … … 165 164 166 165 // 3b. construct set of all points, transformed into cylindrical system and with left and right neighbours 167 Walker = mol->start; 168 while (Walker->next != mol->end) { 169 Walker = Walker->next; 170 ProjectedVector = Walker->x - (*MolCenter); 166 for (molecule::const_iterator iter = mol->begin(); iter != mol->end(); ++iter) { 167 ProjectedVector = (*iter)->x - (*MolCenter); 171 168 ProjectedVector.ProjectOntoPlane(AxisVector); 172 169 … … 182 179 angle = 2. * M_PI - angle; 183 180 } 184 DoLog(1) && (Log() << Verbose(1) << "Inserting " << *Walker << ": (r, alpha) = (" << radius << "," << angle << "): " << ProjectedVector << endl);185 BoundaryTestPair = BoundaryPoints[axis].insert(BoundariesPair(angle, DistancePair (radius, Walker)));181 DoLog(1) && (Log() << Verbose(1) << "Inserting " << **iter << ": (r, alpha) = (" << radius << "," << angle << "): " << ProjectedVector << endl); 182 BoundaryTestPair = BoundaryPoints[axis].insert(BoundariesPair(angle, DistancePair (radius, (*iter)))); 186 183 if (!BoundaryTestPair.second) { // same point exists, check first r, then distance of original vectors to center of gravity 187 184 DoLog(2) && (Log() << Verbose(2) << "Encountered two vectors whose projection onto axis " << axis << " is equal: " << endl); 188 185 DoLog(2) && (Log() << Verbose(2) << "Present vector: " << *BoundaryTestPair.first->second.second << endl); 189 DoLog(2) && (Log() << Verbose(2) << "New vector: " << * Walker << endl);186 DoLog(2) && (Log() << Verbose(2) << "New vector: " << **iter << endl); 190 187 const double ProjectedVectorNorm = ProjectedVector.NormSquared(); 191 188 if ((ProjectedVectorNorm - BoundaryTestPair.first->second.first) > MYEPSILON) { 192 189 BoundaryTestPair.first->second.first = ProjectedVectorNorm; 193 BoundaryTestPair.first->second.second = Walker;190 BoundaryTestPair.first->second.second = (*iter); 194 191 DoLog(2) && (Log() << Verbose(2) << "Keeping new vector due to larger projected distance " << ProjectedVectorNorm << "." << endl); 195 192 } else if (fabs(ProjectedVectorNorm - BoundaryTestPair.first->second.first) < MYEPSILON) { 196 helper = Walker->x - (*MolCenter); 193 helper = (*iter)->x; 194 helper -= *MolCenter; 197 195 const double oldhelperNorm = helper.NormSquared(); 198 196 helper = BoundaryTestPair.first->second.second->x - (*MolCenter); 199 197 if (helper.NormSquared() < oldhelperNorm) { 200 BoundaryTestPair.first->second.second = Walker;198 BoundaryTestPair.first->second.second = (*iter); 201 199 DoLog(2) && (Log() << Verbose(2) << "Keeping new vector due to larger distance to molecule center " << helper.NormSquared() << "." << endl); 202 200 } else { … … 620 618 for (TriangleMap::iterator runner = TesselStruct->TrianglesOnBoundary.begin(); runner != TesselStruct->TrianglesOnBoundary.end(); runner++) 621 619 { // go through every triangle, calculate volume of its pyramid with CoG as peak 622 x = (*runner->second->endpoints[0]->node->node) - (*runner->second->endpoints[1]->node->node);623 y = (*runner->second->endpoints[0]->node->node) - (*runner->second->endpoints[2]->node->node);624 const double a = sqrt(runner->second->endpoints[0]->node->node->DistanceSquared(*runner->second->endpoints[1]->node->node));625 const double b = sqrt(runner->second->endpoints[0]->node->node->DistanceSquared(*runner->second->endpoints[2]->node->node));626 const double c = sqrt(runner->second->endpoints[2]->node->node->DistanceSquared(*runner->second->endpoints[1]->node->node));620 x = runner->second->getEndpoint(0) - runner->second->getEndpoint(1); 621 y = runner->second->getEndpoint(0) - runner->second->getEndpoint(2); 622 const double a = x.Norm(); 623 const double b = y.Norm(); 624 const double c = runner->second->getEndpoint(2).distance(runner->second->getEndpoint(1)); 627 625 const double G = sqrt(((a + b + c) * (a + b + c) - 2 * (a * a + b * b + c * c)) / 16.); // area of tesselated triangle 628 x = Plane(*(runner->second->endpoints[0]->node->node), 629 *(runner->second->endpoints[1]->node->node), 630 *(runner->second->endpoints[2]->node->node)).getNormal(); 631 x.Scale(runner->second->endpoints[1]->node->node->ScalarProduct(x)); 626 x = runner->second->getPlane().getNormal(); 627 x.Scale(runner->second->getEndpoint(1).ScalarProduct(x)); 632 628 const double h = x.Norm(); // distance of CoG to triangle 633 629 const double PyramidVolume = (1. / 3.) * G * h; // this formula holds for _all_ pyramids (independent of n-edge base or (not) centered peak) … … 697 693 int repetition[NDIM] = { 1, 1, 1 }; 698 694 int TotalNoClusters = 1; 699 atom *Walker = NULL;700 695 double totalmass = 0.; 701 696 double clustervolume = 0.; … … 721 716 722 717 // sum up the atomic masses 723 Walker = mol->start; 724 while (Walker->next != mol->end) { 725 Walker = Walker->next; 726 totalmass += Walker->type->mass; 718 for (molecule::const_iterator iter = mol->begin(); iter != mol->end(); ++iter) { 719 totalmass += (*iter)->type->mass; 727 720 } 728 721 DoLog(0) && (Log() << Verbose(0) << "RESULT: The summed mass is " << setprecision(10) << totalmass << " atomicmassunit." << endl); … … 806 799 Vector Inserter; 807 800 double FillIt = false; 808 atom *Walker = NULL;809 801 bond *Binder = NULL; 810 802 double phi[NDIM]; … … 813 805 814 806 for (MoleculeList::iterator ListRunner = List->ListOfMolecules.begin(); ListRunner != List->ListOfMolecules.end(); ListRunner++) 815 if ((*ListRunner)-> AtomCount> 0) {807 if ((*ListRunner)->getAtomCount() > 0) { 816 808 DoLog(1) && (Log() << Verbose(1) << "Pre-creating linked cell lists for molecule " << *ListRunner << "." << endl); 817 809 LCList[(*ListRunner)] = new LinkedCell((*ListRunner), 10.); // get linked cell list … … 831 823 } 832 824 833 filler->CountAtoms(); 834 atom * CopyAtoms[filler->AtomCount]; 825 atom * CopyAtoms[filler->getAtomCount()]; 835 826 836 827 // calculate filler grid in [0,1]^3 … … 857 848 858 849 // go through all atoms 859 for (int i=0;i<filler-> AtomCount;i++)850 for (int i=0;i<filler->getAtomCount();i++) 860 851 CopyAtoms[i] = NULL; 861 Walker = filler->start; 862 while (Walker->next != filler->end) { 863 Walker = Walker->next; 852 for(molecule::iterator iter = filler->begin(); iter !=filler->end();++filler){ 864 853 865 854 // create atomic random translation vector ... … … 885 874 886 875 // ... and put at new position 887 Inserter = Walker->x;876 Inserter = (*iter)->x; 888 877 if (DoRandomRotation) 889 878 Inserter.MatrixMultiplication(Rotations); … … 909 898 DoLog(1) && (Log() << Verbose(1) << "INFO: Position at " << Inserter << " is outer point." << endl); 910 899 // copy atom ... 911 CopyAtoms[ Walker->nr] = Walker->clone();912 CopyAtoms[ Walker->nr]->x = Inserter;913 Filling->AddAtom(CopyAtoms[ Walker->nr]);914 DoLog(4) && (Log() << Verbose(4) << "Filling atom " << * Walker << ", translated to " << AtomTranslations << ", at final position is " << (CopyAtoms[Walker->nr]->x) << "." << endl);900 CopyAtoms[(*iter)->nr] = (*iter)->clone(); 901 CopyAtoms[(*iter)->nr]->x = Inserter; 902 Filling->AddAtom(CopyAtoms[(*iter)->nr]); 903 DoLog(4) && (Log() << Verbose(4) << "Filling atom " << **iter << ", translated to " << AtomTranslations << ", at final position is " << (CopyAtoms[(*iter)->nr]->x) << "." << endl); 915 904 } else { 916 905 DoLog(1) && (Log() << Verbose(1) << "INFO: Position at " << Inserter << " is inner point, within boundary or outside of MaxDistance." << endl); 917 CopyAtoms[ Walker->nr] = NULL;906 CopyAtoms[(*iter)->nr] = NULL; 918 907 continue; 919 908 } … … 954 943 bool TesselationFailFlag = false; 955 944 945 mol->getAtomCount(); 946 956 947 if (TesselStruct == NULL) { 957 948 DoLog(1) && (Log() << Verbose(1) << "Allocating Tesselation struct ..." << endl); … … 1025 1016 // // look whether all points are inside of the convex envelope, otherwise add them via degenerated triangles 1026 1017 // //->InsertStraddlingPoints(mol, LCList); 1027 // mol->GoToFirst();1018 // for (molecule::const_iterator iter = mol->begin(); iter != mol->end(); ++iter) { 1028 1019 // class TesselPoint *Runner = NULL; 1029 // while (!mol->IsEnd()) { 1030 // Runner = mol->GetPoint(); 1020 // Runner = *iter; 1031 1021 // Log() << Verbose(1) << "Checking on " << Runner->Name << " ... " << endl; 1032 1022 // if (!->IsInnerPoint(Runner, LCList)) { … … 1036 1026 // Log() << Verbose(2) << Runner->Name << " is inside of or on envelope." << endl; 1037 1027 // } 1038 // mol->GoToNext();1039 1028 // } 1040 1029 … … 1045 1034 status = CheckListOfBaselines(TesselStruct); 1046 1035 1036 cout << "before correction" << endl; 1037 1047 1038 // store before correction 1048 StoreTrianglesinFile(mol, (const Tesselation *&)TesselStruct, filename, "");1039 StoreTrianglesinFile(mol, TesselStruct, filename, ""); 1049 1040 1050 1041 // // correct degenerated polygons … … 1056 1047 // write final envelope 1057 1048 CalculateConcavityPerBoundaryPoint(TesselStruct); 1058 StoreTrianglesinFile(mol, (const Tesselation *&)TesselStruct, filename, ""); 1049 cout << "after correction" << endl; 1050 StoreTrianglesinFile(mol, TesselStruct, filename, ""); 1059 1051 1060 1052 if (freeLC)
Note:
See TracChangeset
for help on using the changeset viewer.