dft_zmp/patch_n2v.sh

38 lines
956 B
Bash
Raw Permalink Normal View History

2024-02-26 10:47:10 +01:00
#!/bin/bash
2024-02-26 13:25:43 +01:00
set -e
if [[ -z "$CONDA_PREFIX" ]]; then
echo "You do not seem to have an active conda environment active, aborting"
exit 1
fi
PYTHON_VERSION=$(python --version | sed -e 's/.* \([0-9]\.[0-9]\{2\}\).*/\1/')
echo "Detected python v$PYTHON_VERSION"
N2V_DIR="$CONDA_PREFIX/lib/python$PYTHON_VERSION/site-packages/n2v"
2024-02-26 10:47:10 +01:00
case $1 in
r | reset)
echo "Unpatching n2v"
cp -v n2v.bak/engines/psi4.py n2v/engines/psi4.py
cp -v n2v.bak/inverter.py n2v/inverter.py
cp -v n2v.bak/methods/zmp.py n2v/methods/zmp.py
cp -v n2v.bak/grid/grider.py n2v/grid/grider.py
2024-02-26 13:25:43 +01:00
echo "Success"
2024-02-26 10:47:10 +01:00
;;
*)
echo "Patching n2v"
2024-02-26 13:25:43 +01:00
if [[ ! -d n2v.bak ]]; then
echo "Backing up n2v ..."
cp -v -r $N2V_DIR n2v.bak
echo "Done"
echo
fi
2024-02-26 10:47:10 +01:00
cp -v n2v.patched/engines/psi4.py n2v/engines/psi4.py
cp -v n2v.patched/inverter.py n2v/inverter.py
cp -v n2v.patched/methods/zmp.py n2v/methods/zmp.py
cp -v n2v.patched/grid/grider.py n2v/grid/grider.py
2024-02-26 13:25:43 +01:00
echo "Success"
2024-02-26 10:47:10 +01:00
;;
esac