Changeset caf5d6 for src


Ignore:
Timestamp:
Dec 11, 2008, 3:23:01 PM (16 years ago)
Author:
Christian Neuen <neuen@…>
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:
e4ea46
Parents:
f714979
Message:

Atom indices are now correctly processed.

Location:
src
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • src/boundary.cpp

    rf714979 rcaf5d6  
    10181018};
    10191019
    1020 
    1021 
    1022 
    1023 
    1024 
    1025 //====================================================================================================================
    1026 //
    1027 // ab hier habe ich das verzapft.
    1028 //
    1029 //====================================================================================================================
     1020void Tesselation::AddTrianglePoint(atom* Candidate, int n)
     1021{
     1022          PointTestPair InsertUnique;
     1023          TPS[n] = new class BoundaryPointSet(Candidate);
     1024          InsertUnique = PointsOnBoundary.insert( PointPair(Candidate->nr, TPS[n]) );
     1025          if (InsertUnique.second)  // if new point was not present before, increase counter
     1026          {
     1027                  PointsOnBoundaryCount++;
     1028          }
     1029          else
     1030          {
     1031                  delete TPS[n];
     1032                  cout << Verbose(2) << "Atom " << *((InsertUnique.first)->second->node) << " gibt's schon in der PointMap." << endl;
     1033                  TPS[n] = (InsertUnique.first)->second;
     1034          }
     1035};
     1036
     1037/*
     1038 * Function tries to add line from current Points in BPS to BoundaryLineSet.
     1039 * If succesfull it raises the line count and iserts the new line into the BLS,
     1040 * if unsuccesfull, it writes the line which had been present into the BLS, deleting the new constructed one. 
     1041 */
     1042
     1043void Tesselation::AddTriangleLine(int n)
     1044{
     1045          LineMap::iterator LineWalker;
     1046          BLS[n] = new class BoundaryLineSet(BPS, BPS[1]->node->nr);
     1047          if ((BPS[0]->lines.find(BPS[1]->node->nr))->second->endpoints[0] == BLS[n]->endpoints[0]
     1048              and (BPS[0]->lines.find(BPS[1]->node->nr))->second->endpoints[1] == BLS[n]->endpoints[1])
     1049                  //If a line is there, how do I recognize that beyond a shadow of a doubt?
     1050          {
     1051                  delete BLS[n];
     1052                  cout << Verbose(2) << "Tried to add an existing line, handled it." << endl;
     1053                  LineWalker = LinesOnBoundary.end();
     1054                 
     1055                  while(LineWalker->second->endpoints[0] != BLS[n]->endpoints[0] or LineWalker->second->endpoints[1] != BLS[n]->endpoints[1])
     1056                  {
     1057                          cout << Verbose(1) << "Looking for line which already exists"<< endl;
     1058                          LineWalker--;
     1059                  }
     1060                  BLS[n]=LineWalker->second;
     1061          }
     1062          else
     1063          {
     1064                  cout << Verbose(2) << "Adding line which has not been used before." << endl;
     1065                  BPS[1]->lines.insert( LinePair(BPS[0]->node->nr, BLS[n]) );
     1066                  BPS[2]->lines.insert( LinePair(BPS[1]->node->nr, BLS[n]) );
     1067                 
     1068                  LinesOnBoundary.insert( LinePair(LinesOnBoundaryCount, BLS[n]));
     1069                  LinesOnBoundaryCount++;
     1070                 
     1071          }
     1072};
     1073
     1074/*
     1075 * Function tries to add Triangle just created to Triangle and remarks if already existent (Failure of algorithm).
     1076 * Furthermore it adds the triangle to all of its lines, in order to recognize those which are saturated later.
     1077 */
     1078
     1079void Tesselation::AddTriangleToLines()
     1080{
     1081        cout <<Verbose(1) << "Adding triangle to its lines" <<endl;
     1082        int i=0;
     1083        TrianglesOnBoundary.insert(TrianglePair(TrianglesOnBoundaryCount, BTS));
     1084        TrianglesOnBoundaryCount++;
     1085        for (i=0; i<3; i++)
     1086        {
     1087                BLS[i]->AddTriangle(BTS);
     1088        }
     1089};
     1090
     1091
    10301092
    10311093/*!
     
    10391101 *  with all neighbours of the candidate.
    10401102 */
    1041 void Find_next_suitable_point(atom* a, atom* b, atom* Candidate, int n, Vector *Chord, Vector *d1, Vector *OldNormal, atom*& Opt_Candidate, double *Storage, const double RADIUS, molecule* mol, bool problem)
     1103void Find_next_suitable_point(atom* a, atom* b, atom* Candidate, atom* Parent, int n, Vector *Chord, Vector *d1, Vector *OldNormal, atom*& Opt_Candidate, double *Storage, const double RADIUS, molecule* mol, bool problem)
    10421104{
    10431105  /* OldNormal is normal vector on the old triangle
     
    11081170      {
    11091171                  Walker = mol->ListOfBondsPerAtom[Candidate->nr][i]->GetOtherAtom(Candidate);
    1110 
    1111                   Find_next_suitable_point(a, b, Walker, n+1, Chord, d1, OldNormal, Opt_Candidate, Storage, RADIUS, mol, problem);  //call function again
     1172                  if (Walker->nr == Parent->nr){
     1173                          continue;
     1174                  }
     1175                  else{
     1176                          Find_next_suitable_point(a, b, Walker, Candidate, n+1, Chord, d1, OldNormal, Opt_Candidate, Storage, RADIUS, mol, problem);  //call function again
     1177                  }
    11121178      }
    11131179  }
     
    11231189  Vector helper;
    11241190  Vector Chord;
    1125   atom* Walker;
     1191  //atom* Walker;
    11261192
    11271193  double Storage[2];
     
    11561222
    11571223  cout << Verbose(1) << "Looking for third point candidates for triangle ... " << endl;
    1158   Find_next_suitable_point(Line.endpoints[0]->node, Line.endpoints[1]->node, Line.endpoints[0]->node, 0, &Chord, &direction1, &(T.NormalVector), Opt_Candidate, Storage, RADIUS, mol,0);
    1159 
    1160   if (N>-1)
     1224  Find_next_suitable_point(Line.endpoints[0]->node, Line.endpoints[1]->node, Line.endpoints[0]->node, Line.endpoints[1]->node, 0, &Chord, &direction1, &(T.NormalVector), Opt_Candidate, Storage, RADIUS, mol,0);
     1225  Find_next_suitable_point(Line.endpoints[0]->node, Line.endpoints[1]->node, Line.endpoints[1]->node, Line.endpoints[0]->node, 0, &Chord, &direction1, &(T.NormalVector), Opt_Candidate, Storage, RADIUS, mol,0);
     1226
     1227  if (N>7)
    11611228  {
    11621229          cout << Verbose(1) << "No new Atom found, triangle construction will crash" << endl;
    11631230          write_tecplot_file(out, tecplot, this, mol);
    11641231          tecplot->flush();
    1165           Find_next_suitable_point(Line.endpoints[0]->node, Line.endpoints[1]->node, Line.endpoints[0]->node, 0, &Chord, &direction1, &(T.NormalVector), Opt_Candidate, Storage, RADIUS, mol, 1);
    1166 
     1232          Find_next_suitable_point(Line.endpoints[0]->node, Line.endpoints[1]->node, Line.endpoints[0]->node, Line.endpoints[1]->node, 0, &Chord, &direction1, &(T.NormalVector), Opt_Candidate, Storage, RADIUS, mol, 1);
     1233          Find_next_suitable_point(Line.endpoints[0]->node, Line.endpoints[1]->node, Line.endpoints[1]->node, Line.endpoints[0]->node, 0, &Chord, &direction1, &(T.NormalVector), Opt_Candidate, Storage, RADIUS, mol, 1);
    11671234  }
    11681235  // Konstruiere nun neues Dreieck am Ende der Liste der Dreiecke
     
    11701237  cout << Verbose(1) << "Adding exactly one Walker for reasons completely unknown to me ... " << endl;
    11711238  cout << " Optimal candidate is " << *Opt_Candidate << endl;
    1172   AddPoint(Opt_Candidate);
    1173   cout << " Optimal candidate is " << *Opt_Candidate << endl;
    1174 
    1175   BPS[0] = new class BoundaryPointSet(Opt_Candidate);
    1176   cout << " Optimal candidate is " << *Opt_Candidate << endl;
    1177   BPS[1] = new class BoundaryPointSet(Line.endpoints[0]->node);
    1178   cout << " Optimal candidate is " << *Opt_Candidate << endl;
    1179   BLS[0] = new class BoundaryLineSet(BPS , LinesOnBoundaryCount);
    1180   cout << " Optimal candidate is " << *Opt_Candidate << endl;
    1181   BPS[0] = new class BoundaryPointSet(Opt_Candidate);
    1182 
    1183   BPS[1] = new class BoundaryPointSet(Line.endpoints[1]->node);
    1184   BLS[1] = new class BoundaryLineSet(BPS , LinesOnBoundaryCount);
    1185   BLS[2] = new class BoundaryLineSet(Line);
     1239
     1240  AddTrianglePoint(Opt_Candidate, 0);
     1241  AddTrianglePoint(Line.endpoints[0]->node, 1);
     1242  AddTrianglePoint(Line.endpoints[1]->node, 2);
     1243 
     1244  BPS[0] = TPS[0];
     1245  BPS[1] = TPS[1];
     1246  AddTriangleLine(0);
     1247  BPS[0] = TPS[0];
     1248  BPS[1] = TPS[2];
     1249  AddTriangleLine(1);
     1250  BPS[0] = TPS[1];
     1251  BPS[1] = TPS[2];
     1252  AddTriangleLine(2);
    11861253
    11871254  BTS = new class BoundaryTriangleSet(BLS, TrianglesOnBoundaryCount);
    1188   TrianglesOnBoundary.insert( TrianglePair(TrianglesOnBoundaryCount, BTS) );
    1189   TrianglesOnBoundaryCount++;
    1190 
    1191   cout << Verbose(1) << "Checking for already present lines ... " << endl;
    1192   for(int i=0; i<NDIM; i++) // sind Linien bereits vorhanden ???
    1193   {
    1194           if ( (LinesOnBoundary.insert( LinePair(LinesOnBoundaryCount, BTS->lines[i]))).second);
    1195           {
    1196                   LinesOnBoundaryCount++;
    1197           }
    1198   }
     1255  AddTriangleToLines();
     1256 
     1257 
    11991258  cout << Verbose(1) << "Constructing normal vector for this triangle ... " << endl;
    12001259
     
    12101269
    12111270
    1212 void Find_second_point_for_Tesselation(atom* a, atom* Candidate, int n, Vector Oben, atom*& Opt_Candidate, double Storage[2], molecule* mol, double RADIUS)
     1271void Find_second_point_for_Tesselation(atom* a, atom* Candidate, atom* Parent, int n, Vector Oben, atom*& Opt_Candidate, double Storage[2], molecule* mol, double RADIUS)
    12131272{
    12141273        cout << Verbose(1) << "Looking for second point of starting triangle, recursive level "<< n <<endl;;
     
    12341293                        }
    12351294                        else{
    1236                                 cout << Verbose(1) << "Supposedly looses to better candidate" << Opt_Candidate->nr << endl;
     1295                                cout << Verbose(1) << "Supposedly looses to a better candidate" << Opt_Candidate->nr << endl;
    12371296                        }
    12381297                }
     
    12441303      {
    12451304          Walker = mol->ListOfBondsPerAtom[Candidate->nr][i]->GetOtherAtom(Candidate);
    1246           Find_second_point_for_Tesselation(a, Walker, n+1, Oben, Opt_Candidate, Storage, mol, RADIUS);
     1305          if (Walker->nr == Parent->nr)
     1306                  continue;
     1307          else
     1308                  Find_second_point_for_Tesselation(a, Walker, Candidate, n+1, Oben, Opt_Candidate, Storage, mol, RADIUS);
    12471309      };
    12481310    };
     
    13061368  cout << Verbose(1) << "Number of Bonds: " << mol->NumberOfBondsPerAtom[FirstPoint->nr] << endl;
    13071369
    1308   Find_second_point_for_Tesselation(FirstPoint, mol->ListOfBondsPerAtom[FirstPoint->nr][0]->GetOtherAtom(FirstPoint), 0, Oben, Opt_Candidate, Storage, mol, RADIUS);
     1370  Find_second_point_for_Tesselation(FirstPoint, mol->ListOfBondsPerAtom[FirstPoint->nr][0]->GetOtherAtom(FirstPoint), FirstPoint, 0, Oben, Opt_Candidate, Storage, mol, RADIUS);
    13091371
    13101372
     
    13221384
    13231385  cout << Verbose(1) << "Looking for third point candidates \n";
    1324   Find_next_suitable_point(FirstPoint, SecondPoint, mol->ListOfBondsPerAtom[FirstPoint->nr][0]->GetOtherAtom(FirstPoint), 0, &Chord, &helper, &Oben, Opt_Candidate, Storage, RADIUS, mol, 0);
     1386  Find_next_suitable_point(FirstPoint, SecondPoint, SecondPoint, FirstPoint, 0, &Chord, &helper, &Oben, Opt_Candidate, Storage, RADIUS, mol, 0);
    13251387
    13261388
    13271389  //Starting Triangle is Walker, SecondPoint, Opt_Candidate
    13281390
    1329   AddPoint(FirstPoint);
    1330   AddPoint(SecondPoint);
    1331   AddPoint(Opt_Candidate);
    1332 
    1333   cout << Verbose(1) << "The found starting triangle consists of " << *FirstPoint << ", " << *SecondPoint << " and " << *Opt_Candidate << "." << endl;
    1334 
    1335   BPS[0] = new class BoundaryPointSet(FirstPoint);
    1336   BPS[1] = new class BoundaryPointSet(SecondPoint);
     1391    cout << Verbose(1) << "The found starting triangle consists of " << *FirstPoint << ", " << *SecondPoint << " and " << *Opt_Candidate << "." << endl;
     1392
     1393  AddTrianglePoint(FirstPoint, 0);
     1394  AddTrianglePoint(SecondPoint, 1);
     1395  AddTrianglePoint(Opt_Candidate, 2);
     1396 
     1397  BPS[0] = TPS[0];
     1398  BPS[1] = TPS[1];
    13371399  BLS[0] = new class BoundaryLineSet(BPS , LinesOnBoundaryCount);
    1338   BPS[0] = new class BoundaryPointSet(FirstPoint);
    1339   BPS[1] = new class BoundaryPointSet(Opt_Candidate);
     1400  BPS[0] = TPS[1];
     1401  BPS[1] = TPS[2];
    13401402  BLS[1] = new class BoundaryLineSet(BPS , LinesOnBoundaryCount);
    1341   BPS[0] = new class BoundaryPointSet(Opt_Candidate);
    1342   BPS[1] = new class BoundaryPointSet(SecondPoint);
     1403  BPS[0] = TPS[0];
     1404  BPS[1] = TPS[2];
    13431405  BLS[2] = new class BoundaryLineSet(BPS , LinesOnBoundaryCount);
    13441406
     
    13661428        int N =0;
    13671429        struct Tesselation *Tess = new Tesselation;
    1368         cout << Verbose(1) << "Entering finding of non convex hull. " << endl;
     1430        cout << Verbose(1) << "Entering search for non convex hull. " << endl;
    13691431        cout << flush;
    13701432        const double RADIUS =6.;
  • src/boundary.hpp

    rf714979 rcaf5d6  
    8282    void GuessStartingTriangle(ofstream *out);
    8383    void AddPoint(atom * Walker);
     84    void AddTrianglePoint(atom* Candidate, int n);
     85    void AddTriangleLine(int n);
     86    void AddTriangleToLines();
    8487    void Find_starting_triangle(molecule* mol, const double RADIUS);
    8588    void Find_next_suitable_triangle(ofstream *out, ofstream *tecplot, molecule* mol, BoundaryLineSet &Line, BoundaryTriangleSet &T, const double& RADIUS, int N);
     
    8891    LineMap LinesOnBoundary;
    8992    TriangleMap TrianglesOnBoundary;
     93    class BoundaryPointSet *TPS[3]; //this is a Storage for pointers to triangle points, this and BPS[2] needed due to AddLine restrictions
    9094    class BoundaryPointSet *BPS[2];
    9195    class BoundaryLineSet *BLS[3];
  • src/molecules.cpp

    rf714979 rcaf5d6  
    15181518{
    15191519  atom *walker = NULL;
    1520   int No = 0;
     1520  int AtomNo = 0, ElementNo;
    15211521  time_t now;
     1522  element *runner = NULL;
    15221523
    15231524  now = time((time_t *)NULL);   // Get the system time and put it into 'now' as 'calender time'
     
    15251526  while (walker->next != end) { // go through every atom and count
    15261527    walker = walker->next;
    1527     No++;
     1528    AtomNo++;
    15281529  }
    15291530  if (out != NULL) {
    1530     *out << No << "\n\tCreated by molecuilder on " << ctime(&now);
    1531     walker = start;
    1532     while (walker->next != end) { // go through every atom of this element
    1533       walker = walker->next;
    1534       walker->OutputXYZLine(out);
     1531    *out << AtomNo << "\n\tCreated by molecuilder on " << ctime(&now);
     1532    ElementNo = 0;
     1533    runner = elemente->start;
     1534    while (runner->next != elemente->end) { // go through every element
     1535                runner = runner->next;
     1536      if (ElementsInMolecule[runner->Z]) { // if this element got atoms
     1537        ElementNo++;
     1538        walker = start;
     1539        while (walker->next != end) { // go through every atom of this element
     1540          walker = walker->next;
     1541          if (walker->type == runner) { // if this atom fits to element
     1542            walker->OutputXYZLine(out);
     1543          }
     1544        }
     1545      }
    15351546    }
    15361547    return true;
     
    17161727                        };
    17171728                        AddBond(Walker, OtherWalker); //Add the bond between the two atoms with respective indices.
    1718                         BondCount++; //Increase bond count of molecule
     1729                       
    17191730                }
    17201731
Note: See TracChangeset for help on using the changeset viewer.