Skip to content
Snippets Groups Projects
Commit d07b830c authored by Savici, Andrei T.'s avatar Savici, Andrei T.
Browse files

Re #17068. Allow negative determinant for UB

parent 56d8eef4
No related merge requests found
......@@ -56,7 +56,7 @@ public:
// Access private variables
const Kernel::DblMatrix &getU() const;
const Kernel::DblMatrix &getUB() const;
void setU(const Kernel::DblMatrix &newU, const bool force = false);
void setU(const Kernel::DblMatrix &newU, const bool force = true);
void setUB(const Kernel::DblMatrix &newUB);
// get u and v vectors for Horace/Mslice
Kernel::V3D getuVector() const;
......
......@@ -104,7 +104,8 @@ void OrientedLattice::setU(const DblMatrix &newU, const bool force) {
/** Sets the UB matrix and recalculates lattice parameters
@param newUB :: the new UB matrix*/
void OrientedLattice::setUB(const DblMatrix &newUB) {
if (UB.determinant() > 0) {
//check if determinant is close to 0. The 1e-10 value is arbitrary
if (std::fabs(newUB.determinant()) > 1e-10) {
UB = newUB;
DblMatrix newGstar, B;
newGstar = newUB.Tprime() * newUB;
......@@ -113,7 +114,7 @@ void OrientedLattice::setUB(const DblMatrix &newUB) {
B.Invert();
U = newUB * B;
} else
throw std::invalid_argument("determinant of UB is not greater than 0");
throw std::invalid_argument("determinant of UB is too close to 0");
}
/** Calculate the hkl corresponding to a given Q-vector
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment