Changeset a7b761b for src/boundary.cpp


Ignore:
Timestamp:
May 27, 2010, 10:46:54 AM (15 years ago)
Author:
Tillmann Crueger <crueger@…>
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:
1024cb
Parents:
8f215d (diff), 05a97c (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

Merge branch 'MoleculeStartEndSwitch' into StructureRefactoring

Conflicts:

molecuilder/src/Helpers/Assert.cpp
molecuilder/src/Helpers/Assert.hpp
molecuilder/src/Legacy/oldmenu.cpp
molecuilder/src/Makefile.am
molecuilder/src/Patterns/Cacheable.hpp
molecuilder/src/Patterns/Observer.cpp
molecuilder/src/Patterns/Observer.hpp
molecuilder/src/analysis_correlation.cpp
molecuilder/src/boundary.cpp
molecuilder/src/builder.cpp
molecuilder/src/config.cpp
molecuilder/src/helpers.hpp
molecuilder/src/molecule.cpp
molecuilder/src/molecule.hpp
molecuilder/src/molecule_dynamics.cpp
molecuilder/src/molecule_fragmentation.cpp
molecuilder/src/molecule_geometry.cpp
molecuilder/src/molecule_graph.cpp
molecuilder/src/moleculelist.cpp
molecuilder/src/tesselation.cpp
molecuilder/src/unittests/AnalysisCorrelationToSurfaceUnitTest.cpp
molecuilder/src/unittests/ObserverTest.cpp
molecuilder/src/unittests/ObserverTest.hpp

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/boundary.cpp

    r8f215d ra7b761b  
    139139{
    140140        Info FunctionInfo(__func__);
    141   atom *Walker = NULL;
    142141  PointMap PointsOnBoundary;
    143142  LineMap LinesOnBoundary;
     
    165164
    166165    // 3b. construct set of all points, transformed into cylindrical system and with left and right neighbours
    167     Walker = mol->start;
    168     while (Walker->next != mol->end) {
    169       Walker = Walker->next;
    170       ProjectedVector = Walker->x - (*MolCenter);
     166    for (molecule::const_iterator iter = mol->begin(); iter != mol->end(); ++iter) {
     167      ProjectedVector = (*iter)->x - (*MolCenter);
    171168      ProjectedVector.ProjectOntoPlane(AxisVector);
    172169
     
    182179        angle = 2. * M_PI - angle;
    183180      }
    184       DoLog(1) && (Log() << Verbose(1) << "Inserting " << *Walker << ": (r, alpha) = (" << radius << "," << angle << "): " << ProjectedVector << endl);
    185       BoundaryTestPair = BoundaryPoints[axis].insert(BoundariesPair(angle, DistancePair (radius, Walker)));
     181    DoLog(1) && (Log() << Verbose(1) << "Inserting " << **iter << ": (r, alpha) = (" << radius << "," << angle << "): " << ProjectedVector << endl);
     182      BoundaryTestPair = BoundaryPoints[axis].insert(BoundariesPair(angle, DistancePair (radius, (*iter))));
    186183      if (!BoundaryTestPair.second) { // same point exists, check first r, then distance of original vectors to center of gravity
    187184        DoLog(2) && (Log() << Verbose(2) << "Encountered two vectors whose projection onto axis " << axis << " is equal: " << endl);
    188185        DoLog(2) && (Log() << Verbose(2) << "Present vector: " << *BoundaryTestPair.first->second.second << endl);
    189         DoLog(2) && (Log() << Verbose(2) << "New vector: " << *Walker << endl);
     186        DoLog(2) && (Log() << Verbose(2) << "New vector: " << **iter << endl);
    190187        const double ProjectedVectorNorm = ProjectedVector.NormSquared();
    191188        if ((ProjectedVectorNorm - BoundaryTestPair.first->second.first) > MYEPSILON) {
    192189          BoundaryTestPair.first->second.first = ProjectedVectorNorm;
    193           BoundaryTestPair.first->second.second = Walker;
     190          BoundaryTestPair.first->second.second = (*iter);
    194191          DoLog(2) && (Log() << Verbose(2) << "Keeping new vector due to larger projected distance " << ProjectedVectorNorm << "." << endl);
    195192        } else if (fabs(ProjectedVectorNorm - BoundaryTestPair.first->second.first) < MYEPSILON) {
    196           helper = Walker->x - (*MolCenter);
     193          helper = (*iter)->x;
     194          helper -= *MolCenter;
    197195          const double oldhelperNorm = helper.NormSquared();
    198196          helper = BoundaryTestPair.first->second.second->x - (*MolCenter);
    199197          if (helper.NormSquared() < oldhelperNorm) {
    200             BoundaryTestPair.first->second.second = Walker;
     198            BoundaryTestPair.first->second.second = (*iter);
    201199            DoLog(2) && (Log() << Verbose(2) << "Keeping new vector due to larger distance to molecule center " << helper.NormSquared() << "." << endl);
    202200          } else {
     
    695693  int repetition[NDIM] = { 1, 1, 1 };
    696694  int TotalNoClusters = 1;
    697   atom *Walker = NULL;
    698695  double totalmass = 0.;
    699696  double clustervolume = 0.;
     
    719716
    720717  // sum up the atomic masses
    721   Walker = mol->start;
    722   while (Walker->next != mol->end) {
    723       Walker = Walker->next;
    724       totalmass += Walker->type->mass;
     718  for (molecule::const_iterator iter = mol->begin(); iter != mol->end(); ++iter) {
     719      totalmass += (*iter)->type->mass;
    725720  }
    726721  DoLog(0) && (Log() << Verbose(0) << "RESULT: The summed mass is " << setprecision(10) << totalmass << " atomicmassunit." << endl);
     
    804799  Vector Inserter;
    805800  double FillIt = false;
    806   atom *Walker = NULL;
    807801  bond *Binder = NULL;
    808802  double phi[NDIM];
     
    811805
    812806  for (MoleculeList::iterator ListRunner = List->ListOfMolecules.begin(); ListRunner != List->ListOfMolecules.end(); ListRunner++)
    813     if ((*ListRunner)->AtomCount > 0) {
     807    if ((*ListRunner)->getAtomCount() > 0) {
    814808      DoLog(1) && (Log() << Verbose(1) << "Pre-creating linked cell lists for molecule " << *ListRunner << "." << endl);
    815809      LCList[(*ListRunner)] = new LinkedCell((*ListRunner), 10.); // get linked cell list
     
    829823  }
    830824
    831   filler->CountAtoms();
    832   atom * CopyAtoms[filler->AtomCount];
     825  atom * CopyAtoms[filler->getAtomCount()];
    833826
    834827  // calculate filler grid in [0,1]^3
     
    855848
    856849        // go through all atoms
    857         for (int i=0;i<filler->AtomCount;i++)
     850        for (int i=0;i<filler->getAtomCount();i++)
    858851          CopyAtoms[i] = NULL;
    859         Walker = filler->start;
    860         while (Walker->next != filler->end) {
    861           Walker = Walker->next;
     852        for(molecule::iterator iter = filler->begin(); iter !=filler->end();++filler){
    862853
    863854          // create atomic random translation vector ...
     
    883874
    884875          // ... and put at new position
    885           Inserter = Walker->x;
     876          Inserter = (*iter)->x;
    886877          if (DoRandomRotation)
    887878            Inserter.MatrixMultiplication(Rotations);
     
    907898            DoLog(1) && (Log() << Verbose(1) << "INFO: Position at " << Inserter << " is outer point." << endl);
    908899            // copy atom ...
    909             CopyAtoms[Walker->nr] = Walker->clone();
    910             CopyAtoms[Walker->nr]->x = Inserter;
    911             Filling->AddAtom(CopyAtoms[Walker->nr]);
    912             DoLog(4) && (Log() << Verbose(4) << "Filling atom " << *Walker << ", translated to " << AtomTranslations << ", at final position is " << (CopyAtoms[Walker->nr]->x) << "." << endl);
     900            CopyAtoms[(*iter)->nr] = (*iter)->clone();
     901            CopyAtoms[(*iter)->nr]->x = Inserter;
     902            Filling->AddAtom(CopyAtoms[(*iter)->nr]);
     903            DoLog(4) && (Log() << Verbose(4) << "Filling atom " << **iter << ", translated to " << AtomTranslations << ", at final position is " << (CopyAtoms[(*iter)->nr]->x) << "." << endl);
    913904          } else {
    914905            DoLog(1) && (Log() << Verbose(1) << "INFO: Position at " << Inserter << " is inner point, within boundary or outside of MaxDistance." << endl);
    915             CopyAtoms[Walker->nr] = NULL;
     906            CopyAtoms[(*iter)->nr] = NULL;
    916907            continue;
    917908          }
     
    952943  bool TesselationFailFlag = false;
    953944
     945  mol->getAtomCount();
     946
    954947  if (TesselStruct == NULL) {
    955948    DoLog(1) && (Log() << Verbose(1) << "Allocating Tesselation struct ..." << endl);
     
    10231016//  // look whether all points are inside of the convex envelope, otherwise add them via degenerated triangles
    10241017//  //->InsertStraddlingPoints(mol, LCList);
    1025 //  mol->GoToFirst();
     1018//  for (molecule::const_iterator iter = mol->begin(); iter != mol->end(); ++iter) {
    10261019//  class TesselPoint *Runner = NULL;
    1027 //  while (!mol->IsEnd()) {
    1028 //    Runner = mol->GetPoint();
     1020//    Runner = *iter;
    10291021//    Log() << Verbose(1) << "Checking on " << Runner->Name << " ... " << endl;
    10301022//    if (!->IsInnerPoint(Runner, LCList)) {
     
    10341026//      Log() << Verbose(2) << Runner->Name << " is inside of or on envelope." << endl;
    10351027//    }
    1036 //    mol->GoToNext();
    10371028//  }
    10381029
     
    10431034  status = CheckListOfBaselines(TesselStruct);
    10441035
     1036  cout << "before correction" << endl;
     1037
    10451038  // store before correction
    1046   StoreTrianglesinFile(mol, (const Tesselation *&)TesselStruct, filename, "");
     1039  StoreTrianglesinFile(mol, TesselStruct, filename, "");
    10471040
    10481041//  // correct degenerated polygons
     
    10541047  // write final envelope
    10551048  CalculateConcavityPerBoundaryPoint(TesselStruct);
    1056   StoreTrianglesinFile(mol, (const Tesselation *&)TesselStruct, filename, "");
     1049  cout << "after correction" << endl;
     1050  StoreTrianglesinFile(mol, TesselStruct, filename, "");
    10571051
    10581052  if (freeLC)
Note: See TracChangeset for help on using the changeset viewer.