Changeset f1ef9cc
- Timestamp:
- Feb 2, 2010, 3:53:04 PM (16 years ago)
- Children:
- 8fc9b6
- Parents:
- d0c7ec
- Location:
- molecuilder/src
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
molecuilder/src/molecule.cpp
rd0c7ec rf1ef9cc 6 6 7 7 #include <cstring> 8 #include <boost/bind.hpp> 8 9 9 10 #include "atom.hpp" … … 32 33 first(new bond(start, end, 1, -1)), last(new bond(start, end, 1, -1)), MDSteps(0), AtomCount(0), 33 34 BondCount(0), ElementCount(0), NoNonHydrogen(0), NoNonBonds(0), NoCyclicBonds(0), BondDistance(0.), 34 ActiveFlag(false), IndexNr(-1), last_atom(0), InternalPointer(start) 35 ActiveFlag(false), IndexNr(-1), last_atom(0), InternalPointer(start), 36 formula(this,boost::bind(&molecule::calcFormula,this)) 35 37 { 36 38 // init atom chain list … … 72 74 strncpy(name,_name.c_str(),MAXSTRINGSIZE); 73 75 FINISH_OBSERVER; 76 } 77 78 const std::string molecule::getFormula(){ 79 return *formula; 80 } 81 82 std::string molecule::calcFormula(){ 83 int Counts[MAX_ELEMENTS]; 84 stringstream sstr; 85 for (int j = 0; j<MAX_ELEMENTS;j++) 86 Counts[j] = 0; 87 for(atom *Walker = start; Walker != end; Walker = Walker->next) { 88 Counts[Walker->type->Z]++; 89 } 90 for(element* Elemental = elemente->end; Elemental != elemente->start; Elemental = Elemental->previous) { 91 if (Counts[Elemental->Z] != 0) 92 sstr << Elemental->symbol << Counts[Elemental->Z]; 93 } 94 return sstr.str(); 74 95 } 75 96 -
molecuilder/src/molecule.hpp
rd0c7ec rf1ef9cc 33 33 #include "tesselation.hpp" 34 34 #include "Patterns/Observer.hpp" 35 #include "Patterns/Cacheable.hpp" 35 36 36 37 /****************************************** forward declarations *****************************/ … … 105 106 char name[MAXSTRINGSIZE]; //!< arbitrary name 106 107 108 private: 109 Cacheable<string> formula; 110 107 111 public: 108 112 molecule(const periodentafel * const teil); … … 112 116 const std::string getName(); 113 117 void setName(const std::string); 118 const std::string getFormula(); 119 std::string calcFormula(); 114 120 115 121 // re-definition of virtual functions from PointCloud
Note:
See TracChangeset
for help on using the changeset viewer.