oILAB
Loading...
Searching...
No Matches
testSNF.cpp

This example demonstrates the SNF bicrystallography of two 2D lattices

  1. Instantiate the two lattices
    const auto A(TextFileParser("bicrystal_2d.txt").readMatrix<double,2,2>("A",true));
    const auto B(TextFileParser("bicrystal_2d.txt").readMatrix<double,2,2>("B",true));
    const auto F(TextFileParser("bicrystal_2d.txt").readMatrix<double,2,2>("F",true));
    Lattice<2> L1(A);
    Lattice<2> L2(B,F);
  2. SNF bicrystallography of the two lattices
    try
    {
    BiCrystal<2> bc(L1, L2);
    std::cout << "sigma_A=" << bc.sigmaA << std::endl;
    std::cout << "sigma_B=" << bc.sigmaB << std::endl;
    std::cout << "Lambda_A=" << std::endl;
    std::cout << bc.LambdaA<< std::endl;
    std::cout << "Lambda_B=" << std::endl;
    std::cout << bc.LambdaB<< std::endl;
    if (std::fabs(bc.sigmaA) != 34 || std::fabs(bc.sigmaB) != 40) {
    throw std::runtime_error("SNF error in sigma calculation \n");
    }
    }

Full code:

#include <LatticeModule.h>
#include <TextFileParser.h>
using namespace gbLAB;
int main()
{
const auto A(TextFileParser("bicrystal_2d.txt").readMatrix<double,2,2>("A",true));
const auto B(TextFileParser("bicrystal_2d.txt").readMatrix<double,2,2>("B",true));
const auto F(TextFileParser("bicrystal_2d.txt").readMatrix<double,2,2>("F",true));
Lattice<2> L1(A);
Lattice<2> L2(B,F);
try
{
BiCrystal<2> bc(L1, L2);
std::cout << "sigma_A=" << bc.sigmaA << std::endl;
std::cout << "sigma_B=" << bc.sigmaB << std::endl;
std::cout << "Lambda_A=" << std::endl;
std::cout << bc.LambdaA<< std::endl;
std::cout << "Lambda_B=" << std::endl;
std::cout << bc.LambdaB<< std::endl;
if (std::fabs(bc.sigmaA) != 34 || std::fabs(bc.sigmaB) != 40) {
throw std::runtime_error("SNF error in sigma calculation \n");
}
}
catch(std::runtime_error& e)
{
std::cout << e.what() << std::endl;
return -1;
}
return 0;
}
const IntScalarType sigmaB
Signed ratio of the unit cell volume of to that of : .
Definition BiCrystal.h:77
const MatrixDimI LambdaB
Shift tensor describes the shift in the CSL when lattice is shifted by a DSCL vector.
Definition BiCrystal.h:108
const IntScalarType sigmaA
Signed ratio of the unit cell volume of to that of . .
Definition BiCrystal.h:72
const MatrixDimI LambdaA
Shift tensor describes the shift in the CSL when lattice is shifted by a DSCL vector.
Definition BiCrystal.h:103
Lattice class.
Definition Lattice.h:34
int main(int argc, char **argv)
Definition main.cpp:11