ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/group/trunk/OOPSE-1.0/utils/sysbuilder/Lattice.cpp
(Generate patch)

Comparing trunk/OOPSE-1.0/utils/sysbuilder/Lattice.cpp (file contents):
Revision 1423 by tim, Wed Jul 28 04:58:20 2004 UTC vs.
Revision 1427 by tim, Wed Jul 28 18:42:59 2004 UTC

# Line 3 | Line 3 | static LatticeCreator<FCCLattice> *BCCLatticeCreator =
3   #include "LatticeCreator.hpp"
4  
5   static LatticeCreator<FCCLattice> *FCCLatticeCreator = new LatticeCreator<FCCLattice>(FCCLatticeType);
6 < static LatticeCreator<FCCLattice> *BCCLatticeCreator = new LatticeCreator<FCCLattice>(BCCLatticeType);
7 < static LatticeCreator<FCCLattice> *HCPLatticeCreator = new LatticeCreator<FCCLattice>(HCPCLatticeType);
8 < static LatticeCreator<FCCLattice> *OrthorhombicLattice = new LatticeCreator<FCCLattice>(OrthorhombicLatticeType);
6 > //static LatticeCreator<FCCLattice> *BCCLatticeCreator = new LatticeCreator<FCCLattice>(BCCLatticeType);
7 > //static LatticeCreator<FCCLattice> *HCPLatticeCreator = new LatticeCreator<FCCLattice>(HCPCLatticeType);
8 > //static LatticeCreator<FCCLattice> *OrthorhombicLattice = new LatticeCreator<FCCLattice>(OrthorhombicLatticeType);
9  
10 + CubicLattice::CubicLattice(){
11 +  latticeParam = 1.0;
12 +  
13 +  cellLen.x = latticeParam;
14 +  cellLen.y = latticeParam;
15 +  cellLen.z = latticeParam;
16 +  
17 + }
18  
19 + vector<double> CubicLattice::getLatticeConstant(){
20 +  vector lc;
21 +  
22 +  lc.push_back(cellLen.x);
23 +  return lc;
24 + }
25  
26 + void CubicLattice::setLatticeConstant(const vector<double>& lc){
27 +  double latticeParam;
28 +  
29 +  if(lc.size() < 1){
30 +    cerr << "CubicLattice::setLatticeConstant Error: the size of lattice constant vector  is 0" << endl;
31 +    exit(1);
32 +  }
33 +  else if (lc.size() > 1){
34 +    cerr << "CubicLattice::setLatticeConstant Warning: the size of lattice constant vector  is " << lc.size() << endl;
35 +  }
36 +  
37 +  latticeParam = lc[0];
38 +  
39 +  cellLen.x = latticeParam;
40 +  cellLen.y = latticeParam;
41 +  cellLen.z = latticeParam;
42 +  
43 +  update();
44 + }
45 +
46 + FCCLattice::FCCLattice() : CubicLattice(){
47 +  nCellSites = 4;
48 +  cellSitesPos.resize(nCellSites);
49 +  cellSitesOrt.resize(nCellSites);
50 +  update();
51 +
52 + }
53 +
54 + void FCCLattice::update(){
55 +
56 +  double cellLenOver2;
57 +  double oneOverRoot3;
58 +
59 +  cellLenOver2  = 0.5 * latticeParam;
60 +  oneOverRoot3 = 1.0 / sqrt(3.0);
61 +
62 +  // Molecule 1
63 +  cellSitesPos[0].x = 0.0;
64 +  cellSitesPos[0].y = 0.0;
65 +  cellSitesPos[0].z = 0.0;
66 +  
67 +   cellSitesOrt[0].x = oneOverRoot3;
68 +   cellSitesOrt[0].y = oneOverRoot3;
69 +   cellSitesOrt[0].z = oneOverRoot3;
70 +
71 +  // Molecule 2  
72 +  cellSitesPos[1].x   = 0.0;
73 +  cellSitesPos[1].y   = cellLenOver2;
74 +  cellSitesPos[1].z   = cellLenOver2;
75 +
76 +  cellSitesOrt[1].x = -oneOverRoot3;
77 +  cellSitesOrt[1].y = oneOverRoot3;
78 +  cellSitesOrt[1].z = -oneOverRoot3;
79 +  
80 +  // Molecule 3
81 +  cellSitesPos[2].x   = cellLenOver2;
82 +  cellSitesPos[2].y   = cellLenOver2;
83 +  cellSitesPos[2].z   = 0.0;
84 +
85 +  cellSitesOrt[2].x = oneOverRoot3;
86 +  cellSitesOrt[2].y = -oneOverRoot3;
87 +  cellSitesOrt[2].z = -oneOverRoot3;
88 +
89 +  // Molecule 4
90 +
91 +  cellSitesPos[3].x   = cellLenOver2;
92 +  cellSitesPos[3].y   = 0.0;
93 +  cellSitesPos[3].z   = cellLenOver2;
94 +
95 +  cellSitesOrt[3].x = -oneOverRoot3;
96 +  cellSitesOrt[3].y = oneOverRoot3;
97 +  cellSitesOrt[3].z = oneOverRoot3;
98 + }
99 +

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines