# | Line 11 | Line 11 | Lattice::Lattice(int latticeType, double latticeParame | |
---|---|---|
11 | latticePosY = NULL; | |
12 | latticePosZ = NULL; | |
13 | ||
14 | + | startX = 0.0; |
15 | + | startY = 0.0; |
16 | + | startZ = 0.0; |
17 | ||
18 | switch(latticeType){ | |
19 | ||
# | Line 30 | Line 33 | Lattice::Lattice(int latticeType, double latticeParame | |
33 | hasError = createHcpWaterLattice(latticeParameter); | |
34 | break; | |
35 | ||
36 | + | case ORTHORHOMBIC_LATTICE_TYPE: |
37 | + | hasError = createFccLattice(latticeParameter); |
38 | + | break; |
39 | + | |
40 | + | |
41 | default: | |
42 | //simerror here..... | |
43 | ; | |
# | Line 42 | Line 50 | Lattice::Lattice(int latticeType, double latticeParame | |
50 | return; | |
51 | } | |
52 | ||
53 | + | Lattice::Lattice(int latticeType, double latticeParameters[3]){ |
54 | + | int hasError; |
55 | ||
56 | + | latticePosX = NULL; |
57 | + | latticePosY = NULL; |
58 | + | latticePosZ = NULL; |
59 | + | |
60 | + | startX = 0.0; |
61 | + | startY = 0.0; |
62 | + | startZ = 0.0; |
63 | + | |
64 | + | switch(latticeType){ |
65 | + | |
66 | + | case ORTHORHOMBIC_LATTICE_TYPE: |
67 | + | hasError = createOrthorhombicLattice(latticeParameters); |
68 | + | break; |
69 | + | |
70 | + | |
71 | + | default: |
72 | + | //simerror here..... |
73 | + | ; |
74 | + | } |
75 | + | |
76 | + | latticePosX = new double[nCellSites]; |
77 | + | latticePosY = new double[nCellSites]; |
78 | + | latticePosZ = new double[nCellSites]; |
79 | + | |
80 | + | return; |
81 | + | } |
82 | + | |
83 | + | |
84 | Lattice::~Lattice(void){ | |
85 | if (latticePosX != NULL) delete[] latticePosX; | |
86 | if (latticePosY != NULL) delete[] latticePosY; | |
# | Line 54 | Line 92 | Lattice::~Lattice(void){ | |
92 | double cell2; | |
93 | double rroot3; | |
94 | ||
95 | < | cellLength = latticeParameter; |
95 | > | cellLengthX = latticeParameter; |
96 | > | cellLengthY = latticeParameter; |
97 | > | cellLengthZ = latticeParameter; |
98 | ||
99 | cell2 = 0.5 * latticeParameter; | |
100 | rroot3 = 1.0 / sqrt(3.0); | |
# | Line 105 | Line 145 | Lattice::~Lattice(void){ | |
145 | } | |
146 | ||
147 | ||
148 | + | int Lattice::createOrthorhombicLattice(double latticeParameters[3]){ |
149 | + | double cell2; |
150 | + | double rroot3; |
151 | + | |
152 | + | cellLengthX = latticeParameter[0]; |
153 | + | cellLengthY = latticeParameter[1]; |
154 | + | cellLengthZ = latticeParameter[2]; |
155 | + | |
156 | + | cellx2 = 0.5 * latticeParameter[0]; |
157 | + | cellx2 = 0.5 * latticeParameter[1]; |
158 | + | cellx2 = 0.5 * latticeParameter[2]; |
159 | + | rroot3 = 1.0 / sqrt(3.0); |
160 | + | |
161 | + | nCellSites = 4; |
162 | + | // create new unit cells |
163 | + | thisUnitCell.sx = new double[nCellSites]; |
164 | + | thisUnitCell.sy = new double[nCellSites]; |
165 | + | thisUnitCell.sz = new double[nCellSites]; |
166 | + | thisUnitCell.s_ex = new double[nCellSites]; |
167 | + | thisUnitCell.s_ey = new double[nCellSites]; |
168 | + | thisUnitCell.s_ez = new double[nCellSites]; |
169 | + | |
170 | + | // add members to each unit cell |
171 | + | // Molecule 1 |
172 | + | thisUnitCell.sx[0] = 0.0; |
173 | + | thisUnitCell.sy[0] = 0.0; |
174 | + | thisUnitCell.sz[0] = 0.0; |
175 | + | thisUnitCell.s_ex[0] = rroot3; |
176 | + | thisUnitCell.s_ey[0] = rroot3; |
177 | + | thisUnitCell.s_ez[0] = rroot3; |
178 | + | |
179 | + | // Molecule 2 |
180 | + | thisUnitCell.sx[1] = 0.0; |
181 | + | thisUnitCell.sy[1] = celly2; |
182 | + | thisUnitCell.sz[1] = cellz2; |
183 | + | thisUnitCell.s_ex[1] = -rroot3; |
184 | + | thisUnitCell.s_ey[1] = rroot3; |
185 | + | thisUnitCell.s_ez[1] = -rroot3; |
186 | + | |
187 | + | // Molecule 3 |
188 | + | thisUnitCell.sx[2] = cellx2; |
189 | + | thisUnitCell.sy[2] = celly2; |
190 | + | thisUnitCell.sz[2] = 0.0; |
191 | + | thisUnitCell.s_ex[2] = rroot3; |
192 | + | thisUnitCell.s_ey[2] = -rroot3; |
193 | + | thisUnitCell.s_ez[2] = -rroot3; |
194 | + | |
195 | + | // Molecule 4 |
196 | + | thisUnitCell.sx[3] = cellx2; |
197 | + | thisUnitCell.sy[3] = 0.0; |
198 | + | thisUnitCell.sz[3] = cellz2; |
199 | + | thisUnitCell.s_ex[3] = -rroot3; |
200 | + | thisUnitCell.s_ey[3] = -rroot3; |
201 | + | thisUnitCell.s_ez[3] = rroot3; |
202 | + | |
203 | + | return 0; |
204 | + | } |
205 | + | |
206 | + | |
207 | // Body centered cubic lattice | |
208 | int Lattice::createBccLattice(double latticeParameter){ | |
209 | return 0; | |
# | Line 263 | Line 362 | Lattice::~Lattice(void){ | |
362 | ||
363 | for( iref=0;iref < nCellSites;iref++){ | |
364 | ||
365 | < | latticePosX[iref] = thisUnitCell.sx[iref] + |
366 | < | cellLength * (double( ix ) - 0.5); |
367 | < | latticePosY[iref] = thisUnitCell.sy[iref] + |
368 | < | cellLength * (double( iy ) - 0.5); |
369 | < | latticePosZ[iref] = thisUnitCell.sz[iref] + |
370 | < | cellLength * (double( iz ) - 0.5); |
365 | > | latticePosX[iref] = startX + thisUnitCell.sx[iref] + |
366 | > | cellLengthX * (double( ix ) - 0.5); |
367 | > | latticePosY[iref] = startY + thisUnitCell.sy[iref] + |
368 | > | cellLengthY * (double( iy ) - 0.5); |
369 | > | latticePosZ[iref] = startZ + thisUnitCell.sz[iref] + |
370 | > | cellLengthZ * (double( iz ) - 0.5); |
371 | ||
372 | } | |
373 |
– | Removed lines |
+ | Added lines |
< | Changed lines |
> | Changed lines |