echo "------------------------------------------------------"
echo "---------------ORCA MOLECULAR ORBITALS----------------"
echo "------------------------------------------------------"
echo ""
echo "This program generates the .cube and jmol-scripts for required MOs"
echo "Ensure that the following file exist in current working directory:"
echo "a) .gbw file "
echo "The orca file which consist of MO data"
echo ""
echo "b) mo-script"
echo "The jmol script " 
# Prompt for user input
read -p "Enter GBW filename (without .gbw): " file
read -p "Enter initial MO number: " m
read -p "Enter final MO number: " n

# Loop through the orbital range
for server in $(seq $m $n)
do
    echo "Processing MO $server..."
    
    printf "1\n1\n2\n$server\n5\n7\n10\n11\n" | orca_plot "$file.gbw" -i
    
    cp mo-script "mo$server-script"
    
    sed -i "s/mo_filename/$file.mo$server/g" "mo$server-script"
done

echo "Done! Generated files for MO $m to $n."

