oILAB
Loading...
Searching...
No Matches
testCoincidentRotations.cpp

This example demonstrates the generation of CSLs using rotations about an axis of a 3D lattice

  1. Define types
    using VectorDimI = LatticeCore<3>::VectorDimI;
    using VectorDimD = LatticeCore<3>::VectorDimD;
    using IntScalarType = LatticeCore<3>::IntScalarType;
  2. Instantiate a lattice \(\mathcal A\)
    const auto A(TextFileParser("bicrystal_3d.txt").readMatrix<double,3,3>("A",true));
    Lattice<3> lattice(A);
  3. Specify an axis in the form of a reciprocal lattice direction
    const auto axis (TextFileParser("bicrystal_3d.txt").readMatrix<double,3,1>("axis",true));
    ReciprocalLatticeVector<3> rv(axis,lattice);
    std::cout << "Miller indices of the tilt axis plane = " << std::endl;
    std::cout << rv << std::endl;
  4. Generate a family of rotations about the given axis such that lattices \(\mathbf R\mathcal A\) and \(\mathbf R\mathcal A\) share a coincidence relation
    const auto& coincidentRotations= lattice.generateCoincidentLattices(rv);
  5. Loop over the the above family of rotations and carry out SNF bicrystallography of bicrystals \(\mathcal A \cup \mathbf R\mathcal A\).
    for (const auto& rotation : coincidentRotations)
    {
    try
    {
    double theta= acos((rotation.trace()-1.0)/2.0)*180/M_PI;
    std::cout << "angle = " << theta << "; ";
    BiCrystal<3> bc(lattice,Lattice<3>(lattice.latticeBasis,rotation),false);
    std::cout << "Sigma = " << bc.sigma << std::endl;
    }
    catch(std::runtime_error& e)
    {
    std::cout << e.what() << "Moving on ..." << std::endl;
    }
    }

Full code:

#include <LatticeModule.h>
#include <TextFileParser.h>
using namespace gbLAB;
int main()
{
using VectorDimI = LatticeCore<3>::VectorDimI;
using VectorDimD = LatticeCore<3>::VectorDimD;
using IntScalarType = LatticeCore<3>::IntScalarType;
const auto A(TextFileParser("bicrystal_3d.txt").readMatrix<double,3,3>("A",true));
Lattice<3> lattice(A);
const auto axis (TextFileParser("bicrystal_3d.txt").readMatrix<double,3,1>("axis",true));
ReciprocalLatticeVector<3> rv(axis,lattice);
std::cout << "Miller indices of the tilt axis plane = " << std::endl;
std::cout << rv << std::endl;
const auto& coincidentRotations= lattice.generateCoincidentLattices(rv);
for (const auto& rotation : coincidentRotations)
{
try
{
double theta= acos((rotation.trace()-1.0)/2.0)*180/M_PI;
std::cout << "angle = " << theta << "; ";
BiCrystal<3> bc(lattice,Lattice<3>(lattice.latticeBasis,rotation),false);
std::cout << "Sigma = " << bc.sigma << std::endl;
}
catch(std::runtime_error& e)
{
std::cout << e.what() << "Moving on ..." << std::endl;
}
}
return 0;
}
const int sigma
if , else
Definition BiCrystal.h:82
Lattice class.
Definition Lattice.h:34
int main(int argc, char **argv)
Definition main.cpp:11
Eigen::Matrix< double, dim, 1 > VectorDimD
Definition LatticeCore.h:24
long long int IntScalarType
Definition LatticeCore.h:26
Eigen::Matrix< IntScalarType, dim, 1 > VectorDimI
Definition LatticeCore.h:27