source: src/Fragmentation/Exporters/SphericalPointDistribution_getConnections.cpp@ 2d8c4e

Action_Thermostats Add_AtomRandomPerturbation Add_FitFragmentPartialChargesAction Add_RotateAroundBondAction Add_SelectAtomByNameAction Adding_Graph_to_ChangeBondActions Adding_MD_integration_tests Adding_StructOpt_integration_tests Automaking_mpqc_open AutomationFragmentation_failures Candidate_v1.5.4 Candidate_v1.6.0 Candidate_v1.6.1 ChangeBugEmailaddress ChangingTestPorts ChemicalSpaceEvaluator 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_ChargeSampling_PBC Fix_ChronosMutex Fix_FitPartialCharges Fix_FitPotential_needs_atomicnumbers Fix_ForceAnnealing Fix_IndependentFragmentGrids Fix_ParseParticles Fix_ParseParticles_split_forward_backward_Actions Fix_StatusMsg Fix_StepWorldTime_single_argument Fix_Verbose_Codepatterns ForceAnnealing_goodresults ForceAnnealing_oldresults ForceAnnealing_tocheck ForceAnnealing_with_BondGraph ForceAnnealing_with_BondGraph_continued ForceAnnealing_with_BondGraph_continued_betteresults ForceAnnealing_with_BondGraph_contraction-expansion GeometryObjects Gui_displays_atomic_force_velocity IndependentFragmentGrids IndependentFragmentGrids_IndividualZeroInstances IndependentFragmentGrids_IntegrationTest IndependentFragmentGrids_Sole_NN_Calculation JobMarket_RobustOnKillsSegFaults JobMarket_StableWorkerPool JobMarket_unresolvable_hostname_fix ODR_violation_mpqc_open PartialCharges_OrthogonalSummation PythonUI_with_named_parameters QtGui_reactivate_TimeChanged_changes Recreated_GuiChecks RotateToPrincipalAxisSystem_UndoRedo SaturateAtoms_findBestMatching StoppableMakroAction Subpackage_CodePatterns Subpackage_JobMarket Subpackage_LinearAlgebra Subpackage_levmar Subpackage_mpqc_open Subpackage_vmg ThirdParty_MPQC_rebuilt_buildsystem TrajectoryDependenant_MaxOrder TremoloParser_IncreasedPrecision TremoloParser_MultipleTimesteps Ubuntu_1604_changes stable
Last change on this file since 2d8c4e was 6393ff, checked in by Frederik Heber <heber@…>, 9 years ago

Added getConnections() to SphericalPointDistribution.

  • we use tesselation in order to extract the connection information between nearest neighboring points from the BoundaryLines of the tesselation. The triangles are ideal as they assure that no point lies within a triangle, hence all these points may be safely combined.
  • functions reside in extra module as with get().
  • added extensive unit tests.
  • Property mode set to 100644
