Bsoft 2.1.4
Bernard's software package
mol_edit.cpp File Reference

Library routines used for atomic coordinates. More...

#include "rwmolecule.h"
#include "rwatomprop.h"
#include "rwresprop.h"
#include "mol_transform.h"
#include "mol_select.h"
#include "mol_edit.h"
#include "mol_util.h"
#include "seq_util.h"
#include "linked_list.h"
#include "Matrix3.h"
#include "random_numbers.h"
#include "utilities.h"

Functions

long molgroup_set_atom_types_to_elements (Bmolgroup *molgroup)
 Sets atom types to element names. More...
 
int molgroup_remove_hydrogens (Bmolgroup *molgroup)
 Removes all hydrogens from a molecular system. More...
 
bool bond_find (Bmolgroup *molgroup, Batom *atom1, Batom *atom2)
 
int molgroup_add_disulfides (Bmolgroup *molgroup, double distance)
 Adds disulfide bonds when sulfur atoms are close to each other. More...
 
Bmolgroup ** molgroup_split_into_slices (Bmolgroup *molgroup, double slice_thickness, int &nslices)
 Splits a set of coordinates into slices with a given thickness. More...
 
int molgroup_insert (Bmolgroup *molgroup, Bmolgroup *molinsert, double distance)
 Inserts one set of molecules into another. More...
 
int molgroup_randomize (Bmolgroup *molgroup, double random_max)
 Applies random displacements to coordinates. More...
 
int molgroup_randomize_B (Bmolgroup *molgroup, double B)
 Applies random displacements to coordinates. More...
 
int molgroup_random_displace_number (Bmolgroup *molgroup, long number, double stdev)
 Applies random displacements to a selected number of coordinates. More...
 
int molgroup_remove_overlapping_atoms (Bmolgroup *molgroup, double mindist)
 Removes overlapping atoms. More...
 
int molgroup_bond_pseudo_atoms (Bmolgroup *molgroup, int atoms_per_bond, int wrap)
 Places pseudo-atoms on bonds. More...
 
char * grid_from_molgroup (Bmolgroup *molgroup, Vector3< double > min, double sampling, Vector3< int > size)
 
char * grid_from_molecule (Bmolecule *mol, Vector3< double > min, double sampling, Vector3< int > size)
 
int molgroup_prune_molecules (Bmolgroup *molgroup)
 Deletes overlapping molecules. More...
 
long molgroup_delete_deselected_molecules (Bmolgroup *molgroup)
 Deletes deselected molecules. More...
 
long molgroup_prune_overlapping_atoms (Bmolgroup *molgroup, double mindist)
 Prunes overlapping atoms based on a distance criterion. More...
 
long molgroup_delete_deselected_atoms (Bmolgroup *molgroup)
 Deletes deselected atoms. More...
 
int molgroup_untangle_molecules (Bmolgroup *molgroup, double sampling, double lambda)
 Moves overlapping molecules away from each other. More...
 
int molgroup_untangle_groups (Bmolgroup *molgroup, double sampling, double lambda)
 Moves overlapping molecules away from each other. More...
 

Variables

int verbose
 

Detailed Description

Library routines used for atomic coordinates.

Author
Bernard Heymann
Date
Created: 19980214
Modified: 20211029

Function Documentation

◆ bond_find()

bool bond_find ( Bmolgroup molgroup,
Batom atom1,
Batom atom2 
)

◆ grid_from_molecule()

char * grid_from_molecule ( Bmolecule mol,
Vector3< double >  min,
double  sampling,
Vector3< int >  size 
)

◆ grid_from_molgroup()

char * grid_from_molgroup ( Bmolgroup molgroup,
Vector3< double >  min,
double  sampling,
Vector3< int >  size 
)

◆ molgroup_add_disulfides()

int molgroup_add_disulfides ( Bmolgroup molgroup,
double  distance 
)

Adds disulfide bonds when sulfur atoms are close to each other.

Parameters
*molgroupmolecule group structure.
distancemaximum separation between sulfur atoms.
Returns
int number of disulfide bonds added.

◆ molgroup_bond_pseudo_atoms()

int molgroup_bond_pseudo_atoms ( Bmolgroup molgroup,
int  atoms_per_bond,
int  wrap 
)

Places pseudo-atoms on bonds.

Parameters
*molgroupthe molecule group.
atoms_per_bondnumber of pseudo-atoms per bond.
wrapwrap around periodic boundaries if !=0.
Returns
Bbond* new bond list.
The requested number of new atoms are placed to coincide with each bond.

◆ molgroup_delete_deselected_atoms()

long molgroup_delete_deselected_atoms ( Bmolgroup molgroup)

Deletes deselected atoms.

Parameters
*molgroupmolecule group structure to be modified.
Returns
long number of atoms deleted.

