CrystalAligner: A computer program to align crystal directions in a scanning electron microscope by global optimization
2020. Alignment of a crystal with the coordinate system of a scanning electron microscope (SEM) is essential for obtaining controlled diffraction conditions or investigating anisotropic material properties. The computer program crystalAligner was developed to enable the weighted constrained alignment of one or two crystal directions in crystals of arbitrary orientation and structure with the coordinate system of a SEM. For a given set of crystal directions, alignment objectives and rotational constraints, the algorithm simulates the rotation of the crystal on any constrained SEM stage and minimizes the misalignment of the crystal directions with prescribed coordinate axes of the SEM. The possibility of applying crystal symmetry and the use of a genetic algorithm for optimization ensure the determination of the global optimal alignment even in severely constrained conditions. In cases where ideal alignment is not obtainable, weighting factors can be applied to conflicting alignment objectives. Two application examples, the alignment of two crystal directions for a lamella lift out for nano-mechanical testing and the rotation of an orientation-related dual-phase microstructure into a standard projection, demonstrate the functionality and workflow of the freely available open-source program crystalAligner.