10
0
mirror of https://github.com/LCPQ/quantum_package synced 2024-09-27 03:51:01 +02:00
quantum_package/scripts/qp_set_frozen_core

76 lines
1.7 KiB
Plaintext
Raw Normal View History

#!/usr/bin/env python2
"""
Automatically finds n, the number of core electrons. Calls qp_set_mo_class
setting all MOs as Active, except the n/2 first ones which are set as Core.
If pseudo-potentials are used, all the MOs are set as Active.
For elements on the right of the periodic table, qp_set_frozen_core will work
as expected. But for elements on the left, a small core will be chosen. For
example, a Carbon atom will have 2 core electrons, but a Lithium atom will have
2019-01-14 15:20:51 +01:00
zero.
Usage:
2019-01-14 19:52:41 +01:00
qp_set_frozen_core [-q|--query] EZFIO_DIR
Options:
2019-01-14 15:20:51 +01:00
-q --query Prints in the standard output the number of frozen MOs
"""
import os
import sys
import os.path
try:
2019-01-14 15:20:51 +01:00
import qp_path
except ImportError:
print "source .quantum_package.rc"
raise
2019-01-14 15:20:51 +01:00
from docopt import docopt
from ezfio import ezfio
def main(arguments):
2019-01-14 15:20:51 +01:00
"""Main function"""
2019-01-14 19:52:41 +01:00
filename = arguments["EZFIO_DIR"]
ezfio.set_filename(filename)
2019-01-14 15:20:51 +01:00
n_frozen = 0
try:
do_pseudo = ezfio.pseudo_do_pseudo
except:
do_pseudo = False
if not do_pseudo:
for charge in ezfio.nuclei_nucl_charge:
if charge < 5:
pass
elif charge < 13:
2019-01-14 15:20:51 +01:00
n_frozen += 1
else:
2019-01-14 15:20:51 +01:00
n_frozen += 5
2019-01-05 01:51:21 +01:00
mo_num = ezfio.mo_basis_mo_num
2019-01-11 19:10:12 +01:00
if arguments["--query"]:
2019-01-14 15:20:51 +01:00
print n_frozen
sys.exit(0)
2019-01-14 15:20:51 +01:00
if n_frozen == 0:
os.system("""qp_set_mo_class -a "[1-%d]" %s""" %
(mo_num, sys.argv[1]))
else:
2019-01-14 15:20:51 +01:00
os.system("""qp_set_mo_class -c "[1-%d]" -a "[%d-%d]" %s""" %
(n_frozen, n_frozen+1, mo_num, sys.argv[1]))
if __name__ == '__main__':
2019-01-14 15:20:51 +01:00
ARGUMENTS = docopt(__doc__)
main(ARGUMENTS)