1 |
/* |
2 |
* Copyright (C) 2000-2004 Object Oriented Parallel Simulation Engine (OOPSE) project |
3 |
* |
4 |
* Contact: oopse@oopse.org |
5 |
* |
6 |
* This program is free software; you can redistribute it and/or |
7 |
* modify it under the terms of the GNU Lesser General Public License |
8 |
* as published by the Free Software Foundation; either version 2.1 |
9 |
* of the License, or (at your option) any later version. |
10 |
* All we ask is that proper credit is given for our work, which includes |
11 |
* - but is not limited to - adding the above copyright notice to the beginning |
12 |
* of your source code files, and to any copyright notice that you may distribute |
13 |
* with programs based on this work. |
14 |
* |
15 |
* This program is distributed in the hope that it will be useful, |
16 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
17 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
18 |
* GNU Lesser General Public License for more details. |
19 |
* |
20 |
* You should have received a copy of the GNU Lesser General Public License |
21 |
* along with this program; if not, write to the Free Software |
22 |
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
23 |
* |
24 |
*/ |
25 |
|
26 |
#include "types/DirectionalAtomType.hpp" |
27 |
#include "UseTheForce/DarkSide/dipole_interface.h" |
28 |
#include "UseTheForce/DarkSide/sticky_interface.h" |
29 |
#include "utils/simError.h" |
30 |
namespace oopse { |
31 |
|
32 |
void DirectionalAtomType::complete() { |
33 |
|
34 |
// |
35 |
AtomType::complete(); |
36 |
|
37 |
int isError; |
38 |
GenericData* data; |
39 |
|
40 |
//setup dipole atom type in fortran side |
41 |
if (isDipole()) { |
42 |
data = getPropertyByName("Dipole"); |
43 |
if (data != NULL) { |
44 |
DoubleGenericData* doubleData= dynamic_cast<DoubleGenericData*>(data); |
45 |
|
46 |
if (doubleData != NULL) { |
47 |
double dipole = doubleData->getData(); |
48 |
|
49 |
newDipoleType(&atp.ident, &dipole, &isError); |
50 |
if (isError != 0) { |
51 |
sprintf( painCave.errMsg, |
52 |
"Fortran rejected newDipoleType\n"); |
53 |
painCave.severity = OOPSE_ERROR; |
54 |
painCave.isFatal = 1; |
55 |
simError(); |
56 |
} |
57 |
|
58 |
} else { |
59 |
sprintf( painCave.errMsg, |
60 |
"Can not cast GenericData to DoubleGenericData\n"); |
61 |
painCave.severity = OOPSE_ERROR; |
62 |
painCave.isFatal = 1; |
63 |
simError(); |
64 |
} |
65 |
} else { |
66 |
sprintf( painCave.errMsg, "Can not find Dipole Parameters\n"); |
67 |
painCave.severity = OOPSE_ERROR; |
68 |
painCave.isFatal = 1; |
69 |
simError(); |
70 |
} |
71 |
} |
72 |
|
73 |
//setup quadrupole atom type in fortran side |
74 |
if (isQuadrupole()) { |
75 |
data = getPropertyByName("Quadrupole"); |
76 |
if (data != NULL) { |
77 |
Vector3dGenericData* vector3dData= dynamic_cast<Vector3dGenericData*>(data); |
78 |
|
79 |
if (vector3dData != NULL) { |
80 |
Vector3d diagElem= vector3dData->getData(); |
81 |
Mat3x3d Q; |
82 |
Q(0, 0) = diagElem[0]; |
83 |
Q(1, 1) = diagElem[1]; |
84 |
Q(2, 2) = diagElem[2]; |
85 |
|
86 |
//newQuadrupoleType(&atp.ident, Q->getArrayPointer, &isError); |
87 |
if (isError != 0) { |
88 |
sprintf( painCave.errMsg, |
89 |
"Fortran rejected newQuadrupoleType\n"); |
90 |
painCave.severity = OOPSE_ERROR; |
91 |
painCave.isFatal = 1; |
92 |
simError(); |
93 |
} |
94 |
|
95 |
} else { |
96 |
sprintf( painCave.errMsg, |
97 |
"Can not cast GenericData to Vector3dGenericData\n"); |
98 |
painCave.severity = OOPSE_ERROR; |
99 |
painCave.isFatal = 1; |
100 |
simError(); |
101 |
} |
102 |
} else { |
103 |
sprintf( painCave.errMsg, "Can not find Quadrupole Parameters\n"); |
104 |
painCave.severity = OOPSE_ERROR; |
105 |
painCave.isFatal = 1; |
106 |
simError(); |
107 |
} |
108 |
|
109 |
} |
110 |
|
111 |
//setup sticky atom type in fortran side |
112 |
if (isSticky()) { |
113 |
data = getPropertyByName("Sticky"); |
114 |
if (data != NULL) { |
115 |
StickyParamGenericData* stickyData = dynamic_cast<StickyParamGenericData*>(data); |
116 |
|
117 |
if (stickyData != NULL) { |
118 |
StickyParam stickyParam = stickyData->getData(); |
119 |
|
120 |
/**@todo change fortran interface */ |
121 |
//makeStickyType(&atp.ident, &stickyParam.w0, &stickyParam.v0, &stickyParam.v0p, &stickyParam.rl, |
122 |
// &stickyParam.ru, &stickyParam.rlp, &stickyParam.rup); |
123 |
|
124 |
if (isError != 0) { |
125 |
sprintf( painCave.errMsg, |
126 |
"Fortran rejected newLJtype\n"); |
127 |
painCave.severity = OOPSE_ERROR; |
128 |
painCave.isFatal = 1; |
129 |
simError(); |
130 |
} |
131 |
|
132 |
} else { |
133 |
sprintf( painCave.errMsg, |
134 |
"Can not cast GenericData to StickyParam\n"); |
135 |
painCave.severity = OOPSE_ERROR; |
136 |
painCave.isFatal = 1; |
137 |
simError(); |
138 |
} |
139 |
} else { |
140 |
sprintf( painCave.errMsg, "Can not find Parameters for Sticky\n"); |
141 |
painCave.severity = OOPSE_ERROR; |
142 |
painCave.isFatal = 1; |
143 |
simError(); |
144 |
} |
145 |
} |
146 |
|
147 |
//setup GayBerne type in fortran side |
148 |
|
149 |
} |
150 |
|
151 |
|
152 |
} //end namespace oopse |