Changeset 10af0d


Ignore:
Timestamp:
Dec 17, 2008, 3:56:07 PM (16 years ago)
Author:
Christian Neuen <neuen@…>
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:
e9fa06f
Parents:
e4ea46
Message:

Solved possible problem with Second quadrant overhaul

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/boundary.cpp

    re4ea46 r10af0d  
    14441444  /* OldNormal is normal vector on the old triangle
    14451445   * d1 is normal on the triangle line, from which we come, as well as on OldNormal.
    1446    * Chord points from a to b.
     1446   * Chord points from b to a!!!
    14471447   */
    14481448  Vector dif_a; //Vector from a to candidate
     
    14951495
    14961496      Umkreisradius = SideA / 2.0 / sin(alpha);
    1497       cout << Umkreisradius << endl;
    1498       cout << SideB / 2.0 / sin(beta) << endl;
    1499       cout << SideC / 2.0 / sin(gamma) << endl;
     1497      //cout << Umkreisradius << endl;
     1498      //cout << SideB / 2.0 / sin(beta) << endl;
     1499      //cout << SideC / 2.0 / sin(gamma) << endl;
    15001500
    15011501      if (Umkreisradius < RADIUS)
     
    15101510          Umkreismittelpunkt.Scale(1/(sin(2*alpha) + sin(2*beta) + sin(2*gamma)));
    15111511
    1512           cout << "Umkreismittelpunkt has coordinates" << Umkreismittelpunkt.x[0] << " "<< Umkreismittelpunkt.x[1] <<" "<<Umkreismittelpunkt.x[2] << endl;
    1513           cout << "Candidate has coordinates" << Candidate->x.x[0]<< " " << Candidate->x.x[1] << " " << Candidate->x.x[2] << endl;
    1514           cout << "a has coordinates" << a->x.x[0]<< " " << a->x.x[1] << " " << a->x.x[2] << endl;
    1515           cout << "b has coordinates" << b->x.x[0]<< " " << b->x.x[1] << " " << b->x.x[2] << endl;
    15161512
    15171513          TempNormal.CopyVector(&dif_a);
     
    15231519          TempNormal.Normalize();
    15241520          Restradius = sqrt(RADIUS*RADIUS - Umkreisradius*Umkreisradius);
    1525           cout << "Umkreisradius ist " << Umkreisradius << endl;
    1526           cout << "Restradius ist " << Restradius << endl;
     1521
    15271522          TempNormal.Scale(Restradius);
    1528           cout << "TempNormal has coordinates " << TempNormal.x[0] << " " << TempNormal.x[1] << " " << TempNormal.x[2] << " " << endl;
     1523
    15291524          Mittelpunkt.CopyVector(&Umkreismittelpunkt);
    15301525          Mittelpunkt.AddVector(&TempNormal);  //this is center of sphere supported by a, b and Candidate
    1531           cout << "Mittelpunkt has coordinates" << Mittelpunkt.x[0] << " " << Mittelpunkt.x[1]<< " "  <<Mittelpunkt.x[2] << endl;
    1532           cout << "Dist a to UmkreisMittelpunkt " << a->x.Distance(&Umkreismittelpunkt) << endl;
    1533           cout << "Dist b to UmkreisMittelpunkt " << b->x.Distance(&Umkreismittelpunkt) << endl;
    1534           cout << "Dist Candidate to UmkreisMittelpunkt " << Candidate->x.Distance(&Umkreismittelpunkt) << endl;
    1535           cout << "Dist a to Mittelpunkt " << a->x.Distance(&Mittelpunkt) << endl;
    1536           cout << "Dist b to Mittelpunkt " << b->x.Distance(&Mittelpunkt) << endl;
    1537           cout << "Dist Candidate to Mittelpunkt " << Candidate->x.Distance(&Mittelpunkt) << endl;
     1526
     1527
    15381528
    15391529          if (Storage[0]< -1.5) // first Candidate at all
     
    15471537              cout << "Angle is " << Storage[1] << ", Halbraum ist "
    15481538                  << Storage[0] << endl;
     1539
     1540
    15491541            }
    15501542          else
     
    15541546
    15551547              Distance = Opt_Candidate->x.Distance(&Mittelpunkt);
    1556               cout << "Opt_Candidate " << Opt_Candidate << " has distance " << Distance << " to Center of Candidate " << endl;
     1548              //cout << "Opt_Candidate " << Opt_Candidate << " has distance " << Distance << " to Center of Candidate " << endl;
    15571549
    15581550
    15591551              if (Distance >RADIUS) // We have no interference and may now check whether the new point is better.
    15601552                {
    1561                   cout << "Atom " << Candidate << " has distance " << Candidate->x.Distance(Opt_Mittelpunkt) << " to Center of Candidate " << endl;
    1562 
    1563                   if ((Storage[0] < 0 && fabs(sign - Storage[0]) > CurrentEpsilon))// || //This will give absolute preference to those in "right-hand" quadrants
    1564                       //sqrt(Candidate->x.Distance(Opt_Mittelpunkt)) < RADIUS)    //and those where Candidate would be within old Sphere.
     1553                  //cout << "Atom " << Candidate << " has distance " << Candidate->x.Distance(Opt_Mittelpunkt) << " to Center of Candidate " << endl;
     1554
     1555                  if (((Storage[0] < 0 && fabs(sign - Storage[0]) > CurrentEpsilon)) || //This will give absolute preference to those in "right-hand" quadrants
     1556                      (Candidate->x.Distance(Opt_Mittelpunkt) < RADIUS))    //and those where Candidate would be within old Sphere.
    15651557                    {
    15661558                      cout << "Next better candidate is " << *Candidate << " with ";
     
    15711563                      cout << "Angle is " << Storage[1] << ", Halbraum ist "
    15721564                          << Storage[0] << endl;
     1565/*
     1566                      cout << "Umkreismittelpunkt has coordinates" << Umkreismittelpunkt.x[0] << " "<< Umkreismittelpunkt.x[1] <<" "<<Umkreismittelpunkt.x[2] << endl;
     1567                                    cout << "Candidate has coordinates" << Candidate->x.x[0]<< " " << Candidate->x.x[1] << " " << Candidate->x.x[2] << endl;
     1568                                    cout << "a has coordinates" << a->x.x[0]<< " " << a->x.x[1] << " " << a->x.x[2] << endl;
     1569                                    cout << "b has coordinates" << b->x.x[0]<< " " << b->x.x[1] << " " << b->x.x[2] << endl;
     1570                                    cout << "Mittelpunkt has coordinates" << Mittelpunkt.x[0] << " " << Mittelpunkt.x[1]<< " "  <<Mittelpunkt.x[2] << endl;
     1571                                    cout << "Umkreisradius ist " << Umkreisradius << endl;
     1572                                    cout << "Restradius ist " << Restradius << endl;
     1573                                    cout << "TempNormal has coordinates " << TempNormal.x[0] << " " << TempNormal.x[1] << " " << TempNormal.x[2] << " " << endl;
     1574                                    cout << "OldNormal has coordinates " << OldNormal->x[0] << " " << OldNormal->x[1] << " " << OldNormal->x[2] << " " << endl;
     1575                                    cout << "Dist a to UmkreisMittelpunkt " << a->x.Distance(&Umkreismittelpunkt) << endl;
     1576                                    cout << "Dist b to UmkreisMittelpunkt " << b->x.Distance(&Umkreismittelpunkt) << endl;
     1577                                    cout << "Dist Candidate to UmkreisMittelpunkt " << Candidate->x.Distance(&Umkreismittelpunkt) << endl;
     1578                                    cout << "Dist a to Mittelpunkt " << a->x.Distance(&Mittelpunkt) << endl;
     1579                                    cout << "Dist b to Mittelpunkt " << b->x.Distance(&Mittelpunkt) << endl;
     1580                                    cout << "Dist Candidate to Mittelpunkt " << Candidate->x.Distance(&Mittelpunkt) << endl;
     1581                                    */
     1582
    15731583                    }
    15741584                  else
     
    15921602              else
    15931603                {
    1594                   if (DEBUG)
    1595                     cout << "Looses to better candidate" << endl;
     1604                  if (sign>0 && AngleCheck.Angle(OldNormal)>0 && Storage[0]<0)
     1605                    {
     1606                      cout << "Next better candidate is " << *Candidate << " with ";
     1607                      Opt_Candidate = Candidate;
     1608                      Storage[0] = sign;
     1609                      Storage[1] = AngleCheck.Angle(OldNormal);
     1610                      Opt_Mittelpunkt->CopyVector(&Mittelpunkt);
     1611                      cout << "Angle is " << Storage[1] << ", Halbraum ist "
     1612                      << Storage[0] << endl;
     1613
     1614/*
     1615                      cout << "Umkreismittelpunkt has coordinates" << Umkreismittelpunkt.x[0] << " "<< Umkreismittelpunkt.x[1] <<" "<<Umkreismittelpunkt.x[2] << endl;
     1616                                    cout << "Candidate has coordinates" << Candidate->x.x[0]<< " " << Candidate->x.x[1] << " " << Candidate->x.x[2] << endl;
     1617                                    cout << "a has coordinates" << a->x.x[0]<< " " << a->x.x[1] << " " << a->x.x[2] << endl;
     1618                                    cout << "b has coordinates" << b->x.x[0]<< " " << b->x.x[1] << " " << b->x.x[2] << endl;
     1619                                    cout << "Mittelpunkt has coordinates" << Mittelpunkt.x[0] << " " << Mittelpunkt.x[1]<< " "  <<Mittelpunkt.x[2] << endl;
     1620                                    cout << "Umkreisradius ist " << Umkreisradius << endl;
     1621                                    cout << "Restradius ist " << Restradius << endl;
     1622                                    cout << "TempNormal has coordinates " << TempNormal.x[0] << " " << TempNormal.x[1] << " " << TempNormal.x[2] << " " << endl;
     1623                                    cout << "OldNormal has coordinates " << OldNormal->x[0] << " " << OldNormal->x[1] << " " << OldNormal->x[2] << " " << endl;
     1624                                    cout << "Dist a to UmkreisMittelpunkt " << a->x.Distance(&Umkreismittelpunkt) << endl;
     1625                                    cout << "Dist b to UmkreisMittelpunkt " << b->x.Distance(&Umkreismittelpunkt) << endl;
     1626                                    cout << "Dist Candidate to UmkreisMittelpunkt " << Candidate->x.Distance(&Umkreismittelpunkt) << endl;
     1627                                    cout << "Dist a to Mittelpunkt " << a->x.Distance(&Mittelpunkt) << endl;
     1628                                    cout << "Dist b to Mittelpunkt " << b->x.Distance(&Mittelpunkt) << endl;
     1629                                    cout << "Dist Candidate to Mittelpunkt " << Candidate->x.Distance(&Mittelpunkt) << endl;
     1630                                    */
     1631
     1632
     1633                    }
     1634                  else
     1635                    {
     1636                      if (DEBUG)
     1637                        cout << "Looses to better candidate" << endl;
     1638                    }
    15961639                }
    15971640            }
     
    16121655    }
    16131656
    1614   if (RecursionLevel < 7) // Five is the recursion level threshold.
     1657  if (RecursionLevel < 9) // Five is the recursion level threshold.
    16151658    {
    16161659      for (int i = 0; i < mol->NumberOfBondsPerAtom[Candidate->nr]; i++) // go through all bond
     
    16851728  Chord.SubtractVector(&(Line.endpoints[1]->node->x));
    16861729
    1687   cout << Verbose(1) << "Looking for third point candidates for triangle ... "
    1688       << endl;
     1730  cout << Verbose(1) << "Looking for third point candidates for triangle ... " << endl;
     1731
    16891732  Find_next_suitable_point(Line.endpoints[0]->node, Line.endpoints[1]->node,
    16901733      Line.endpoints[0]->node, Line.endpoints[1]->node, 0, &Chord, &direction1,
     
    16931736      Line.endpoints[1]->node, Line.endpoints[0]->node, 0, &Chord, &direction1,
    16941737      &(T.NormalVector), Opt_Candidate, &Opt_Mittelpunkt, Storage, RADIUS, mol);
     1738
    16951739
    16961740  if ((TrianglesOnBoundaryCount % 10) == 0)
     
    17041748  }
    17051749
    1706   if ((Opt_Candidate == NULL) || (N<12))
     1750  if (TrianglesOnBoundaryCount >1000 )
    17071751    {
    17081752      cout << Verbose(1)
    17091753          << "No new Atom found, triangle construction will crash" << endl;
    17101754      write_tecplot_file(out, tecplot, this, mol, TriangleFilesWritten);
    1711       Find_next_suitable_point(Line.endpoints[0]->node,
    1712           Line.endpoints[1]->node, Line.endpoints[0]->node,
    1713           Line.endpoints[1]->node, 0, &Chord, &direction1, &(T.NormalVector),
    1714           Opt_Candidate, &Opt_Mittelpunkt, Storage, RADIUS, mol);
    1715       Find_next_suitable_point(Line.endpoints[0]->node,
    1716           Line.endpoints[1]->node, Line.endpoints[1]->node,
    1717           Line.endpoints[0]->node, 0, &Chord, &direction1, &(T.NormalVector),
    1718           Opt_Candidate, &Opt_Mittelpunkt, Storage, RADIUS, mol);
     1755      cout << "This is currently added candidate" << Opt_Candidate << endl;
    17191756    }
    17201757  // Konstruiere nun neues Dreieck am Ende der Liste der Dreiecke
     
    17331770  AddTriangleToLines();
    17341771  cout << "New triangle with " << *BTS << endl;
    1735 
    1736   cout << Verbose(1) << "Constructing normal vector for this triangle ... "
    1737       << endl;
     1772  cout << "We have "<< TrianglesOnBoundaryCount << endl;
     1773  cout << Verbose(1) << "Constructing normal vector for this triangle ... " << endl;
    17381774
    17391775  BTS->GetNormalVector(BTS->NormalVector);
    17401776
    1741   if ((BTS->NormalVector.ScalarProduct(&(T.NormalVector)) < 0 && Storage[0] > 0)
    1742       || ((BTS->NormalVector.ScalarProduct(&(T.NormalVector)) > 0 && Storage[0]
    1743           < 0)))
     1777  if ((BTS->NormalVector.ScalarProduct(&(T.NormalVector)) < 0 && Storage[0] > 0)  ||
     1778      (BTS->NormalVector.ScalarProduct(&(T.NormalVector)) > 0 && Storage[0] < 0))
    17441779    {
    17451780      BTS->NormalVector.Scale(-1);
Note: See TracChangeset for help on using the changeset viewer.