AvogadroLibs 1.98.1
Loading...
Searching...
No Matches
Public Types | Static Public Member Functions | List of all members
HydrogenTools Class Reference

Public Types

enum  Adjustment {
  Add = 0 ,
  Remove ,
  AddAndRemove
}
 

Static Public Member Functions

static void removeAllHydrogens (RWMolecule &molecule)
 
static void adjustHydrogens (RWMolecule &molecule, Adjustment adjustment=AddAndRemove)
 
static void adjustHydrogens (RWAtom &atom, Adjustment adjustment=AddAndRemove)
 
static int valencyAdjustment (const RWAtom &atom)
 
static int extraHydrogenIndices (const RWAtom &atom, int numberOfHydrogens, std::vector< size_t > &indices)
 
static void generateNewHydrogenPositions (const RWAtom &atom, int numberOfHydrogens, std::vector< Vector3 > &positions)
 

Member Enumeration Documentation

◆ Adjustment

enum Adjustment

Enum values that control the adjustHydrogen function's behavior.

Enumerator
Add 

Only add hydrogens to underbonded atoms.

Remove 

Only remove hydrogens from overbonded atoms.

AddAndRemove 

Add hydrogens to underbonded atoms and remove hydrogens from overbonded atoms.

Member Function Documentation

◆ removeAllHydrogens()

static void removeAllHydrogens ( RWMolecule molecule)
static

Remove all hydrogen atoms from molecule.

◆ adjustHydrogens() [1/2]

static void adjustHydrogens ( RWMolecule molecule,
Adjustment  adjustment = AddAndRemove 
)
static

Add/remove hydrogens on molecule to satisfy valency.

◆ adjustHydrogens() [2/2]

static void adjustHydrogens ( RWAtom atom,
Adjustment  adjustment = AddAndRemove 
)
static

Add/remove hydrogens on atom to satisfy valency.

◆ valencyAdjustment()

static int valencyAdjustment ( const RWAtom atom)
static
Returns
The number of bonds that need to be added or removed from atom to satisfy valency. A positive number indicates the number of bonds to add, a negative number indicates the number of bonds that need to be removed.

◆ extraHydrogenIndices()

static int extraHydrogenIndices ( const RWAtom atom,
int  numberOfHydrogens,
std::vector< size_t > &  indices 
)
static

Obtain the indices of hydrogens that can be removed from atom.

Parameters
atomThe atom from which to prune hydrogens.
numberOfHydrogensThe maximum number of hydrogens to prune.
indicesA vector that will be appended with the indices of the hydrogens to remove.
Returns
The number of hydrogen indices appended to indices.
Note
This function modifies neither atom nor its parent molecule. It only pushes the indices of hydrogens to remove to the end of indices.

◆ generateNewHydrogenPositions()

static void generateNewHydrogenPositions ( const RWAtom atom,
int  numberOfHydrogens,
std::vector< Vector3 > &  positions 
)
static

Generate positions for numberOfHydrogens hydrogens bonded to atom.

Parameters
positionsVector of positions that will be appended with numberOfHydrogens hydrogen locations.
Note
There is nothing intelligent going on here. The new positions are randomly oriented and have a length that is the sum of atom's and hydrogen's covalent radii. Effort is made to prevent overlap with other bonded atoms, but this is not guaranteed.

The documentation for this class was generated from the following file: