From: Full cyclic coordinate descent: solving the protein loop closure problem in Cα space
maxit = maximum number of iterations |
---|
moving = N × 3 matrix of Cα positions in moving segment |
fixed = N × 3 matrix of Cα positions in fixed segment |
threshold = desired minimum RMSD |
N = length of the segments |
M = 3 × 3 matrix (centered coordinates along columns) |
F = 3 × 3 matrix (centered coordinates along columns) |
S = diag(1, 1, -1) |
repeat maxit: |
# Start iteration over pivots |
for i from 2 to N-3: |
pivot = moving[i,:] |
# Make pivot point origin |
for j from 0 to 2: |
M [:,j] = moving [N-3+j,:]-pivot |
F [:,j] = fixed [N-3+j,:]-pivot |
# Find the rotation Γ that minimizes RMSD |
Σ = FMT |
U, D, VT= svd(Σ) |
# Check for reflection |
if det(U)det(VT)<0: |
U = US |
Γ = UVT |
# Evaluate and apply rotation |
if accept(Γ): |
# Apply the rotation to the moving segment |
for j from i+1 to N-1: |
moving [j,:] = Γ (moving [j,:]-pivot)+pivot |
rmsd = calc_rmsd(moving [N-3,:], fixed [N-3,:]) |
# Stop if RMSD below threshold |
if rmsd<threshold: |
return moving, rmsd |
# Failed: RMSD threshold not reached before maxit |
return 0 |