Changeset e9fa06f
- Timestamp:
- Dec 18, 2008, 5:21:34 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:
- 7c6712
- Parents:
- 10af0d
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/boundary.cpp
r10af0d re9fa06f 1437 1437 * @param mol molecule structure with atoms and bonds 1438 1438 */ 1439 void 1440 Find_next_suitable_point(atom* a, atom* b, atom* Candidate, atom* Parent, 1439 void Find_next_suitable_point(atom* a, atom* b, atom* Candidate, atom* Parent, 1441 1440 int RecursionLevel, Vector *Chord, Vector *d1, Vector *OldNormal, 1442 1441 atom*& Opt_Candidate, Vector *Opt_Mittelpunkt, double *Storage, const double RADIUS, molecule* mol) … … 1448 1447 Vector dif_a; //Vector from a to candidate 1449 1448 Vector dif_b; //Vector from b to candidate 1450 Vector AngleCheck ; // Projection of a difference vector on plane orthogonal on triangle side.1449 Vector AngleCheck, AngleCheckReference, DirectionCheckPoint; 1451 1450 Vector TempNormal, Umkreismittelpunkt, Mittelpunkt; 1452 1451 1453 1452 double CurrentEpsilon = 0.1; 1454 1453 double alpha, beta, gamma, SideA, SideB, SideC, sign, Umkreisradius, Restradius, Distance; 1454 double BallAngle; 1455 1455 atom *Walker; // variable atom point 1456 1456 … … 1460 1460 dif_b.CopyVector(&(b->x)); 1461 1461 dif_b.SubtractVector(&(Candidate->x)); 1462 AngleCheck.CopyVector(&dif_a);1463 AngleCheck.Scale(-1);1464 AngleCheck.ProjectOntoPlane(Chord);1462 DirectionCheckPoint.CopyVector(&dif_a); 1463 DirectionCheckPoint.Scale(-1); 1464 DirectionCheckPoint.ProjectOntoPlane(Chord); 1465 1465 1466 1466 SideA = dif_b.Norm(); … … 1484 1484 if (a != Candidate and b != Candidate) 1485 1485 { 1486 // alpha = dif_a.Angle(&dif_b) / 2.;1487 // SideA = Chord->Norm() / 2.;// (Chord->Norm()/2.) / sin(0.5*alpha);1488 // SideB = dif_a.Norm();1489 // centerline = SideA * SideA + SideB * SideB - 2. * SideA * SideB * cos(1490 // alpha); // note this is squared of center line length1491 // Those are remains from Freddie. Needed? 1492 1493 // centerline = (Chord->Norm()/2.) / sin(0.5*alpha); 1494 // Old Chordtest. Replaced by test for Radius of Circumscribing circle 1486 // alpha = dif_a.Angle(&dif_b) / 2.; 1487 // SideA = Chord->Norm() / 2.;// (Chord->Norm()/2.) / sin(0.5*alpha); 1488 // SideB = dif_a.Norm(); 1489 // centerline = SideA * SideA + SideB * SideB - 2. * SideA * SideB * cos( 1490 // alpha); // note this is squared of center line length 1491 // centerline = (Chord->Norm()/2.) / sin(0.5*alpha); 1492 // Those are remains from Freddie. Needed? 1493 1494 1495 1495 1496 1496 Umkreisradius = SideA / 2.0 / sin(alpha); … … 1499 1499 //cout << SideC / 2.0 / sin(gamma) << endl; 1500 1500 1501 if (Umkreisradius < RADIUS) 1502 { 1503 1504 sign = AngleCheck.ScalarProduct(d1); 1505 sign /= fabs(sign); // +1 if in direction of triangle plane, -1 if in other direction... 1506 1507 // intermediate calculations: 1501 if (Umkreisradius < RADIUS && DirectionCheckPoint.ScalarProduct(&(Candidate->x))>0) //Checking whether ball will at least rest o points. 1502 { 1503 1504 // intermediate calculations to aquire centre of sphere, called Mittelpunkt: 1508 1505 1509 1506 Umkreismittelpunkt = (a->x) * sin(2.*alpha) + b->x * sin(2.*beta) + (Candidate->x) * sin(2.*gamma) ; 1510 1507 Umkreismittelpunkt.Scale(1/(sin(2*alpha) + sin(2*beta) + sin(2*gamma))); 1511 1512 1508 1513 1509 TempNormal.CopyVector(&dif_a); … … 1519 1515 TempNormal.Normalize(); 1520 1516 Restradius = sqrt(RADIUS*RADIUS - Umkreisradius*Umkreisradius); 1521 1522 1517 TempNormal.Scale(Restradius); 1523 1518 … … 1525 1520 Mittelpunkt.AddVector(&TempNormal); //this is center of sphere supported by a, b and Candidate 1526 1521 1522 AngleCheck.CopyVector(Chord); 1523 AngleCheck.Scale(-0.5); 1524 AngleCheck.SubtractVector(&(b->x)); 1525 AngleCheckReference.CopyVector(&AngleCheck); 1526 AngleCheckReference.AddVector(Opt_Mittelpunkt); 1527 AngleCheck.AddVector(&Mittelpunkt); 1528 1529 BallAngle = AngleCheck.Angle(&AngleCheckReference); 1530 1531 d1->ProjectOntoPlane(&AngleCheckReference); 1532 sign = AngleCheck.ScalarProduct(d1); 1533 sign /= fabs(sign); // +1 if in direction of triangle plane, -1 if in other direction... 1527 1534 1528 1535 … … 1533 1540 Opt_Candidate = Candidate; 1534 1541 Storage[0] = sign; 1535 Storage[1] = AngleCheck.Angle(OldNormal);1542 Storage[1] = BallAngle; 1536 1543 Opt_Mittelpunkt->CopyVector(&Mittelpunkt); 1537 1544 cout << "Angle is " << Storage[1] << ", Halbraum ist " … … 1542 1549 else 1543 1550 { 1551 /* 1552 * removed due to change in criterium, now checking angle of ball to old normal. 1544 1553 //We will now check for non interference, that is if the new candidate would have the Opt_Candidate 1545 1554 //within the ball. … … 1550 1559 1551 1560 if (Distance >RADIUS) // We have no interference and may now check whether the new point is better. 1561 */ 1552 1562 { 1553 1563 //cout << "Atom " << Candidate << " has distance " << Candidate->x.Distance(Opt_Mittelpunkt) << " to Center of Candidate " << endl; 1554 1564 1555 if (((Storage[0] < 0 && fabs(sign - Storage[0]) > CurrentEpsilon)) ||//This will give absolute preference to those in "right-hand" quadrants1556 (Candidate->x.Distance(Opt_Mittelpunkt) < RADIUS)) //and those where Candidate would be within old Sphere.1565 if (((Storage[0] < 0 && fabs(sign - Storage[0]) > CurrentEpsilon))) //This will give absolute preference to those in "right-hand" quadrants 1566 //(Candidate->x.Distance(Opt_Mittelpunkt) < RADIUS)) //and those where Candidate would be within old Sphere. 1557 1567 { 1558 1568 cout << "Next better candidate is " << *Candidate << " with "; 1559 1569 Opt_Candidate = Candidate; 1560 1570 Storage[0] = sign; 1561 Storage[1] = AngleCheck.Angle(OldNormal);1571 Storage[1] = BallAngle; 1562 1572 Opt_Mittelpunkt->CopyVector(&Mittelpunkt); 1563 1573 cout << "Angle is " << Storage[1] << ", Halbraum ist " 1564 1574 << 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 */ 1575 1582 1576 1583 1577 } … … 1585 1579 { 1586 1580 if ((fabs(sign - Storage[0]) < CurrentEpsilon && sign > 0 1587 && Storage[1] > AngleCheck.Angle(OldNormal)) ||1581 && Storage[1] > BallAngle) || 1588 1582 (fabs(sign - Storage[0]) < CurrentEpsilon && sign < 0 1589 && Storage[1] < AngleCheck.Angle(OldNormal)))1583 && Storage[1] < BallAngle)) 1590 1584 //Depending on quadrant we prefer higher or lower atom with respect to Triangle normal first. 1591 1585 { … … 1593 1587 Opt_Candidate = Candidate; 1594 1588 Storage[0] = sign; 1595 Storage[1] = AngleCheck.Angle(OldNormal);1589 Storage[1] = BallAngle; 1596 1590 Opt_Mittelpunkt->CopyVector(&Mittelpunkt); 1597 1591 cout << "Angle is " << Storage[1] << ", Halbraum ist " 1598 1592 << Storage[0] << endl; 1599 1593 } 1594 1600 1595 } 1601 1596 } 1602 else 1597 /* 1598 * This is for checking point-angle and presence of Candidates in Ball, currently we are checking the ball Angle. 1599 * 1600 else 1603 1601 { 1604 if (sign>0 && AngleCheck.Angle(OldNormal)>0 && Storage[0]<0)1602 if (sign>0 && BallAngle>0 && Storage[0]<0) 1605 1603 { 1606 1604 cout << "Next better candidate is " << *Candidate << " with "; 1607 1605 Opt_Candidate = Candidate; 1608 1606 Storage[0] = sign; 1609 Storage[1] = AngleCheck.Angle(OldNormal);1607 Storage[1] = BallAngle; 1610 1608 Opt_Mittelpunkt->CopyVector(&Mittelpunkt); 1611 1609 cout << "Angle is " << Storage[1] << ", Halbraum ist " 1612 1610 << Storage[0] << endl; 1613 1611 1614 / *1612 //Debugging purposes only 1615 1613 cout << "Umkreismittelpunkt has coordinates" << Umkreismittelpunkt.x[0] << " "<< Umkreismittelpunkt.x[1] <<" "<<Umkreismittelpunkt.x[2] << endl; 1616 1617 1618 1619 1620 1621 1622 1623 1624 1625 1626 1627 1628 1629 1630 */ 1614 cout << "Candidate has coordinates" << Candidate->x.x[0]<< " " << Candidate->x.x[1] << " " << Candidate->x.x[2] << endl; 1615 cout << "a has coordinates" << a->x.x[0]<< " " << a->x.x[1] << " " << a->x.x[2] << endl; 1616 cout << "b has coordinates" << b->x.x[0]<< " " << b->x.x[1] << " " << b->x.x[2] << endl; 1617 cout << "Mittelpunkt has coordinates" << Mittelpunkt.x[0] << " " << Mittelpunkt.x[1]<< " " <<Mittelpunkt.x[2] << endl; 1618 cout << "Umkreisradius ist " << Umkreisradius << endl; 1619 cout << "Restradius ist " << Restradius << endl; 1620 cout << "TempNormal has coordinates " << TempNormal.x[0] << " " << TempNormal.x[1] << " " << TempNormal.x[2] << " " << endl; 1621 cout << "OldNormal has coordinates " << OldNormal->x[0] << " " << OldNormal->x[1] << " " << OldNormal->x[2] << " " << endl; 1622 cout << "Dist a to UmkreisMittelpunkt " << a->x.Distance(&Umkreismittelpunkt) << endl; 1623 cout << "Dist b to UmkreisMittelpunkt " << b->x.Distance(&Umkreismittelpunkt) << endl; 1624 cout << "Dist Candidate to UmkreisMittelpunkt " << Candidate->x.Distance(&Umkreismittelpunkt) << endl; 1625 cout << "Dist a to Mittelpunkt " << a->x.Distance(&Mittelpunkt) << endl; 1626 cout << "Dist b to Mittelpunkt " << b->x.Distance(&Mittelpunkt) << endl; 1627 cout << "Dist Candidate to Mittelpunkt " << Candidate->x.Distance(&Mittelpunkt) << endl; 1628 1631 1629 1632 1630 … … 1638 1636 } 1639 1637 } 1638 */ 1640 1639 } 1641 1640 } … … 1728 1727 Chord.SubtractVector(&(Line.endpoints[1]->node->x)); 1729 1728 1729 { 1730 Vector TempNormal, Umkreismittelpunkt, Mittelpunkt; 1731 double alpha, beta, gamma, SideA, SideB, SideC, sign, Umkreisradius, Restradius, Distance; 1732 1733 SideA = dif_b.Norm(); 1734 SideB = dif_a.Norm(); 1735 SideC = Chord->Norm(); 1736 //Chord->Scale(-1); 1737 1738 alpha = Chord->Angle(&dif_a); 1739 beta = M_PI - Chord->Angle(&dif_b); 1740 gamma = dif_a.Angle(&dif_b); 1741 1742 Umkreismittelpunkt = (a->x) * sin(2.*alpha) + b->x * sin(2.*beta) + (Candidate->x) * sin(2.*gamma) ; 1743 Umkreismittelpunkt.Scale(1/(sin(2*alpha) + sin(2*beta) + sin(2*gamma))); 1744 } 1730 1745 cout << Verbose(1) << "Looking for third point candidates for triangle ... " << endl; 1731 1746
Note:
See TracChangeset
for help on using the changeset viewer.