Ignore:
Timestamp:
Sep 12, 2016, 2:03:11 PM (8 years ago)
Author:
Frederik Heber <heber@…>
Branches:
Action_Thermostats, Add_AtomRandomPerturbation, Add_FitFragmentPartialChargesAction, Add_RotateAroundBondAction, Add_SelectAtomByNameAction, Adding_Graph_to_ChangeBondActions, Adding_MD_integration_tests, Adding_StructOpt_integration_tests, Automaking_mpqc_open, AutomationFragmentation_failures, Candidate_v1.5.4, Candidate_v1.6.0, Candidate_v1.6.1, ChangeBugEmailaddress, ChangingTestPorts, ChemicalSpaceEvaluator, 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_ChargeSampling_PBC, Fix_ChronosMutex, Fix_FitPartialCharges, Fix_FitPotential_needs_atomicnumbers, Fix_ForceAnnealing, Fix_IndependentFragmentGrids, Fix_ParseParticles, Fix_ParseParticles_split_forward_backward_Actions, Fix_StatusMsg, Fix_StepWorldTime_single_argument, Fix_Verbose_Codepatterns, Fixes, ForceAnnealing_goodresults, ForceAnnealing_oldresults, ForceAnnealing_tocheck, ForceAnnealing_with_BondGraph, ForceAnnealing_with_BondGraph_continued, ForceAnnealing_with_BondGraph_continued_betteresults, ForceAnnealing_with_BondGraph_contraction-expansion, GeometryObjects, Gui_displays_atomic_force_velocity, IndependentFragmentGrids, IndependentFragmentGrids_IndividualZeroInstances, IndependentFragmentGrids_IntegrationTest, IndependentFragmentGrids_Sole_NN_Calculation, JobMarket_RobustOnKillsSegFaults, JobMarket_StableWorkerPool, JobMarket_unresolvable_hostname_fix, ODR_violation_mpqc_open, PartialCharges_OrthogonalSummation, PythonUI_with_named_parameters, QtGui_reactivate_TimeChanged_changes, Recreated_GuiChecks, RotateToPrincipalAxisSystem_UndoRedo, SaturateAtoms_findBestMatching, StoppableMakroAction, Subpackage_CodePatterns, Subpackage_JobMarket, Subpackage_LinearAlgebra, Subpackage_levmar, Subpackage_mpqc_open, Subpackage_vmg, ThirdParty_MPQC_rebuilt_buildsystem, TrajectoryDependenant_MaxOrder, TremoloParser_IncreasedPrecision, TremoloParser_MultipleTimesteps, Ubuntu_1604_changes, stable
Children:
6cb1cd
Parents:
64cafb2
git-author:
Frederik Heber <heber@…> (05/10/16 20:04:47)
git-committer:
Frederik Heber <heber@…> (09/12/16 14:03:11)
Message:

