ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/group/branches/new_design/OOPSE-2.0/src/types/AtomType.cpp
Revision: 1740
Committed: Mon Nov 15 23:00:32 2004 UTC (19 years, 8 months ago) by tim
File size: 2131 byte(s)
Log Message:
adding ForceFieldFactory and LJFF classes

File Contents

# Content
1 #include <stdlib.h>
2 #include <stdio.h>
3 #include <string.h>
4 #include <iostream>
5
6 #include "types/AtomType.hpp"
7 #include "utils/simError.h"
8 #define __C
9 #include "UseTheForce/DarkSide/atype_interface.h"
10
11 name_space oopse {
12 AtomType::AtomType(){
13
14 // initialize to an error:
15 atp_.ident = -1;
16
17 // and mass_less:
18 mass_ = 0.0;
19
20 // atom type is a Tabula Rasa:
21 atp_.is_Directional = 0;
22 atp_.is_LennardJones = 0;
23 atp_.is_Electrostatic = 0;
24 atp_.is_Charge = 0;
25 atp_.is_Dipole = 0;
26 atp_.is_Sticky = 0;
27 atp_.is_GayBerne = 0;
28 atp_.is_EAM = 0;
29 atp_.is_Shape = 0;
30 atp_.is_FLARB = 0;
31 }
32
33 void AtomType::complete() {
34
35 int status;
36
37 if (name_.empty()) {
38 sprintf( painCave.errMsg,
39 "Attempting to complete an AtomType without giving "
40 "it a name_!\n");
41 painCave.severity = OOPSE_ERROR;
42 painCave.isFatal = 1;
43 simError();
44 }
45
46 if (atp_.ident == -1) {
47 sprintf( painCave.errMsg,
48 "Attempting to complete AtomType %s without setting the"
49 " ident!/n", name_.c_str());
50 painCave.severity = OOPSE_ERROR;
51 painCave.isFatal = 1;
52 simError();
53 }
54
55 status = 0;
56
57 makeAtype(&atp_, &status);
58
59 if (status != 0) {
60 sprintf( painCave.errMsg,
61 "Fortran rejected AtomType %s!\n", name_.c_str());
62 painCave.severity = OOPSE_ERROR;
63 painCave.isFatal = 1;
64 simError();
65 }
66 }
67
68 void AtomType::addProperty(GenericData* genData) {
69 properties_.addProperty(genData);
70 }
71
72 void AtomType::removeProperty(const std::string& propName) {
73 properties_.removeProperty(propName);
74 }
75
76 void AtomType::clearProperties() {
77 properties_.clearProperties();
78 }
79
80 std::vector<std::string> AtomType::getPropertyNames() {
81 return properties_.getPropertyNames();
82 }
83
84 std::vector<GenericData*> AtomType::getProperties() {
85 return properties_.getProperties();
86 }
87
88 GenericData* AtomType::getPropertyByName(const std::string& propName) {
89 return properties_.getPropertyByName(propName);
90 }
91 }