10
0
mirror of https://github.com/QuantumPackage/qp2.git synced 2024-11-09 07:33:49 +01:00
QuantumPackage/bin/qp_basis

55 lines
1.2 KiB
Plaintext
Raw Normal View History

2020-03-17 16:39:43 +01:00
#!/usr/bin/env python3
2020-02-04 19:30:04 +01:00
# -*- coding: utf-8 -*-
"""
Installs basis sets in the data directory from Basis Set Exchange.
Usage:
qp_basis list
qp_basis get BSE_BASIS
qp_basis install BSE_BASIS QP_BASIS
"""
2020-03-17 16:39:43 +01:00
2020-02-04 19:30:04 +01:00
import sys
import os
import subprocess
try:
from docopt import docopt
from qp_path import QP_ROOT
except ImportError:
print("Please check if you have sourced the ${QP_ROOT}/quantum_package.rc")
print("(`source ${QP_ROOT}/quantum_package.rc`)")
sys.exit(1)
def main(arguments):
"""Main function"""
if arguments["list"]:
os.system("bse list-basis-sets")
elif arguments["install"]:
bse_basis = arguments["BSE_BASIS"]
qp_basis = arguments["QP_BASIS"]
for character in """"[]{}()*&%$#!;:,<>?'|\\""":
if character in qp_basis:
print("Invalid character %s in QP_BASIS"%character)
sys.exit(1)
path = QP_ROOT+"/data/basis/"+qp_basis
os.system("bse get-basis --unc-spdf '%s' gamess_us > %s"%(bse_basis, path))
elif arguments["get"]:
bse_basis = arguments["BSE_BASIS"]
os.system("bse get-basis --unc-spdf '%s' gamess_us"%(bse_basis))
if __name__ == '__main__':
ARGS = docopt(__doc__)
main(ARGS)