10
0
mirror of https://github.com/LCPQ/quantum_package synced 2024-11-18 12:03:57 +01:00
quantum_package/scripts/save_current_mos.sh

52 lines
914 B
Bash
Raw Normal View History

2014-04-01 11:34:35 +02:00
#!/bin/bash
2014-04-03 01:45:22 +02:00
# This script is used by the MOs module, and should not be used by users.
# It copies the EZFIO/mo_basis directory in the save/EZFIO/mo_basis/xxx
# directory, where xxx is the corresponding mo_label.
# Wed Apr 2 14:35:15 CEST 2014
2014-04-01 11:34:35 +02:00
2015-09-22 09:07:34 +02:00
2015-06-08 14:49:10 +02:00
if [[ -z ${QP_ROOT} ]]
then
2015-06-08 14:49:10 +02:00
print "The QP_ROOT environment variable is not set."
print "Please reload the quantum_package.rc file."
exit -1
fi
2015-09-22 09:07:34 +02:00
EZFIO="$1"
2014-04-01 11:34:35 +02:00
2015-09-22 09:07:34 +02:00
if [[ -z "${EZFIO}" ]]
2014-04-01 11:34:35 +02:00
then
echo "Error in $0"
exit 1
fi
2015-09-22 09:07:34 +02:00
if [[ ! -f "${EZFIO}/mo_basis/mo_label" ]]
2014-04-01 11:34:35 +02:00
then
LABEL='no_label'
else
2015-09-22 09:07:34 +02:00
LABEL=$(head -1 "${EZFIO}/mo_basis/mo_label")
2014-04-01 11:34:35 +02:00
fi
DESTINATION="save/mo_basis/${LABEL}"
2015-09-22 09:07:34 +02:00
cd "${EZFIO}"
2014-04-01 11:34:35 +02:00
if [[ ! -d save/mo_basis ]]
then
mkdir -p save/mo_basis
fi
2015-09-22 09:07:34 +02:00
BACKUP="${DESTINATION}.old"
if [[ -d "${BACKUP}" ]]
2014-04-01 11:34:35 +02:00
then
2015-09-22 09:07:34 +02:00
rm -rf "${BACKUP}"
2014-04-01 11:34:35 +02:00
fi
2015-09-22 09:07:34 +02:00
if [[ -d "${DESTINATION}" ]]
2014-04-01 11:34:35 +02:00
then
2015-09-22 09:07:34 +02:00
mv "${DESTINATION}" "${BACKUP}"
2014-04-01 11:34:35 +02:00
fi
2015-09-22 09:07:34 +02:00
cp -r mo_basis "${DESTINATION}"
2014-04-01 11:34:35 +02:00