*** Wartungsfenster jeden ersten Mittwoch vormittag im Monat ***

Skip to content
Snippets Groups Projects
main.py 1.69 KiB
Newer Older
import jackknife
Patrick Kappl's avatar
Patrick Kappl committed
import adga
import numpy as np
# TODO: Use a config file for this
infix = ""
if len(sys.argv) < 4:
    print("""Command line argument missing. Please specify the ADGA root
          directory, the configuration file and the 2-particle Green's
          function file. The infix for the output file as well as the
          number of MPI process to use for the DGA calculation are the
          optional 4th and 5th argument respectively.""")
    sys.exit(1)
if len(sys.argv) >= 4:
    adga_root = sys.argv[1]
    adga_config = sys.argv[2]
    two_particle_file = sys.argv[3]
if len(sys.argv) >= 5:
    infix = sys.argv[4]
if len(sys.argv) >= 6:
    n_processes = sys.argv[5]
if len(sys.argv) > 6:
    print("""Too many command line arguments. Please specify only the
          ADGA root directory, the configuration file, the 2-particle
          Green's function file and optionally the infix for the output
          file name as well as the number of MPI processes to use for
          the DGA calculation.""")
Patrick Kappl's avatar
Patrick Kappl committed

abinitio_dga = adga.Adga(adga_root, adga_config, two_particle_file,
                         n_processes)
Patrick Kappl's avatar
Patrick Kappl committed
x_generator = abinitio_dga.get_worm_sample_generator()
n = abinitio_dga.n_worm_samples
Patrick Kappl's avatar
Patrick Kappl committed
f = abinitio_dga.__call__
# Do the Jackknife estimation
output_file_name = jackknife.do_jackknife_estimation(x_generator, n, f, infix)

# Add some useful metadata to the output file
try:
    with h5py.File(output_file_name, "r+") as output_file:
        output_file[".config"].attrs.create("qmc.nmeas", abinitio_dga.n_meas)
except Exception as e:
    print("-- Something went wrong when adding metadata to the output file")
    print(e)