1 |
/* |
2 |
* sphericalNanoparticle.cpp |
3 |
* OOPSE-2.0 |
4 |
* |
5 |
* Created by Charles F. Vardeman II on 9/28/05. |
6 |
* Copyright 2005 __MyCompanyName__. All rights reserved. |
7 |
* Copyright (c) 2005 The University of Notre Dame. All Rights Reserved. |
8 |
* |
9 |
* The University of Notre Dame grants you ("Licensee") a |
10 |
* non-exclusive, royalty free, license to use, modify and |
11 |
* redistribute this software in source and binary code form, provided |
12 |
* that the following conditions are met: |
13 |
* |
14 |
* 1. Acknowledgement of the program authors must be made in any |
15 |
* publication of scientific results based in part on use of the |
16 |
* program. An acceptable form of acknowledgement is citation of |
17 |
* the article in which the program was described (Matthew |
18 |
* A. Meineke, Charles F. Vardeman II, Teng Lin, Christopher |
19 |
* J. Fennell and J. Daniel Gezelter, "OOPSE: An Object-Oriented |
20 |
* Parallel Simulation Engine for Molecular Dynamics," |
21 |
* J. Comput. Chem. 26, pp. 252-271 (2005)) |
22 |
* |
23 |
* 2. Redistributions of source code must retain the above copyright |
24 |
* notice, this list of conditions and the following disclaimer. |
25 |
* |
26 |
* 3. Redistributions in binary form must reproduce the above copyright |
27 |
* notice, this list of conditions and the following disclaimer in the |
28 |
* documentation and/or other materials provided with the |
29 |
* distribution. |
30 |
* |
31 |
* This software is provided "AS IS," without a warranty of any |
32 |
* kind. All express or implied conditions, representations and |
33 |
* warranties, including any implied warranty of merchantability, |
34 |
* fitness for a particular purpose or non-infringement, are hereby |
35 |
* excluded. The University of Notre Dame and its licensors shall not |
36 |
* be liable for any damages suffered by licensee as a result of |
37 |
* using, modifying or distributing the software or its |
38 |
* derivatives. In no event will the University of Notre Dame or its |
39 |
* licensors be liable for any lost revenue, profit or data, or for |
40 |
* direct, indirect, special, consequential, incidental or punitive |
41 |
* damages, however caused and regardless of the theory of liability, |
42 |
* arising out of the use of or inability to use software, even if the |
43 |
* University of Notre Dame has been advised of the possibility of |
44 |
* such damages. |
45 |
*/ |
46 |
|
47 |
#include "sphericalNanoparticle.hpp" |
48 |
#include <cstdlib> |
49 |
#include <cstdio> |
50 |
#include <cstring> |
51 |
#include <cmath> |
52 |
#include <iostream> |
53 |
#include <string> |
54 |
#include <map> |
55 |
#include <fstream> |
56 |
|
57 |
#include "config.h" |
58 |
|
59 |
|
60 |
#include "lattice/LatticeFactory.hpp" |
61 |
#include "utils/MoLocator.hpp" |
62 |
#include "lattice/Lattice.hpp" |
63 |
#include "brains/Register.hpp" |
64 |
#include "brains/SimInfo.hpp" |
65 |
#include "brains/SimCreator.hpp" |
66 |
#include "io/DumpWriter.hpp" |
67 |
#include "math/Vector3.hpp" |
68 |
#include "math/SquareMatrix3.hpp" |
69 |
#include "utils/StringUtils.hpp" |
70 |
|
71 |
using namespace std; |
72 |
using namespace oopse; |
73 |
|
74 |
sphericalNanoparticle::sphericalNanoparticle(double radius, int latticeCnst){ |
75 |
|
76 |
particleRadius = radius; |
77 |
particleDiameter = 2.0 * radius; |
78 |
latticeConstant = latticeCnst; |
79 |
|
80 |
// Number of Unit Cells in Length first |
81 |
ny_ = (int)(particleDiameter/latticeConstant); |
82 |
// Number of unit cells in Width |
83 |
nx_ = (int)(particleDiameter/latticeConstant); |
84 |
nz_ = (int)(particleDiameter/latticeConstant); |
85 |
} |
86 |
|
87 |
int sphericalNanoparticle::getNMol(Lattice& simpleLat){ |
88 |
int numMol; |
89 |
int numMolPerCell |
90 |
std::vector<Vector3d> latticePos; |
91 |
|
92 |
numMol = 0; |
93 |
numMolPerCell = simpleLat->getNumSitesPerCell(); |
94 |
for(int i = -nx_; i < nx_; i++) { |
95 |
for(int j = -ny_; j < ny_; j++) { |
96 |
for(int k = -nz_; k < nz_; k++) { |
97 |
simpleLat->getLatticePointsPos(latticePos, i, j, k); |
98 |
|
99 |
for(int l = 0; l < numMolPerCell; l++) { |
100 |
rx = latticePos[l][0]; |
101 |
ry = latticePos[l][1]; |
102 |
rz = latticePos[l][2]; |
103 |
dist = sqrt(rx*rx + ry*ry + rz*rz) |
104 |
if (dist <= particleRadius){ |
105 |
numMol++; |
106 |
} |
107 |
} |
108 |
} |
109 |
} |
110 |
} |
111 |
|
112 |
return numMol; |
113 |
} |
114 |
|
115 |
int sphericalNanoparticle::getNMol(Lattice &simpleLat, int nComponents, double &shellRadius,int &numSites){ |
116 |
int numMol; |
117 |
int numMolPerCell |
118 |
std::vector<Vector3d> latticePos; |
119 |
|
120 |
numMol = 0; |
121 |
numMolPerCell = simpleLat->getNumSitesPerCell(); |
122 |
for(int i = -nx_; i < nx_; i++) { |
123 |
for(int j = -ny_; j < ny_; j++) { |
124 |
for(int k = -nz_; k < nz_; k++) { |
125 |
simpleLat->getLatticePointsPos(latticePos, i, j, k); |
126 |
|
127 |
for(int l = 0; l < numMolPerCell; l++) { |
128 |
rx = latticePos[l][0]; |
129 |
ry = latticePos[l][1]; |
130 |
rz = latticePos[l][2]; |
131 |
dist = sqrt(rx*rx + ry*ry + rz*rz) |
132 |
if (dist <= particleRadius){ |
133 |
for (int l = 0; l< nComponents -1;l++){ |
134 |
if (dist <= shellRadius[l]{ |
135 |
numMol++; |
136 |
} |
137 |
} |
138 |
} |
139 |
} |
140 |
} |
141 |
} |
142 |
|
143 |
return numMol; |
144 |
} |
145 |
|
146 |
|
147 |
|
148 |
|
149 |
void sphericalNanoparticle::buildSphericalNanoparticle(Molecule* ){ |
150 |
|
151 |
|
152 |
|
153 |
|
154 |
|
155 |
} |
156 |
|