This example demonstrates the computation of step heights and the use of Gb class
{
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));
try
{
rvec << 1,1;
std::cout << "Miller indices w.r.t A: ";
std::cout << gb.
nA << std::endl;
std::cout << "Miller indices w.r.t B: ";
std::cout << gb.
nB << std::endl;
b << 1,1;
std::cout << "Step height A: ";
std::cout << stepHeightA << std::endl;
std::cout << "Step height B: ";
std::cout << stepHeightB << std::endl;
double cslPlaneSpacing= dir.planeSpacing();
double error= abs(stepHeightA-stepHeightB - b.
cartesian().dot(gb.
nA.cartesian().normalized()));
error= std::remainder(error,cslPlaneSpacing);
if((gb.
nA.cartesian().normalized()+gb.
nB.cartesian().normalized()).norm() > 1e-5)
throw std::runtime_error("Cartesian coordinates of normalized nA and nB are not anti-parallel");
if(error > 1e-6)
throw std::runtime_error("Error in step height calculation");
auto nC= gb.
bc.getReciprocalLatticeDirectionInC(gb.
nA.reciprocalLatticeVector());
auto planeParallelBasis= bc.
csl.planeParallelLatticeBasis(nC,
true);
std::vector<LatticeVector<2>> boxVectors;
boxVectors.push_back(planeParallelBasis[0].latticeVector());
boxVectors.push_back(planeParallelBasis[1].latticeVector());
gb.
box(boxVectors,0.9,1,
"gb.txt",
true);
}
catch(std::runtime_error& e)
{
std::cout << e.what() << std::endl;
return -1;
}
return 0;
}
const Lattice< dim > dscl
DCSL lattice .
const Lattice< dim > csl
CSL lattice .
const ReciprocalLatticeDirection< dim > nA
double stepHeightA(const LatticeVector< dim > &d) const
Computes the step height of a disconnection formed by displacing lattice by a Burgers vector .
const BiCrystal< dim > & bc
std::enable_if< dm==2||dm==3, std::vector< LatticeVector< dim > > >::type box(std::vector< LatticeVector< dim > > &boxVectors, const double &orthogonality, const int &dsclFactor, std::string filename="", bool orient=false) const
const ReciprocalLatticeDirection< dim > nB
double stepHeightB(const LatticeVector< dim > &d) const
Computes the step height of a disconnection formed by displacing lattice by a Burgers vector .
VectorDimD cartesian() const
int main(int argc, char **argv)
const ReciprocalLatticeVector< dim > & reciprocalLatticeVector() const
Returns a constant reference to the base class (ReciprocalLatticeVector)