diff --git a/src/murfey/server/feedback.py b/src/murfey/server/feedback.py index 2e77928f..480db7fa 100644 --- a/src/murfey/server/feedback.py +++ b/src/murfey/server/feedback.py @@ -1115,12 +1115,12 @@ def _find_initial_model(visit: str, machine_config: MachineConfig) -> Path | Non def _downscaled_box_size( - particle_diameter: int, pixel_size: float + particle_diameter_ang: float, pixel_size: float ) -> Tuple[int, float]: + particle_diameter = particle_diameter_ang / pixel_size box_size = int(math.ceil(1.2 * particle_diameter)) box_size = box_size + box_size % 2 for small_box_pix in ( - 48, 64, 96, 128, @@ -1145,9 +1145,9 @@ def _downscaled_box_size( # Don't go larger than the original box if small_box_pix > box_size: return box_size, pixel_size - # If Nyquist freq. is better than 8.5 A, use this downscaled box, else step size + # If Nyquist freq. is better than 7.5 A, use this downscaled box, else step size small_box_angpix = pixel_size * box_size / small_box_pix - if small_box_angpix < 4.25: + if small_box_angpix < 3.75: return small_box_pix, small_box_angpix raise ValueError(f"Box size is too large: {box_size}") @@ -1161,9 +1161,9 @@ def _resize_intial_model( env: Dict[str, str], ) -> None: with mrcfile.open(input_path) as input_mrc: - input_size_x = input_mrc.nx - input_size_y = input_mrc.ny - input_size_z = input_mrc.nz + input_size_x = input_mrc.header.nx + input_size_y = input_mrc.header.ny + input_size_z = input_mrc.header.nz if executables.get("clip") and not input_size_x == input_size_y == input_size_z: # If the initial model is not a cube, do some padding clip_proc = subprocess.run( @@ -1198,6 +1198,8 @@ def _resize_intial_model( str(downscaled_box_size), "--rescale_angpix", str(downscaled_pixel_size), + "--force_header_angpix", + str(downscaled_pixel_size), "--o", str(output_path), ],