File size: 13.4 KB
Line 
1/*
2 * Project: MoleCuilder
3 * Description: creates and alters molecular systems
4 * Copyright (C) 2014 Frederik Heber. All rights reserved.
5 *
6 *
7 * This file is part of MoleCuilder.
8 *
9 * MoleCuilder is free software: you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation, either version 2 of the License, or
12 * (at your option) any later version.
13 *
14 * MoleCuilder is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
18 *
19 * You should have received a copy of the GNU General Public License
20 * along with MoleCuilder. If not, see <http://www.gnu.org/licenses/>.
21 */
22
23/*
24 * SphericalPointDistribution_getConnections.cpp
25 *
26 * Created on: Jul 12, 2014
27 * Author: heber
28 */
29
30// include config.h
31#ifdef HAVE_CONFIG_H
32#include <config.h>
33#endif
34
35#include "CodePatterns/MemDebug.hpp"
36
37#include "SphericalPointDistribution.hpp"
38
39#include "CodePatterns/Assert.hpp"
40
41#include <boost/assign.hpp>
42
43using namespace std;
44using namespace boost::assign;
45
46typedef SphericalPointDistribution::IndexSet_t IndexSet_t;
47
48template <>
49SphericalPointDistribution::adjacency_t SphericalPointDistribution::getConnections<0>()
50{
51 adjacency_t adjacency;
52 ASSERT( adjacency.size() == 0,
53 "SphericalPointDistribution::getConnections<0>() - adjacency has wrong size.");
54 return adjacency;
55}
56
57template <>
58SphericalPointDistribution::adjacency_t SphericalPointDistribution::getConnections<1>()
59{
60 adjacency_t adjacency;
61 ASSERT( adjacency.size() == 0,
62 "SphericalPointDistribution::getConnections<1>() - adjacency has wrong size.");
63 return adjacency;
64}
65
66template <>
67SphericalPointDistribution::adjacency_t SphericalPointDistribution::getConnections<2>()
68{
69 adjacency_t adjacency;
70 adjacency += make_pair<unsigned int, IndexSet_t >( 0, list_of<unsigned int>(1) );
71 adjacency += make_pair<unsigned int, IndexSet_t >( 1, list_of<unsigned int>(0) );
72 ASSERT( adjacency.size() == 2,
73 "SphericalPointDistribution::getConnections<2>() - adjacency has wrong size.");
74 return adjacency;
75}
76
77template <>
78SphericalPointDistribution::adjacency_t SphericalPointDistribution::getConnections<3>()
79{
80 adjacency_t adjacency;
81 adjacency += make_pair<unsigned int, IndexSet_t >( 0, list_of<unsigned int>(1)(2) );
82 adjacency += make_pair<unsigned int, IndexSet_t >( 1, list_of<unsigned int>(0)(2) );
83 adjacency += make_pair<unsigned int, IndexSet_t >( 2, list_of<unsigned int>(0)(1) );
84 ASSERT( adjacency.size() == 3,
85 "SphericalPointDistribution::getConnections<3>() - adjacency has wrong size.");
86 return adjacency;
87}
88
89template <>
90SphericalPointDistribution::adjacency_t SphericalPointDistribution::getConnections<4>()
91{
92 adjacency_t adjacency;
93 adjacency += make_pair<unsigned int, IndexSet_t >( 0, list_of<unsigned int>(1)(2)(3) );
94 adjacency += make_pair<unsigned int, IndexSet_t >( 1, list_of<unsigned int>(0)(2)(3) );
95 adjacency += make_pair<unsigned int, IndexSet_t >( 2, list_of<unsigned int>(0)(1)(3) );
96 adjacency += make_pair<unsigned int, IndexSet_t >( 3, list_of<unsigned int>(0)(1)(2) );
97 ASSERT( adjacency.size() == 4,
98 "SphericalPointDistribution::getConnections<4>() - adjacency has wrong size.");
99 return adjacency;
100}
101
102template <>
103SphericalPointDistribution::adjacency_t SphericalPointDistribution::getConnections<5>()
104{
105 adjacency_t adjacency;
106 adjacency += make_pair<unsigned int, IndexSet_t >( 0, list_of<unsigned int>(2)(3)(4) );
107 adjacency += make_pair<unsigned int, IndexSet_t >( 1, list_of<unsigned int>(2)(3)(4) );
108 adjacency += make_pair<unsigned int, IndexSet_t >( 2, list_of<unsigned int>(0)(1)(3)(4) );
109 adjacency += make_pair<unsigned int, IndexSet_t >( 3, list_of<unsigned int>(0)(1)(2)(4) );
110 adjacency += make_pair<unsigned int, IndexSet_t >( 4, list_of<unsigned int>(0)(1)(2)(3) );
111 ASSERT( adjacency.size() == 5,
112 "SphericalPointDistribution::getConnections<5>() - adjacency has wrong size.");
113 return adjacency;
114}
115
116template <>
117SphericalPointDistribution::adjacency_t SphericalPointDistribution::getConnections<6>()
118{
119 adjacency_t adjacency;
120 adjacency += make_pair<unsigned int, IndexSet_t >( 0, list_of<unsigned int>(2)(3)(4)(5) );
121 adjacency += make_pair<unsigned int, IndexSet_t >( 1, list_of<unsigned int>(2)(3)(4)(5) );
122 adjacency += make_pair<unsigned int, IndexSet_t >( 2, list_of<unsigned int>(0)(1)(4)(5) );
123 adjacency += make_pair<unsigned int, IndexSet_t >( 3, list_of<unsigned int>(0)(1)(4)(5) );
124 adjacency += make_pair<unsigned int, IndexSet_t >( 4, list_of<unsigned int>(0)(1)(2)(3) );
125 adjacency += make_pair<unsigned int, IndexSet_t >( 5, list_of<unsigned int>(0)(1)(2)(3) );
126 ASSERT( adjacency.size() == 6,
127 "SphericalPointDistribution::getConnections<6>() - adjacency has wrong size.");
128 return adjacency;
129}
130
131template <>
132SphericalPointDistribution::adjacency_t SphericalPointDistribution::getConnections<7>()
133{
134 adjacency_t adjacency;
135 adjacency += make_pair<unsigned int, IndexSet_t >( 0, list_of<unsigned int>(2)(3)(4)(5)(6) );
136 adjacency += make_pair<unsigned int, IndexSet_t >( 1, list_of<unsigned int>(2)(3)(4)(5)(6) );
137 adjacency += make_pair<unsigned int, IndexSet_t >( 2, list_of<unsigned int>(0)(1)(3)(6) );
138 adjacency += make_pair<unsigned int, IndexSet_t >( 3, list_of<unsigned int>(0)(1)(2)(4) );
139 adjacency += make_pair<unsigned int, IndexSet_t >( 4, list_of<unsigned int>(0)(1)(3)(5) );
140 adjacency += make_pair<unsigned int, IndexSet_t >( 5, list_of<unsigned int>(0)(1)(4)(6) );
141 adjacency += make_pair<unsigned int, IndexSet_t >( 6, list_of<unsigned int>(0)(1)(2)(5) );
142 ASSERT( adjacency.size() == 7,
143 "SphericalPointDistribution::getConnections<7>() - adjacency has wrong size.");
144 return adjacency;
145}
146
147template <>
148SphericalPointDistribution::adjacency_t SphericalPointDistribution::getConnections<8>()
149{
150 adjacency_t adjacency;
151 adjacency += make_pair<unsigned int, IndexSet_t >( 0, list_of<unsigned int>(2)(3)(4)(5)(6)(7) );
152 adjacency += make_pair<unsigned int, IndexSet_t >( 1, list_of<unsigned int>(2)(3)(4)(5) );
153 adjacency += make_pair<unsigned int, IndexSet_t >( 2, list_of<unsigned int>(0)(1)(3)(4)(6)(7) );
154 adjacency += make_pair<unsigned int, IndexSet_t >( 3, list_of<unsigned int>(0)(1)(2)(5)(7) );
155 adjacency += make_pair<unsigned int, IndexSet_t >( 4, list_of<unsigned int>(0)(1)(2)(5)(6) );
156 adjacency += make_pair<unsigned int, IndexSet_t >( 5, list_of<unsigned int>(0)(1)(3)(4) );
157 adjacency += make_pair<unsigned int, IndexSet_t >( 6, list_of<unsigned int>(0)(2)(4) );
158 adjacency += make_pair<unsigned int, IndexSet_t >( 7, list_of<unsigned int>(0)(2)(3) );
159 ASSERT( adjacency.size() == 8,
160 "SphericalPointDistribution::getConnections<8>() - adjacency has wrong size.");
161 return adjacency;
162}
163
164template <>
165SphericalPointDistribution::adjacency_t SphericalPointDistribution::getConnections<9>()
166{
167 adjacency_t adjacency;
168 adjacency += make_pair<unsigned int, IndexSet_t >( 0, list_of<unsigned int>(1)(2)(3)(4) );
169 adjacency += make_pair<unsigned int, IndexSet_t >( 1, list_of<unsigned int>(0)(3)(4)(5)(6) );
170 adjacency += make_pair<unsigned int, IndexSet_t >( 2, list_of<unsigned int>(0)(3)(4)(7)(8) );
171 adjacency += make_pair<unsigned int, IndexSet_t >( 3, list_of<unsigned int>(0)(1)(2)(5)(8) );
172 adjacency += make_pair<unsigned int, IndexSet_t >( 4, list_of<unsigned int>(0)(1)(2)(6)(7) );
173 adjacency += make_pair<unsigned int, IndexSet_t >( 5, list_of<unsigned int>(1)(3)(6)(7)(8) );
174 adjacency += make_pair<unsigned int, IndexSet_t >( 6, list_of<unsigned int>(1)(4)(5)(7) );
175 adjacency += make_pair<unsigned int, IndexSet_t >( 7, list_of<unsigned int>(2)(4)(5)(6)(8) );
176 adjacency += make_pair<unsigned int, IndexSet_t >( 8, list_of<unsigned int>(2)(3)(5)(7) );
177 ASSERT( adjacency.size() == 9,
178 "SphericalPointDistribution::getConnections<9>() - adjacency has wrong size.");
179 return adjacency;
180}
181
182template <>
183SphericalPointDistribution::adjacency_t SphericalPointDistribution::getConnections<10>()
184{
185 adjacency_t adjacency;
186 adjacency += make_pair<unsigned int, IndexSet_t >( 0, list_of<unsigned int>(2)(3)(4)(5) );
187 adjacency += make_pair<unsigned int, IndexSet_t >( 1, list_of<unsigned int>(6)(7)(8)(9) );
188 adjacency += make_pair<unsigned int, IndexSet_t >( 2, list_of<unsigned int>(0)(4)(5)(6)(7) );
189 adjacency += make_pair<unsigned int, IndexSet_t >( 3, list_of<unsigned int>(0)(4)(5)(8)(9) );
190 adjacency += make_pair<unsigned int, IndexSet_t >( 4, list_of<unsigned int>(0)(2)(3)(6)(9) );
191 adjacency += make_pair<unsigned int, IndexSet_t >( 5, list_of<unsigned int>(0)(2)(3)(7)(8) );
192 adjacency += make_pair<unsigned int, IndexSet_t >( 6, list_of<unsigned int>(1)(2)(4)(7)(9) );
193 adjacency += make_pair<unsigned int, IndexSet_t >( 7, list_of<unsigned int>(1)(2)(5)(6)(8) );
194 adjacency += make_pair<unsigned int, IndexSet_t >( 8, list_of<unsigned int>(1)(3)(5)(7)(9) );
195 adjacency += make_pair<unsigned int, IndexSet_t >( 9, list_of<unsigned int>(1)(3)(4)(6)(8) );
196 ASSERT( adjacency.size() == 10,
197 "SphericalPointDistribution::getConnections<10>() - adjacency has wrong size.");
198 return adjacency;
199}
200
201template <>
202SphericalPointDistribution::adjacency_t SphericalPointDistribution::getConnections<11>()
203{
204 adjacency_t adjacency;
205 adjacency += make_pair<unsigned int, IndexSet_t >( 0, list_of<unsigned int>(1)(2)(3)(4)(5) );
206 adjacency += make_pair<unsigned int, IndexSet_t >( 1, list_of<unsigned int>(0)(2)(5)(6)(10) );
207 adjacency += make_pair<unsigned int, IndexSet_t >( 2, list_of<unsigned int>(0)(1)(3)(6)(7) );
208 adjacency += make_pair<unsigned int, IndexSet_t >( 3, list_of<unsigned int>(0)(2)(4)(7)(8) );
209 adjacency += make_pair<unsigned int, IndexSet_t >( 4, list_of<unsigned int>(0)(3)(5)(8)(9) );
210 adjacency += make_pair<unsigned int, IndexSet_t >( 5, list_of<unsigned int>(0)(1)(4)(9)(10) );
211 adjacency += make_pair<unsigned int, IndexSet_t >( 6, list_of<unsigned int>(1)(2)(7)(8)(9)(10) );
212 adjacency += make_pair<unsigned int, IndexSet_t >( 7, list_of<unsigned int>(2)(3)(6)(8) );
213 adjacency += make_pair<unsigned int, IndexSet_t >( 8, list_of<unsigned int>(3)(4)(6)(7)(9) );
214 adjacency += make_pair<unsigned int, IndexSet_t >( 9, list_of<unsigned int>(4)(5)(6)(8)(10) );
215 adjacency += make_pair<unsigned int, IndexSet_t >( 10, list_of<unsigned int>(1)(5)(6)(9) );
216 ASSERT( adjacency.size() == 11,
217 "SphericalPointDistribution::getConnections<11>() - adjacency has wrong size.");
218 return adjacency;
219}
220
221template <>
222SphericalPointDistribution::adjacency_t SphericalPointDistribution::getConnections<12>()
223{
224 adjacency_t adjacency;
225 adjacency += make_pair<unsigned int, IndexSet_t >( 0, list_of<unsigned int>(2)(3)(4)(5)(6) );
226 adjacency += make_pair<unsigned int, IndexSet_t >( 1, list_of<unsigned int>(7)(8)(9)(10)(11) );
227 adjacency += make_pair<unsigned int, IndexSet_t >( 2, list_of<unsigned int>(0)(3)(6)(9)(10) );
228 adjacency += make_pair<unsigned int, IndexSet_t >( 3, list_of<unsigned int>(0)(2)(4)(10)(11) );
229 adjacency += make_pair<unsigned int, IndexSet_t >( 4, list_of<unsigned int>(0)(3)(5)(7)(11) );
230 adjacency += make_pair<unsigned int, IndexSet_t >( 5, list_of<unsigned int>(0)(4)(6)(7)(8) );
231 adjacency += make_pair<unsigned int, IndexSet_t >( 6, list_of<unsigned int>(0)(2)(5)(8)(9) );
232 adjacency += make_pair<unsigned int, IndexSet_t >( 7, list_of<unsigned int>(1)(4)(5)(8)(11) );
233 adjacency += make_pair<unsigned int, IndexSet_t >( 8, list_of<unsigned int>(1)(5)(6)(7)(9) );
234 adjacency += make_pair<unsigned int, IndexSet_t >( 9, list_of<unsigned int>(1)(2)(6)(8)(10) );
235 adjacency += make_pair<unsigned int, IndexSet_t >( 10, list_of<unsigned int>(1)(2)(3)(9)(11) );
236 adjacency += make_pair<unsigned int, IndexSet_t >( 11, list_of<unsigned int>(1)(3)(4)(7)(10) );
237 ASSERT( adjacency.size() == 12,
238 "SphericalPointDistribution::getConnections<12>() - adjacency has wrong size.");
239 return adjacency;
240}
241
242template <>
243SphericalPointDistribution::adjacency_t SphericalPointDistribution::getConnections<14>()
244{
245 adjacency_t adjacency;
246 adjacency += make_pair<unsigned int, IndexSet_t >( 0, list_of<unsigned int>(2)(3)(4)(5)(6)(7) );
247 adjacency += make_pair<unsigned int, IndexSet_t >( 1, list_of<unsigned int>(8)(9)(10)(11)(12)(13) );
248 adjacency += make_pair<unsigned int, IndexSet_t >( 2, list_of<unsigned int>(0)(3)(7)(8)(13) );
249 adjacency += make_pair<unsigned int, IndexSet_t >( 3, list_of<unsigned int>(0)(2)(4)(8)(9) );
250 adjacency += make_pair<unsigned int, IndexSet_t >( 4, list_of<unsigned int>(0)(3)(5)(9)(10) );
251 adjacency += make_pair<unsigned int, IndexSet_t >( 5, list_of<unsigned int>(0)(4)(6)(10)(11) );
252 adjacency += make_pair<unsigned int, IndexSet_t >( 6, list_of<unsigned int>(0)(5)(7)(11)(12) );
253 adjacency += make_pair<unsigned int, IndexSet_t >( 7, list_of<unsigned int>(0)(2)(6)(12)(13) );
254 adjacency += make_pair<unsigned int, IndexSet_t >( 8, list_of<unsigned int>(1)(2)(3)(9)(13) );
255 adjacency += make_pair<unsigned int, IndexSet_t >( 9, list_of<unsigned int>(1)(3)(4)(8)(10) );
256 adjacency += make_pair<unsigned int, IndexSet_t >( 10, list_of<unsigned int>(1)(4)(5)(9)(11) );
257 adjacency += make_pair<unsigned int, IndexSet_t >( 11, list_of<unsigned int>(1)(5)(6)(10)(12) );
258 adjacency += make_pair<unsigned int, IndexSet_t >( 12, list_of<unsigned int>(1)(6)(7)(11)(13) );
259 adjacency += make_pair<unsigned int, IndexSet_t >( 13, list_of<unsigned int>(1)(2)(7)(8)(12) );
260 ASSERT( adjacency.size() == 14,
261 "SphericalPointDistribution::getConnections<14>() - adjacency has wrong size.");
262 return adjacency;
263}
Note: See TracBrowser for help on using the repository browser.