diff --git a/bin/ipie b/bin/ipie index b01f0208..7a1c8d24 100755 --- a/bin/ipie +++ b/bin/ipie @@ -1,4 +1,3 @@ - # Copyright 2022 The ipie Developers. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); @@ -20,12 +19,9 @@ #!/usr/bin/env python3 import argparse -import json import sys -from ipie.config import MPI - -from ipie.config import config +from ipie.config import config, MPI def parse_args(args, comm): @@ -43,10 +39,12 @@ def parse_args(args, comm): """ if comm.rank == 0: - parser = argparse.ArgumentParser(description = __doc__) - parser.add_argument('--gpu', dest='use_gpu', action="store_true", - help='Use GPU.') - parser.add_argument('remaining_options', nargs=argparse.REMAINDER) + parser = argparse.ArgumentParser(description=__doc__) + parser.add_argument("--gpu", dest="use_gpu", action="store_true", help="Use GPU.") + parser.add_argument( + "--legacy", dest="use_legacy", action="store_true", help="Use legacy driver." + ) + parser.add_argument("remaining_options", nargs=argparse.REMAINDER) options = parser.parse_args(args) else: options = None @@ -60,7 +58,6 @@ def parse_args(args, comm): return options - def main(input_file): """Simple launcher for ipie via input file. @@ -72,11 +69,21 @@ def main(input_file): comm = MPI.COMM_WORLD options = parse_args(sys.argv[1:], comm) config.update_option("use_gpu", options.use_gpu) - from ipie.qmc.calc import setup_calculation - (afqmc, comm) = setup_calculation(options.remaining_options[0]) - afqmc.run(verbose=True) - afqmc.finalise(verbose=True) + if options.use_legacy: + from ipie.legacy.qmc.calc import get_driver as get_legacy_driver + from ipie.qmc.calc import read_input + + input_dict = read_input(options.remaining_options[0], comm) + afqmc = get_legacy_driver(input_dict, comm) + afqmc.run(comm=comm) + afqmc.finalise(comm) + else: + from ipie.qmc.calc import setup_calculation + + (afqmc, comm) = setup_calculation(options.remaining_options[0]) + afqmc.run(verbose=True) + afqmc.finalise(verbose=True) -if __name__ == '__main__': +if __name__ == "__main__": main(sys.argv[1])