diff --git a/common/DatasetSettings.cpp b/common/DatasetSettings.cpp index c6665018..3d7cc769 100644 --- a/common/DatasetSettings.cpp +++ b/common/DatasetSettings.cpp @@ -103,20 +103,18 @@ DatasetSettings &DatasetSettings::Compression(CompressionAlgorithm input) { } DatasetSettings &DatasetSettings::SetUnitCell(const std::optional &cell) { - if (cell - && (cell->a > 0.0) && std::isfinite(cell->a) - && (cell->b > 0.0) && std::isfinite(cell->b) - && (cell->c > 0.0) && std::isfinite(cell->c) - && (cell->alpha > 0.0) && std::isfinite(cell->alpha) - && (cell->beta > 0.0) && std::isfinite(cell->beta) - && (cell->gamma > 0.0) && std::isfinite(cell->gamma)) { - - check_min("Angle alpha", cell->alpha, 0); - check_min("Angle beta", cell->beta, 0); - check_min("Angle gamma", cell->gamma, 0); - - check_max("Angle alpha", cell->alpha, 360); - check_max("Angle beta", cell->beta, 360); + // If one or more cell parameters are zero - assume cell is not provided + // But if all parameters non-zero - throw exception for non-sense values + if (cell && (cell->a != 0) && (cell->b != 0) && (cell->c != 0) + && (cell->alpha != 0) && (cell->beta != 0) && (cell->gamma != 0)) { + check_min("Unit cell a", cell->a, 0.1); + check_min("Unit cell b", cell->b, 0.1); + check_min("Unit cell c", cell->c, 0.1); + check_min("Angle alpha", cell->alpha, 5.0); + check_min("Angle beta", cell->beta, 5.0); + check_min("Angle gamma", cell->gamma, 5.0); + check_max("Angle alpha", cell->alpha, 355.0); + check_max("Angle beta", cell->beta, 355.0); check_max("Angle gamma", cell->gamma, 360); unit_cell = cell; } else