OpenMD
3.2
Molecular Dynamics in the Open
Toggle main menu visibility
Loading...
Searching...
No Matches
Decahedron.cpp
1
/*
2
* Copyright (c) 2004-present, The University of Notre Dame. All rights
3
* reserved.
4
*
5
* Redistribution and use in source and binary forms, with or without
6
* modification, are permitted provided that the following conditions are met:
7
*
8
* 1. Redistributions of source code must retain the above copyright notice,
9
* this list of conditions and the following disclaimer.
10
*
11
* 2. Redistributions in binary form must reproduce the above copyright notice,
12
* this list of conditions and the following disclaimer in the documentation
13
* and/or other materials provided with the distribution.
14
*
15
* 3. Neither the name of the copyright holder nor the names of its
16
* contributors may be used to endorse or promote products derived from
17
* this software without specific prior written permission.
18
*
19
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
20
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
22
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
23
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
24
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
25
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
27
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29
* POSSIBILITY OF SUCH DAMAGE.
30
*
31
* SUPPORT OPEN SCIENCE! If you use OpenMD or its source code in your
32
* research, please cite the following paper when you publish your work:
33
*
34
* [1] Drisko et al., J. Open Source Softw. 9, 7004 (2024).
35
*
36
* Good starting points for code and simulation methodology are:
37
*
38
* [2] Meineke, et al., J. Comp. Chem. 26, 252-271 (2005).
39
* [3] Fennell & Gezelter, J. Chem. Phys. 124, 234104 (2006).
40
* [4] Sun, Lin & Gezelter, J. Chem. Phys. 128, 234107 (2008).
41
* [5] Vardeman, Stocker & Gezelter, J. Chem. Theory Comput. 7, 834 (2011).
42
* [6] Kuang & Gezelter, Mol. Phys., 110, 691-701 (2012).
43
* [7] Lamichhane, Gezelter & Newman, J. Chem. Phys. 141, 134109 (2014).
44
* [8] Bhattarai, Newman & Gezelter, Phys. Rev. B 99, 094106 (2019).
45
* [9] Drisko & Gezelter, J. Chem. Theory Comput. 20, 4986-4997 (2024).
46
*/
47
48
#include "
clusters/Decahedron.hpp
"
49
50
#include <algorithm>
51
#include <cmath>
52
53
#include "utils/Constants.hpp"
54
55
using namespace
std;
56
57
namespace
OpenMD
{
58
59
Decahedron::Decahedron
(
int
columnAtoms,
int
shells,
int
twinAtoms) :
60
N_(columnAtoms), M_(shells), K_(twinAtoms) {
61
Basis.clear();
62
Points.clear();
63
64
//
65
// Initialize Basis vectors.
66
//
67
const
RealType phi = 2.0 * Constants::PI / 5.0;
// 72 degrees
68
const
RealType r3o2 = 0.5 * sqrt(3.0);
69
70
Basis.push_back(
71
Vector3d(r3o2 * cos(0.0 * phi), r3o2 * sin(0.0 * phi), 0.0));
72
Basis.push_back(
73
Vector3d(r3o2 * cos(1.0 * phi), r3o2 * sin(1.0 * phi), 0.0));
74
Basis.push_back(
75
Vector3d(r3o2 * cos(2.0 * phi), r3o2 * sin(2.0 * phi), 0.0));
76
Basis.push_back(
77
Vector3d(r3o2 * cos(3.0 * phi), r3o2 * sin(3.0 * phi), 0.0));
78
Basis.push_back(
79
Vector3d(r3o2 * cos(4.0 * phi), r3o2 * sin(4.0 * phi), 0.0));
80
}
81
82
vector<Vector3d>
Decahedron::getPoints
() {
83
// Generate central column of Decahedron
84
85
for
(
int
i = 0; i < N_; i++) {
86
Points.push_back(Vector3d(0.0, 0.0, RealType(i) - 0.5 * (N_ - 1)));
87
}
88
89
for
(
int
i = 1; i < M_ + 1; i++) {
90
// generate the shells of the decahedron:
91
92
vector<Vector3d> ring;
93
94
if
(i > K_ - 1) {
95
ring =
truncatedRing
(i, i - K_ + 1);
96
}
else
{
97
ring =
truncatedRing
(i, 0);
98
}
99
100
// shift the rings in the z-direction (along the shell)
101
102
for
(
int
j = 0; j < N_ - i; j++) {
103
Vector3d shift =
104
Vector3d(0, 0, -0.5 * RealType((N_ - i) - 1) + RealType(j));
105
106
for
(vector<Vector3d>::iterator k = ring.begin(); k != ring.end();
107
++k) {
108
Points.push_back((*k) + shift);
109
}
110
}
111
}
112
return
Points;
113
}
114
115
vector<Vector3d>
Decahedron::truncatedRing
(
int
n,
int
k) {
116
// This function generates the rings of a Decahedron
117
// n: index of shell (order of ring)
118
// k: how many atoms are missing from both ends of one side of
119
// pentagon ring
120
121
vector<Vector3d> ring;
122
123
// Generate atomic coordinates along each side of pentagonal ring
124
for
(
int
i = 0; i < 5; i++) {
125
Vector3d b1 = Basis[i];
126
Vector3d b2 = Basis[(i + 1) % 5];
127
128
if
(k == 0) {
129
// without truncation
130
for
(
int
j = 0; j < n; j++) {
131
ring.push_back(RealType(n) * b1 + RealType(j) * (b2 - b1));
132
}
133
134
}
else
{
135
for
(
int
j = k; j <= n - k; j++) {
136
// with truncation
137
ring.push_back(RealType(n) * b1 + RealType(j) * (b2 - b1));
138
}
139
}
140
}
141
return
ring;
142
}
143
144
CurlingStoneDecahedron::CurlingStoneDecahedron(
int
columnAtoms,
int
shells,
145
int
twinAtoms,
146
int
truncatedPlanes) :
147
Decahedron
(columnAtoms, shells, twinAtoms),
148
T_(truncatedPlanes) {}
149
150
vector<Vector3d>
CurlingStoneDecahedron::getPoints
() {
151
vector<Vector3d> raw =
Decahedron::getPoints
();
152
vector<Vector3d> snipped;
153
RealType maxZ, minZ;
154
155
maxZ = raw.begin()->z();
156
minZ = raw.begin()->z();
157
158
for
(vector<Vector3d>::iterator i = raw.begin(); i != raw.end(); ++i) {
159
maxZ = max(maxZ, (*i).z());
160
minZ = min(minZ, (*i).z());
161
}
162
163
for
(vector<Vector3d>::iterator i = raw.begin(); i != raw.end(); ++i) {
164
if
(((*i).z() < maxZ - 0.995 * (T_ / 2.0)) &&
165
((*i).z() > minZ + 0.995 * (T_ / 2.0))) {
166
snipped.push_back((*i));
167
}
168
}
169
return
snipped;
170
}
171
172
}
// namespace OpenMD
Decahedron.hpp
Decahedron cluster structure generator.
OpenMD::CurlingStoneDecahedron::getPoints
vector< Vector3d > getPoints()
Get the generated points in the cluster.
Definition
Decahedron.cpp:150
OpenMD::Decahedron
Creates the regular decahedron, Ino decahedron, or truncated (Marks) decahedron structures (depending...
Definition
Decahedron.hpp:100
OpenMD::Decahedron::getPoints
virtual vector< Vector3d > getPoints()
Get the generated points in the cluster.
Definition
Decahedron.cpp:82
OpenMD::Decahedron::truncatedRing
vector< Vector3d > truncatedRing(int n, int k)
Generate the rings of the Decahedron.
Definition
Decahedron.cpp:115
OpenMD::Decahedron::Decahedron
Decahedron(int columnAtoms, int shells, int twinAtoms)
Default constructor.
Definition
Decahedron.cpp:59
OpenMD
This basic Periodic Table class was originally taken from the data.cpp file in OpenBabel.
Definition
ActionCorrFunc.cpp:63
clusters
Decahedron.cpp
Generated on
for OpenMD by
1.17.0