Changeset 1b2aa1 for molecuilder/src/atom.cpp
- Timestamp:
- Jul 23, 2009, 12:14:13 PM (16 years ago)
- Children:
- f39735
- Parents:
- a41b50
- File:
-
- 1 edited
-
molecuilder/src/atom.cpp (modified) (6 diffs)
Legend:
- Unmodified
- Added
- Removed
-
molecuilder/src/atom.cpp
ra41b50 r1b2aa1 13 13 atom::atom() 14 14 { 15 Name = NULL;16 previous = NULL;17 next = NULL;18 father = this;// generally, father is itself19 Ancestor = NULL;20 type = NULL;21 sort = NULL;22 FixedIon = 0;23 nr = -1;24 GraphNr = -1;25 ComponentNr = NULL;26 IsCyclic = false;27 SeparationVertex = false;28 LowpointNr = -1;29 AdaptiveOrder = 0;30 MaxOrder = false;15 Name = NULL; 16 previous = NULL; 17 next = NULL; 18 father = this; // generally, father is itself 19 Ancestor = NULL; 20 type = NULL; 21 sort = NULL; 22 FixedIon = 0; 23 nr = -1; 24 GraphNr = -1; 25 ComponentNr = NULL; 26 IsCyclic = false; 27 SeparationVertex = false; 28 LowpointNr = -1; 29 AdaptiveOrder = 0; 30 MaxOrder = false; 31 31 }; 32 32 … … 35 35 atom::~atom() 36 36 { 37 Free((void **)&Name, "atom::~atom: *Name");38 Free((void **)&ComponentNr, "atom::~atom: *ComponentNr");37 Free((void **)&Name, "atom::~atom: *Name"); 38 Free((void **)&ComponentNr, "atom::~atom: *ComponentNr"); 39 39 }; 40 40 … … 45 45 atom *atom::GetTrueFather() 46 46 { 47 atom *walker = this;48 do {49 if (walker == walker->father) // top most father is the one that points on itself50 break;51 walker = walker->father;52 } while (walker != NULL);53 return walker;47 atom *walker = this; 48 do { 49 if (walker == walker->father) // top most father is the one that points on itself 50 break; 51 walker = walker->father; 52 } while (walker != NULL); 53 return walker; 54 54 }; 55 55 … … 62 62 bool atom::Output(int ElementNo, int AtomNo, ofstream *out, const char *comment) const 63 63 { 64 if (out != NULL) {65 *out << "Ion_Type" << ElementNo << "_" << AtomNo << "\t"<< fixed << setprecision(9) << showpoint;66 *out << x.x[0] << "\t" << x.x[1] << "\t" << x.x[2];67 *out << "\t" << FixedIon;68 if (v.Norm() > MYEPSILON)69 *out << "\t" << scientific << setprecision(6) << v.x[0] << "\t" << v.x[1] << "\t" << v.x[2] << "\t";70 if (comment != NULL)71 *out << " # " << comment << endl;72 else73 *out << " # molecule nr " << nr << endl;74 return true;75 } else76 return false;64 if (out != NULL) { 65 *out << "Ion_Type" << ElementNo << "_" << AtomNo << "\t" << fixed << setprecision(9) << showpoint; 66 *out << x.x[0] << "\t" << x.x[1] << "\t" << x.x[2]; 67 *out << "\t" << FixedIon; 68 if (v.Norm() > MYEPSILON) 69 *out << "\t" << scientific << setprecision(6) << v.x[0] << "\t" << v.x[1] << "\t" << v.x[2] << "\t"; 70 if (comment != NULL) 71 *out << " # " << comment << endl; 72 else 73 *out << " # molecule nr " << nr << endl; 74 return true; 75 } else 76 return false; 77 77 }; 78 78 … … 82 82 bool atom::OutputXYZLine(ofstream *out) const 83 83 { 84 if (out != NULL) {85 *out << type->symbol << "\t" << x.x[0] << "\t" << x.x[1] << "\t" << x.x[2] << "\t" << endl;86 return true;87 } else88 return false;84 if (out != NULL) { 85 *out << type->symbol << "\t" << x.x[0] << "\t" << x.x[1] << "\t" << x.x[2] << "\t" << endl; 86 return true; 87 } else 88 return false; 89 89 }; 90 90 91 91 ostream & operator << (ostream &ost, atom &a) 92 92 { 93 ost << "[" << a.Name << "|" << &a << "]";94 return ost;93 ost << "[" << a.Name << "|" << &a << "]"; 94 return ost; 95 95 }; 96 96 … … 101 101 bool atom::Compare(atom &ptr) 102 102 { 103 if (nr < ptr.nr)104 return true;105 else106 return false;103 if (nr < ptr.nr) 104 return true; 105 else 106 return false; 107 107 }; 108 108 109 109 bool operator < (atom &a, atom &b) 110 110 { 111 return a.Compare(b);111 return a.Compare(b); 112 112 }; 113 113
Note:
See TracChangeset
for help on using the changeset viewer.
