IRA reference

Functions

subroutine determinant3x3(a, d)

determinant of a 3x3 matrix a

subroutine sort(n, ndim, array, axis)

Use mergesort to sort the input array by the chosen axis.

The routine mergesort is located in sorting_module.

subroutine svd(m, n, a, u, s, v, ierr)

routine that calls LAPACK svd routine

Parameters
  • m[in] :: leading dimension of matrix a

  • n[in] :: second dimension of matrix a

  • a[in] :: matrix a

  • s[out] :: diagonal matrix of singular values

  • u[out] :: orthonormal matrix u

  • v[out] :: orthonormal matrix v

  • ierr[out] :: error code

subroutine permute_real_2d(n, m, array, order)

permute a real 2D array into order, equivalent to:

array(:,:) = array(:, order(:) )

subroutine permute_real_2d_back(n, m, array, order)

permute a real 2D array into inverse order, equivalent to:

array(:, order(:) ) = array(:,:)

subroutine permute_int_1d(n, array, order)

permute an integer 1D array into order, equivalent to:

array(:) = array( order(:) )

subroutine permute_int_1d_back(n, array, order)

permute an integer 1D array into inverse order, equivalent to:

array( order(:) ) = array(:)

subroutine set_orthonorm_bas(vec1, vec2, basis, fail)

Set orthonormal basis from input vectors, third is cross of the first two, fail happens when input is collinear.

basis on output contains basis vectors in rows.

subroutine svdrot_m(nat1, typ1, coords1_in, nat2, typ2, coords2_in, rmat, translate, ierr)

Optimal rotation by SVD.

This rouine allows rotation matrix to be a reflection. no ‘correction’ when determinant is negative

The output can be applied as:

coords2(:,i) = matmul( rmat, coords2(:,i) ) + translate

OR

coords1(:,i) = matmul( transpose(rmat), coords1(:,i) ) - &
                             matmul( transpose(rmat), translate )

Parameters
  • nat1[in] -> number of atoms in conf 1;

  • typ1(nat1)[in] -> atomic types in conf 1;

  • coords1_in(3, nat1)[in] -> coordinates of conf 1;

  • nat2[in] -> number of atoms in conf 2;

  • typ2(nat2)[in] -> atomic types in conf 2;

  • coords2_in(3, nat2)[in] -> coordinates of conf 2;

  • rmat(3, 3)[out] -> 3x3 optimal rotation matrix

  • translate(3)[out] -> optimal translation vector

Returns

rmat, translate

subroutine svd_forcerot(nat1, typ1, coords1_in, nat2, typ2, coords2_in, rmat, translate, ierr)

Optimal rotation by SVD.

This routine forces the output rmat to be rotation (determinant = +1)

The output can be applied as:

coords2(:,i) = matmul( rmat, coords2(:,i) ) + translate

OR

coords1(:,i) = matmul( transpose(rmat), coords1(:,i) ) - &
                             matmul( transpose(rmat), translate )

Parameters:

Parameters
  • 2{in, nat1, integer} – -> number of atoms in conf 1;

  • 2{in, typ1, integer} – size(nat1) -> atomic types in conf 1;

  • 2{in, coords1_in, real} – size(3,nat1) -> coordinates of conf 1;

  • 2{in, nat2, integer} – -> number of atoms in conf 2;

  • 2{in, typ2, integer} – size(nat2) -> atomic types in conf 2;

  • 2{in, coords2_in, real} – size(3,nat2) -> coordinates of conf 2;

  • 2{out, rmat, real} – size(3,3) -> 3x3 optimal rotation matrix

  • 2{out, translate, real} – size(3) -> optimal translation vector

subroutine get_gamma_m(nat1, typ1_in, coords1_in, nat2, typ2_in, coords2_in, kmax, gamma, gamma_idx, hd_out, some_thr)