Extended SaturateAction to be able to deal with bonded atoms.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/Fragmentation/Exporters/SphericalPointDistribution.cpp

    r64cafb2 r0c42f2  
    3939#include "CodePatterns/Assert.hpp"
    4040#include "CodePatterns/IteratorAdaptors.hpp"
     41#include "CodePatterns/Log.hpp"
    4142#include "CodePatterns/toString.hpp"
    4243
     
    5758typedef std::vector<double> DistanceArray_t;
    5859
     60// static instances
     61const double SphericalPointDistribution::SQRT_3(sqrt(3.0));
     62
    5963DistanceArray_t calculatePairwiseDistances(
    60     const std::vector<Vector> &_points,
     64    const std::vector<Vector> &_returnpolygon,
    6165    const IndexList_t &_indices
    6266    )
     
    6973      if (firstiter == seconditer)
    7074        continue;
    71       const double distance = (_points[*firstiter] - _points[*seconditer]).NormSquared();
     75      const double distance = (_returnpolygon[*firstiter] - _returnpolygon[*seconditer]).NormSquared();
    7276      result.push_back(distance);
    7377    }
     
    8993 * \a _new.
    9094 *
    91  * \param _old first set of points (fewer or equal to \a _new)
    92  * \param _new second set of points
     95 * \param _old first set of returnpolygon (fewer or equal to \a _new)
     96 * \param _new second set of returnpolygon
    9397 * \param _Matching matching between the two sets
    9498 * \return pair with L1 and squared L2 error
     
    129133
    130134SphericalPointDistribution::Polygon_t removeMatchingPoints(
    131     const SphericalPointDistribution::Polygon_t &_points,
     135    const SphericalPointDistribution::Polygon_t &_returnpolygon,
    132136    const IndexList_t &_matchingindices
    133137    )
    134138{
    135   SphericalPointDistribution::Polygon_t remainingpoints;
     139  SphericalPointDistribution::Polygon_t remainingreturnpolygon;
    136140  IndexArray_t indices(_matchingindices.begin(), _matchingindices.end());
    137141  std::sort(indices.begin(), indices.end());
    138142  IndexArray_t::const_iterator valueiter = indices.begin();
    139143  SphericalPointDistribution::Polygon_t::const_iterator pointiter =
    140       _points.begin();
    141   for (unsigned int i=0; i< _points.size(); ++i, ++pointiter) {
     144      _returnpolygon.begin();
     145  for (unsigned int i=0; i< _returnpolygon.size(); ++i, ++pointiter) {
    142146    // skip all those in values
    143147    if (*valueiter == i)
    144148      ++valueiter;
    145149    else
    146       remainingpoints.push_back(*pointiter);
    147   }
    148 
    149   return remainingpoints;
     150      remainingreturnpolygon.push_back(*pointiter);
     151  }
     152
     153  return remainingreturnpolygon;
    150154}
    151155
    152156/** Rotates a given polygon around x, y, and z axis by the given angles.
    153157 *
    154  * Essentially, we concentrate on the three points of the polygon to rotate
     158 * Essentially, we concentrate on the three returnpolygon of the polygon to rotate
    155159 * to the correct position. First, we rotate its center via \a angles,
    156160 * then we rotate the "triangle" around itself/\a _RotationAxis by
    157161 * \a _RotationAngle.
    158162 *
    159  * \param _polygon polygon whose points to rotate
     163 * \param _polygon polygon whose returnpolygon to rotate
    160164 * \param _angles vector with rotation angles for x,y,z axis
    161165 * \param _RotationAxis
     
    188192  double bestL2;
    189193  IndexList_t bestmatching;
    190   VectorArray_t oldpoints;
    191   VectorArray_t newpoints;
     194  VectorArray_t oldreturnpolygon;
     195  VectorArray_t newreturnpolygon;
    192196};
    193197
     
    229233      // calculate errors
    230234      std::pair<double, double> errors = calculateErrorOfMatching(
    231           _MCS.oldpoints, _MCS.newpoints, _matching);
     235          _MCS.oldreturnpolygon, _MCS.newreturnpolygon, _matching);
    232236      if (errors.first < L1THRESHOLD) {
    233237        _MCS.bestmatching = _matching;
     
    248252    )
    249253{
    250   SphericalPointDistribution::Polygon_t remainingpoints;
     254  SphericalPointDistribution::Polygon_t remainingreturnpolygon;
    251255  VectorArray_t remainingold(_polygon.begin(), _polygon.end());
    252256  VectorArray_t remainingnew(_newpolygon.begin(), _newpolygon.end());
     
    256260    MCS.foundflag = false;
    257261    MCS.bestL2 = std::numeric_limits<double>::max();
    258     MCS.oldpoints.insert(MCS.oldpoints.begin(), _polygon.begin(),_polygon.end() );
    259     MCS.newpoints.insert(MCS.newpoints.begin(), _newpolygon.begin(),_newpolygon.end() );
     262    MCS.oldreturnpolygon.insert(MCS.oldreturnpolygon.begin(), _polygon.begin(),_polygon.end() );
     263    MCS.newreturnpolygon.insert(MCS.newreturnpolygon.begin(), _newpolygon.begin(),_newpolygon.end() );
    260264
    261265    // search for bestmatching combinatorially
     
    269273      const unsigned int matchingsize = _polygon.size();
    270274      ASSERT( matchingsize <= indices.size(),
    271           "SphericalPointDistribution::matchSphericalPointDistributions() - not enough new points to choose for matching to old ones.");
     275          "SphericalPointDistribution::matchSphericalPointDistributions() - not enough new returnpolygon to choose for matching to old ones.");
    272276      recurseMatchings(MCS, matching, indices, matchingsize);
    273277    }
     
    278282    Vector newCenter;
    279283    {
    280       // calculate center of triangle/line/point consisting of first points of matching
     284      // calculate center of triangle/line/point consisting of first returnpolygon of matching
    281285      Vector oldCenter;
    282286      IndexList_t::const_iterator iter = MCS.bestmatching.begin();
     
    313317        rotatePolygon(_newpolygon, angles, RotationAxis, RotationAngle);
    314318
    315     // remove all points in matching and return remaining ones
     319    // remove all returnpolygon in matching and return remaining ones
    316320    return removeMatchingPoints(rotated_newpolygon, MCS.bestmatching);
    317321  } else
     
    319323}
    320324
    321 
    322 
     325SphericalPointDistribution::Polygon_t
     326SphericalPointDistribution::getSimplePolygon(const int _NumberOfPoints) const
     327{
     328  Polygon_t returnpolygon;
     329
     330        switch (_NumberOfPoints)
     331        {
     332          case 0:
     333            returnpolygon = get<0>();
     334            break;
     335          case 1:
     336            returnpolygon = get<1>();
     337            break;
     338          case 2:
     339            returnpolygon = get<2>();
     340            break;
     341          case 3:
     342            returnpolygon = get<3>();
     343            break;
     344          case 4:
     345            returnpolygon = get<4>();
     346            break;
     347          case 5:
     348            returnpolygon = get<5>();
     349            break;
     350          case 6:
     351            returnpolygon = get<6>();
     352            break;
     353          case 7:
     354            returnpolygon = get<7>();
     355            break;
     356          case 8:
     357            returnpolygon = get<8>();
     358            break;
     359          case 9:
     360            returnpolygon = get<9>();
     361            break;
     362          case 10:
     363            returnpolygon = get<10>();
     364            break;
     365          case 11:
     366            returnpolygon = get<11>();
     367            break;
     368          case 12:
     369            returnpolygon = get<12>();
     370            break;
     371          case 14:
     372            returnpolygon = get<14>();
     373            break;
     374          default:
     375            ASSERT(0, "SphericalPointDistribution::initSelf() - cannot deal with the case "
     376                +toString(_NumberOfPoints)+".");
     377        }
     378
     379        return returnpolygon;
     380}
     381
Note: See TracChangeset for help on using the changeset viewer.