◆ molgroup_delete_deselected_molecules()

long molgroup_delete_deselected_molecules ( Bmolgroup molgroup)

Deletes deselected molecules.

Parameters
*molgroupmolecule group structure to be modified.
Returns
long number of molecules deleted.

◆ molgroup_insert()

int molgroup_insert ( Bmolgroup molgroup,
Bmolgroup molinsert,
double  distance 
)

Inserts one set of molecules into another.

Molecules overlapping in the receiving molecule group are deleted.
The footprint of the molecules being inserted is calculated on a grid
and all atoms within this footprint is tested for deletion.
Note: The molecule list is transferred from the insertion group to 
    the main group and the insertion group is deallocated.
Parameters
*molgroupmolecule group structure to be modified.
*molinsertmolecule group structure to insert. (deallocated)
distancecutoff distance to remove atoms.
Returns
int 0.

◆ molgroup_prune_molecules()

int molgroup_prune_molecules ( Bmolgroup molgroup)

Deletes overlapping molecules.

Parameters
*molgroupthe molecule group.
Returns
int 0.

◆ molgroup_prune_overlapping_atoms()

long molgroup_prune_overlapping_atoms ( Bmolgroup molgroup,
double  mindist 
)

Prunes overlapping atoms based on a distance criterion.

The first atom in any pair of overlapping atoms is kept.
Parameters
*molgroupmolecule group structure to be modified.
mindistdistance criterion.
Returns
long number of remaining atoms.

◆ molgroup_random_displace_number()

int molgroup_random_displace_number ( Bmolgroup molgroup,
long  number,
double  stdev 
)

Applies random displacements to a selected number of coordinates.

Parameters
*molgroupmolecule group structure to be modified.
numbernumber of coordinates to displace.
stdevstandard devaition of displacement.
Returns
int 0.

◆ molgroup_randomize()

int molgroup_randomize ( Bmolgroup molgroup,
double  random_max 
)

Applies random displacements to coordinates.

Parameters
*molgroupmolecule group structure to be modified.
random_maxmaximum displacement.
Returns
int 0.

◆ molgroup_randomize_B()

int molgroup_randomize_B ( Bmolgroup molgroup,
double  B 
)

Applies random displacements to coordinates.

Parameters
*molgroupmolecule group structure to be modified.
BB factor.
Returns
int 0.

◆ molgroup_remove_hydrogens()

int molgroup_remove_hydrogens ( Bmolgroup molgroup)

Removes all hydrogens from a molecular system.

Parameters
*molgroupmolecule group structure.
Returns
int number of hydrogens removed.

◆ molgroup_remove_overlapping_atoms()

int molgroup_remove_overlapping_atoms ( Bmolgroup molgroup,
double  mindist 
)

Removes overlapping atoms.

Parameters
*molgroupmolecule group.
mindistminimum distance allowed between atoms.
Returns
int number of atoms removed, <0 on error.
The input molecule group is checked for any atom pairs closer than
a minimum allowed distance. The second atom of an overlapping pair
is removed. This is intended to clean up after symmetry operations
that generate overlapping pseudo-atoms lying on symmetry axes.

◆ molgroup_set_atom_types_to_elements()

long molgroup_set_atom_types_to_elements ( Bmolgroup molgroup)

Sets atom types to element names.

Parameters
*molgroupmolecule group structure.
Returns
long number of atoms.

◆ molgroup_split_into_slices()

Bmolgroup ** molgroup_split_into_slices ( Bmolgroup molgroup,
double  slice_thickness,
int &  nslices 
)

Splits a set of coordinates into slices with a given thickness.

Parameters
*molgroupmolecule group structure.
slice_thicknessslice thickness (in angstrom).
&nslicespointer to the number of slices generated
Returns
Bmolgroup** set of molecule groups.

◆ molgroup_untangle_groups()

int molgroup_untangle_groups ( Bmolgroup molgroup,
double  sampling,
double  lambda 
)

Moves overlapping molecules away from each other.

The overlap of molecules are assessed by projecting atom positions
onto a grid. Overlapping molecules are then moved away from each other
along a vector through their centers-of-mass.
Parameters
*molgroupthe molecule group.
samplinggrid sampling (angstrom).
lambdadamping factor.
Returns
int 0.

◆ molgroup_untangle_molecules()

int molgroup_untangle_molecules ( Bmolgroup molgroup,
double  sampling,
double  lambda 
)

Moves overlapping molecules away from each other.

The overlap of molecules are assessed by projecting atom positions
onto a grid. Overlapping molecules are then moved away from each other
along a vector through their centers-of-mass.
Parameters
*molgroupthe molecule group.
samplinggrid sampling (angstrom).
lambdadamping factor.
Returns
int 0.

Variable Documentation

◆ verbose

int verbose
extern