diff --git a/reciprocalspaceship/utils/cell.py b/reciprocalspaceship/utils/cell.py index 4524203b..b1181f8a 100644 --- a/reciprocalspaceship/utils/cell.py +++ b/reciprocalspaceship/utils/cell.py @@ -29,7 +29,7 @@ def compute_dHKL(H, cell): if inverse.shape[-1] == 1: inverse = inverse.squeeze(-1) - F = np.array(cell.fractionalization_matrix.tolist()).astype(np.float64) + F = np.array(cell.frac.mat, dtype=np.float64) dhkls = np.reciprocal(np.linalg.norm((hkls @ F), 2, 1)).astype(np.float32) return dhkls[inverse] diff --git a/reciprocalspaceship/utils/grid.py b/reciprocalspaceship/utils/grid.py index 6ba0af8f..4bc2ef49 100644 --- a/reciprocalspaceship/utils/grid.py +++ b/reciprocalspaceship/utils/grid.py @@ -50,6 +50,7 @@ def get_reciprocal_grid_size(cell, dmin, sample_rate=3.0, spacegroup=None): # Use gemmi.Mtz to find valid grid (FFT-friendly and obeys symmetry) m = gemmi.Mtz() - m.spacegroup = spacegroup + if spacegroup is not None: + m.spacegroup = spacegroup return m.get_size_for_hkl(min_size=min_size) diff --git a/reciprocalspaceship/utils/structurefactors.py b/reciprocalspaceship/utils/structurefactors.py index e665e453..1966930b 100644 --- a/reciprocalspaceship/utils/structurefactors.py +++ b/reciprocalspaceship/utils/structurefactors.py @@ -131,4 +131,4 @@ def is_absent(H, spacegroup): absent : array Boolean array of length n. absent[i] == True if H[i] is systematically absent in sg. """ - return spacegroup.operations().systematic_absences(H) + return spacegroup.operations().systematic_absences(np.array(H, dtype=np.int32)) diff --git a/setup.py b/setup.py index 277304f9..4b70ec43 100644 --- a/setup.py +++ b/setup.py @@ -74,7 +74,7 @@ def getVersionNumber(): project_urls=PROJECT_URLS, python_requires=">=3.9", install_requires=[ - "gemmi>=0.5.5, <=0.6.7", + "gemmi>=0.7.0, <=0.7.0", "pandas>=2.2.2, <=2.2.3", "numpy", "scipy", @@ -90,7 +90,7 @@ def getVersionNumber(): entry_points={ "console_scripts": [ "rs.mtzdump=reciprocalspaceship.commandline.mtzdump:main", - "rs.cifdump=reciprocalspaceship.commandline.cifdump:main" + "rs.cifdump=reciprocalspaceship.commandline.cifdump:main", ] }, classifiers=[ diff --git a/tests/test_dataset_grid.py b/tests/test_dataset_grid.py index 77fa1267..cd869856 100644 --- a/tests/test_dataset_grid.py +++ b/tests/test_dataset_grid.py @@ -22,10 +22,10 @@ def test_to_reciprocal_grid_gemmi(mtz_by_spacegroup, sample_rate, p1, use_sf): grid_size = dataset.get_reciprocal_grid_size(sample_rate=sample_rate) if use_sf: - gemmigrid = gemmimtz.get_f_phi_on_grid("FMODEL", "PHIFMODEL", size=grid_size) - expected = np.array(gemmigrid, copy=False) dataset["sf"] = dataset.to_structurefactor("FMODEL", "PHIFMODEL") result = dataset.to_reciprocal_grid("sf", grid_size=grid_size) + gemmigrid = gemmimtz.get_f_phi_on_grid("FMODEL", "PHIFMODEL", size=grid_size) + expected = gemmigrid.array # Requires rtol due to truncations applied in gemmi assert np.allclose(result, expected, rtol=1e-4)