7 #ifndef BALL_KERNEL_GLOBAL_H
8 #define BALL_KERNEL_GLOBAL_H
10 #ifndef BALL_KERNEL_ATOM_H
14 #ifndef BALL_KERNEL_BOND_H
56 template <
class AtomContainerType>
57 void cloneBonds(
const AtomContainerType& atom_container, AtomContainerType& cloned)
62 std::list<const Bond*> bond_list;
71 for (; +atom_iter_a && +atom_iter_b; ++atom_iter_a, ++atom_iter_b)
75 atom_map.insert(std::pair<const Atom*, Atom*>(&*atom_iter_a, &*atom_iter_b));
79 for (bond_iter = atom_iter_a->beginBond(); bond_iter != atom_iter_a->endBond(); ++bond_iter)
81 if (bond_iter->getFirstAtom() == &(*atom_iter_a))
83 bond_list.push_back(&(*bond_iter));
92 std::list<const Bond*>::iterator list_iter = bond_list.begin();
93 for ( ; list_iter != bond_list.end(); ++list_iter)
95 if (atom_map.has((*list_iter)->getFirstAtom()) && atom_map.has((*list_iter)->getSecondAtom()))
97 Atom* a1 = atom_map[(*list_iter)->getFirstAtom()];
98 Atom* a2 = atom_map[(*list_iter)->getSecondAtom()];
99 Bond* tmp_bond =
static_cast<Bond*
>((*list_iter)->create(
false,
true));
101 *tmp_bond = **list_iter;
117 #endif // BALL_KERNEL_GLOBAL_H
void setFirstAtom(Atom *atom)
void setSecondAtom(Atom *atom)
static Bond * createBond(Bond &bond, Atom &first, Atom &second)
Mutable bidirectional iterator.
void cloneBonds(const AtomContainerType &atom_container, AtomContainerType &cloned)
HashMap class based on the STL map (containing serveral convenience functions)