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 |
#include "types/DirectionalAtomType.hpp" |
26 |
|
27 |
namespace oopse { |
28 |
|
29 |
void DirectionalAtomType::complete() { |
30 |
|
31 |
AtomType::complete(); |
32 |
|
33 |
int isError; |
34 |
GenericData* data; |
35 |
|
36 |
if (isDipole()) { |
37 |
data = getPropertyByName("Dipole"); |
38 |
if (data != NULL) { |
39 |
DoubleGenericData* doubleData= dynamic_cast<DoubleGenericData*>(data); |
40 |
|
41 |
if (doubleData != NULL) { |
42 |
double dipole = doubleData->getData(); |
43 |
|
44 |
newDipoleType(&atp_.ident,, &dipole, &isError); |
45 |
if (isError != 0) { |
46 |
sprintf( painCave.errMsg, |
47 |
"Fortran rejected newDipoleType\n"); |
48 |
painCave.severity = OOPSE_ERROR; |
49 |
painCave.isFatal = 1; |
50 |
simError(); |
51 |
} |
52 |
|
53 |
} else { |
54 |
sprintf( painCave.errMsg, |
55 |
"Can not cast GenericData to DoubleGenericData\n"); |
56 |
painCave.severity = OOPSE_ERROR; |
57 |
painCave.isFatal = 1; |
58 |
simError(); |
59 |
} |
60 |
} else { |
61 |
sprintf( painCave.errMsg, "Can not find Dipole Parameters\n"); |
62 |
painCave.severity = OOPSE_ERROR; |
63 |
painCave.isFatal = 1; |
64 |
simError(); |
65 |
} |
66 |
} |
67 |
|
68 |
if (isSticky()) { |
69 |
data = getPropertyByName("Sticky"); |
70 |
if (data != NULL) { |
71 |
StickyParamGenericData* stickyData = dynamic_cast<LJParamGenericData*>(data); |
72 |
|
73 |
if (stickyData != NULL) { |
74 |
StickyParam stickyParam = stickyData->getData(); |
75 |
|
76 |
makeStickyType( &stickyParam.w0, &stickyParam.v0, &stickyParam.v0p, &stickyParam.rl, |
77 |
&stickyParam.ru, &stickyParam.rlp, &stickyParam.rup); |
78 |
|
79 |
if (isError != 0) { |
80 |
sprintf( painCave.errMsg, |
81 |
"Fortran rejected newLJtype\n"); |
82 |
painCave.severity = OOPSE_ERROR; |
83 |
painCave.isFatal = 1; |
84 |
simError(); |
85 |
} |
86 |
|
87 |
} else { |
88 |
sprintf( painCave.errMsg, |
89 |
"Can not cast GenericData to StickyParam\n"); |
90 |
painCave.severity = OOPSE_ERROR; |
91 |
painCave.isFatal = 1; |
92 |
simError(); |
93 |
} |
94 |
} else { |
95 |
sprintf( painCave.errMsg, "Can not find Parameters for Sticky\n"); |
96 |
painCave.severity = OOPSE_ERROR; |
97 |
painCave.isFatal = 1; |
98 |
simError(); |
99 |
} |
100 |
} |
101 |
|
102 |
|
103 |
} |
104 |
|
105 |
|
106 |
} //end namespace oopse |