Ignore:
Timestamp:
Aug 20, 2009, 3:40:49 PM (16 years ago)
Author:
Saskia Metzler <metzler@…>
Children:
2aea0b, 390a2b
Parents:
6c6d84
Message:

Ticket 17: Write new function molecule::CopyMoleculeFromSubRegion()

File:
1 edited

Legend:

Unmodified
Added
Removed
  • molecuilder/src/molecules.cpp

    r6c6d84 rbc3953  
    176176 * Increases molecule::last_atom and gives last number to added atom.
    177177 * \param *pointer allocated and set atom
    178  * \return true - succeeded, false - atom not found in list
     178 * \return pointer to the newly added atom
    179179 */
    180180atom * molecule::AddCopyAtom(atom *pointer)
     
    612612  return copy;
    613613};
     614
     615
     616/**
     617 * Copies all atoms of a molecule which are within the defined parallelepiped.
     618 *
     619 * @param offest for the origin of the parallelepiped
     620 * @param three vectors forming the matrix that defines the shape of the parallelpiped
     621 */
     622molecule* molecule::CopyMoleculeFromSubRegion(Vector offset, double *parallelepiped) {
     623  molecule *copy = new molecule(elemente);
     624  atom *Walker = start;
     625
     626  while(Walker->next != end) {
     627    Walker = Walker->next;
     628    if (Walker->x.IsInParallelepiped(offset, parallelepiped)) {
     629      cout << "Adding atom " << *Walker << endl;
     630      copy->AddCopyAtom(Walker);
     631    }
     632  }
     633
     634  //TODO: copy->BuildInducedSubgraph((ofstream *)&cout, this);
     635
     636  return copy;
     637}
    614638
    615639/** Adds a bond to a the molecule specified by two atoms, \a *first and \a *second.
Note: See TracChangeset for help on using the changeset viewer.