Bsoft 2.1.4
Bernard's software package
mol_transform.h File Reference

Library routines used for atomic coordinate transformations. More...

#include "Matrix3.h"
#include "Transform.h"
#include "View.h"
#include "rwmolecule.h"

Functions

int molgroup_coor_shift (Bmolgroup *molgroup, Vector3< double > shift)
 Translates a molecule group. More...
 
int mol_coor_shift (Bmolecule *mol, Vector3< double > shift)
 Translates a molecule. More...
 
int molgroup_coor_rotate (Bmolgroup *molgroup, Transform t)
 Rotates and translates a molecule group. More...
 
int mol_coor_rotate (Bmolecule *mol, Transform t)
 Rotates and translates a molecule. More...
 
Bmolgroupmolgroup_rotate_to_view (Bmolgroup *molgroup, View view, Vector3< double > origin, Vector3< double > trans)
 Rotates a molecule group to a specified view and translates it afterwards. More...
 
Bmolgroupmolgroup_rotate_from_view (Bmolgroup *molgroup, View view, Vector3< double > origin, Vector3< double > trans)
 Rotates a molecule group from a specified view and translates it afterwards. More...
 
Bmoleculemol_rotate_to_view (Bmolecule *mol, View view, Vector3< double > origin, Vector3< double > trans)
 Rotates a molecule to a specified view and translates it afterwards. More...
 
Bmoleculemol_rotate_from_view (Bmolecule *mol, View view, Vector3< double > origin, Vector3< double > trans)
 Rotates a molecule from a specified view and translates it afterwards. More...
 
int molgroup_coor_transform (Bmolgroup *molgroup, Transform t)
 Rotates and translates a molecule group. More...
 
int mol_coor_transform (Bmolecule *mol, Transform t)
 Rotates and translates a molecule. More...
 
int molgroup_coor_invert (Bmolgroup *molgroup, Vector3< double > point)
 Inverts the coordinates of a molecule through a given point. More...
 
int molgroup_resolve_pbc (Bmolgroup *molgroup)
 Recombines coordinates split across periodic box boundaries. More...
 
int molgroup_pack_in_periodic_box (Bmolgroup *molgroup)
 Distributes coordinates across periodic box boundaries. More...
 
int molgroup_coor_shift_PBC (Bmolgroup *molgroup, Vector3< double > shift)
 Translates a molecule within a periodic box. More...
 
int molgroup_coor_shift_rotate_PBC (Bmolgroup *molgroup, Vector3< double > origin, Matrix3 mat, Vector3< double > shift)
 Translates and rotates a molecule within a periodic box. More...
 
int molgroup_shift_to_center_of_mass (Bmolgroup *molgroup)
 Translates a set of coordinates to the center of mass. More...
 
int mol_shift_to_center_of_mass (Bmolecule *mol)
 Translates a set of coordinates to the center of mass. More...
 
int molgroup_place_at_coordinates (Bmolgroup *molgroup, Vector3< double > location)
 Translates a set of coordinates to a defined center-of-mass. More...
 

Detailed Description

Library routines used for atomic coordinate transformations.

Author
Bernard Heymann
Date
Created: 19980214
Modified: 20070614

Function Documentation

◆ mol_coor_rotate()

int mol_coor_rotate ( Bmolecule mol,
Transform  t 
)

Rotates and translates a molecule.

The new coordinates are:
    coord_new = (coord - origin)*rot_mat + origin + shift.
Parameters
*molmolecule structure.
ttransform structure.
Returns
int 0.

◆ mol_coor_shift()

int mol_coor_shift ( Bmolecule mol,
Vector3< double >  shift 
)

Translates a molecule.

Parameters
*molmolecule structure.
shiftthree-valued translation vector.
Returns
int 0.

◆ mol_coor_transform()

int mol_coor_transform ( Bmolecule mol,
Transform  t 
)

Rotates and translates a molecule.

The new coordinates are:
    coord_new = (coord - origin)*rot_mat + origin + shift.
Parameters
*molmolecule structure.
ttransform structure.
Returns
int 0.

◆ mol_rotate_from_view()

Bmolecule * mol_rotate_from_view ( Bmolecule mol,
View  view,
Vector3< double >  origin,
Vector3< double >  trans 
)

Rotates a molecule from a specified view and translates it afterwards.

A new rotated and translated molecule is generated.
Parameters
*molmolecule structure (unmodified).
viewview to rotate from.
originorigin of rotation.
trans3-valued translation vector.
Returns
Bmolecule* new molecule group.

◆ mol_rotate_to_view()

Bmolecule * mol_rotate_to_view ( Bmolecule mol,
View  view,
Vector3< double >  origin,
Vector3< double >  trans 
)

Rotates a molecule to a specified view and translates it afterwards.

A new rotated and translated molecule is generated.
Parameters
*molmolecule structure (unmodified).
viewview to rotate to.
originorigin of rotation.
trans3-valued translation vector.
Returns
Bmolecule* new molecule group.

◆ mol_shift_to_center_of_mass()

int mol_shift_to_center_of_mass ( Bmolecule mol)

Translates a set of coordinates to the center of mass.

The function mol_center_of_mass is used to calculate the center of mass.
The function mol_coor_shift is used to shift the coordinates.
Parameters
*molmolecule structure.
Returns
int 0.

◆ molgroup_coor_invert()

int molgroup_coor_invert ( Bmolgroup molgroup,
Vector3< double >  point 
)

Inverts the coordinates of a molecule through a given point.

Parameters
*molgroupmolecule group structure.
point3-valued inversion point.
Returns
int 0.

◆ molgroup_coor_rotate()

int molgroup_coor_rotate ( Bmolgroup molgroup,
Transform  t 
)

Rotates and translates a molecule group.

The new coordinates are:
    coord_new = (coord - origin)*rot_mat + origin + shift.
Parameters
*molgroupmolecule group structure.
ttransform structure.
Returns
int 0.

◆ molgroup_coor_shift()

int molgroup_coor_shift ( Bmolgroup molgroup,
Vector3< double >  shift 
)

Translates a molecule group.

Parameters
*molgroupmolecule group structure.
shiftthree-valued translation vector.
Returns
int 0.

◆ molgroup_coor_shift_PBC()

int molgroup_coor_shift_PBC ( Bmolgroup molgroup,
Vector3< double >  shift 
)

Translates a molecule within a periodic box.

The periodic box is defined in the molecule group structure.
Parameters
*molgroupmolecule group structure.
shiftthree-valued translation vector.
Returns
int 0.

◆ molgroup_coor_shift_rotate_PBC()

int molgroup_coor_shift_rotate_PBC ( Bmolgroup molgroup,
Vector3< double >  origin,
Matrix3  mat,
Vector3< double >  shift 
)

Translates and rotates a molecule within a periodic box.

The molecule group is first rotated around the origin and then shifted.
The periodic box is defined in the molecule group structure.
Parameters
*molgroupmolecule group structure.
origin3-valued origin for rotation.
mat3x3 rotation matrix.
shift3-valued translation vector.
Returns
int 0.

◆ molgroup_coor_transform()

int molgroup_coor_transform ( Bmolgroup molgroup,
Transform  t 
)

Rotates and translates a molecule group.

The new coordinates are:
    coord_new = (coord - origin)*rot_mat + origin + shift.
Parameters
*molgroupmolecule group structure.
ttransform structure.
Returns
int 0.

◆ molgroup_pack_in_periodic_box()

int molgroup_pack_in_periodic_box ( Bmolgroup molgroup)

Distributes coordinates across periodic box boundaries.

Parameters
*molgroupmolecule group structure.
Returns
int 0.

◆ molgroup_place_at_coordinates()

int molgroup_place_at_coordinates ( Bmolgroup molgroup,
Vector3< double >  location 
)

Translates a set of coordinates to a defined center-of-mass.

The function molgroup_center_of_mass is used to calculate the center of mass.
The function molgroup_coor_shift is used to shift the coordinates.
Parameters
*molgroupmolecule group structure.
locationdesired center-of-mass coordinates.
Returns
int 0.

◆ molgroup_resolve_pbc()

int molgroup_resolve_pbc ( Bmolgroup molgroup)

Recombines coordinates split across periodic box boundaries.

Parameters
*molgroupmolecule group structure.
Returns
int 0.
The center of mass of each molecule is calculated to determine the
shift needed to be applied to get the center of mass within the box.

◆ molgroup_rotate_from_view()

Bmolgroup * molgroup_rotate_from_view ( Bmolgroup molgroup,
View  view,
Vector3< double >  origin,
Vector3< double >  trans 
)

Rotates a molecule group from a specified view and translates it afterwards.

A new rotated and translated molecule group is generated.
Parameters
*molgroupmolecule group structure (unmodified).
viewview to rotate from.
originorigin of rotation.
trans3-valued translation vector.
Returns
Bmolgroup* new molecule group.

◆ molgroup_rotate_to_view()

Bmolgroup * molgroup_rotate_to_view ( Bmolgroup molgroup,
View  view,
Vector3< double >  origin,
Vector3< double >  trans 
)

Rotates a molecule group to a specified view and translates it afterwards.

A new rotated and translated molecule group is generated.
Parameters
*molgroupmolecule group structure (unmodified).
viewview to rotate to.
originorigin of rotation.
trans3-valued translation vector.
Returns
Bmolgroup* new molecule group.

◆ molgroup_shift_to_center_of_mass()

int molgroup_shift_to_center_of_mass ( Bmolgroup molgroup)

Translates a set of coordinates to the center of mass.

The function molgroup_center_of_mass is used to calculate the center of mass.
The function molgroup_coor_shift is used to shift the coordinates.
Parameters
*molgroupmolecule group structure.
Returns
int 0.