#!/usr/bin/env python3

"""Installs the default basis set files from the BSE command-line tool in the required format for """

import basis_set_exchange as bse
conversion = {
    "3-21g":  "3-21G",
    "4-31g":  "4-31G",
    "6-311g":  "6-311G",
    "6-311++g_2d_2p":  "6-311++G(2d,2p)",
    "6-311g_2df_2pd":  "6-311G(2df,2pd)",
    "6-311++g_3df_3pd":  "6-311++G(3df,3pd)",
    "6-311+g_star":  "6-311+G*",
    "6-311G_star":  "6-311G*",
    "6-311++g_star_star":  "6-311++G**",
    "6-311G_star_star":  "6-311G**",
    "6-31g":  "6-31G",
    "6-31+g":  "6-31+G",
    "6-31++g":  "6-31++G",
    "6-31g_3df_3pd":  "6-31G(3df,3pd)",
    "6-31++g_star":  "6-31++G*",
    "6-31+g_star":  "6-31+G*",
    "6-31g_star":  "6-31G*",
    "6-31++g_star_star":  "6-31++G**",
    "6-31g_star_star":  "6-31G**",
    "ano2_ames":  "NASA Ames ANO2",
    "ano_ames":  "NASA Ames ANO",
    "ano-rcc":  "ANO-RCC",
    "apr-cc-pv_q+d_z":  "apr-cc-pV(Q+d)Z",
    "aug-cc-pcv5z":  "aug-cc-pCV5Z",
    "aug-cc-pcvdz":  "aug-cc-pCVDZ",
    "aug-cc-pcvqz":  "aug-cc-pCVQZ",
    "aug-cc-pcvtz":  "aug-cc-pCVTZ",
    "aug-cc-pv5z":  "aug-cc-pV5Z",
    "aug-cc-pv6z":  "aug-cc-pV6Z",
    "aug-cc-pvdz":  "aug-cc-pVDZ",
    "aug-cc-pvqz":  "aug-cc-pVQZ",
    "aug-cc-pvtz":  "aug-cc-pVTZ",
    "aug-cc-pwcv5z":  "aug-cc-pwCV5Z",
    "aug-cc-pwcvdz":  "aug-cc-pwCVDZ",
    "aug-cc-pwcvqz":  "aug-cc-pwCVQZ",
    "aug-cc-pwcvtz":  "aug-cc-pwCVTZ",
    "cc-pcv5z":  "cc-pCV5Z",
    "cc-pcvdz":  "cc-pCVDZ",
    "cc-pcvqz":  "cc-pCVQZ",
    "cc-pcvtz":  "cc-pCVTZ",
    "cc-pv5z":  "cc-pV5Z",
    "cc-pv6z":  "cc-pV6Z",
    "cc-pv8z":  "cc-pV8Z",
    "cc-pv9z":  "cc-pV9Z",
    "cc-pvdz":  "cc-pVDZ",
    "cc-pvqz":  "cc-pVQZ",
    "cc-pvtz":  "cc-pVTZ",
    "cc-pwcv5z":  "cc-pwCV5Z",
    "cc-pwcvdz":  "cc-pwCVDZ",
    "cc-pwcvqz":  "cc-pwCVQZ",
    "cc-pwcvtz":  "cc-pwCVTZ",
    "d-aug-cc-pv5z":  "d-aug-cc-pV5Z",
    "d-aug-cc-pv6z":  "d-aug-cc-pV6Z",
    "d-aug-cc-pvdz":  "d-aug-cc-pVDZ",
    "d-aug-cc-pvqz":  "d-aug-cc-pVQZ",
    "d-aug-cc-pvtz":  "d-aug-cc-pVTZ",
    "def2-qzvp":  "def2-QZVP",
    "def2-qzvpd":  "def2-QZVPD",
    "def2-qzvpp":  "def2-QZVPP",
    "def2-qzvppd":  "def2-QZVPPD",
    "def2-svp":  "def2-SVP",
    "def2-sv_p":  "def2-SV(P)",
    "def2-svpd":  "def2-SVPD",
    "def2-tzvp":  "def2-TZVP",
    "def2-tzvpd":  "def2-TZVPD",
    "def2-tzvpp":  "def2-TZVPP",
    "def2-tzvppd":  "def2-TZVPPD",
    "jul-cc-pv_d+d_z":  "jul-cc-pV(D+d)Z",
    "jul-cc-pv_q+d_z":  "jul-cc-pV(Q+d)Z",
    "jul-cc-pv_t+d_z":  "jul-cc-pV(T+d)Z",
    "jun-cc-pv_d+d_z":  "jun-cc-pV(D+d)Z",
    "jun-cc-pv_q+d_z":  "jun-cc-pV(Q+d)Z",
    "jun-cc-pv_t+d_z":  "jun-cc-pV(T+d)Z",
    "lanl08":  "LANL08",
    "lanl08+":  "LANL08+",
    "lanl08d":  "LANL08(d)",
    "lanl08f":  "LANL08(f)",
    "m6-31g":  "m6-31G",
    "may-cc-pv_q+d_z":  "may-cc-pV(Q+d)Z",
    "may-cc-pv_t+d_z":  "may-cc-pV(T+d)Z",
    "midi_bang":  "MIDI!",
    "midi_huzinaga":  "MIDI",
    "mini":  "MINI",
    "pv6z":  "pV6Z",
    "pv7z":  "pV7Z",
    "pvdz_ahlrichs":  "Ahlrichs pVDZ",
    "sto-2g":  "STO-2G",
    "sto-3g":  "STO-3G",
    "sto-4g":  "STO-4G",
    "sto-5g":  "STO-5G",
    "sto-6g":  "STO-6G",
    "sto-3g_star":  "STO-3G*",
}


for filename in conversion.keys():
    print(filename)
    data = bse.get_basis(
        conversion[filename], fmt='nwchem', uncontract_general=True, uncontract_spdf=True)
    with open(filename, 'w') as f:
        f.write(data)
