The general analytical rebridging algorithm is a set of subroutines capable of solving the rebridging problem in molecular simulations. It is freely distributed under the GNU Public License.

- Description
- Download sources
- Preparing the data input
- Function call and returned values
- Feedback
- References

Consider a arbitrary segment of the molecular backbone shown in
Fig. 1. The bonds shown in bold lines are chosen to
be torsionally constrained. Given the the two bonds
**u**_{1},
**u**_{6} in the 3-d space, the algorithm finds
all the solutions that re-insert in a valid way the backbone units
within the dotted region. The variables to be solved are the six
torsional angles
_{i}, *i* = 1,..., 6. The number of variables is
six, because the rebridging solution enforces six geometrical
constraints towards the end.

`do_rebridge`

. To make use of
the subroutine
- Uncompress the file with gunzip do_rebridge.tar.gz
- Extract the file with tar -xvf do_rebridge.tar
- Copy all of the extracted files to your source directory
- Call the do_rebridge subroutine from your code

We ask that you cite our paper [1] in any publications that result from
the use of the `do_rebridge`

subroutine.

We denote
** û**_{i},
*i* = 1,..., 6, as the unit axis of the *i*th
torsional bond. Let
**r**_{i} be the 3-d position of the atom that ends
the *i*th torsional bond. The idea is to construct a closed loop
consisting of seven joints with
**u**_{1}, **u**_{2},.., **u**_{7} and of seven links with vectors
**a**_{1},**a**_{2}, ..., **a**_{7}, as shown in
Fig. 2.

- Find the shortest vector,
**a**_{i}, that connects the lines containing the two consecutive torsional bonds**û**_{i}and**û**_{i + 1}. Choose the direction for**a**_{i}so that it goes from**û**_{i}to**û**_{i + 1}. Let*a*_{i}be the length of**a**_{i}. Define**â**_{i}as the unit axis of**a**_{i}. If the lines containing**û**_{i}and**û**_{i + 1}intersect with each other,*a*_{i}= 0 and**a**_{i}is a null vector. In this case, we choose**â**_{i}as the unit axis perpendicular to both**û**_{i}and**û**_{i + 1}and passing through the intersection. Choose the direction of**â**_{i}so that it is parallel with**û**_{i}`x`**û**_{i + 1}. - Calculate
_{i}, the ``twist'' angle, defined by**û**_{i},**â**_{i}, and**û**_{i + 1}. The ``twist'' angle_{i}is zero when**û**_{i}and**û**_{i + 1}are parallel to each other. In the*a*_{i}= 0 case, the**â**_{i}chosen in the previous step makes_{i}always positive. - Find the shortest
vector connecting
**r**_{i}and the line containing**â**_{i}, and calculate the projection of this vector on**û**_{i}. This projection is called*S*_{i}. - Find the shortest
vector connecting
**r**_{i + 1}and the line containing**â**_{i}, and calculate the projection of this vector on -**û**_{i + 1}. This projection is called*T*_{i}.

`do_rebridge`

are
`do_rebridge.c`

as
follows
void do_rebridge(double uv1[3], double uv6[3], double rv1[3], double rv6[3], double a_in[6], double alpha_in[6], double S_in[6], double T_in[6], int *n_roots, double **uv_solve[MAXROOTS], double **rv_solve[MAXROOTS])Here

`MAXROOTS`

is 16, the maximum number of possible
solutions. The first and second arguments pass the 3-d components of
the unit axes
`a_in[1]`

stores
`S_in[5]`

stores `*n_roots`

returns the number of solutions
found. It is always an even number between 0 and 16. The 3-dimensional
array `**uv_solve[MAXROOTS]`

returns
`**rv_solve[MAXROOTS]`

returns
`uv_solve[i][j][k]`

as an example, the valid ranges for the
`i`

, `j`

, and `k`

are 0,...,`*n_roots-1`

,
1,..., 6, and
0,..., 2, respectively. The `uv_solve[i]`

and `rv_solve[i]`

vectors determine the positions of the five
rebridged units, as determined in the A minimal example of a call to do_rebridge has been graciously provided by Stepan Ruzicka (stepan.ruzicka@epfl.ch). It can be found here (download example.tar.gz, last updated 4 August 2017).

In actual Monte Carlo simulations, each solution must be weighted by a associated Jacobian so as to account for the non-uniform distribution of the solutions in the torsional angle space. The Jacobian J takes this form:

Here
is the z-axis of the reference coordinate.
The determinant of the 5x5 matrix **B** can be evaluated by the
function `double mtx_det(double **a, int n)`

in
`mtxinv.c`

. The first argument, `double **a`

, passes the
elements of **B**, and the second argument `n`

passes
the size of the matrix, which is 5 in this case. The subscripts of
the 2-dimensional array `a`

go from 0 to `n-1`

.
That is, `a[i-1][j-1]`

stores the value of, where `i`

and `j`

are 1,...,`n`

.

`do_rebridge.c`

is unsupported software.