[f54930] | 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_getPoints.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 "LinearAlgebra/Vector.hpp"
|
---|
| 42 |
|
---|
| 43 | template <>
|
---|
[0c42f2] | 44 | SphericalPointDistribution::Polygon_t SphericalPointDistribution::get<0>() const
|
---|
[f54930] | 45 | {
|
---|
| 46 | Polygon_t polygon;
|
---|
| 47 | ASSERT( polygon.size() == 0,
|
---|
| 48 | "SphericalPointDistribution::get<0>() - polygon has wrong size.");
|
---|
| 49 | return polygon;
|
---|
| 50 | }
|
---|
| 51 |
|
---|
| 52 | template <>
|
---|
[0c42f2] | 53 | SphericalPointDistribution::Polygon_t SphericalPointDistribution::get<1>() const
|
---|
[f54930] | 54 | {
|
---|
| 55 | Polygon_t polygon;
|
---|
| 56 | polygon.push_back( Vector(Bondlength,0.,0.));
|
---|
| 57 | ASSERT( polygon.size() == 1,
|
---|
| 58 | "SphericalPointDistribution::get<1>() - polygon has wrong size.");
|
---|
| 59 | return polygon;
|
---|
| 60 | }
|
---|
| 61 |
|
---|
| 62 | template <>
|
---|
[0c42f2] | 63 | SphericalPointDistribution::Polygon_t SphericalPointDistribution::get<2>() const
|
---|
[f54930] | 64 | {
|
---|
| 65 | Polygon_t polygon;
|
---|
| 66 | polygon.push_back( Vector(Bondlength,0.,0.));
|
---|
| 67 | polygon.push_back( Vector(-Bondlength,0.,0.));
|
---|
| 68 | ASSERT( polygon.size() == 2,
|
---|
| 69 | "SphericalPointDistribution::get<2>() - polygon has wrong size.");
|
---|
| 70 | return polygon;
|
---|
| 71 | }
|
---|
| 72 |
|
---|
| 73 | template <>
|
---|
[0c42f2] | 74 | SphericalPointDistribution::Polygon_t SphericalPointDistribution::get<3>() const
|
---|
[f54930] | 75 | {
|
---|
| 76 | Polygon_t polygon;
|
---|
| 77 | polygon.push_back( Vector(Bondlength,0.,0.));
|
---|
| 78 | polygon.push_back( Vector(-Bondlength*0.5, SQRT_3*0.5,0.));
|
---|
| 79 | polygon.push_back( Vector(-Bondlength*0.5, -SQRT_3*0.5,0.));
|
---|
| 80 | ASSERT( polygon.size() == 3,
|
---|
| 81 | "SphericalPointDistribution::get<3>() - polygon has wrong size.");
|
---|
| 82 | return polygon;
|
---|
| 83 | }
|
---|
| 84 |
|
---|
| 85 | template <>
|
---|
[0c42f2] | 86 | SphericalPointDistribution::Polygon_t SphericalPointDistribution::get<4>() const
|
---|
[f54930] | 87 | {
|
---|
| 88 | Polygon_t polygon;
|
---|
| 89 | polygon.push_back( Vector(Bondlength,0.,0.));
|
---|
| 90 | polygon.push_back( Vector(-Bondlength/3.0, Bondlength*2.0*M_SQRT2/3.0,0.));
|
---|
| 91 | polygon.push_back( Vector(-Bondlength/3.0, -Bondlength*M_SQRT2/3.0, Bondlength*M_SQRT2/SQRT_3));
|
---|
| 92 | polygon.push_back( Vector(-Bondlength/3.0, -Bondlength*M_SQRT2/3.0, -Bondlength*M_SQRT2/SQRT_3));
|
---|
| 93 | ASSERT( polygon.size() == 4,
|
---|
| 94 | "SphericalPointDistribution::get<4>() - polygon has wrong size.");
|
---|
| 95 | return polygon;
|
---|
| 96 | }
|
---|
| 97 |
|
---|
| 98 | template <>
|
---|
[0c42f2] | 99 | SphericalPointDistribution::Polygon_t SphericalPointDistribution::get<5>() const
|
---|
[f54930] | 100 | {
|
---|
| 101 | Polygon_t polygon;
|
---|
| 102 | polygon.push_back( Vector(Bondlength,0.,0.));
|
---|
| 103 | polygon.push_back( Vector(-Bondlength, 0.0, 0.0));
|
---|
| 104 | polygon.push_back( Vector(0.0, Bondlength, 0.0));
|
---|
| 105 | polygon.push_back( Vector(0.0, -Bondlength*0.5, Bondlength*SQRT_3*0.5));
|
---|
| 106 | polygon.push_back( Vector(0.0, -Bondlength*0.5, -Bondlength*SQRT_3*0.5));
|
---|
| 107 | ASSERT( polygon.size() == 5,
|
---|
| 108 | "SphericalPointDistribution::get<5>() - polygon has wrong size.");
|
---|
| 109 | return polygon;
|
---|
| 110 | }
|
---|
| 111 |
|
---|
| 112 | template <>
|
---|
[0c42f2] | 113 | SphericalPointDistribution::Polygon_t SphericalPointDistribution::get<6>() const
|
---|
[f54930] | 114 | {
|
---|
| 115 | Polygon_t polygon;
|
---|
| 116 | polygon.push_back( Vector(Bondlength,0.,0.));
|
---|
| 117 | polygon.push_back( Vector(-Bondlength, 0.0, 0.0));
|
---|
| 118 | polygon.push_back( Vector(0.0, Bondlength, 0.0));
|
---|
| 119 | polygon.push_back( Vector(0.0, -Bondlength, 0.0));
|
---|
| 120 | polygon.push_back( Vector(0.0, 0.0, Bondlength));
|
---|
| 121 | polygon.push_back( Vector(0.0, 0.0, -Bondlength));
|
---|
| 122 | ASSERT( polygon.size() == 6,
|
---|
| 123 | "SphericalPointDistribution::get<6>() - polygon has wrong size.");
|
---|
| 124 | return polygon;
|
---|
| 125 | }
|
---|
| 126 |
|
---|
| 127 | template <>
|
---|
[0c42f2] | 128 | SphericalPointDistribution::Polygon_t SphericalPointDistribution::get<7>() const
|
---|
[f54930] | 129 | {
|
---|
| 130 | Polygon_t polygon;
|
---|
| 131 | polygon.push_back( Vector(Bondlength,0.,0.));
|
---|
| 132 | polygon.push_back( Vector(-Bondlength, 0.0, 0.0));
|
---|
| 133 | polygon.push_back( Vector(0.0, Bondlength, 0.0));
|
---|
| 134 | polygon.push_back( Vector(0.0, Bondlength*cos(M_PI*0.4), Bondlength*sin(M_PI*0.4)));
|
---|
| 135 | polygon.push_back( Vector(0.0, Bondlength*cos(M_PI*0.8), Bondlength*sin(M_PI*0.8)));
|
---|
| 136 | polygon.push_back( Vector(0.0, Bondlength*cos(M_PI*1.2), Bondlength*sin(M_PI*1.2)));
|
---|
| 137 | polygon.push_back( Vector(0.0, Bondlength*cos(M_PI*1.6), Bondlength*sin(M_PI*1.6)));
|
---|
| 138 | ASSERT( polygon.size() == 7,
|
---|
| 139 | "SphericalPointDistribution::get<7>() - polygon has wrong size.");
|
---|
| 140 | return polygon;
|
---|
| 141 | }
|
---|
| 142 |
|
---|
| 143 | template <>
|
---|
[0c42f2] | 144 | SphericalPointDistribution::Polygon_t SphericalPointDistribution::get<8>() const
|
---|
[f54930] | 145 | {
|
---|
| 146 | Polygon_t polygon;
|
---|
| 147 | polygon.push_back( Vector(Bondlength,0.,0.));
|
---|
| 148 | polygon.push_back( Vector(-Bondlength, 0.0, 0.0));
|
---|
| 149 | polygon.push_back( Vector(-Bondlength/3.0, Bondlength*2.0*M_SQRT2/3.0, 0.0));
|
---|
| 150 | polygon.push_back( Vector(-Bondlength/3.0, -Bondlength*M_SQRT2/3.0, Bondlength*M_SQRT2/SQRT_3));
|
---|
| 151 | polygon.push_back( Vector(-Bondlength/3.0, -Bondlength*M_SQRT2/3.0, -Bondlength*M_SQRT2/SQRT_3));
|
---|
| 152 | polygon.push_back( Vector(Bondlength/3.0, -Bondlength*2.0*M_SQRT2/3.0, 0.0));
|
---|
| 153 | polygon.push_back( Vector(Bondlength/3.0, Bondlength*M_SQRT2/3.0, -Bondlength*M_SQRT2/SQRT_3));
|
---|
| 154 | polygon.push_back( Vector(Bondlength/3.0, Bondlength*M_SQRT2/3.0, Bondlength*M_SQRT2/SQRT_3));
|
---|
| 155 | ASSERT( polygon.size() == 8,
|
---|
| 156 | "SphericalPointDistribution::get<8>() - polygon has wrong size.");
|
---|
| 157 | return polygon;
|
---|
| 158 | }
|
---|
| 159 |
|
---|
| 160 | template <>
|
---|
[0c42f2] | 161 | SphericalPointDistribution::Polygon_t SphericalPointDistribution::get<9>() const
|
---|
[f54930] | 162 | {
|
---|
| 163 | Polygon_t polygon;
|
---|
| 164 | polygon.push_back( Vector(Bondlength,0.,0.));
|
---|
| 165 | polygon.push_back( Vector(Bondlength*cos(0.4*M_PI), Bondlength*sin(0.4*M_PI), 0.0));
|
---|
| 166 | polygon.push_back( Vector(Bondlength*cos(0.4*M_PI), -Bondlength*sin(0.4*M_PI), 0.0));
|
---|
| 167 | polygon.push_back( Vector(Bondlength*cos(0.4*M_PI), 0.0, Bondlength*sin(0.4*M_PI)));
|
---|
| 168 | polygon.push_back( Vector(Bondlength*cos(0.4*M_PI), 0.0, -Bondlength*sin(0.4*M_PI)));
|
---|
| 169 | polygon.push_back( Vector(Bondlength*cos(0.8*M_PI), Bondlength*sin(0.8*M_PI)*sin(0.25*M_PI), Bondlength*sin(0.8*M_PI)*cos(0.25*M_PI)));
|
---|
| 170 | polygon.push_back( Vector(Bondlength*cos(0.8*M_PI), Bondlength*sin(0.8*M_PI)*sin(0.75*M_PI), Bondlength*sin(0.8*M_PI)*cos(0.75*M_PI)));
|
---|
| 171 | polygon.push_back( Vector(Bondlength*cos(0.8*M_PI), Bondlength*sin(0.8*M_PI)*sin(1.25*M_PI), Bondlength*sin(0.8*M_PI)*cos(1.25*M_PI)));
|
---|
| 172 | polygon.push_back( Vector(Bondlength*cos(0.8*M_PI), Bondlength*sin(0.8*M_PI)*sin(1.75*M_PI), Bondlength*sin(0.8*M_PI)*cos(1.75*M_PI)));
|
---|
| 173 | ASSERT( polygon.size() == 9,
|
---|
| 174 | "SphericalPointDistribution::get<9>() - polygon has wrong size.");
|
---|
| 175 | return polygon;
|
---|
| 176 | }
|
---|
| 177 |
|
---|
| 178 | template <>
|
---|
[0c42f2] | 179 | SphericalPointDistribution::Polygon_t SphericalPointDistribution::get<10>() const
|
---|
[f54930] | 180 | {
|
---|
| 181 | Polygon_t polygon;
|
---|
| 182 | polygon.push_back( Vector(Bondlength,0.,0.));
|
---|
| 183 | polygon.push_back( Vector(-Bondlength, 0.0, 0.0));
|
---|
| 184 | const double temp_Bondlength = Bondlength*0.5*SQRT_3;
|
---|
| 185 | polygon.push_back( Vector(temp_Bondlength/SQRT_3, temp_Bondlength, 0.0));
|
---|
| 186 | polygon.push_back( Vector(temp_Bondlength/SQRT_3, -temp_Bondlength, 0.0));
|
---|
| 187 | polygon.push_back( Vector(temp_Bondlength/SQRT_3, 0.0, temp_Bondlength));
|
---|
| 188 | polygon.push_back( Vector(temp_Bondlength/SQRT_3, 0.0, -temp_Bondlength));
|
---|
| 189 | polygon.push_back( Vector(-temp_Bondlength/SQRT_3, temp_Bondlength*sin(0.25*M_PI), temp_Bondlength*cos(0.25*M_PI)));
|
---|
| 190 | polygon.push_back( Vector(-temp_Bondlength/SQRT_3, temp_Bondlength*sin(0.75*M_PI), temp_Bondlength*cos(0.75*M_PI)));
|
---|
| 191 | polygon.push_back( Vector(-temp_Bondlength/SQRT_3, temp_Bondlength*sin(1.25*M_PI), temp_Bondlength*cos(1.25*M_PI)));
|
---|
| 192 | polygon.push_back( Vector(-temp_Bondlength/SQRT_3, temp_Bondlength*sin(1.75*M_PI), temp_Bondlength*cos(1.75*M_PI)));
|
---|
| 193 | ASSERT( polygon.size() == 10,
|
---|
| 194 | "SphericalPointDistribution::get<10>() - polygon has wrong size.");
|
---|
| 195 | return polygon;
|
---|
| 196 | }
|
---|
| 197 |
|
---|
| 198 | template <>
|
---|
[0c42f2] | 199 | SphericalPointDistribution::Polygon_t SphericalPointDistribution::get<11>() const
|
---|
[f54930] | 200 | {
|
---|
| 201 | Polygon_t polygon;
|
---|
| 202 | polygon.push_back( Vector(Bondlength,0.,0.));
|
---|
| 203 | {
|
---|
| 204 | const double temp_Bondlength = Bondlength*sin(0.4*M_PI);
|
---|
| 205 | polygon.push_back( Vector(Bondlength*cos(0.4*M_PI), temp_Bondlength, 0.0));
|
---|
| 206 | polygon.push_back( Vector(Bondlength*cos(0.4*M_PI), temp_Bondlength*cos(0.4*M_PI), temp_Bondlength*sin(0.4*M_PI)));
|
---|
| 207 | polygon.push_back( Vector(Bondlength*cos(0.4*M_PI), temp_Bondlength*cos(0.8*M_PI), temp_Bondlength*sin(0.8*M_PI)));
|
---|
| 208 | polygon.push_back( Vector(Bondlength*cos(0.4*M_PI), temp_Bondlength*cos(1.2*M_PI), temp_Bondlength*sin(1.2*M_PI)));
|
---|
| 209 | polygon.push_back( Vector(Bondlength*cos(0.4*M_PI), temp_Bondlength*cos(1.6*M_PI), temp_Bondlength*sin(1.6*M_PI)));
|
---|
| 210 | }
|
---|
| 211 | {
|
---|
| 212 | const double temp_Bondlength = Bondlength*sin(0.8*M_PI);
|
---|
| 213 | polygon.push_back( Vector(Bondlength*cos(0.8*M_PI), temp_Bondlength*cos(0.2*M_PI), temp_Bondlength*sin(0.2*M_PI)));
|
---|
| 214 | polygon.push_back( Vector(Bondlength*cos(0.8*M_PI), temp_Bondlength*cos(0.6*M_PI), temp_Bondlength*sin(0.6*M_PI)));
|
---|
| 215 | polygon.push_back( Vector(Bondlength*cos(0.8*M_PI), temp_Bondlength*cos(1.0*M_PI), temp_Bondlength*sin(1.0*M_PI)));
|
---|
| 216 | polygon.push_back( Vector(Bondlength*cos(0.8*M_PI), temp_Bondlength*cos(1.4*M_PI), temp_Bondlength*sin(1.4*M_PI)));
|
---|
| 217 | polygon.push_back( Vector(Bondlength*cos(0.8*M_PI), temp_Bondlength*cos(1.8*M_PI), temp_Bondlength*sin(1.8*M_PI)));
|
---|
| 218 | }
|
---|
| 219 | ASSERT( polygon.size() == 11,
|
---|
| 220 | "SphericalPointDistribution::get<11>() - polygon has wrong size.");
|
---|
| 221 | return polygon;
|
---|
| 222 | }
|
---|
| 223 |
|
---|
| 224 | template <>
|
---|
[0c42f2] | 225 | SphericalPointDistribution::Polygon_t SphericalPointDistribution::get<12>() const
|
---|
[f54930] | 226 | {
|
---|
| 227 | Polygon_t polygon;
|
---|
| 228 | polygon.push_back( Vector(Bondlength,0.,0.));
|
---|
| 229 | polygon.push_back( Vector(-Bondlength, 0.0, 0.0));
|
---|
| 230 | const double temp_Bondlength = Bondlength*0.5*SQRT_3;
|
---|
| 231 | polygon.push_back( Vector(temp_Bondlength/SQRT_3, temp_Bondlength, 0.0));
|
---|
| 232 | polygon.push_back( Vector(temp_Bondlength/SQRT_3, temp_Bondlength*cos(0.4*M_PI), temp_Bondlength*sin(0.4*M_PI)));
|
---|
| 233 | polygon.push_back( Vector(temp_Bondlength/SQRT_3, temp_Bondlength*cos(0.8*M_PI), temp_Bondlength*sin(0.8*M_PI)));
|
---|
| 234 | polygon.push_back( Vector(temp_Bondlength/SQRT_3, temp_Bondlength*cos(1.2*M_PI), temp_Bondlength*sin(1.2*M_PI)));
|
---|
| 235 | polygon.push_back( Vector(temp_Bondlength/SQRT_3, temp_Bondlength*cos(1.6*M_PI), temp_Bondlength*sin(1.6*M_PI)));
|
---|
| 236 | polygon.push_back( Vector(-temp_Bondlength/SQRT_3, -temp_Bondlength, 0.0));
|
---|
| 237 | polygon.push_back( Vector(-temp_Bondlength/SQRT_3, -temp_Bondlength*cos(0.4*M_PI), -temp_Bondlength*sin(0.4*M_PI)));
|
---|
| 238 | polygon.push_back( Vector(-temp_Bondlength/SQRT_3, -temp_Bondlength*cos(0.8*M_PI), -temp_Bondlength*sin(0.8*M_PI)));
|
---|
| 239 | polygon.push_back( Vector(-temp_Bondlength/SQRT_3, -temp_Bondlength*cos(1.2*M_PI), -temp_Bondlength*sin(1.2*M_PI)));
|
---|
| 240 | polygon.push_back( Vector(-temp_Bondlength/SQRT_3, -temp_Bondlength*cos(1.6*M_PI), -temp_Bondlength*sin(1.6*M_PI)));
|
---|
| 241 | ASSERT( polygon.size() == 12,
|
---|
| 242 | "SphericalPointDistribution::get<12>() - polygon has wrong size.");
|
---|
| 243 | return polygon;
|
---|
| 244 | }
|
---|
| 245 |
|
---|
| 246 | template <>
|
---|
[0c42f2] | 247 | SphericalPointDistribution::Polygon_t SphericalPointDistribution::get<14>() const
|
---|
[f54930] | 248 | {
|
---|
| 249 | Polygon_t polygon;
|
---|
| 250 | polygon.push_back( Vector(Bondlength,0.,0.));
|
---|
| 251 | polygon.push_back( Vector(-Bondlength, 0.0, 0.0));
|
---|
| 252 | const double temp_Bondlength = Bondlength*0.5*SQRT_3;
|
---|
| 253 | polygon.push_back( Vector(temp_Bondlength/SQRT_3, temp_Bondlength, 0.0));
|
---|
| 254 | polygon.push_back( Vector(temp_Bondlength/SQRT_3, temp_Bondlength*cos(M_PI/3.0), temp_Bondlength*sin(M_PI/3.0)));
|
---|
| 255 | polygon.push_back( Vector(temp_Bondlength/SQRT_3, temp_Bondlength*cos(2.0*M_PI/3.0), temp_Bondlength*sin(2.0*M_PI/3.0)));
|
---|
| 256 | polygon.push_back( Vector(temp_Bondlength/SQRT_3, -temp_Bondlength, 0.0));
|
---|
| 257 | polygon.push_back( Vector(temp_Bondlength/SQRT_3, temp_Bondlength*cos(4.0*M_PI/3.0), temp_Bondlength*sin(4.0*M_PI/3.0)));
|
---|
| 258 | polygon.push_back( Vector(temp_Bondlength/SQRT_3, temp_Bondlength*cos(5.0*M_PI/3.0), temp_Bondlength*sin(5.0*M_PI/3.0)));
|
---|
| 259 | polygon.push_back( Vector(-temp_Bondlength/SQRT_3, temp_Bondlength*cos(M_PI/6.0), temp_Bondlength*sin(M_PI/6.0)));
|
---|
| 260 | polygon.push_back( Vector(-temp_Bondlength/SQRT_3, temp_Bondlength*cos(M_PI/3.0 +M_PI/6.0), temp_Bondlength*sin(M_PI/3.0+M_PI/6.0)));
|
---|
| 261 | polygon.push_back( Vector(-temp_Bondlength/SQRT_3, temp_Bondlength*cos(2.0*M_PI/3.0 +M_PI/6.0), temp_Bondlength*sin(2.0*M_PI/3.0 +M_PI/6.0)));
|
---|
| 262 | polygon.push_back( Vector(-temp_Bondlength/SQRT_3, temp_Bondlength*cos(3.0*M_PI/3.0 +M_PI/6.0), temp_Bondlength*sin(3.0*M_PI/3.0 +M_PI/6.0)));
|
---|
| 263 | polygon.push_back( Vector(-temp_Bondlength/SQRT_3, temp_Bondlength*cos(4.0*M_PI/3.0 +M_PI/6.0), temp_Bondlength*sin(4.0*M_PI/3.0 +M_PI/6.0)));
|
---|
| 264 | polygon.push_back( Vector(-temp_Bondlength/SQRT_3, temp_Bondlength*cos(5.0*M_PI/3.0 +M_PI/6.0), temp_Bondlength*sin(5.0*M_PI/3.0 +M_PI/6.0)));
|
---|
| 265 | ASSERT( polygon.size() == 14,
|
---|
| 266 | "SphericalPointDistribution::get<14>() - polygon has wrong size.");
|
---|
| 267 | return polygon;
|
---|
| 268 | }
|
---|
| 269 |
|
---|