Ejemplo n.º 1
0
	distance_pair BondGraph::ClosestAtom (const MolPtr& mol, const Atom::Element_t elmt) const {
		distance_vec distances;

		for (Atom_it it = mol->begin(); it != mol->end(); it++) {
			distances.push_back ((ClosestAtoms (*it, 1, elmt, false))[0]);
		}

		pair_utility::pair_sort_first(distances.begin(), distances.end());

		return distances[0];
	}
Ejemplo n.º 2
0
	distance_vec BondGraph::ClosestAtoms (const MolPtr mol, const int num, const Atom::Element_t elmt) const {
		distance_vec distances;
		for (Atom_it atom = mol->begin(); atom != mol->end(); atom++) {
			distance_vec closest = ClosestAtoms (*atom, 10, elmt, false);
			std::copy (closest.begin(), closest.end(), std::back_inserter(distances));
		}

		pair_utility::pair_sort_first (distances.begin(), distances.end());
		distance_vec::const_iterator it = std::unique(distances.begin(), distances.end(), pair_utility::pair_equal_second_pred<distance_pair>());
		distances.resize(it - distances.begin());
		pair_utility::pair_sort_first (distances.begin(), distances.end());
		distances.resize(num);

		return distances;
	} // closest Atoms - molecular version
Ejemplo n.º 3
0
// if given a 2nd molecule, this will merge the current and the new molecules into one larger molecule.
MolPtr Molecule::Merge (MolPtr mol) {
    printf ("merging two molecules:\n");
    this->Print();
    printf ("mol 2---\n");
    mol->Print();
    // the new molecule's name is yet unknown
    _name = "undefined";
    _moltype = Molecule::NO_MOLECULE;

    for (Atom_it it = mol->begin(); it != mol->end(); it++) {
        this->AddAtom (*it);
    }

    return (this);
}