Changeset 1de701 for molecuilder/src/molecule.cpp
- Timestamp:
- May 8, 2010, 12:47:57 PM (16 years ago)
- Children:
- 0341a9
- Parents:
- 25e17e9
- File:
-
- 1 edited
-
molecuilder/src/molecule.cpp (modified) (9 diffs)
Legend:
- Unmodified
- Added
- Removed
-
molecuilder/src/molecule.cpp
r25e17e9 r1de701 135 135 if (pointer->type->Z != 1) 136 136 NoNonHydrogen++; 137 if (pointer->Name == NULL){138 Free(&pointer->Name);139 pointer->Name = Malloc<char>(6, "molecule::AddAtom: *pointer->Name");140 sprintf(pointer->Name, "%2s%02d", pointer->type->symbol, pointer->nr+1);137 if(pointer->getName() == "Unknown"){ 138 stringstream sstr; 139 sstr << pointer->type->symbol << pointer->nr+1; 140 pointer->setName(sstr.str()); 141 141 } 142 142 } … … 157 157 if (pointer != NULL) { 158 158 atom *walker = pointer->clone(); 159 walker->Name = Malloc<char>(strlen(pointer->Name) + 1, "atom::atom: *Name"); 160 strcpy (walker->Name, pointer->Name); 159 stringstream sstr; 160 sstr << pointer->getName(); 161 walker->setName(sstr.str()); 161 162 walker->nr = last_atom++; // increase number within molecule 162 163 add(walker, end); … … 252 253 BondRescale = TopOrigin->type->HBondDistance[TopBond->BondDegree-1]; 253 254 if (BondRescale == -1) { 254 DoeLog(1) && (eLog()<< Verbose(1) << "There is no typical hydrogen bond distance in replacing bond (" << TopOrigin-> Name << "<->" << TopReplacement->Name<< ") of degree " << TopBond->BondDegree << "!" << endl);255 DoeLog(1) && (eLog()<< Verbose(1) << "There is no typical hydrogen bond distance in replacing bond (" << TopOrigin->getName() << "<->" << TopReplacement->getName() << ") of degree " << TopBond->BondDegree << "!" << endl); 255 256 return false; 256 257 BondRescale = bondlength; … … 295 296 SecondOtherAtom = (*Runner)->GetOtherAtom(TopOrigin); 296 297 } else { 297 DoeLog(2) && (eLog()<< Verbose(2) << "Detected more than four bonds for atom " << TopOrigin-> Name);298 DoeLog(2) && (eLog()<< Verbose(2) << "Detected more than four bonds for atom " << TopOrigin->getName()); 298 299 } 299 300 } … … 339 340 bondangle = TopOrigin->type->HBondAngle[1]; 340 341 if (bondangle == -1) { 341 DoeLog(1) && (eLog()<< Verbose(1) << "There is no typical hydrogen bond angle in replacing bond (" << TopOrigin-> Name << "<->" << TopReplacement->Name<< ") of degree " << TopBond->BondDegree << "!" << endl);342 DoeLog(1) && (eLog()<< Verbose(1) << "There is no typical hydrogen bond angle in replacing bond (" << TopOrigin->getName() << "<->" << TopReplacement->getName() << ") of degree " << TopBond->BondDegree << "!" << endl); 342 343 return false; 343 344 bondangle = 0; … … 616 617 add(Binder, last); 617 618 } else { 618 DoeLog(1) && (eLog()<< Verbose(1) << "Could not add bond between " << atom1-> Name << " and " << atom2->Name<< " as one or both are not present in the molecule." << endl);619 DoeLog(1) && (eLog()<< Verbose(1) << "Could not add bond between " << atom1->getName() << " and " << atom2->getName() << " as one or both are not present in the molecule." << endl); 619 620 } 620 621 return Binder; … … 695 696 AtomCount--; 696 697 } else 697 DoeLog(1) && (eLog()<< Verbose(1) << "Atom " << pointer-> Name<< " is of element " << pointer->type->Z << " but the entry in the table of the molecule is 0!" << endl);698 DoeLog(1) && (eLog()<< Verbose(1) << "Atom " << pointer->getName() << " is of element " << pointer->type->Z << " but the entry in the table of the molecule is 0!" << endl); 698 699 if (ElementsInMolecule[pointer->type->Z] == 0) // was last atom of this element? 699 700 ElementCount--; … … 713 714 ElementsInMolecule[pointer->type->Z]--; // decrease number of atom of this element 714 715 else 715 DoeLog(1) && (eLog()<< Verbose(1) << "Atom " << pointer-> Name<< " is of element " << pointer->type->Z << " but the entry in the table of the molecule is 0!" << endl);716 DoeLog(1) && (eLog()<< Verbose(1) << "Atom " << pointer->getName() << " is of element " << pointer->type->Z << " but the entry in the table of the molecule is 0!" << endl); 716 717 if (ElementsInMolecule[pointer->type->Z] == 0) // was last atom of this element? 717 718 ElementCount--; … … 915 916 if (Walker->type->Z != 1) // count non-hydrogen atoms whilst at it 916 917 NoNonHydrogen++; 917 Free(&Walker->Name);918 Walker->Name = Malloc<char>(6, "molecule::CountAtoms: *walker->Name");919 sprintf(Walker->Name, "%2s%02d", Walker->type->symbol, Walker->nr+1);920 DoLog(3) && (Log() << Verbose(3) << "Naming atom nr. " << Walker->nr << " " << Walker-> Name<< "." << endl);918 stringstream sstr; 919 sstr << Walker->type->symbol << Walker->nr+1; 920 Walker->setName(sstr.str()); 921 DoLog(3) && (Log() << Verbose(3) << "Naming atom nr. " << Walker->nr << " " << Walker->getName() << "." << endl); 921 922 i++; 922 923 }
Note:
See TracChangeset
for help on using the changeset viewer.
