from coseda.logging_utils import log_print
import subprocess
[docs]
def run_index_and_integrate(
geom_file,
list_file,
output_stream,
threads,
cell_file,
push_res,
integration_mode,
int_radius,
min_peaks,
xgandalf_tolerance,
xgandalf_pitch,
xgandalf_min_len,
xgandalf_max_len,
xgandalf_iter,
tolerance,
profile_radius,
use_cell=True,
):
cmd = [
'indexamajig',
'-g', geom_file,
'-i', list_file,
'-o', output_stream,
'-j', str(threads),
'--indexing=xgandalf',
*(['-p', cell_file] if use_cell else []),
f'--push-res={push_res}',
f'--integration={integration_mode}',
'--no-check-cell',
f'--int-radius={int_radius}',
'--no-retry',
'--peaks=cxi',
'--no-half-pixel-shift',
'--no-revalidate',
'--max-indexer-threads=1',
f'--min-peaks={min_peaks}',
f'--xgandalf-tolerance={xgandalf_tolerance}',
f'--xgandalf-sampling-pitch={xgandalf_pitch}',
*([f'--xgandalf-min-lattice-vector-length={xgandalf_min_len}',
f'--xgandalf-max-lattice-vector-length={xgandalf_max_len}'] if not use_cell else []),
f'--xgandalf-grad-desc-iterations={xgandalf_iter}',
f'--tolerance={tolerance}',
'--no-non-hits-in-stream',
]
if profile_radius:
cmd.append(f'--fix-profile-radius={profile_radius}')
log_print(f"Running: {' '.join(cmd)}")
subprocess.run(cmd, check=True)