CellEsdTest: synthetic cells in place of cells that looked measured
The monoclinic cell of the .ins/mmCIF and fit tests is now 10/7/12, beta 100, and the orthorhombic, hexagonal and tetragonal cells of the sampling tests are rounded synthetic ones. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_015CeEGgpKdfkCTJb3YNMJcu (cherry picked from commit 6f964bc0de0ca842f374e6aed83c8848e410173b)
This commit is contained in:
1 parent
48bf9ebe3a
commit
0143d57eb0
1 file changed
+12
-12
+12
-12
@@ -107,28 +107,28 @@ TEST_CASE("CellEsd: the metric basis has the free parameters of each crystal sys
|
||||
TEST_CASE("CellEsd: the metric basis spans the reciprocal metric of a cell of the group", "[cell_esd]") {
|
||||
// R G* R^T, not R^T G* R: only the right one keeps a hexagonal G* (g12* = +a*^2/2) in the span.
|
||||
double residual = 1.0;
|
||||
Coordinates(MetricBasis(Sg("P 61 2 2")), ReciprocalMetric(5.4, 5.4, 56.3, 90, 90, 120), residual);
|
||||
Coordinates(MetricBasis(Sg("P 61 2 2")), ReciprocalMetric(5.5, 5.5, 56.0, 90, 90, 120), residual);
|
||||
CHECK(residual < 1e-12);
|
||||
Coordinates(MetricBasis(Sg("R 3 :R")), ReciprocalMetric(7.0, 7.0, 7.0, 80, 80, 80), residual);
|
||||
CHECK(residual < 1e-12);
|
||||
Coordinates(MetricBasis(Sg("P 1 21 1")), ReciprocalMetric(11.0, 6.5, 11.3, 90, 96, 90), residual);
|
||||
Coordinates(MetricBasis(Sg("P 1 21 1")), ReciprocalMetric(10.0, 7.0, 12.0, 90, 100, 90), residual);
|
||||
CHECK(residual < 1e-12);
|
||||
// and nothing outside it
|
||||
Coordinates(MetricBasis(Sg("P 1 21 1")), ReciprocalMetric(11.0, 6.5, 11.3, 91, 96, 90), residual);
|
||||
Coordinates(MetricBasis(Sg("P 1 21 1")), ReciprocalMetric(10.0, 7.0, 12.0, 91, 100, 90), residual);
|
||||
CHECK(residual > 1e-4);
|
||||
}
|
||||
|
||||
TEST_CASE("CellEsd: e.s.d.s from a covariance follow the constraints and match sampling", "[cell_esd]") {
|
||||
CheckAgainstSampling("P 1", 7.1, 8.3, 9.2, 81.0, 76.0, 69.0);
|
||||
CheckAgainstSampling("P 1 21 1", 11.26, 6.54, 11.26, 90.0, 95.9, 90.0);
|
||||
CheckAgainstSampling("P 21 21 21", 8.35, 9.58, 27.07, 90.0, 90.0, 90.0);
|
||||
CheckAgainstSampling("P 61 2 2", 5.42, 5.42, 56.28, 90.0, 90.0, 120.0);
|
||||
CheckAgainstSampling("P 1 21 1", 10.0, 7.0, 12.0, 90.0, 100.0, 90.0);
|
||||
CheckAgainstSampling("P 21 21 21", 8.0, 9.5, 27.0, 90.0, 90.0, 90.0);
|
||||
CheckAgainstSampling("P 61 2 2", 5.5, 5.5, 56.0, 90.0, 90.0, 120.0);
|
||||
CheckAgainstSampling("R 3 :R", 7.0, 7.0, 7.0, 80.0, 80.0, 80.0);
|
||||
|
||||
// Tetragonal: a and b share one e.s.d., the angles have none.
|
||||
const auto basis = MetricBasis(Sg("I -4 2 d"));
|
||||
double residual = 0.0;
|
||||
const Eigen::VectorXd p = Coordinates(basis, ReciprocalMetric(7.4, 7.4, 6.9, 90, 90, 90), residual);
|
||||
const Eigen::VectorXd p = Coordinates(basis, ReciprocalMetric(7.5, 7.5, 7.0, 90, 90, 90), residual);
|
||||
const auto esd = CellEsdFromCovariance(basis, p, Eigen::MatrixXd::Identity(2, 2) * 1e-12);
|
||||
CHECK(esd[0] > 0.0);
|
||||
CHECK(esd[0] == Catch::Approx(esd[1]).epsilon(1e-9));
|
||||
@@ -137,7 +137,7 @@ TEST_CASE("CellEsd: e.s.d.s from a covariance follow the constraints and match s
|
||||
}
|
||||
|
||||
TEST_CASE("CellEsd: the d-spacing fit recovers the cell, and its e.s.d. is its scatter", "[cell_esd]") {
|
||||
const double a = 11.26, b = 6.54, c = 11.26, beta = 95.9;
|
||||
const double a = 10.0, b = 7.0, c = 12.0, beta = 100.0; // synthetic
|
||||
const Eigen::Matrix3d gstar = ReciprocalMetric(a, b, c, 90, beta, 90);
|
||||
std::vector<CellObservation> clean;
|
||||
for (int h = -8; h <= 8; h++)
|
||||
@@ -195,7 +195,7 @@ TEST_CASE("CellEsd: the d-spacing fit recovers the cell, and its e.s.d. is its s
|
||||
TEST_CASE("CellEsd: the SHELX .ins carries CELL, ZERR, LATT and SYMM", "[cell_esd][write_reflections]") {
|
||||
CellEsd esd;
|
||||
esd.esd = {0.0014, 0.0013, 0.0012, 0.0, 0.0034, 0.0};
|
||||
const UnitCell cell{11.262f, 6.543f, 11.257f, 90.0f, 95.916f, 90.0f};
|
||||
const UnitCell cell{10.0f, 7.0f, 12.0f, 90.0f, 100.0f, 90.0f}; // synthetic
|
||||
const auto path = (std::filesystem::temp_directory_path() / "rugnux_cell_esd_test.ins").string();
|
||||
const auto read_ins = [&](int sg_number, const CellEsd *e) {
|
||||
DiffractionExperiment x;
|
||||
@@ -212,7 +212,7 @@ TEST_CASE("CellEsd: the SHELX .ins carries CELL, ZERR, LATT and SYMM", "[cell_es
|
||||
// P 21/c: centrosymmetric with -1 at the origin, so LATT +1 and one operator of each pair.
|
||||
std::string ins = read_ins(14, &esd);
|
||||
CHECK(ins.find("TITL p in P 1 21/c 1\n") == 0);
|
||||
CHECK(ins.find(" 11.26200 6.54300 11.25700 90.0000 95.9160 90.0000\n") != std::string::npos);
|
||||
CHECK(ins.find(" 10.00000 7.00000 12.00000 90.0000 100.0000 90.0000\n") != std::string::npos);
|
||||
CHECK(ins.find("\nCELL 0.6199") != std::string::npos);
|
||||
CHECK(ins.find("\nZERR 4 0.00140 0.00130 0.00120 0.0000 0.0034 0.0000\n") != std::string::npos);
|
||||
CHECK(ins.find("\nLATT 1\n") != std::string::npos);
|
||||
@@ -240,7 +240,7 @@ TEST_CASE("CellEsd: the mmCIF carries the e.s.d.s, '.' where the symmetry fixes
|
||||
DiffractionExperiment x;
|
||||
x.IncidentEnergy_keV(20.0f);
|
||||
x.SpaceGroupNumber(4);
|
||||
const UnitCell cell{11.262f, 6.543f, 11.257f, 90.0f, 95.916f, 90.0f};
|
||||
const UnitCell cell{10.0f, 7.0f, 12.0f, 90.0f, 100.0f, 90.0f}; // synthetic
|
||||
x.SetUnitCell(cell);
|
||||
CellEsd esd;
|
||||
esd.esd = {0.0014, 0.0013, 0.0012, 0.0, 0.0034, 0.0};
|
||||
@@ -255,7 +255,7 @@ TEST_CASE("CellEsd: the mmCIF carries the e.s.d.s, '.' where the symmetry fixes
|
||||
gemmi::cif::Document doc = gemmi::read_cif_gz(path);
|
||||
std::filesystem::remove(path);
|
||||
gemmi::cif::Block &block = doc.blocks[0];
|
||||
CHECK(*block.find_value("_cell.length_a") == "11.2620");
|
||||
CHECK(*block.find_value("_cell.length_a") == "10.0000");
|
||||
CHECK(*block.find_value("_cell.length_a_esd") == "0.00140");
|
||||
CHECK(*block.find_value("_cell.angle_beta_esd") == "0.0034");
|
||||
CHECK(*block.find_value("_cell.angle_alpha_esd") == ".");
|
||||
|
||||
Reference in new issue
Block a user