Density Calculator is a library for calculating a gemmi
in-memory objects.
pip install density-calculator
density_calculator.calculate(structure: gemmi.Structure, mtz: gemmi.Mtz, column_names: List[str]) -> gemmi.Mtz
import density_calculator
import gemmi
mtz: gemmi.Mtz = gemmi.read_mtz_file("reflections.mtz")
st: gemmi.Structure = gemmi.read_structure("model.pdb")
# Calculate the difference map using density_calculator
recalculated_mtz: gemmi.Mtz = density_calculator.calculate(st, mtz, ["FP", "SIGFP"])
# Transform the difference_mtz into a map for calculation use
best_map: gemmi.FloatGrid = recalculated_mtz.transform_f_phi_to_map("FWT", "PHWT")
# Transform the difference_mtz into a map for calculation use
difference_map: gemmi.FloatGrid = recalculated_mtz.transform_f_phi_to_map("DELFWT", "PHDELWT")
pip install --no-build-isolation --config-settings=editable.rebuild=true -Cbuild-dir=build -ve .