Changeset 620a3f


Ignore:
Timestamp:
Apr 22, 2010, 2:10:08 PM (15 years ago)
Author:
Frederik Heber <heber@…>
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:
b0a5f1
Parents:
f04f11
Message:

BUGFIX in Tesselation::FindThirdPointForTesselation() - regarding three points in a line

  • three points in a line, i.e. the baseline with the candidate on this extended line, is numerically unstable.
  • GetCenterofCircumCircle() warns already about "aum of angle"s
  • now, candidate is rejected if the distance from both baseline's endpoints to the NewPlaneCenter is not equal as it should be.
  • i.e. the error message present before has been converted into an additional check.
  • This solved problems with tesselating a CNT (6,0) with radius 1.5 which has lots of triples in a line.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/tesselation.cpp

    rf04f11 r620a3f  
    32553255                    if (radius < RADIUS * RADIUS) {
    32563256                      otherradius = CandidateLine.BaseLine->endpoints[1]->node->node->DistanceSquared(&NewPlaneCenter);
    3257                       if (fabs(radius - otherradius) > HULLEPSILON) {
    3258                         DoeLog(1) && (eLog() << Verbose(1) << "Distance to center of circumcircle is not the same from each corner of the triangle: " << fabs(radius - otherradius) << endl);
    3259                       }
    3260                       // construct both new centers
    3261                       NewSphereCenter.CopyVector(&NewPlaneCenter);
    3262                       OtherNewSphereCenter.CopyVector(&NewPlaneCenter);
    3263                       helper.CopyVector(&NewNormalVector);
    3264                       helper.Scale(sqrt(RADIUS * RADIUS - radius));
    3265                       DoLog(2) && (Log() << Verbose(2) << "INFO: Distance of NewPlaneCenter " << NewPlaneCenter << " to either NewSphereCenter is " << helper.Norm() << " of vector " << helper << " with sphere radius " << RADIUS << "." << endl);
    3266                       NewSphereCenter.AddVector(&helper);
    3267                       DoLog(2) && (Log() << Verbose(2) << "INFO: NewSphereCenter is at " << NewSphereCenter << "." << endl);
    3268                       // OtherNewSphereCenter is created by the same vector just in the other direction
    3269                       helper.Scale(-1.);
    3270                       OtherNewSphereCenter.AddVector(&helper);
    3271                       DoLog(2) && (Log() << Verbose(2) << "INFO: OtherNewSphereCenter is at " << OtherNewSphereCenter << "." << endl);
    3272 
    3273                       alpha = GetPathLengthonCircumCircle(CircleCenter, CirclePlaneNormal, CircleRadius, NewSphereCenter, OldSphereCenter, NormalVector, SearchDirection);
    3274                       Otheralpha = GetPathLengthonCircumCircle(CircleCenter, CirclePlaneNormal, CircleRadius, OtherNewSphereCenter, OldSphereCenter, NormalVector, SearchDirection);
    3275                       alpha = min(alpha, Otheralpha);
    3276 
    3277                       // if there is a better candidate, drop the current list and add the new candidate
    3278                       // otherwise ignore the new candidate and keep the list
    3279                       if (CandidateLine.ShortestAngle > (alpha - HULLEPSILON)) {
    3280                         if (fabs(alpha - Otheralpha) > MYEPSILON) {
    3281                           CandidateLine.OptCenter.CopyVector(&NewSphereCenter);
    3282                           CandidateLine.OtherOptCenter.CopyVector(&OtherNewSphereCenter);
     3257                      if (fabs(radius - otherradius) < HULLEPSILON) {
     3258                        // construct both new centers
     3259                        NewSphereCenter.CopyVector(&NewPlaneCenter);
     3260                        OtherNewSphereCenter.CopyVector(&NewPlaneCenter);
     3261                        helper.CopyVector(&NewNormalVector);
     3262                        helper.Scale(sqrt(RADIUS * RADIUS - radius));
     3263                        DoLog(2) && (Log() << Verbose(2) << "INFO: Distance of NewPlaneCenter " << NewPlaneCenter << " to either NewSphereCenter is " << helper.Norm() << " of vector " << helper << " with sphere radius " << RADIUS << "." << endl);
     3264                        NewSphereCenter.AddVector(&helper);
     3265                        DoLog(2) && (Log() << Verbose(2) << "INFO: NewSphereCenter is at " << NewSphereCenter << "." << endl);
     3266                        // OtherNewSphereCenter is created by the same vector just in the other direction
     3267                        helper.Scale(-1.);
     3268                        OtherNewSphereCenter.AddVector(&helper);
     3269                        DoLog(2) && (Log() << Verbose(2) << "INFO: OtherNewSphereCenter is at " << OtherNewSphereCenter << "." << endl);
     3270
     3271                        alpha = GetPathLengthonCircumCircle(CircleCenter, CirclePlaneNormal, CircleRadius, NewSphereCenter, OldSphereCenter, NormalVector, SearchDirection);
     3272                        Otheralpha = GetPathLengthonCircumCircle(CircleCenter, CirclePlaneNormal, CircleRadius, OtherNewSphereCenter, OldSphereCenter, NormalVector, SearchDirection);
     3273                        alpha = min(alpha, Otheralpha);
     3274
     3275                        // if there is a better candidate, drop the current list and add the new candidate
     3276                        // otherwise ignore the new candidate and keep the list
     3277                        if (CandidateLine.ShortestAngle > (alpha - HULLEPSILON)) {
     3278                          if (fabs(alpha - Otheralpha) > MYEPSILON) {
     3279                            CandidateLine.OptCenter.CopyVector(&NewSphereCenter);
     3280                            CandidateLine.OtherOptCenter.CopyVector(&OtherNewSphereCenter);
     3281                          } else {
     3282                            CandidateLine.OptCenter.CopyVector(&OtherNewSphereCenter);
     3283                            CandidateLine.OtherOptCenter.CopyVector(&NewSphereCenter);
     3284                          }
     3285                          // if there is an equal candidate, add it to the list without clearing the list
     3286                          if ((CandidateLine.ShortestAngle - HULLEPSILON) < alpha) {
     3287                            CandidateLine.pointlist.push_back(Candidate);
     3288                            DoLog(0) && (Log() << Verbose(0) << "ACCEPT: We have found an equally good candidate: " << *(Candidate) << " with " << alpha << " and circumsphere's center at " << CandidateLine.OptCenter << "." << endl);
     3289                          } else {
     3290                            // remove all candidates from the list and then the list itself
     3291                            CandidateLine.pointlist.clear();
     3292                            CandidateLine.pointlist.push_back(Candidate);
     3293                            DoLog(0) && (Log() << Verbose(0) << "ACCEPT: We have found a better candidate: " << *(Candidate) << " with " << alpha << " and circumsphere's center at " << CandidateLine.OptCenter << "." << endl);
     3294                          }
     3295                          CandidateLine.ShortestAngle = alpha;
     3296                          DoLog(0) && (Log() << Verbose(0) << "INFO: There are " << CandidateLine.pointlist.size() << " candidates in the list now." << endl);
    32833297                        } else {
    3284                           CandidateLine.OptCenter.CopyVector(&OtherNewSphereCenter);
    3285                           CandidateLine.OtherOptCenter.CopyVector(&NewSphereCenter);
     3298                          if ((Candidate != NULL) && (CandidateLine.pointlist.begin() != CandidateLine.pointlist.end())) {
     3299                            DoLog(1) && (Log() << Verbose(1) << "REJECT: Old candidate " << *(*CandidateLine.pointlist.begin()) << " with " << CandidateLine.ShortestAngle << " is better than new one " << *Candidate << " with " << alpha << " ." << endl);
     3300                          } else {
     3301                            DoLog(1) && (Log() << Verbose(1) << "REJECT: Candidate " << *Candidate << " with " << alpha << " was rejected." << endl);
     3302                          }
    32863303                        }
    3287                         // if there is an equal candidate, add it to the list without clearing the list
    3288                         if ((CandidateLine.ShortestAngle - HULLEPSILON) < alpha) {
    3289                           CandidateLine.pointlist.push_back(Candidate);
    3290                           DoLog(0) && (Log() << Verbose(0) << "ACCEPT: We have found an equally good candidate: " << *(Candidate) << " with " << alpha << " and circumsphere's center at " << CandidateLine.OptCenter << "." << endl);
    3291                         } else {
    3292                           // remove all candidates from the list and then the list itself
    3293                           CandidateLine.pointlist.clear();
    3294                           CandidateLine.pointlist.push_back(Candidate);
    3295                           DoLog(0) && (Log() << Verbose(0) << "ACCEPT: We have found a better candidate: " << *(Candidate) << " with " << alpha << " and circumsphere's center at " << CandidateLine.OptCenter << "." << endl);
    3296                         }
    3297                         CandidateLine.ShortestAngle = alpha;
    3298                         DoLog(0) && (Log() << Verbose(0) << "INFO: There are " << CandidateLine.pointlist.size() << " candidates in the list now." << endl);
    32993304                      } else {
    3300                         if ((Candidate != NULL) && (CandidateLine.pointlist.begin() != CandidateLine.pointlist.end())) {
    3301                           DoLog(1) && (Log() << Verbose(1) << "REJECT: Old candidate " << *(*CandidateLine.pointlist.begin()) << " with " << CandidateLine.ShortestAngle << " is better than new one " << *Candidate << " with " << alpha << " ." << endl);
    3302                         } else {
    3303                           DoLog(1) && (Log() << Verbose(1) << "REJECT: Candidate " << *Candidate << " with " << alpha << " was rejected." << endl);
    3304                         }
     3305                        DoLog(1) && (Log() << Verbose(1) << "REJECT: Distance to center of circumcircle is not the same from each corner of the triangle: " << fabs(radius - otherradius) << endl);
    33053306                      }
    33063307                    } else {
Note: See TracChangeset for help on using the changeset viewer.