source: src/boundary.hpp@ 2319ed

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 Candidate_v1.7.0 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
Last change on this file since 2319ed was 2319ed, checked in by Frederik Heber <heber@…>, 16 years ago

We are one step further in fixing the convex hull: There are two functions of Saskia Metzler missing, but then we may proceed with testing whether the simple correction scheme of the convex envelope works, but one thing: Right now we cannot associate a Tesselation to its molecule as the snake bites it's one tail. Hence, the next commit will consist of fixing this bad-OOP issue.

  • Makefile.am: Just some alphabetical resorting.
  • atom::atom() new copy constructor
  • builder.cpp: some output for cluster volume, molecule::AddCopyAtom() uses new copy constructor
  • FillBoxWithMolecule() - new function to fill the remainder of the simulation box with some given filler molecules. Makes explicit use of the tesselated surfaces
  • find_convex_border() - InsertStraddlingPoints() and CorrectConcaveBaselines() is called to correct for atoms outside the envelope and caused-by concave points
  • Tesselation::InsertStraddlingPoints() enlarges the envelope for all atoms found outside, Tesselation::CorrectConcaveBaselines() corrects all found baselines if the adjacent triangles are concave by flipping.
  • boundary.cpp: Lots of helper routines for stuff further below:
  • The following routines are needed to check whether point is in- or outside:
  • FIX: Tesselation::AddPoint() - newly created BoundaryPoint is removed if already present.

Problem: We want to associate a Tesselation class with each molecule class. However, so far we have to know about atoms and bond and molecules inside the Tesselation. We have to remove this dependency and create some intermediate class which enables/encapsulates the access to Vectors, e.g. hidden inside the atom class. This is also good OOP! The Tesselation also only needs a set of Vectors, not more!

  • Property mode set to 100755
