Job file auto-rewriting

2025 July 10, updated

In CrySPY job files, the string CrySPY_ID is automatically replaced with the structure ID. When using job schedulers like PBS or SLURM, it is convenient to use the structure ID in the job name. For example, in PBS, #PBS -N Si_CrySPY_ID becomes #PBS -N Si_15. In most cases, job names cannot start with numbers, so it’s good to start with letters like Si_.

Also, since version 1.4.2, it is no longer necessary to write the following command at the end. CrySPY automatically appends it.

sed -i -e '3s/^sub.*/done/' stat_job

For example, if you prepare a job file like this in ./calc_in/job_cryspy (where job_cryspy is the file name specified by jobfile in cryspy.in):

#!/bin/sh
#$ -cwd
#$ -V -S /bin/bash
####$ -V -S /bin/zsh
#$ -N Si8_CrySPY_ID
#$ -pe smp 20
####$ -q ibis1.q
####$ -q ibis2.q

mpirun -np $NSLOTS pw.x < pwscf.in > pwscf.out


if [ -e "CRASH" ]; then
    sed -i -e '3 s/^.*$/skip/' stat_job
    exit 1
fi

For example, if the ID is 15, CrySPY rewrites ./work/15/job_cryspy as follows. The CrySPY_ID in the 5th line is replaced with 15, and the sed command is appended at the end.

#!/bin/sh
#$ -cwd
#$ -V -S /bin/bash
####$ -V -S /bin/zsh
#$ -N Si8_15
#$ -pe smp 20
####$ -q ibis1.q
####$ -q ibis2.q

mpirun -np $NSLOTS pw.x < pwscf.in > pwscf.out


if [ -e "CRASH" ]; then
    sed -i -e '3 s/^.*$/skip/' stat_job
    exit 1
fi

# ---------- CrySPY
sed -i -e '3s/^sub.*/done/' stat_job