Mechanics of Defect Evolution Library
Loading...
Searching...
No Matches
LatticeTransitionMatrix.cpp
Go to the documentation of this file.
1/* This file is part of PIL, the Particle Interaction Library.
2 *
3 *
4 * MODEL is distributed without any warranty under the
5 * GNU General Public License (GPL) v2 <http://www.gnu.org/licenses/>.
6 */
7
8#ifndef model_LatticeTransitionMatrix_cpp_
9#define model_LatticeTransitionMatrix_cpp_
10#include <LatticeModule.h>
11#include <LatticeTransitionMatrix.h> // FLT_EPSILON
12
13namespace model
14{
20 /**********************************************************************/
21 template <int dim>
26
27 /**********************************************************************/
28 template <int dim>
30 const LatticeType &B)
31 {
32 const MatrixDimD R(B.latticeBasis * A.reciprocalBasis.transpose());
33
34 // Check that R is a proper rotation
35 const MatrixDimD RRT = R * R.transpose();
36 const double RRTmInorm = (RRT - Eigen::Matrix<double, dim, dim>::Identity()).norm() / Eigen::Matrix<double, dim, dim>::Identity().norm();
37 if (RRTmInorm > FLT_EPSILON)
38 {
39 std::cout << "R=" << std::endl
40 << R << std::endl;
41 std::cout << "R*R^T=" << std::endl
42 << RRT << std::endl;
43 std::cout << "norm(R*R^T-I)/norm(I)=" << RRTmInorm << ", tol=" << FLT_EPSILON << std::endl;
44 assert(0 && "R IS NOT ORTHOGONAL.");
45 }
46 // make sure that C2G is proper
47 assert(std::fabs(R.determinant() - 1.0) < FLT_EPSILON && "R IS NOT PROPER.");
48
49 // Compute the transition matrix T=inv(A)*B
50 const MatrixDimD T = A.reciprocalBasis.transpose() * B.latticeBasis;
51
52 // For the two lattices to have coincident sites, R must be a rational matrix
53 // Compute the integer matrix P and the integer sigma such that T=P/sigma
54 return RationalMatrix<dim>(T);
55 }
56
57 /**********************************************************************/
58 template <int dim>
60 const LatticeType &B_in) : /* init */ RationalMatrix<dim>(getTransitionMatrix(A_in, B_in))
61 {
62 }
63 template struct LatticeTransitionMatrix<3>;
64
65} // end namespace
66#endif
67
68
RationalMatrix(const MatrixDimD &R)
initial point of the source segment B
function infiniteDisplacement syms Ax Ay Az Bx By Bz qx qy qz u L x y z real A
a
Definition int_R.m:14
b
Definition int_R.m:16
static RationalMatrix< dim > getTransitionMatrix(const LatticeType &A, const LatticeType &B)
Eigen::Matrix< double, dim, dim > MatrixDimD
static IntValueType gcd(const IntValueType &a, const IntValueType &b)
LatticeTransitionMatrix(const LatticeType &A_in, const LatticeType &B_in)