File size: 5.5 KB
RevLine 
[8eb17a]1#ifndef BOUNDARY_HPP_
2#define BOUNDARY_HPP_
3
4class BoundaryPointSet;
5class BoundaryLineSet;
6class BoundaryTriangleSet;
[3d919e]7class CandidateForTesselation;
[8eb17a]8
9// include config.h
10#ifdef HAVE_CONFIG_H
11#include <config.h>
12#endif
13
14// STL headers
15#include <map>
16#include <set>
17#include <deque>
18
19#include <gsl/gsl_poly.h>
20
[6ac7ee]21#include "linkedcell.hpp"
[8eb17a]22#include "molecules.hpp"
23
24template <typename T> void SetEndpointsOrdered(T endpoints[2], T endpoint1, T endpoint2)
25{
[3d919e]26 if (endpoint1->Nr < endpoint2->Nr) {
27 endpoints[0] = endpoint1;
28 endpoints[1] = endpoint2;
29 } else {
30 endpoints[0] = endpoint2;
31 endpoints[1] = endpoint1;
32 }
[8eb17a]33};
34
35class BoundaryPointSet {
[3d919e]36 public:
37 BoundaryPointSet();
38 BoundaryPointSet(atom *Walker);
39 ~BoundaryPointSet();
[a8bcea6]40
[3d919e]41 void AddLine(class BoundaryLineSet *line);
[a8bcea6]42
[3d919e]43 LineMap lines;
44 int LinesCount;
45 atom *node;
46 int Nr;
[8eb17a]47};
48
49class BoundaryLineSet {
[3d919e]50 public:
51 BoundaryLineSet();
52 BoundaryLineSet(class BoundaryPointSet *Point[2], int number);
53 ~BoundaryLineSet();
[8eb17a]54
[3d919e]55 void AddTriangle(class BoundaryTriangleSet *triangle);
[2319ed]56 bool IsConnectedTo(class BoundaryLineSet *line);
57 bool ContainsBoundaryPoint(class BoundaryPointSet *point);
58 bool CheckConvexityCriterion(ofstream *out);
[8eb17a]59
[3d919e]60 class BoundaryPointSet *endpoints[2];
61 TriangleMap triangles;
62 int TrianglesCount;
63 int Nr;
[8eb17a]64};
65
66class BoundaryTriangleSet {
[3d919e]67 public:
68 BoundaryTriangleSet();
69 BoundaryTriangleSet(class BoundaryLineSet *line[3], int number);
70 ~BoundaryTriangleSet();
[a8bcea6]71
[3d919e]72 void GetNormalVector(Vector &NormalVector);
[2319ed]73 bool GetIntersectionInsideTriangle(ofstream *out, Vector *MolCenter, Vector *x, Vector *Intersection);
74 bool ContainsBoundaryLine(class BoundaryLineSet *line);
75 bool ContainsBoundaryPoint(class BoundaryPointSet *point);
[a8bcea6]76
[3d919e]77 class BoundaryPointSet *endpoints[3];
78 class BoundaryLineSet *lines[3];
79 Vector NormalVector;
80 int Nr;
[8eb17a]81};
82
[3d919e]83
84class CandidateForTesselation {
85 public :
[042f82]86 CandidateForTesselation(atom* candidate, BoundaryLineSet* currentBaseLine, Vector OptCandidateCenter, Vector OtherOptCandidateCenter);
87 ~CandidateForTesselation();
88 atom *point;
89 BoundaryLineSet *BaseLine;
90 Vector OptCenter;
91 Vector OtherOptCenter;
[3d919e]92};
93
94
[8eb17a]95class Tesselation {
[3d919e]96 public:
97
98 Tesselation();
99 ~Tesselation();
100
[d30402]101 void TesselateOnBoundary(ofstream *out, molecule *mol);
[3d919e]102 void GuessStartingTriangle(ofstream *out);
103 void AddPoint(atom * Walker);
104 void AddTrianglePoint(atom* Candidate, int n);
105 void AddTriangleLine(class BoundaryPointSet *a, class BoundaryPointSet *b, int n);
106 void AlwaysAddTriangleLine(class BoundaryPointSet *a, class BoundaryPointSet *b, int n);
[86234b]107 void AddTriangle();
[3d919e]108 void Find_starting_triangle(ofstream *out, molecule* mol, const double RADIUS, LinkedCell *LC);
109 bool Find_next_suitable_triangle(ofstream *out, molecule* mol, BoundaryLineSet &Line, BoundaryTriangleSet &T, const double& RADIUS, int N, const char *filename, LinkedCell *LC);
110 int CheckPresenceOfTriangle(ofstream *out, atom *Candidates[3]);
111 void Find_next_suitable_point_via_Angle_of_Sphere(atom* a, atom* b, atom* c, atom* Candidate, atom* Parent, int RecursionLevel, Vector *Chord, Vector *direction1, Vector *OldNormal, Vector ReferencePoint, atom*& Opt_Candidate, double *Storage, const double RADIUS, molecule* mol);
[2319ed]112 class BoundaryTriangleSet * FindClosestTriangleToPoint(ofstream *out, Vector *x);
113 bool IsInside(Vector *pointer);
114 bool InsertStraddlingPoints(ofstream *out, molecule *mol);
115 bool CorrectConcaveBaselines(ofstream *out);
[3d919e]116
117 PointMap PointsOnBoundary;
118 LineMap LinesOnBoundary;
119 TriangleMap TrianglesOnBoundary;
120 class BoundaryPointSet *TPS[3]; //this is a Storage for pointers to triangle points, this and BPS[2] needed due to AddLine restrictions
121 class BoundaryPointSet *BPS[2];
122 class BoundaryLineSet *BLS[3];
123 class BoundaryTriangleSet *BTS;
124 int PointsOnBoundaryCount;
125 int LinesOnBoundaryCount;
126 int TrianglesOnBoundaryCount;
127 int TriangleFilesWritten;
[8eb17a]128};
129
130
131ostream & operator << (ostream &ost, BoundaryPointSet &a);
132ostream & operator << (ostream &ost, BoundaryLineSet &a);
133ostream & operator << (ostream &ost, BoundaryTriangleSet &a);
134
135
[d30402]136double VolumeOfConvexEnvelope(ofstream *out, class Tesselation *TesselStruct, class config *configuration);
[318bfd]137double * GetDiametersOfCluster(ofstream *out, Boundaries *BoundaryPtr, molecule *mol, bool IsAngstroem);
[edb650]138void PrepareClustersinWater(ofstream *out, config *configuration, molecule *mol, double ClusterVolume, double celldensity);
[2319ed]139molecule * FillBoxWithMolecule(ofstream *out, MoleculeListClass *List, molecule *filler, config &configuration, double distance[NDIM], double RandAtomDisplacement, double RandMolDisplacement, bool DoRandomRotation);
[d30402]140void Find_convex_border(ofstream *out, molecule* mol, class Tesselation *&TesselStruct, class LinkedCell *LCList, const char *filename);
[3d919e]141void Find_non_convex_border(ofstream *out, molecule* mol, class Tesselation *T, class LinkedCell *LC, const char *tempbasename, const double RADIUS);
[6ac7ee]142void Find_next_suitable_point(class BoundaryTriangleSet *BaseTriangle, class BoundaryLineSet *BaseLine, atom*& OptCandidate, Vector *OptCandidateCenter, double *ShortestAngle, const double RADIUS, LinkedCell *LC);
[3d919e]143bool Choose_preferable_third_point(atom *Candidate, atom *OptCandidate, class BoundaryLineSet *BaseLine, atom *ThirdNode, Tesselation *Tess);
144bool existsIntersection(Vector point1, Vector point2, Vector point3, Vector point4);
145bool sortCandidates(CandidateForTesselation* candidate1, CandidateForTesselation* candidate2);
[8eb17a]146
147#endif /*BOUNDARY_HPP_*/
Note: See TracBrowser for help on using the repository browser.