Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/boundary.cpp

    r6e5084 r83f176  
     1/*
     2 * Project: MoleCuilder
     3 * Description: creates and alters molecular systems
     4 * Copyright (C)  2010 University of Bonn. All rights reserved.
     5 * Please see the LICENSE file or "Copyright notice" in builder.cpp for details.
     6 */
     7
    18/** \file boundary.cpp
    29 *
     
    411 */
    512
     13// include config.h
     14#ifdef HAVE_CONFIG_H
     15#include <config.h>
     16#endif
     17
    618#include "Helpers/MemDebug.hpp"
    719
    820#include "Actions/MoleculeAction/RotateToPrincipalAxisSystemAction.hpp"
     21#include "BoundaryPointSet.hpp"
     22#include "BoundaryLineSet.hpp"
     23#include "BoundaryTriangleSet.hpp"
     24#include "CandidateForTesselation.hpp"
     25//#include "TesselPoint.hpp"
    926#include "World.hpp"
    1027#include "atom.hpp"
     
    87104              if (Neighbour == BoundaryPoints[axis].end()) // make it wrap around
    88105                Neighbour = BoundaryPoints[axis].begin();
    89               DistanceVector = runner->second.second->x - Neighbour->second.second->x;
     106              DistanceVector = (runner->second.second->getPosition()) - (Neighbour->second.second->getPosition());
    90107              do { // seek for neighbour pair where it flips
    91108                  OldComponent = DistanceVector[Othercomponent];
     
    93110                  if (Neighbour == BoundaryPoints[axis].end()) // make it wrap around
    94111                    Neighbour = BoundaryPoints[axis].begin();
    95                   DistanceVector = runner->second.second->x - Neighbour->second.second->x;
     112                  DistanceVector = (runner->second.second->getPosition()) - (Neighbour->second.second->getPosition());
    96113                  //Log() << Verbose(2) << "OldComponent is " << OldComponent << ", new one is " << DistanceVector.x[Othercomponent] << "." << endl;
    97114                } while ((runner != Neighbour) && (fabs(OldComponent / fabs(
     
    105122                  //Log() << Verbose(1) << "The pair, where the sign of OtherComponent flips, is: " << *(Neighbour->second.second) << " and " << *(OtherNeighbour->second.second) << "." << endl;
    106123                  // now we have found the pair: Neighbour and OtherNeighbour
    107                   OtherVector = runner->second.second->x - OtherNeighbour->second.second->x;
     124                  OtherVector = (runner->second.second->getPosition()) - (OtherNeighbour->second.second->getPosition());
    108125                  //Log() << Verbose(1) << "Distances to Neighbour and OtherNeighbour are " << DistanceVector.x[component] << " and " << OtherVector.x[component] << "." << endl;
    109126                  //Log() << Verbose(1) << "OtherComponents to Neighbour and OtherNeighbour are " << DistanceVector.x[Othercomponent] << " and " << OtherVector.x[Othercomponent] << "." << endl;
     
    173190    // 3b. construct set of all points, transformed into cylindrical system and with left and right neighbours
    174191    for (molecule::const_iterator iter = mol->begin(); iter != mol->end(); ++iter) {
    175       ProjectedVector = (*iter)->x - (*MolCenter);
     192      ProjectedVector = (*iter)->getPosition() - (*MolCenter);
    176193      ProjectedVector.ProjectOntoPlane(AxisVector);
    177194
     
    188205      }
    189206    DoLog(1) && (Log() << Verbose(1) << "Inserting " << **iter << ": (r, alpha) = (" << radius << "," << angle << "): " << ProjectedVector << endl);
    190       BoundaryTestPair = BoundaryPoints[axis].insert(BoundariesPair(angle, DistancePair (radius, (*iter))));
     207      BoundaryTestPair = BoundaryPoints[axis].insert(BoundariesPair(angle, TesselPointDistancePair (radius, (*iter))));
    191208      if (!BoundaryTestPair.second) { // same point exists, check first r, then distance of original vectors to center of gravity
    192209        DoLog(2) && (Log() << Verbose(2) << "Encountered two vectors whose projection onto axis " << axis << " is equal: " << endl);
     
    199216          DoLog(2) && (Log() << Verbose(2) << "Keeping new vector due to larger projected distance " << ProjectedVectorNorm << "." << endl);
    200217        } else if (fabs(ProjectedVectorNorm - BoundaryTestPair.first->second.first) < MYEPSILON) {
    201           helper = (*iter)->x;
    202           helper -= *MolCenter;
     218          helper = (*iter)->getPosition() - (*MolCenter);
    203219          const double oldhelperNorm = helper.NormSquared();
    204           helper = BoundaryTestPair.first->second.second->x - (*MolCenter);
     220          helper = BoundaryTestPair.first->second.second->getPosition() - (*MolCenter);
    205221          if (helper.NormSquared() < oldhelperNorm) {
    206222            BoundaryTestPair.first->second.second = (*iter);
     
    255271        {
    256272          Vector SideA, SideB, SideC, SideH;
    257           SideA = left->second.second->x - (*MolCenter);
     273          SideA = left->second.second->getPosition() - (*MolCenter);
    258274          SideA.ProjectOntoPlane(AxisVector);
    259275          //          Log() << Verbose(1) << "SideA: " << SideA << endl;
    260276
    261           SideB = right->second.second->x -(*MolCenter);
     277          SideB = right->second.second->getPosition() -(*MolCenter);
    262278          SideB.ProjectOntoPlane(AxisVector);
    263279          //          Log() << Verbose(1) << "SideB: " << SideB << endl;
    264280
    265           SideC = left->second.second->x - right->second.second->x;
     281          SideC = left->second.second->getPosition() - right->second.second->getPosition();
    266282          SideC.ProjectOntoPlane(AxisVector);
    267283          //          Log() << Verbose(1) << "SideC: " << SideC << endl;
    268284
    269           SideH = runner->second.second->x -(*MolCenter);
     285          SideH = runner->second.second->getPosition() -(*MolCenter);
    270286          SideH.ProjectOntoPlane(AxisVector);
    271287          //          Log() << Verbose(1) << "SideH: " << SideH << endl;
     
    701717  // sum up the atomic masses
    702718  for (molecule::const_iterator iter = mol->begin(); iter != mol->end(); ++iter) {
    703       totalmass += (*iter)->type->mass;
     719      totalmass += (*iter)->getType()->getMass();
    704720  }
    705721  DoLog(0) && (Log() << Verbose(0) << "RESULT: The summed mass is " << setprecision(10) << totalmass << " atomicmassunit." << endl);
     
    800816  // Center filler at origin
    801817  filler->CenterEdge(&Inserter);
    802   filler->Center.Zero();
    803818  const int FillerCount = filler->getAtomCount();
    804819  DoLog(2) && (Log() << Verbose(2) << "INFO: Filler molecule has the following bonds:" << endl);
     
    857872
    858873          // ... and put at new position
    859           Inserter = (*iter)->x;
     874          Inserter = (*iter)->getPosition();
    860875          if (DoRandomRotation)
    861876            Inserter *= Rotations;
     
    882897            // copy atom ...
    883898            CopyAtoms[(*iter)->nr] = (*iter)->clone();
    884             CopyAtoms[(*iter)->nr]->x = Inserter;
     899            (*CopyAtoms[(*iter)->nr]).setPosition(Inserter);
    885900            Filling->AddAtom(CopyAtoms[(*iter)->nr]);
    886             DoLog(4) && (Log() << Verbose(4) << "Filling atom " << **iter << ", translated to " << AtomTranslations << ", at final position is " << (CopyAtoms[(*iter)->nr]->x) << "." << endl);
     901            DoLog(1) && (Log() << Verbose(1) << "Filling atom " << **iter << ", translated to " << AtomTranslations << ", at final position is " << (CopyAtoms[(*iter)->nr]->getPosition()) << "." << endl);
    887902          } else {
    888903            DoLog(1) && (Log() << Verbose(1) << "INFO: Position at " << Inserter << " is inner point, within boundary or outside of MaxDistance." << endl);
Note: See TracChangeset for help on using the changeset viewer.