We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
Iterate over specific atoms in a System using the Selector:
Selector
#include <BALL/KERNEL/selector.h> ... BALL::System system; ... system.deselect(); BALL::Selector select("SMARTS([$([#6D3](~[#8D1])(~[#8D1]))])"); system.apply(select); List<BALL::Atom*> selected_atoms = select.getSelectedAtoms(); List<BALL::Atom*>::iterator it = selected_atoms.begin(); for ( ; it != selected_atoms.end(); ++it) { std::cout << (*it)->getElement().getAtomicNumber() << std::endl; } system.deselect();
Note: Never try to add or remove atoms from the System while using the Iterator! Your programm will crash!
import BALL s = getSystem(0) select = BALL.Selector("SMARTS(N-H)") s.apply(select) print len(select.getSelectedAtoms()) for atom in select.getSelectedAtoms(): print atom.getPosition() #update BALLView getMainControl().update(s)