I’m analyzing some moderate size SFX datasets with anomalous scattering, and I would like to use the multivariate Wilson prior and optimize r as in figure S13 of the paper. I’m wondering if there is a simple example somewhere which bakes in (un)friedelization in a single script with appropriate careless parameters? I have found this example, but it has a lot of complicated SLURM machinery I don’t want. Anyone have such a script handy (@Doeke_Hekstra , hkwang)?
For careless to merge anomalous data with the double Wilson prior, there are 3 steps.
- split the unmerged mtz file into two files containing
a) Friedel Plus and centric reflections
b) Friedel Minus reflections - merge these files using the
--separate-filesflag in careless - combine the ouputs
*_{0,1}.mtzinto a single mtz.
This workflow needs to accessory scripts which were previously called friedelize.py and unfriedelize.py. To better support this workflow, I’ve internalized and cleaned up these scripts in careless main. This feature isn’t available in the release version yet, but will be in the next release.
I have written a pilot slurm script for merging data on NERSC using this strategy. I would still welcome feedback from @Doeke_Hekstra or @hkwang.
#!/bin/bash
#SBATCH -A lcls_g
#SBATCH -C gpu
#SBATCH -q shared
#SBATCH -t 0-12:00
#SBATCH -n 1
#SBATCH -c 32
#SBATCH --gpus-per-task=1
BASE_DIR=/global/cfs/cdirs/lcls/nminneti/SPREAD_R2a_2025
BASE_NAME=R2A
INPUT_MTZ=$BASE_DIR/export_mtz/ox_51814704/step_8_for_careless_7119-7125.mtz
#INPUT_MTZ=$BASE_DIR/export_mtz/ox_51814704/step_8_for_careless_7153-7159.mtz #very small file for testing
OUTDIR=$BASE_DIR/careless/results/merge_$SLURM_JOB_ID
DMIN=1.80
ITERS=30_000
CARELESS_METADATA="dHKL,cartesian_fixed_x,cartesian_fixed_y,cartesian_fixed_z,ewald_offset"
CARELESS_PARAMS=(
--merge-half-datasets #Run merging for CChalf calculation
--half-dataset-repeats=1
--disable-progress-bar
--separate-files
--mlp-layers=10
--mlp-width=6
--image-layers=2
--dmin=$DMIN
--iterations=$ITERS
--double-wilson-r 0.0,0.99
--double-wilson-parents None,0
--optimize-double-wilson-r
)
# Loads careless 0.5.4
source /global/common/software/lcls/abismal/setup_careless.sh
# Log available GPUs
nvidia-smi
# Log TensorFlow devices
careless devices
mkdir -p $OUTDIR
cd $OUTDIR
careless.split_friedel $INPUT_MTZ
cat $0 >> $OUTDIR/merge.sh
careless mono ${CARELESS_PARAMS[@]} $CARELESS_METADATA friedel_plus.mtz friedel_minus.mtz $OUTDIR/$BASE_NAME
careless.combine_friedel $OUTDIR/$BASE_NAME\_0.mtz $OUTDIR/$BASE_NAME\_1.mtz $BASE_NAME\_merged.mtz
1 Like