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: 1813
Committed: Wed Dec 1 17:38:32 2004 UTC (19 years, 9 months ago) by tim
File size: 5431 byte(s)
Log Message:
refactory AtomType

File Contents

# User Rev Content
1 tim 1769 /*
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 tim 1770 //
32 tim 1769 AtomType::complete();
33    
34     int isError;
35     GenericData* data;
36    
37 tim 1813 //setup dipole atom type in fortran side
38 tim 1769 if (isDipole()) {
39     data = getPropertyByName("Dipole");
40     if (data != NULL) {
41     DoubleGenericData* doubleData= dynamic_cast<DoubleGenericData*>(data);
42    
43     if (doubleData != NULL) {
44     double dipole = doubleData->getData();
45    
46 tim 1787 newDipoleType(&atp.ident, &dipole, &isError);
47 tim 1769 if (isError != 0) {
48     sprintf( painCave.errMsg,
49     "Fortran rejected newDipoleType\n");
50     painCave.severity = OOPSE_ERROR;
51     painCave.isFatal = 1;
52     simError();
53     }
54    
55     } else {
56     sprintf( painCave.errMsg,
57     "Can not cast GenericData to DoubleGenericData\n");
58     painCave.severity = OOPSE_ERROR;
59     painCave.isFatal = 1;
60     simError();
61     }
62     } else {
63     sprintf( painCave.errMsg, "Can not find Dipole Parameters\n");
64     painCave.severity = OOPSE_ERROR;
65     painCave.isFatal = 1;
66     simError();
67     }
68     }
69    
70 tim 1813 //setup quadrupole atom type in fortran side
71     if (isQuadrupole()) {
72     data = getPropertyByName("Quadrupole");
73     if (data != NULL) {
74     Vector3dGenericData* vector3dData= dynamic_cast<Vector3dGenericData*>(data);
75    
76     if (vector3dData != NULL) {
77     Vector3d diagElem= vector3dData->getData();
78     Mat3x3d Q;
79     Q[0][0] = diagElem[0];
80     Q[1][1] = diagElem[1];
81     Q[2][2] = diagElem[2];
82    
83     //newQuadrupoleType(&atp.ident, Q->getArrayPointer, &isError);
84     if (isError != 0) {
85     sprintf( painCave.errMsg,
86     "Fortran rejected newQuadrupoleType\n");
87     painCave.severity = OOPSE_ERROR;
88     painCave.isFatal = 1;
89     simError();
90     }
91    
92     } else {
93     sprintf( painCave.errMsg,
94     "Can not cast GenericData to Vector3dGenericData\n");
95     painCave.severity = OOPSE_ERROR;
96     painCave.isFatal = 1;
97     simError();
98     }
99     } else {
100     sprintf( painCave.errMsg, "Can not find Quadrupole Parameters\n");
101     painCave.severity = OOPSE_ERROR;
102     painCave.isFatal = 1;
103     simError();
104     }
105    
106     }
107    
108     //setup sticky atom type in fortran side
109 tim 1769 if (isSticky()) {
110     data = getPropertyByName("Sticky");
111     if (data != NULL) {
112 tim 1770 StickyParamGenericData* stickyData = dynamic_cast<StickyParamGenericData*>(data);
113 tim 1769
114     if (stickyData != NULL) {
115     StickyParam stickyParam = stickyData->getData();
116    
117 tim 1787 makeStickyType(&atp.ident, &stickyParam.w0, &stickyParam.v0, &stickyParam.v0p, &stickyParam.rl,
118 tim 1769 &stickyParam.ru, &stickyParam.rlp, &stickyParam.rup);
119    
120     if (isError != 0) {
121     sprintf( painCave.errMsg,
122     "Fortran rejected newLJtype\n");
123     painCave.severity = OOPSE_ERROR;
124     painCave.isFatal = 1;
125     simError();
126     }
127    
128     } else {
129     sprintf( painCave.errMsg,
130     "Can not cast GenericData to StickyParam\n");
131     painCave.severity = OOPSE_ERROR;
132     painCave.isFatal = 1;
133     simError();
134     }
135     } else {
136     sprintf( painCave.errMsg, "Can not find Parameters for Sticky\n");
137     painCave.severity = OOPSE_ERROR;
138     painCave.isFatal = 1;
139     simError();
140     }
141     }
142    
143 tim 1813 //setup GayBerne type in fortran side
144 tim 1769
145     }
146    
147    
148     } //end namespace oopse