@@ -316,7 +316,8 @@ def write_cp2k_md_slurm_script(
316316#SBATCH --job-name=cp2k-md
317317#SBATCH --nodes=1
318318#SBATCH --ntasks-per-node=8
319- #SBATCH --time=24:00:00
319+ #SBATCH --mem=1G
320+ #SBATCH --time=01:00:00
320321#SBATCH --output=slurm-%j.out
321322
322323set -euo pipefail
@@ -368,20 +369,28 @@ def write_cp2k_snapshot_run_script(
368369#SBATCH --job-name=cp2k-snapshot
369370#SBATCH --nodes=1
370371#SBATCH --ntasks-per-node=8
371- #SBATCH --time=24:00:00
372+ #SBATCH --mem=1G
373+ #SBATCH --time=04:00:00
372374#SBATCH --output=slurm-%j.out
373375
374376set -euo pipefail
375377
376378CP2K_CMD="${CP2K_CMD:-cp2k.psmp}"
377- SCRIPT_DIR ="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
379+ RUN_DIR ="$(pwd)"
378380
379- if [[ -f "${SCRIPT_DIR}/ setup-env.sh" ]]; then
381+ if [[ -f setup-env.sh ]]; then
380382 # Optional user/site-specific environment setup.
381- source "${SCRIPT_DIR}/ setup-env.sh"
383+ source setup-env.sh
382384fi
383385export OMP_NUM_THREADS="${OMP_NUM_THREADS:-1}"
384386
387+ for input in pos.xyz single-point.inp md.inp; do
388+ if [[ ! -f "${input}" ]]; then
389+ echo "Missing ${input} in ${RUN_DIR}" >&2
390+ exit 1
391+ fi
392+ done
393+
385394if [[ ! -f .single-point.done ]]; then
386395 echo "Running single-point calculation"
387396 srun "${CP2K_CMD}" -i single-point.inp -o single-point.out
@@ -423,9 +432,13 @@ def write_cp2k_snapshot_submit_script(
423432 mkdir -p "${{run_dir}}"
424433 cp "${{main_dir}}/single-point.inp" "${{run_dir}}/single-point.inp"
425434 cp "${{main_dir}}/md.inp" "${{run_dir}}/md.inp"
435+ cp "${{main_dir}}/run.sh" "${{run_dir}}/run.sh"
426436 cp "${{xyz}}" "${{run_dir}}/pos.xyz"
437+ if [[ -f "${{main_dir}}/setup-env.sh" ]]; then
438+ cp "${{main_dir}}/setup-env.sh" "${{run_dir}}/setup-env.sh"
439+ fi
427440 echo "Submitting ${{stem}}"
428- sbatch --chdir="${{run_dir}}" "${{main_dir }}/run.sh"
441+ sbatch --chdir="${{run_dir}}" "${{run_dir }}/run.sh"
429442done
430443"""
431444 Path (fn_out ).write_text (script )
0 commit comments