ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/group/branches/new_design/OOPSE-3.0/src/types/DirectionalAtomType.cpp
Revision: 1770
Committed: Tue Nov 23 17:53:43 2004 UTC (19 years, 7 months ago) by tim
File size: 3910 byte(s)
Log Message:
add Electrostatic AtomType Section Parser

File Contents

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