Mantid
|
This class contains static utility methods for determining an orientation matrix corresponding to a conventional, given the orientation matrix corresponding to the Niggli reduced cell. More...
#include <ScalarUtils.h>
Static Public Member Functions | |
static ConventionalCell | GetCellBestError (const std::vector< ConventionalCell > &list, bool use_triclinic) |
Get the cell from the list with the smallest error, possibly excluding triclinic cells. More... | |
static ConventionalCell | GetCellForForm (const Kernel::DblMatrix &UB, size_t form_num, bool allowPermutations=false) |
Get the best conventional cell for the form number, using the specified UB, and three related "almost Niggli" cells obtained by reflecting pairs of sides a, b, c. More... | |
static std::vector< ConventionalCell > | GetCells (const Kernel::DblMatrix &UB, bool best_only, bool allowPermutations=false) |
Get list of all possible conventional cells for UB, regardless of errors, using this UB, and three related "almost Niggli" cells obtained by reflecting pairs of sides a, b, c. More... | |
static std::vector< ConventionalCell > | GetCells (const Kernel::DblMatrix &UB, const std::string &cell_type, const std::string ¢ering, bool allowPermutations=false) |
Get list of conventional cells for UB with specified type and centering, using this UB, and three related "almost Niggli" cells obtained by reflecting pairs of sides a, b, c. More... | |
static std::vector< ConventionalCell > | GetCellsUBOnly (const Kernel::DblMatrix &UB, const std::string &cell_type, const std::string ¢ering, bool allowPermutations=false) |
Get list of conventional cells for UB with specified type and centering, using ONLY this UB, not related reflected cells. More... | |
static std::vector< Kernel::DblMatrix > | GetRelatedUBs (const Kernel::DblMatrix &UB, double factor, double angle_tolerance) |
Get list of related cells obtained by reflecting pairs of sides with nearly a 90 degree angle between the sides, and permuting sides. More... | |
static void | RemoveHighErrorForms (std::vector< ConventionalCell > &list, double level) |
Remove cells from list that have scalar errors above the specified level. More... | |
Static Private Member Functions | |
static void | AddIfBest (std::vector< ConventionalCell > &list, ConventionalCell &info) |
Add conventional cell to list if it has the least error for its form num. More... | |
This class contains static utility methods for determining an orientation matrix corresponding to a conventional, given the orientation matrix corresponding to the Niggli reduced cell.
Definition at line 32 of file ScalarUtils.h.
|
staticprivate |
Add conventional cell to list if it has the least error for its form num.
Add the conventional cell record to the list if there is not already an entry with the same form number, or replace the entry that has the same form number with the specified cell info, if the specified cell info has a smaller error.
NOTE: The list must initially contain at most one entry with the same form number as the specified ConventionalCellInfo object. That list property will be maintained by this method.
list | The initial list of ConventionalCell objects. |
info | The new ConventionalCell object that might be added to the list. |
Definition at line 418 of file ScalarUtils.cpp.
References Mantid::Geometry::ConventionalCell::GetError(), and Mantid::Geometry::ConventionalCell::GetFormNum().
Referenced by GetCells().
|
static |
Get the cell from the list with the smallest error, possibly excluding triclinic cells.
Get the cell info object that has the smallest error of any of the cells in the list.
If use_triclinc is false, this will skip triclinic cells in the list, and return the non-triclinic cell with the smallest error of all non-triclinic cells. If there is no such cell, or if the list is empty, this will throw an exception.
list | The list of conventional cell info objects. |
use_triclinic | If false, skip any triclinic cells in the list when checking for smallest error. |
Definition at line 280 of file ScalarUtils.cpp.
References error, Mantid::Geometry::ConventionalCell::GetCellType(), and Mantid::Geometry::ReducedCell::TRICLINIC().
Referenced by Mantid::Crystal::SelectCellOfType::exec(), and GetCells().
|
static |
Get the best conventional cell for the form number, using the specified UB, and three related "almost Niggli" cells obtained by reflecting pairs of sides a, b, c.
Get one cell, the for specified UB and form, by trying different reflections of a,b,c and forming the ConventionalCellInfo object corresponding to the smallest form error.
UB | Crystal::Orientation transformation corresponding to a Niggli reduced cell. |
form_num | The form number to use. |
allowPermutations | Allow permutations of conventional cells for related UBs with better fit to peaks. |
Definition at line 217 of file ScalarUtils.cpp.
References error, Mantid::Geometry::IndexingUtils::GetLatticeParameters(), GetRelatedUBs(), and Mantid::Geometry::ReducedCell::WeightedDistance().
Referenced by Mantid::Crystal::SelectCellWithForm::exec().
|
static |
Get list of all possible conventional cells for UB, regardless of errors, using this UB, and three related "almost Niggli" cells obtained by reflecting pairs of sides a, b, c.
Get a list of cell info objects, corresponding to all forms that match the specified UB, or related UBs, with pairs of edges reflected.
If the same form number matches several times when different pairs of edges are reflected, only the one with the smallest error value will be included. A pair of edges will be reflected if the angle between the edges is within 2 degrees of 90 degrees. This is needed to take care of the case where a positive Niggli cell was found, but due to errors in the data, a negative Niggli cell should have been found, and visa-versa.
UB | The lattice parameters for this UB matrix and matrices related to it by reflecting pairs of sides, are used to form the list of possible conventional cells. |
best_only | If true, only include the best form for each Bravais lattice. |
allowPermutations | Allow permutations of conventional cells for related UBs with better fit to peaks. |
Definition at line 91 of file ScalarUtils.cpp.
References AddIfBest(), BRAVAIS_CENTERING, BRAVAIS_TYPE, GetCellBestError(), and GetCells().
Referenced by Mantid::Crystal::SelectCellOfType::exec(), Mantid::Crystal::ShowPossibleCells::exec(), and GetCells().
|
static |
Get list of conventional cells for UB with specified type and centering, using this UB, and three related "almost Niggli" cells obtained by reflecting pairs of sides a, b, c.
Get a list of cell info objects, corresponding to all forms that match the specified UB, or related UBs, with pairs of edges reflected, and have the specified cell type and centering.
If the same form number matches several times when different pairs of edges are reflected, only the one with the smallest error value will be included. A pair of edges will be reflected if the angle between the edges is within 2 degrees of 90 degrees. This is needed to take care of the case where a positive Niggli cell was found, but due to errors in the data, a negative Niggli cell should have been found, and visa-versa.
UB | The lattice parameters for this UB matrix and matrices related to it by reflecting pairs of sides, are used to form the list of possible conventional cells. |
cell_type | String specifying the cell type, as listed in the ReducedCell class. |
centering | String specifying the centering, as listed in the ReducedCell class. |
allowPermutations | Allow permutations of conventional cells for related UBs with better fit to peaks. |
Definition at line 135 of file ScalarUtils.cpp.
References AddIfBest(), GetCellsUBOnly(), and GetRelatedUBs().
|
static |
Get list of conventional cells for UB with specified type and centering, using ONLY this UB, not related reflected cells.
Get a list of cell info objects that correspond to the specific given UB matrix.
The list will have at most one instance of any matching form since only the specified UB matrix is used (no reflections or other related cell modifications). For any form with the specified cell type and centering, a cell info object will be added to the list, regardless of the error in cell scalars. As a result, the list returned by this method will often have forms that don't fit well. However, the list will be a complete list of matching forms for the specified UB, cell_type and centering. Poorly matching entries can be removed subsequently by the calling code, if need be.
UB | The lattice parameters for this UB matrix are used to form the list of possible conventional cells. |
cell_type | String specifying the cell type, as listed in the ReducedCell class. |
centering | String specifying the centering, as listed in the ReducedCell class. |
allowPermutations | Allow permutations of conventional cells for related UBs with better fit to peaks. |
Definition at line 182 of file ScalarUtils.cpp.
References Mantid::Geometry::ReducedCell::GetCellType(), Mantid::Geometry::ReducedCell::GetCentering(), Mantid::Geometry::IndexingUtils::GetLatticeParameters(), and Mantid::Geometry::ReducedCell::NUM_CELL_TYPES.
Referenced by GetCells().
|
static |
Get list of related cells obtained by reflecting pairs of sides with nearly a 90 degree angle between the sides, and permuting sides.
Get a list of UB matrices that are related to the specified UB.
The related UBs are generated by both reflecting pairs of of the unit cell edge vectors a,b,c and permuting the resulting edge vectors in ways that preserve the handedness of the cell. For example replacing a,b,c with b,c,a would preserve the handedness, but replacing a,b,c with a,c,b would not. In this case we would also need to negate side a, so we would replace a,b,c with -a,c,b. A permutation of the sides is only used provided the sides are still "essentially" in increasing order. The specified factor provides a tolerance to relax the restriction that |a|<=|b|<=|c|. As long as a side is less than or equal to the following side times the specified factor, it is considered less than or equal to the following side, for purposes of checking whether or not the list of sides could form a Niggli cell. This provides a tolerance for experimental error. Two sides will be reflected across the origin if the angle between them is within the specified angle_tolerance of 90 degrees. This will help find the correct Niggli cell for cases where the angle is near 90 degrees. In particular, if a positive Niggli cell was found with an angle near 90 degrees, due to errors in the data, it possibly should have been a negative Niggli cell. Adding the cases with reflected sides for angles near 90 degrees will include the opposite sign Niggli cell so it is also checked.
UB | The original matrix (should be for Niggli cell) |
factor | Tolerance for error in real-space cell edge lengths. |
angle_tolerance | Tolerance for angles near 90 degree. |
Definition at line 339 of file ScalarUtils.cpp.
References Mantid::Kernel::V3D::angle(), fabs, Mantid::Geometry::OrientedLattice::GetABC(), Mantid::Geometry::OrientedLattice::GetUB(), and Mantid::Kernel::V3D::norm().
Referenced by GetCellForForm(), and GetCells().
|
static |
Remove cells from list that have scalar errors above the specified level.
Remove any forms from the list that have errors that are above the specified level.
list | The list of conventional cell objects to be cleaned up. |
level | This specifies the maximum error for cells that will not be discarded from the list. |
Definition at line 259 of file ScalarUtils.cpp.
Referenced by Mantid::Crystal::ShowPossibleCells::exec().