From 4ddbe3933850ec19cce958f5209da23de6b5d57e Mon Sep 17 00:00:00 2001 From: Anthony Scemama Date: Sun, 11 Jul 2021 02:18:35 +0200 Subject: [PATCH 1/2] Added qp_gaussian --- bin/qp_gaussian | 83 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 83 insertions(+) create mode 100755 bin/qp_gaussian diff --git a/bin/qp_gaussian b/bin/qp_gaussian new file mode 100755 index 00000000..a059a023 --- /dev/null +++ b/bin/qp_gaussian @@ -0,0 +1,83 @@ +#!/usr/bin/env python3 +# +""" +Runs a Quantum Package calculation using a Gaussian input file. + +Usage: + qp_gaussian INPUT + +""" + +# Requires pymatgen (https://pymatgen.org/) +# pip install pymatgen + + +import os +import sys +import os.path + +try: + import qp_path +except ImportError: + print("source quantum_package.rc") + +from docopt import docopt +import pymatgen +from pymatgen.io.gaussian import GaussianInput + + +def main(arguments): + + filename = arguments["INPUT"] + + with open(filename,'r') as f: + text = f.read() + + in_file = GaussianInput.from_string(text) + + d = in_file.as_dict() + charge = ("%d"%(d["charge"])).replace('-','m') + basis = d["basis_set"] + mult = d["spin_multiplicity"] + natoms = len(d["molecule"]["sites"]) + with open("g09.xyz","w") as f: + f.write("%d\n"%natoms) + f.write("%s\n"%d["title"]) + f.write("%s\n"%in_file.get_cart_coords()) + + if basis is None: + print("Basis set not found. Use '/' before basis set") + sys.exit(1) + + command = f"rm -rf g09.ezfio" + os.system(command) + + command = f"qp_create_ezfio -c {charge} -m {mult} g09.xyz -b {basis} -o g09.ezfio" + os.system(command) + + command = f"rm -rf g09.xyz" + os.system(command) + + command = f"qp_run scf g09.ezfio" + os.system(command) + + command = f"qp_set_frozen_core g09.ezfio" + os.system(command) + + if d["functional"] == "FCI": + command = f"qp_run fci g09.ezfio" + elif d["functional"] == "CIS": + command = f"qp_run cis g09.ezfio" + elif d["functional"] == "CISD": + command = f"qp_run cisd g09.ezfio" + + os.system(command) + + + + + + +if __name__ == '__main__': + ARGUMENTS = docopt(__doc__) + main(ARGUMENTS) From 9875c8ce1130b19053be46bab285cbd8fa401589 Mon Sep 17 00:00:00 2001 From: vijay gopal chilkuri Date: Wed, 28 Jul 2021 07:44:08 +0200 Subject: [PATCH 2/2] Fix for `Floating-point exceptio` during the calculation of Ncsf --- src/csf/sigma_vector.irp.f | 40 ++++++++++++++++++++++---------------- 1 file changed, 23 insertions(+), 17 deletions(-) diff --git a/src/csf/sigma_vector.irp.f b/src/csf/sigma_vector.irp.f index 85ed5f84..edf6c400 100644 --- a/src/csf/sigma_vector.irp.f +++ b/src/csf/sigma_vector.irp.f @@ -56,24 +56,30 @@ endif endif ncfg = ncfgpersomo - ncfgprev - if(iand(MS,1) .EQ. 0) then - !dimcsfpercfg = max(1,nint((binom(i,i/2)-binom(i,i/2+1)))) - binom1 = dexp(logabsgamma(1.0d0*(i+1)) & - - logabsgamma(1.0d0*((i/2)+1)) & - - logabsgamma(1.0d0*(i-((i/2))+1))); - binom2 = dexp(logabsgamma(1.0d0*(i+1)) & - - logabsgamma(1.0d0*(((i/2)+1)+1)) & - - logabsgamma(1.0d0*(i-((i/2)+1)+1))); - dimcsfpercfg = max(1,nint(binom1 - binom2)) + if(i .EQ. 0 .OR. i .EQ. 1) then + dimcsfpercfg = 1 + elseif( i .EQ. 3) then + dimcsfpercfg = 2 else - !dimcsfpercfg = max(1,nint((binom(i,(i+1)/2)-binom(i,(i+3)/2)))) - binom1 = dexp(logabsgamma(1.0d0*(i+1)) & - - logabsgamma(1.0d0*(((i+1)/2)+1)) & - - logabsgamma(1.0d0*(i-(((i+1)/2))+1))); - binom2 = dexp(logabsgamma(1.0d0*(i+1)) & - - logabsgamma(1.0d0*((((i+3)/2)+1)+1)) & - - logabsgamma(1.0d0*(i-(((i+3)/2)+1)+1))); - dimcsfpercfg = max(1,nint(binom1 - binom2)) + if(iand(MS,1) .EQ. 0) then + !dimcsfpercfg = max(1,nint((binom(i,i/2)-binom(i,i/2+1)))) + binom1 = dexp(logabsgamma(1.0d0*(i+1)) & + - logabsgamma(1.0d0*((i/2)+1)) & + - logabsgamma(1.0d0*(i-((i/2))+1))); + binom2 = dexp(logabsgamma(1.0d0*(i+1)) & + - logabsgamma(1.0d0*(((i/2)+1)+1)) & + - logabsgamma(1.0d0*(i-((i/2)+1)+1))); + dimcsfpercfg = max(1,nint(binom1 - binom2)) + else + !dimcsfpercfg = max(1,nint((binom(i,(i+1)/2)-binom(i,(i+3)/2)))) + binom1 = dexp(logabsgamma(1.0d0*(i+1)) & + - logabsgamma(1.0d0*(((i+1)/2)+1)) & + - logabsgamma(1.0d0*(i-(((i+1)/2))+1))); + binom2 = dexp(logabsgamma(1.0d0*(i+1)) & + - logabsgamma(1.0d0*((((i+3)/2)+1)+1)) & + - logabsgamma(1.0d0*(i-(((i+3)/2)+1)+1))); + dimcsfpercfg = max(1,nint(binom1 - binom2)) + endif endif n_CSF += ncfg * dimcsfpercfg if(cfg_seniority_index(i+2) > ncfgprev) then