9
1
mirror of https://github.com/QuantumPackage/qp2.git synced 2024-10-04 15:15:58 +02:00

Merge branch 'master' into dev

This commit is contained in:
Anthony Scemama 2021-11-18 09:06:00 +01:00 committed by GitHub
commit 14d69c1cdd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 106 additions and 17 deletions

83
bin/qp_gaussian Executable file
View File

@ -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)

View File

@ -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