| Bsoft 2.0.5 Bernard's software package

Functions | Variables
mol_transform.cpp File Reference

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

`#include "rwmolecule.h"`
`#include "mol_transform.h"`
`#include "mol_util.h"`
`#include "linked_list.h"`
`#include "utilities.h"`

Go to the source code of this file.

## Functions
Bmolgroup * | molgroup_rotate (Bmolgroup *molgroup, Matrix3 mat, Vector3< double > origin, Vector3< double > trans)
Bmolecule * | mol_rotate (Bmolecule *mol, Matrix3 mat, Vector3< double > origin, Vector3< double > trans)
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...
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. More...
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. More...
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. More...
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. 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...

## Variables
int | verbose

## Detailed Description

Library routines used for atomic coordinate transformations.

Author
  Bernard Heymann

Date
  Created: 19980214
  Modified: 20070614

Definition in file mol_transform.cpp.

## 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

  *mol | molecule structure.
  t | transform structure.

Returns
  int 0.

Definition at line 131 of file mol_transform.cpp.

## ◆ mol_coor_shift()

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

Translates a molecule.

Parameters

  *mol | molecule structure.
  shift | three-valued translation vector.

Returns
  int 0.

Definition at line 56 of file mol_transform.cpp.

## ◆ 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

  *mol | molecule structure.
  t | transform structure.

Returns
  int 0.

Definition at line 378 of file mol_transform.cpp.

## ◆ mol_rotate()

Bmolecule * mol_rotate | ( | Bmolecule * | mol,
|  | Matrix3 | mat,
|  | Vector3< double > | origin,
|  | Vector3< double > | trans
| ) |  |

Definition at line 294 of file mol_transform.cpp.

## ◆ 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

  *mol | molecule structure (unmodified).
  view | view to rotate from.
  origin | origin of rotation.
  trans | 3-valued translation vector.

Returns
  Bmolecule* new molecule group.

Definition at line 281 of file mol_transform.cpp.

## ◆ 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

  *mol | molecule structure (unmodified).
  view | view to rotate to.
  origin | origin of rotation.
  trans | 3-valued translation vector.

Returns
  Bmolecule* new molecule group.

Definition at line 258 of file mol_transform.cpp.

## ◆ 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

  *mol | molecule structure.

Returns
  int 0.

Definition at line 645 of file mol_transform.cpp.

## ◆ molgroup_coor_invert()

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

Inverts the coordinates of a molecule through a given point.

Parameters

  *molgroup | molecule group structure.
  point | 3-valued inversion point.

Returns
  int 0.

Definition at line 419 of file mol_transform.cpp.

## ◆ 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

  *molgroup | molecule group structure.
  t | transform structure.

Returns
  int 0.

Definition at line 87 of file mol_transform.cpp.

## ◆ molgroup_coor_shift()

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

Translates a molecule group.

Parameters

  *molgroup | molecule group structure.
  shift | three-valued translation vector.

Returns
  int 0.

Definition at line 28 of file mol_transform.cpp.

## ◆ 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

  *molgroup | molecule group structure.
  shift | three-valued translation vector.

Returns
  int 0.

Definition at line 544 of file mol_transform.cpp.

## ◆ 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

  *molgroup | molecule group structure.
  origin | 3-valued origin for rotation.
  mat | 3x3 rotation matrix.
  shift | 3-valued translation vector.

Returns
  int 0.

Definition at line 581 of file mol_transform.cpp.

## ◆ 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

  *molgroup | molecule group structure.
  t | transform structure.

Returns
  int 0.

Definition at line 332 of file mol_transform.cpp.

## ◆ molgroup_pack_in_periodic_box()

int molgroup_pack_in_periodic_box | ( | Bmolgroup * | molgroup | ) |

Distributes coordinates across periodic box boundaries.

Parameters

  *molgroup | molecule group structure.

Returns
  int 0.

Definition at line 513 of file mol_transform.cpp.

## ◆ 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

  *molgroup | molecule group structure.
  location | desired center-of-mass coordinates.

Returns
  int 0.

Definition at line 666 of file mol_transform.cpp.

## ◆ molgroup_resolve_pbc()

int molgroup_resolve_pbc | ( | Bmolgroup * | molgroup | ) |

Recombines coordinates split across periodic box boundaries.

Parameters

  *molgroup | molecule 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.

Definition at line 450 of file mol_transform.cpp.

## ◆ molgroup_rotate()

Bmolgroup * molgroup_rotate | ( | Bmolgroup * | molgroup,
|  | Matrix3 | mat,
|  | Vector3< double > | origin,
|  | Vector3< double > | trans
| ) |  |

Definition at line 216 of file mol_transform.cpp.

## ◆ 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

  *molgroup | molecule group structure (unmodified).
  view | view to rotate from.
  origin | origin of rotation.
  trans | 3-valued translation vector.

Returns
  Bmolgroup* new molecule group.

Definition at line 203 of file mol_transform.cpp.

## ◆ 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

  *molgroup | molecule group structure (unmodified).
  view | view to rotate to.
  origin | origin of rotation.
  trans | 3-valued translation vector.

Returns
  Bmolgroup* new molecule group.

Definition at line 180 of file mol_transform.cpp.

## ◆ 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

  *molgroup | molecule group structure.

Returns
  int 0.

Definition at line 625 of file mol_transform.cpp.

## Variable Documentation

## ◆ verbose

int verbose