Skip to content

AddHydrogensToLigand

dstoeckel edited this page Feb 20, 2015 · 2 revisions

How can I add hydrogens to a ligand?

The following example shows how to add hydrogens if bond orders are valid.

C++

#include <BALL/KERNEL/system.h>
#include <BALL/KERNEL/atom.h>

#include <BALL/MATHS/vector3.h>

#include <BALL/QSAR/ringPerceptionProcessor.h>
#include <BALL/STRUCTURE/addHydrogenProcessor.h>


System* system;
...

// compute all rings
RingPerceptionProcessor rpp;
vector<vector<Atom*> > rings;

// compute all smallest rings
rpp.calculateSSSR(rings, *system);
rings = rpp.getAllSmallRings();

// add hydrogens
AddHydrogenProcessor ahp;
ahp.setRings(rings);
system->apply(ahp);
Clone this wiki locally