Skip to content

Commit

Permalink
add ADF
Browse files Browse the repository at this point in the history
  • Loading branch information
Konjkov committed Mar 30, 2019
1 parent 5f44957 commit 85f3b73
Show file tree
Hide file tree
Showing 15 changed files with 132 additions and 112 deletions.
66 changes: 48 additions & 18 deletions ADF/Snakefile
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import re

WFN_FILE = 'stowfn.data'
WFN_TYPE = 'slater-type'
include: '../Snakefile'

STD_ERR = config['STD_ERR']
Expand All @@ -10,17 +12,13 @@ BASES = config['BASES']
JASTROWS = config['JASTROWS']


def get_up_down(*path):
"""Get up and down electron numbers from ADF output file.
Nalpha = 3
Nbeta = 2
def get_up_down(method, basis, molecule):
"""Get up and down electron numbers from XYZ output file.
"""
with open(os.path.join(*path, 'output.dat'), 'r') as adf_out:
for line in adf_out:
if line.startswith(' Nalpha'):
neu = int(line.split('=')[1])
if line.startswith(' Nbeta'):
ned = int(line.split('=')[1])
charge, mult = get_XYZ_charge_mul(molecule)
elec = get_XYZ_nel(molecule)
neu = (elec + mult - 1)//2
ned = (elec - mult + 1)//2
return neu, ned


Expand All @@ -36,6 +34,12 @@ rule ALL_VMC_DMC:
expand('{method}/{basis}/{molecule}/VMC_DMC/emin/{jastrow}/tmax_2_2048_2/out', method=METHODS, basis=BASES, molecule=MOLECULES, jastrow=JASTROWS),
expand('{method}/{basis}/{molecule}/VMC_DMC/emin/{jastrow}/tmax_4_4096_2/out', method=METHODS, basis=BASES, molecule=MOLECULES, jastrow=JASTROWS),

rule ALL_VMC_DMC_BF:
input:
expand('{method}/{basis}/{molecule}/VMC_DMC_BF/emin_BF/{jastrow}__9_9_33/tmax_1_1024_2/out', method=METHODS, basis=BASES, molecule=MOLECULES, jastrow=JASTROWS),
# expand('{method}/{basis}/{molecule}/VMC_DMC_BF/emin_BF/{jastrow}__9_9_33/tmax_2_2048_2/out', method=METHODS, basis=BASES, molecule=MOLECULES, jastrow=JASTROWS),
# expand('{method}/{basis}/{molecule}/VMC_DMC_BF/emin_BF/{jastrow}__9_9_33/tmax_4_4096_2/out', method=METHODS, basis=BASES, molecule=MOLECULES, jastrow=JASTROWS),

rule ALL_VMC_OPT_ENERGY:
input:
expand('{method}/{basis}/{molecule}/VMC_OPT_ENERGY/emin/{jastrow}/1000000/out', method=METHODS, basis=BASES, molecule=MOLECULES, jastrow=JASTROWS),
Expand All @@ -44,39 +48,65 @@ rule ALL_VMC_OPT:
input:
expand('{method}/{basis}/{molecule}/VMC_OPT/emin/{jastrow}/out', method=METHODS, basis=BASES, molecule=MOLECULES, jastrow=JASTROWS),

rule ALL_VMC_OPT_BF:
input:
expand('{method}/{basis}/{molecule}/VMC_OPT_BF/emin_BF/{jastrow}__9_9_33/out', method=METHODS, basis=BASES, molecule=MOLECULES, jastrow=JASTROWS),

rule ALL_VMC:
input:
expand('{method}/{basis}/{molecule}/VMC/10000000/out', method=METHODS, molecule=MOLECULES, basis=BASES),

rule ALL_ADF:
input:
expand('{method}/{basis}/{molecule}/gwfn.data', method=METHODS, molecule=MOLECULES, basis=BASES),
expand('{method}/{basis}/{molecule}/stowfn.data', method=METHODS, molecule=MOLECULES, basis=BASES),

###################################################################################################################

rule MDET:
input: '{method}/{basis}/{molecule}/output.dat'
output: '{method}/{basis}/{molecule}/correlation.data'
shell: 'cd "$(dirname "{output}")" && multideterminant.py 1 output.dat'
shell: 'cd "$(dirname "{output}")" && multideterminant.py 0 output.dat'

rule WFN:
input: '{method}/{basis}/{molecule}/TAPE21.asc'
output: '{method}/{basis}/{molecule}/stowfn.data'
shell: 'cd "$(dirname "{output}")" && adf2stowf.py'

rule GWFN:
rule TAPE21:
input: '{method}/{basis}/{molecule}/output.dat'
output: '{method}/{basis}/{molecule}/gwfn.data'
shell: 'molden2qmc.py 1 "$(dirname "{output}")/molden.dat" "{output}"'
output: '{method}/{basis}/{molecule}/TAPE21.asc'
shell: 'dmpkf "$(dirname "{output}")/TAPE21" > "{output}"'

rule ADF_RUN:
input: '{path}/input.dat'
output: '{path}/output.dat'
shell: 'cd "{wildcards.path}" && adf < {input} > {output}'
shell: 'cd "{wildcards.path}" && adf < input.dat > output.dat'

rule ADF_INPUT:
input: INPUTS_DIR + '/{molecule}.xyz'
output: '{method}/{basis}/{molecule}/input.dat'
run:
total_nel = get_XYZ_nel(wildcards.molecule)
charge, multiplicity = get_XYZ_charge_mul(wildcards.molecule)
with open(input[0], 'r') as f:
f.readline() # skip first line
f.readline() # skip second line
molecule_data = f.read()[:-1] # skip last NL
with open(output[0], 'w') as f:
basis = wildcards.basis.replace('ZORA_', 'ZORA/')
splited_basis = basis.split('_')
basis = splited_basis[0]
if len(splited_basis) == 2:
# None, Small, Medium, Large
core = splited_basis[1]
else:
core = 'None'
f.write(open('adf.tmpl').read().format(
basis=wildcards.basis,
basis=basis,
core=core,
method=wildcards.method,
molecule=wildcards.molecule,
charge=charge,
a_minus_b=multiplicity-1,
unrestricted='UNRESTRICTED' if multiplicity>1 else '',
molecule_data=molecule_data,
))
8 changes: 6 additions & 2 deletions ADF/adf.tmpl
Original file line number Diff line number Diff line change
@@ -1,12 +1,16 @@
Title {molecule}

ATOMS
He 0.000000000000 0.000000000000 0.000000000000
{molecule_data}
END

CHARGE {charge} {a_minus_b}

{unrestricted}

BASIS
Type {basis}
Core None
Core {core}
END

XC
Expand Down
11 changes: 8 additions & 3 deletions ADF/config.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
STD_ERR: 0.0001
VMC_NCONFIG: 100000
MOLECULES: ['B']
METHODS: ['HF']
BASES: ['def2-QZVP']
#MOLECULES: ['H', 'He', 'Li', 'Be', 'B', 'C', 'N', 'O', 'F', 'Ne', 'Na', 'Mg', 'Al', 'Si', 'P', 'S', 'P', 'Cl', 'Ar']
#MOLECULES: ['K', 'Ca', 'Sc', 'Ti', 'V', 'Cr', 'Mn', 'Fe', 'Co', 'Ni', 'Cu', 'Zn', 'Ga', 'Ge', 'As', 'Se', 'Br', 'Kr']
METHODS: ['HartreeFock']
#BASES: ['DZ', 'TZP', 'TZ2P', 'QZ4P']
BASES: ['QZ4P']
#MOLECULES: ['Rb', 'Sr', 'Y', 'Zr', 'Nb', 'Mo', 'Tc', 'Ru', 'Rh', 'Pd', 'Ag', 'Cd', 'In', 'Sn', 'Sb', 'Te', 'I', 'Xe']
MOLECULES: ['O3']
#BASES: ['ZORA_DZ', 'ZORA_TZP', 'ZORA_TZ2P', 'ZORA_QZ4P']
JASTROWS: ['8_8_44']
4 changes: 3 additions & 1 deletion ORCA/Snakefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ from datetime import timedelta

PROCS = min(16, multiprocessing.cpu_count())

WFN_FILE = 'gwfn.data'
WFN_TYPE = 'gaussian'
include: '../Snakefile'

STD_ERR = config['STD_ERR']
Expand Down Expand Up @@ -137,7 +139,7 @@ rule MDET:
else:
shell('cd "$(dirname "{output}")" && multideterminant.py 3 mol.out')

rule GWFN:
rule WFN:
input: '{method}/{basis}/{molecule}/mol.molden.input'
output: '{method}/{basis}/{molecule}/gwfn.data'
run:
Expand Down
4 changes: 3 additions & 1 deletion PSI4/Snakefile
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import re

WFN_FILE = 'gwfn.data'
WFN_TYPE = 'gaussian'
include: '../Snakefile'

STD_ERR = config['STD_ERR']
Expand Down Expand Up @@ -59,7 +61,7 @@ rule MDET:
output: '{method}/{basis}/{molecule}/correlation.data'
shell: 'cd "$(dirname "{output}")" && multideterminant.py 1 output.dat'

rule GWFN:
rule WFN:
input: '{method}/{basis}/{molecule}/output.dat'
output: '{method}/{basis}/{molecule}/gwfn.data'
shell: 'molden2qmc.py 1 "$(dirname "{output}")/molden.dat" "{output}"'
Expand Down
5 changes: 4 additions & 1 deletion QCHEM/Snakefile
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import re

WFN_FILE = 'gwfn.data'
WFN_TYPE = 'gaussian'
include: '../Snakefile'

STD_ERR = config['STD_ERR']
Expand All @@ -10,6 +12,7 @@ BASES = config['BASES']
JASTROWS = config['JASTROWS']
STABILITY_ANALYSIS = False


def hf_energy(*path):
"""Get QCHEM output energy."""
regexp = re.compile(' Total energy in the final basis set =\s+(?P<energy>[-+]?\d+\.\d+)')
Expand Down Expand Up @@ -101,7 +104,7 @@ rule MDET:
else:
shell('cd "$(dirname "{output}")" && multideterminant.py 7 mol.out')

rule GWFN:
rule WFN:
input: '{method}/{basis}/{molecule}/mol.molden'
output: '{method}/{basis}/{molecule}/gwfn.data'
shell: 'molden2qmc.py 7 "{input}" "{output}"'
Expand Down
Loading

0 comments on commit 85f3b73

Please sign in to comment.