Changeset 1024cb for src/boundary.cpp


Ignore:
Timestamp:
May 31, 2010, 5:32:27 PM (15 years ago)
Author:
Frederik Heber <heber@…>
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:
e08c46
Parents:
42af9e (diff), a7b761b (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.
git-author:
Frederik Heber <heber@…> (05/31/10 17:29:30)
git-committer:
Frederik Heber <heber@…> (05/31/10 17:32:27)
Message:

Merge commit 'jupiter/MoleculeStartEndSwitch' into CommandLineActionMapping

Conflicts:

molecuilder/src/Makefile.am
molecuilder/src/builder.cpp
molecuilder/src/config.cpp
molecuilder/src/helpers.hpp
molecuilder/src/molecule.cpp
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/unittests/AnalysisCorrelationToPointUnitTest.cpp
molecuilder/src/unittests/listofbondsunittest.cpp

Integration of MoleculeStartEndSwitch had the following consequences:

  • no more AtomCount -> getAtomCount()
  • no more start/end -> begin(), end() and iterator
  • no more decent ordering in atomic ids (hence, Simple_configuration/8 and Domain/5, Domain/6 now check by comparing sorted xyz, not confs)

There is still a huge problem with bonds. One test runs into an endless loop.

Signed-off-by: Frederik Heber <heber@…>

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/boundary.cpp

    r42af9e r1024cb  
    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 {
     
    620618  for (TriangleMap::iterator runner = TesselStruct->TrianglesOnBoundary.begin(); runner != TesselStruct->TrianglesOnBoundary.end(); runner++)
    621619    { // go through every triangle, calculate volume of its pyramid with CoG as peak
    622       x = (*runner->second->endpoints[0]->node->node) - (*runner->second->endpoints[1]->node->node);
    623       y = (*runner->second->endpoints[0]->node->node) - (*runner->second->endpoints[2]->node->node);
    624       const double a = sqrt(runner->second->endpoints[0]->node->node->DistanceSquared(*runner->second->endpoints[1]->node->node));
    625       const double b = sqrt(runner->second->endpoints[0]->node->node->DistanceSquared(*runner->second->endpoints[2]->node->node));
    626       const double c = sqrt(runner->second->endpoints[2]->node->node->DistanceSquared(*runner->second->endpoints[1]->node->node));
     620      x = runner->second->getEndpoint(0) - runner->second->getEndpoint(1);
     621      y = runner->second->getEndpoint(0) - runner->second->getEndpoint(2);
     622      const double a = x.Norm();
     623      const double b = y.Norm();
     624      const double c = runner->second->getEndpoint(2).distance(runner->second->getEndpoint(1));
    627625      const double G = sqrt(((a + b + c) * (a + b + c) - 2 * (a * a + b * b + c * c)) / 16.); // area of tesselated triangle
    628       x = Plane(*(runner->second->endpoints[0]->node->node),
    629                 *(runner->second->endpoints[1]->node->node),
    630                 *(runner->second->endpoints[2]->node->node)).getNormal();
    631       x.Scale(runner->second->endpoints[1]->node->node->ScalarProduct(x));
     626      x = runner->second->getPlane().getNormal();
     627      x.Scale(runner->second->getEndpoint(1).ScalarProduct(x));
    632628      const double h = x.Norm(); // distance of CoG to triangle
    633629      const double PyramidVolume = (1. / 3.) * G * h; // this formula holds for _all_ pyramids (independent of n-edge base or (not) centered peak)
     
    697693  int repetition[NDIM] = { 1, 1, 1 };
    698694  int TotalNoClusters = 1;
    699   atom *Walker = NULL;
    700695  double totalmass = 0.;
    701696  double clustervolume = 0.;
     
    721716
    722717  // sum up the atomic masses
    723   Walker = mol->start;
    724   while (Walker->next != mol->end) {
    725       Walker = Walker->next;
    726       totalmass += Walker->type->mass;
     718  for (molecule::const_iterator iter = mol->begin(); iter != mol->end(); ++iter) {
     719      totalmass += (*iter)->type->mass;
    727720  }
    728721  DoLog(0) && (Log() << Verbose(0) << "RESULT: The summed mass is " << setprecision(10) << totalmass << " atomicmassunit." << endl);
     
    806799  Vector Inserter;
    807800  double FillIt = false;
    808   atom *Walker = NULL;
    809801  bond *Binder = NULL;
    810802  double phi[NDIM];
     
    813805
    814806  for (MoleculeList::iterator ListRunner = List->ListOfMolecules.begin(); ListRunner != List->ListOfMolecules.end(); ListRunner++)
    815     if ((*ListRunner)->AtomCount > 0) {
     807    if ((*ListRunner)->getAtomCount() > 0) {
    816808      DoLog(1) && (Log() << Verbose(1) << "Pre-creating linked cell lists for molecule " << *ListRunner << "." << endl);
    817809      LCList[(*ListRunner)] = new LinkedCell((*ListRunner), 10.); // get linked cell list
     
    831823  }
    832824
    833   filler->CountAtoms();
    834   atom * CopyAtoms[filler->AtomCount];
     825  atom * CopyAtoms[filler->getAtomCount()];
    835826
    836827  // calculate filler grid in [0,1]^3
     
    857848
    858849        // go through all atoms
    859         for (int i=0;i<filler->AtomCount;i++)
     850        for (int i=0;i<filler->getAtomCount();i++)
    860851          CopyAtoms[i] = NULL;
    861         Walker = filler->start;
    862         while (Walker->next != filler->end) {
    863           Walker = Walker->next;
     852        for(molecule::iterator iter = filler->begin(); iter !=filler->end();++filler){
    864853
    865854          // create atomic random translation vector ...
     
    885874
    886875          // ... and put at new position
    887           Inserter = Walker->x;
     876          Inserter = (*iter)->x;
    888877          if (DoRandomRotation)
    889878            Inserter.MatrixMultiplication(Rotations);
     
    909898            DoLog(1) && (Log() << Verbose(1) << "INFO: Position at " << Inserter << " is outer point." << endl);
    910899            // copy atom ...
    911             CopyAtoms[Walker->nr] = Walker->clone();
    912             CopyAtoms[Walker->nr]->x = Inserter;
    913             Filling->AddAtom(CopyAtoms[Walker->nr]);
    914             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);
    915904          } else {
    916905            DoLog(1) && (Log() << Verbose(1) << "INFO: Position at " << Inserter << " is inner point, within boundary or outside of MaxDistance." << endl);
    917             CopyAtoms[Walker->nr] = NULL;
     906            CopyAtoms[(*iter)->nr] = NULL;
    918907            continue;
    919908          }
     
    954943  bool TesselationFailFlag = false;
    955944
     945  mol->getAtomCount();
     946
    956947  if (TesselStruct == NULL) {
    957948    DoLog(1) && (Log() << Verbose(1) << "Allocating Tesselation struct ..." << endl);
     
    10251016//  // look whether all points are inside of the convex envelope, otherwise add them via degenerated triangles
    10261017//  //->InsertStraddlingPoints(mol, LCList);
    1027 //  mol->GoToFirst();
     1018//  for (molecule::const_iterator iter = mol->begin(); iter != mol->end(); ++iter) {
    10281019//  class TesselPoint *Runner = NULL;
    1029 //  while (!mol->IsEnd()) {
    1030 //    Runner = mol->GetPoint();
     1020//    Runner = *iter;
    10311021//    Log() << Verbose(1) << "Checking on " << Runner->Name << " ... " << endl;
    10321022//    if (!->IsInnerPoint(Runner, LCList)) {
     
    10361026//      Log() << Verbose(2) << Runner->Name << " is inside of or on envelope." << endl;
    10371027//    }
    1038 //    mol->GoToNext();
    10391028//  }
    10401029
     
    10451034  status = CheckListOfBaselines(TesselStruct);
    10461035
     1036  cout << "before correction" << endl;
     1037
    10471038  // store before correction
    1048   StoreTrianglesinFile(mol, (const Tesselation *&)TesselStruct, filename, "");
     1039  StoreTrianglesinFile(mol, TesselStruct, filename, "");
    10491040
    10501041//  // correct degenerated polygons
     
    10561047  // write final envelope
    10571048  CalculateConcavityPerBoundaryPoint(TesselStruct);
    1058   StoreTrianglesinFile(mol, (const Tesselation *&)TesselStruct, filename, "");
     1049  cout << "after correction" << endl;
     1050  StoreTrianglesinFile(mol, TesselStruct, filename, "");
    10591051
    10601052  if (freeLC)
Note: See TracChangeset for help on using the changeset viewer.