Routine that does the loop over coords2 to find U_J, here called gamma. This is the main IRA loop over the space of rotations. Gamma basis can be returned as 3x3 matrix “gamma”, or 3x1 integer vector “gamma_idx”, which contains indices of atoms that set up the “gamma” basis. The first element gamma_idx(1) gives the reflection.

Parameters
  • nat1[in] -> number of atoms in conf 1;

  • typ1_in(nat1)[in] -> atomic types in conf 1;

  • coords1_in(3, nat1)[in] -> coordinates of conf 1;

  • nat2[in] -> number of atoms in conf 2;

  • typ2_in(nat2)[in] -> atomic types in conf 2;

  • coords2_in(3, nat2)[in] -> coordinates of conf 2;

  • kmax[in] -> distance cutoff for atoms included in search;

  • gamma(3, 3)[out] -> The U_J reference frame (here called gamma), as 3x3 matrix;

  • m_fin[out] -> Value giving reflection: m_fin = 1 -> no reflection, m_fin = -1 -> reflection.

  • hd_out[out] -> Hausdorff distance value

  • gamma_idx(3)[out] -> possible intent(out) array of atomic indices giving gamma, gamma_idx(1) = m_fin

  • some_thr[inout] -> threshold for dh, updated in self-sufficient way

subroutine ira_unify(nat1, typ1_in, coords1_in, candidate_1, nat2, typ2_in, coords2_in, candidate_2, kmax_factor, rotation, translation, permutation, hd_out, ierr)

Unified call to IRA for structures with equal and nonequal number of atoms. The SVD is NOT performed at the end of this routine!

the result is applied to struc 2:

j = permutation(i)
coords2(:,i) = matmul( rotation, coords2(:,j) ) + tr

Parameters
  • nat1[in] :: number of atoms in struc 1

  • typ1_in(nat1)[in] :: atomic types of struc 1

  • coords1_in(3, nat1)[in] :: atoms positions of struc1

  • candidate_1(nat1)[in] :: candidate cenral atom of struc 1

  • nat2[in] :: number of atoms of struc 2

  • typ2_in(nat2)[in] :: atomic types of struc 2

  • coords2_in(3, nat2)[in] :: atomic positions of struc 2

  • candidate_2(nat2)[in] :: candidate central atoms of struc 2

  • kmax_factor[in] :: multiplicative factor for kmax, should > 1.

  • rotation(3, 3)[out] :: R_apx rotation matrix after IRA

  • translation(3)[out] :: translation vector

  • permutation(nat2)[out] :: atomic permutations

  • hd_out[out] :: hausdorff distance

  • ierr[out] :: error value, negative on error, zero otherwise

subroutine ira_svd(nat1, typ1_in, coords1_in, nat2, typ2_in, coords2_in, kmax_factor, rotation, translation, permutation, hd, rmsd, ierr)

set_candidates + ira_unify + svd candidates are set as per default:

  • gc if equal;

  • 1st atom in smaller,

  • all in larger

  • hah

Input: Output:

Parameters
  • 2{in, nat1, integer – } :: number of atoms in struc 1

  • 2{in, typ1_in, integer – } size(nat1) :: atomic types of struc 1

  • 2{in, coords1_in, real – } size(3, nat1) :: atomic positions of struc 1

  • 2{in, nat2, integer – } :: number of atoms of struc 2

  • 2{in, typ2_in, integer – } size(nat2) :: atomic types of struc 2

  • 2{in, coords2_in, real – } size(3, nat2) :: atomic positions of struc 2

  • 2{in, kmax_factor, real – } :: multiplicative factor for kmax, should > 1.

  • 2{out, rotation, real – } size(3,3) :: \( R_{apx}\) rotation matrix after IRA

  • 2{out, translation, real – } size(3) :: translation vector

  • 2{out, permutation, integer – } size(nat2) :: atomic permutations

  • 2{out, hd, real} – :: hausdorff distance

  • 2{out, rmsd, real – } :: rmsd distance

  • 2{out, ierr, integer – } :: error value, negative on error, zero otherwise

subroutine ira_get_err_msg(ierr, msg)