diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 80bc5ddc..18c1b16b 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -10,7 +10,7 @@ jobs: with: python-version: 3.7 architecture: x64 - - run: python setup.py sdist + - run: pipx run build - name: Publish a Python distribution to PyPI if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags') uses: pypa/gh-action-pypi-publish@release/v1 diff --git a/codecov.yml b/codecov.yml new file mode 100644 index 00000000..fe16b894 --- /dev/null +++ b/codecov.yml @@ -0,0 +1,10 @@ +ignore: + - "tests" +coverage: + status: + project: + default: + threshold: 100% + patch: + default: + threshold: 100% diff --git a/dpti/__init__.py b/dpti/__init__.py index 250dc6cc..660a9006 100755 --- a/dpti/__init__.py +++ b/dpti/__init__.py @@ -1,11 +1,13 @@ -# s.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), '..'))) -# sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), '..'))) -# import dpti -# from . import lib -# import .lib -# from . import equi -# from . import hti -# from . import hti_liq -# from . import ti -# from . import gdi -# from dpti import lib +import sys +import os + +NAME = "dpti" +SHORT_CMD = "dpti" +sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), '..'))) +import dpti +from . import lib +from . import equi +from . import hti +from . import hti_liq +from . import ti +from . import gdi \ No newline at end of file diff --git a/dpti/equi.py b/dpti/equi.py index 3248e1b4..0bfb911e 100755 --- a/dpti/equi.py +++ b/dpti/equi.py @@ -315,9 +315,6 @@ def extract(job_dir, output) : # open(output, 'w').write(conf_lmp) def make_task(iter_name, jdata, ens=None, temp=None, pres=None, if_dump_avg_posi=None, npt_dir=None): - # jfile_path = os.path.abspath(jfile) - # with open(jfile, 'r') as f: - # jdata = json.load(f) equi_args = [ Argument("equi_conf", str), @@ -577,12 +574,13 @@ def post_task(iter_name, natoms = None, is_water = None) : # open(, 'w').write(json.dumps(info)).close() return info_dict -def _main (): - parser = argparse.ArgumentParser( - description="Equilibrium simulation") - subparsers = parser.add_subparsers(title='Valid subcommands', dest='command') +def add_module_subparsers(main_subparsers): + module_parser = main_subparsers.add_parser('equi', help='equilibration simulations') + module_subparsers = module_parser.add_subparsers(help='commands for equilibration simulations', dest='command', required=True) + add_subparsers(module_subparsers) - parser_gen = subparsers.add_parser('gen', help='Generate a job') +def add_subparsers(module_subparsers): + parser_gen = module_subparsers.add_parser('gen', help='generate a job') parser_gen.add_argument('PARAM', type=str , help='json parameter file') parser_gen.add_argument('-e','--ensemble', type=str, @@ -597,42 +595,55 @@ def _main (): help='use conf computed from NPT simulation') parser_gen.add_argument('-o','--output', type=str, default = 'new_job', help='the output folder for the job') - # parser_gen.add_argument("-z", "--meam", help="whether use meam instead of dp", action="store_true") + parser_gen.set_defaults(func=handle_gen) - parser_comp = subparsers.add_parser('extract', help= 'Extract the conf') - parser_comp.add_argument('JOB', type=str , + parser_extract = module_subparsers.add_parser('extract', help= 'extract the conf') + parser_extract.add_argument('JOB', type=str , help='folder of the job') - parser_comp.add_argument('-o','--output', type=str, default = 'conf.lmp', + parser_extract.add_argument('-o','--output', type=str, default = 'conf.lmp', help='output conf file name') + parser_extract.set_defaults(func=handle_extract) - parser_stat = subparsers.add_parser('stat-bond', help= 'Statistic of the bonds') + parser_stat = module_subparsers.add_parser('stat-bond', help= 'Statistic of the bonds') parser_stat.add_argument('JOB', type=str , help='folder of the job') parser_stat.add_argument('-s','--skip', type=int, default = 1, help='skip this number of frames') + parser_stat.set_defaults(func=handle_stat_bond) - parser_stat = subparsers.add_parser('compute', help= 'Compute thermodynamics') - parser_stat.add_argument('JOB', type=str , + parser_compute = module_subparsers.add_parser('compute', help= 'Compute thermodynamics') + parser_compute.add_argument('JOB', type=str , help='folder of the job') + parser_compute.set_defaults(func=handle_compute) + +def handle_gen(args): + jdata = json.load(open(args.PARAM, 'r')) + # jfile = os.path.abspath(args.PARAM) + make_task(args.output, jdata, args.ensemble, args.temperature, args.pressure, args.avg_posi, args.conf_npt,) + +def handle_extract(args): + extract(args.JOB, args.output) + +def handle_stat_bond(args): + b, a = water_bond(args.JOB, args.skip) + print(b, a/np.pi*180) +def handle_compute(args): + post_task(args.JOB) + +def _main (): + parser = argparse.ArgumentParser( + description="equilibration simulations") + main_subparsers = parser.add_subparsers(title='modules', description='the subcommands of dpti', help='module-level help', dest='module', required=True) + add_subparsers(main_subparsers) args = parser.parse_args() + exec_args(args, parser) - - if args.command is None : +def exec_args(args, parser): + if hasattr(args, 'func'): + args.func(args) + else: parser.print_help() - exit - if args.command == 'gen' : - jdata = json.load(open(args.PARAM, 'r')) - # jfile = os.path.abspath(args.PARAM) - make_task(args.output, jdata, args.ensemble, args.temperature, args.pressure, args.avg_posi, args.conf_npt,) - elif args.command == 'extract' : - extract(args.JOB, args.output) - elif args.command == 'stat-bond' : - b, a = water_bond(args.JOB, args.skip) - print(b, a/np.pi*180) - elif args.command == 'compute' : - post_task(args.JOB) - - -if __name__ == '__main__' : - _main() + +if __name__ == '__main__': + _main() \ No newline at end of file diff --git a/dpti/gdi.py b/dpti/gdi.py index 307b445b..bb4a1327 100755 --- a/dpti/gdi.py +++ b/dpti/gdi.py @@ -478,42 +478,64 @@ def gdi_main_loop(jdata, mdata, gdidata_dict={}, gdidata_cli={}, workflow=None): np.savetxt(os.path.join(gdidata['output'], 'pb.out'), tmp.T) return True -def _main () : - parser = argparse.ArgumentParser( - description="Compute the phase boundary via Gibbs-Duhem integration") - parser.add_argument('PARAM', type=str, +def add_module_subparsers(main_subparsers): + module_parser = main_subparsers.add_parser('gdi', help='compute the phase boundary via Gibbs-Duhem integration') + # module_subparsers = module_parser.add_subparsers(help='commands of Gibbs-Duhem integration', dest='command', required=True) + + module_parser.add_argument('PARAM', type=str, help='json parameter file') - parser.add_argument('MACHINE', type=str, + module_parser.add_argument('MACHINE', type=str, help='json machine file') - parser.add_argument('-g', '--gdidata-json', type=str, default=None, + module_parser.add_argument('-g', '--gdidata-json', type=str, default=None, help='json gdi integration file') - parser.add_argument('-b','--begin', type=float, default=None, + module_parser.add_argument('-b','--begin', type=float, default=None, help='start of the integration') - parser.add_argument('-e','--end', type=float, default=None, + module_parser.add_argument('-e','--end', type=float, default=None, help='end of the integration') - parser.add_argument('-d','--direction', type=str, choices=['t','p'], default=None, + module_parser.add_argument('-d','--direction', type=str, choices=['t','p'], default=None, help='direction of the integration, along T or P') - parser.add_argument('-i','--initial-value', type=float, default=None, + module_parser.add_argument('-i','--initial-value', type=float, default=None, help='the initial value of T (direction=p) or P (direction=t)') - parser.add_argument('-s','--step-value', type=float, nargs = '+', + module_parser.add_argument('-s','--step-value', type=float, nargs = '+', help='the T (direction=t) or P (direction=p) values must be evaluated') - parser.add_argument('-a','--abs-tol', type=float, default = 10, + module_parser.add_argument('-a','--abs-tol', type=float, default = 10, help='the absolute tolerance of the integration') - parser.add_argument('-r','--rel-tol', type=float, default = 1e-2, + module_parser.add_argument('-r','--rel-tol', type=float, default = 1e-2, help='the relative tolerance of the integration') - parser.add_argument('-w','--if-water', action = 'store_true', + module_parser.add_argument('-w','--if-water', action = 'store_true', help='assumes water molecules: nmols = natoms//3') - parser.add_argument('-o','--output', type=str, default = 'new_job', + module_parser.add_argument('-o','--output', type=str, default = 'new_job', help='the output folder for the job') - parser.add_argument('-f','--first-step', type=float, default=None, + module_parser.add_argument('-f','--first-step', type=float, default=None, help='the first step size of the integrator') - parser.add_argument('-S','--shift', type=float, nargs = 2, default = [0.0, 0.0], + module_parser.add_argument('-S','--shift', type=float, nargs = 2, default = [0.0, 0.0], help='the output folder for the job') - parser.add_argument('-v','--verbose', action = 'store_true', + module_parser.add_argument('-v','--verbose', action = 'store_true', help='print detailed infomation') - parser.add_argument("-z", "--if-meam", help="whether use meam instead of dp", action="store_true") - args = parser.parse_args() + module_parser.add_argument("-z", "--if-meam", help="whether use meam instead of dp", action="store_true") + module_parser.set_defaults(func=handle_gdi) + + + +# mdata = json.load(open('machine.json')) +# jdata = json.load(open('in.json')) +# # ssh_sess = SSHSession(mdata['machine']) +# # if not os.path.isdir('gdi_test') : +# # _setup_dpdt('gdi_test', jdata) +# # make_dpdt(100, 1, 'gdi_test', mdata, ssh_sess, natoms = [96, 128]) +# # make_dpdt(100, 20, 'gdi_test', mdata, ssh_sess, natoms = [96, 128]) +# gdf = GibbsDuhemFunc(jdata, mdata, 'gdi_test', 'p', natoms = [96, 128], verbose = True) + +# sol = solve_ivp(gdf, [1, 20000], [363], method = 'RK23', atol=10, rtol=1e-2) +# print(sol.t) +# print(sol.y) +# np.savetxt('t.out', sol.t) +# np.savetxt('p.out', sol.y) +# # print(gdf(100, 1)) +# # print(gdf(100, 1)) +# # print(gdf(200, 20)) +def handle_gdi(args): with open(args.PARAM) as j: jdata = json.load(j) with open(args.MACHINE) as m: @@ -545,26 +567,4 @@ def _main () : # abs_tol=args.abs_tol, rel_tol=args.rel_tol, if_water=args.if_water, output=args.output, # first_step=args.first_step, shift=args.shift, verbose=args.verbose, if_meam=args.if_meam, workflow=None) - return return_value - -if __name__ == '__main__' : - _main() - -# mdata = json.load(open('machine.json')) -# jdata = json.load(open('in.json')) -# # ssh_sess = SSHSession(mdata['machine']) -# # if not os.path.isdir('gdi_test') : -# # _setup_dpdt('gdi_test', jdata) -# # make_dpdt(100, 1, 'gdi_test', mdata, ssh_sess, natoms = [96, 128]) -# # make_dpdt(100, 20, 'gdi_test', mdata, ssh_sess, natoms = [96, 128]) - -# gdf = GibbsDuhemFunc(jdata, mdata, 'gdi_test', 'p', natoms = [96, 128], verbose = True) - -# sol = solve_ivp(gdf, [1, 20000], [363], method = 'RK23', atol=10, rtol=1e-2) -# print(sol.t) -# print(sol.y) -# np.savetxt('t.out', sol.t) -# np.savetxt('p.out', sol.y) -# # print(gdf(100, 1)) -# # print(gdf(100, 1)) -# # print(gdf(200, 20)) + return return_value \ No newline at end of file diff --git a/dpti/hti.py b/dpti/hti.py index 71f0296e..9baaa438 100755 --- a/dpti/hti.py +++ b/dpti/hti.py @@ -362,7 +362,7 @@ def _gen_lammps_input (conf_file, ret += 'thermo_style custom step ke pe etotal enthalpy temp press vol c_e_deep c_e_deep c_allmsd[*]\n' ret += 'thermo_modify format 9 %.16e\n' ret += 'thermo_modify format 10 %.16e\n' - ret += '# dump 1 all custom ${DUMP_FREQ} dump.hti id type x y z vx vy vz\n' + ret += 'dump 1 all custom ${DUMP_FREQ} dump.hti id type x y z vx vy vz\n' if ens == 'nvt' : ret += 'fix 1 all nvt temp ${TEMP} ${TEMP} ${TAU_T}\n' elif ens == 'nvt-langevin' : @@ -1187,12 +1187,11 @@ def hti_phase_trans_analyze(job, jdata=None): return if_phase_trans -def _main (): - parser = argparse.ArgumentParser( - description="Compute free energy by Hamiltonian TI") - subparsers = parser.add_subparsers(title='Valid subcommands', dest='command') +def add_module_subparsers(main_subparsers): + module_parser = main_subparsers.add_parser('hti', help='Hamiltonian thermodynamic integration for atomic solid') + module_subparsers = module_parser.add_subparsers(help='commands of Hamiltonian thermodynamic integration for atomic solid', dest='command', required=True) - parser_gen = subparsers.add_parser('gen', help='Generate a job') + parser_gen = module_subparsers.add_parser('gen', help='generate a job') parser_gen.add_argument('PARAM', type=str , help='json parameter file') parser_gen.add_argument('-o','--output', type=str, default = 'new_job', @@ -1203,40 +1202,35 @@ def _main (): two-step: 1 switching on DP, 2 switching off spring.\ three-step: 1 switching on soft LJ, 2 switching on DP, 3 switching off spring and soft LJ.') parser_gen.add_argument("-z", "--meam", help="whether use meam instead of dp", action="store_true") + parser_gen.set_defaults(func=handle_gen) - parser_comp = subparsers.add_parser('compute', help= 'Compute the result of a job') - parser_comp.add_argument('JOB', type=str , + parser_compute = module_subparsers.add_parser('compute', help= 'Compute the result of a job') + parser_compute.add_argument('JOB', type=str , help='folder of the job') - parser_comp.add_argument('-t','--type', type=str, default = 'helmholtz', + parser_compute.add_argument('-t','--type', type=str, default = 'helmholtz', choices=['helmholtz', 'gibbs'], help='the type of free energy') - parser_comp.add_argument('-m','--inte-method', type=str, default = 'inte', + parser_compute.add_argument('-m','--inte-method', type=str, default = 'inte', choices=['inte', 'mbar'], help='the method of thermodynamic integration') - parser_comp.add_argument('-s','--scheme', type=str, default = 'simpson', + parser_compute.add_argument('-s','--scheme', type=str, default = 'simpson', help='the numeric integration scheme') - parser_comp.add_argument('-g', '--pv', type=float, default = None, + parser_compute.add_argument('-g', '--pv', type=float, default = None, help='press*vol value override to calculate Gibbs free energy') - parser_comp.add_argument('-G', '--pv-err', type=float, default = None, + parser_compute.add_argument('-G', '--pv-err', type=float, default = None, help='press*vol error') - args = parser.parse_args() - - if args.command is None : - parser.print_help() - exit - if args.command == 'gen' : - output = args.output - jdata = json.load(open(args.PARAM, 'r')) - if 'crystal' in jdata and jdata['crystal'] == 'frenkel' : - print('# gen task with Frenkel\'s Einstein crystal') - else : - print('# gen task with Vega\'s Einstein molecule') - print('output:', output) - make_tasks(output, jdata, ref='einstein', switch=args.switch, if_meam=args.meam) - elif args.command == 'compute' : - compute_task(job=args.JOB, free_energy_type=args.type, method=args.inte_method, scheme=args.scheme, manual_pv=args.pv, manual_pv_err=args.pv_err) - # if 'reference' not in jdata : - # jdata['reference'] = 'einstein' + parser_compute.set_defaults(func=handle_compute) -if __name__ == '__main__' : - _main() +def handle_gen(args): + jdata = json.load(open(args.PARAM, 'r')) + if 'crystal' in jdata and jdata['crystal'] == 'frenkel' : + print('# gen task with Frenkel\'s Einstein crystal') + else : + print('# gen task with Vega\'s Einstein molecule') + print('output:', args.output) + make_tasks(args.output, jdata, ref='einstein', switch=args.switch, if_meam=args.meam) + +def handle_compute(args): + compute_task(job=args.JOB, free_energy_type=args.type, method=args.inte_method, scheme=args.scheme, manual_pv=args.pv, manual_pv_err=args.pv_err) + # if 'reference' not in jdata : + # jdata['reference'] = 'einstein' \ No newline at end of file diff --git a/dpti/hti_ice.py b/dpti/hti_ice.py index 7ef340dc..df287665 100755 --- a/dpti/hti_ice.py +++ b/dpti/hti_ice.py @@ -10,10 +10,25 @@ def _main (): parser = argparse.ArgumentParser( - description="Compute free energy by Hamiltonian TI") - subparsers = parser.add_subparsers(title='Valid subcommands', dest='command') + description="Compute free energy of ice by Hamiltonian TI") + main_subparsers = parser.add_subparsers(title='modules', description='the subcommands of dpti', help='module-level help', dest='module', required=True) + add_subparsers(main_subparsers) + args = parser.parse_args() + exec_args(args, parser) + +def exec_args(args, parser): + if hasattr(args, 'func'): + args.func(args) + else: + parser.print_help() + +def add_module_subparsers(main_subparsers): + module_parser = main_subparsers.add_parser('hti_ice', help='Hamiltonian thermodynamic integration for ice') + module_subparsers = module_parser.add_subparsers(help='commands of Hamiltonian thermodynamic integration for ice', dest='command', required=True) + add_subparsers(module_subparsers) - parser_gen = subparsers.add_parser('gen', help='Generate a job') +def add_subparsers(module_subparsers): + parser_gen = module_subparsers.add_parser('gen', help='Generate a job') parser_gen.add_argument('PARAM', type=str , help='json parameter file') parser_gen.add_argument('-o','--output', type=str, default = 'new_job', @@ -21,140 +36,137 @@ def _main (): parser_gen.add_argument('-s','--switch', type=str, default = 'one-step', choices = ['one-step', 'two-step', 'three-step'], help='one-step: switching on DP and switching off spring simultanenously.\ - two-step: 1 switching on DP, 2 switching off spring.\ + two-step: 1 switching on DP, 2 switching off spring.\n\ three-step: 1 switching on soft LJ, 2 switching on DP, 3 switching off spring and soft LJ.') + parser_gen.set_defaults(func=handle_gen) - parser_comp = subparsers.add_parser('compute', help= 'Compute the result of a job') - parser_comp.add_argument('JOB', type=str , + parser_compute = module_subparsers.add_parser('compute', help= 'Compute the result of a job') + parser_compute.add_argument('JOB', type=str , help='folder of the job') - parser_comp.add_argument('-t','--type', type=str, default = 'helmholtz', + parser_compute.add_argument('-t','--type', type=str, default = 'helmholtz', choices=['helmholtz', 'gibbs'], help='the type of free energy') - parser_comp.add_argument('-m','--inte-method', type=str, default = 'inte', + parser_compute.add_argument('-m','--inte-method', type=str, default = 'inte', choices=['inte', 'mbar'], help='the method of thermodynamic integration') - parser_comp.add_argument('-d','--disorder-corr', action = 'store_true', + parser_compute.add_argument('-d','--disorder-corr', action = 'store_true', help='apply disorder correction for ice') - parser_comp.add_argument('-p','--partial-disorder', type=str, + parser_compute.add_argument('-p','--partial-disorder', type=str, choices = ['3', '5'], help='apply partial disorder correction for ice') - parser_comp.add_argument('-s','--scheme', type=str, default = 'simpson', + parser_compute.add_argument('-s','--scheme', type=str, default = 'simpson', help='the numeric integration scheme') - parser_comp.add_argument('-S','--shift', type=float, default = 0.0, + parser_compute.add_argument('-S','--shift', type=float, default = 0.0, help='a constant shift in the energy/mole computation, will be removed from FE') - parser_comp.add_argument('-g', '--pv', type=float, default = None, + parser_compute.add_argument('-g', '--pv', type=float, default = None, help='press*vol value override to calculate Gibbs free energy') - parser_comp.add_argument('-G', '--pv-err', type=float, default = None, + parser_compute.add_argument('-G', '--pv-err', type=float, default = None, help='press*vol error') + parser_compute.set_defaults(func=handle_compute) - parser_comp = subparsers.add_parser('refine', help= 'Refine the grid of a job') - parser_comp.add_argument('-i', '--input', type=str, required=True, + parser_refine = module_subparsers.add_parser('refine', help= 'Refine the grid of a job') + parser_refine.add_argument('-i', '--input', type=str, required=True, help='input job') - parser_comp.add_argument('-o', '--output', type=str, required=True, + parser_refine.add_argument('-o', '--output', type=str, required=True, help='output job') - parser_comp.add_argument('-e', '--error', type=float, required=True, + parser_refine.add_argument('-e', '--error', type=float, required=True, help='the error required') - parser_comp.add_argument('-p', '--print', action = 'store_true', + parser_refine.add_argument('-p', '--print', action = 'store_true', help='print the refinement and exit') - args = parser.parse_args() + parser_refine.set_defaults(func=handle_refine) - return exec_args(args=args, parser=parser) +def handle_gen(args): + output = args.output + with open(args.PARAM, 'r') as j: + jdata = json.load(j) + if 'crystal' in jdata and jdata['crystal'] == 'frenkel' : + print('# gen task with Frenkel\'s Einstein crystal') + else : + print('# gen task with Vega\'s Einstein molecule') + hti.make_tasks(output, jdata, 'einstein', args.switch) -def exec_args(args, parser): - if args.command is None : - parser.print_help() - exit - if args.command == 'gen' : - output = args.output - with open(args.PARAM, 'r') as j: - jdata = json.load(j) - if 'crystal' in jdata and jdata['crystal'] == 'frenkel' : - print('# gen task with Frenkel\'s Einstein crystal') - else : - print('# gen task with Vega\'s Einstein molecule') - hti.make_tasks(output, jdata, 'einstein', args.switch) - elif args.command == 'refine' : - hti.refine_task(args.input, args.output, args.error, args.print) - elif args.command == 'compute' : - job = args.JOB - jdata = json.load(open(os.path.join(job, 'in.json'), 'r')) - fp_conf = open(os.path.join(args.JOB, 'conf.lmp')) - sys_data = lmp.to_system_data(fp_conf.read().split('\n')) - natoms = sum(sys_data['atom_numbs']) - if 'copies' in jdata : - natoms *= np.prod(jdata['copies']) - nmols = natoms // 3 - # compute e0 - if 'crystal' not in jdata : - jdata['crystal'] = 'vega' - crystal = jdata['crystal'] - if crystal == 'vega' : - e0 = einstein.free_energy(job) * 3 - else : - e0 = einstein.frenkel(job) * 3 - # compute Paulin estimate for disordered entropy - if args.disorder_corr : - temp = jdata['temp'] - if args.partial_disorder is not None: - if args.partial_disorder == '5': - pauling_corr = -pc.Boltzmann * temp / pc.electron_volt * 0.3817 - note_pauling = '(ice5)' - elif args.partial_disorder == '3': - pauling_corr = -pc.Boltzmann * temp / pc.electron_volt * 0.3686 - note_pauling = '(ice3)' - else: - raise RuntimeError(f'unknow partial_disorder {args.partial_disorder}') +def handle_refine(args): + hti.refine_task(args.input, args.output, args.error, args.print) + +def handle_compute(args): + job = args.JOB + jdata = json.load(open(os.path.join(job, 'in.json'), 'r')) + fp_conf = open(os.path.join(args.JOB, 'conf.lmp')) + sys_data = lmp.to_system_data(fp_conf.read().split('\n')) + natoms = sum(sys_data['atom_numbs']) + if 'copies' in jdata : + natoms *= np.prod(jdata['copies']) + nmols = natoms // 3 + # compute e0 + if 'crystal' not in jdata : + jdata['crystal'] = 'vega' + crystal = jdata['crystal'] + if crystal == 'vega' : + e0 = einstein.free_energy(job) * 3 + else : + e0 = einstein.frenkel(job) * 3 + # compute Paulin estimate for disordered entropy + if args.disorder_corr : + temp = jdata['temp'] + if args.partial_disorder is not None: + if args.partial_disorder == '5': + pauling_corr = -pc.Boltzmann * temp / pc.electron_volt * 0.3817 + note_pauling = '(ice5)' + elif args.partial_disorder == '3': + pauling_corr = -pc.Boltzmann * temp / pc.electron_volt * 0.3686 + note_pauling = '(ice3)' else: - pauling_corr = -pc.Boltzmann * temp / pc.electron_volt * np.log(1.5) - note_pauling = ' ' - e0 += pauling_corr - else : + raise RuntimeError(f'unknow partial_disorder {args.partial_disorder}') + else: + pauling_corr = -pc.Boltzmann * temp / pc.electron_volt * np.log(1.5) note_pauling = ' ' - pauling_corr = 0 - # compute integration - de, de_err, thermo_info = hti.post_tasks(job, jdata, natoms = nmols, method = args.inte_method, scheme = args.scheme) - info = thermo_info.copy() - # printing - print_format = '%20.12f %10.3e %10.3e' - hti.print_thermo_info(thermo_info) - if crystal == 'vega' : - print('# free ener of Einstein Mole: %20.8f' % (e0)) - else : - print('# free ener of Einstein Crys: %20.8f' % (e0)) - print('# Pauling corr %s: %20.8f' % (note_pauling, pauling_corr)) - print(('# fe integration ' + print_format) \ - % (de, de_err[0], de_err[1])) - print( '# fe const shift %20.12f' % args.shift) - # if args.type == 'helmholtz' : - print('# Helmholtz free ener per mol (stat_err inte_err) [eV]:') - print(print_format % (e0 + de - args.shift, de_err[0], de_err[1])) - if args.type == 'gibbs' : - if args.pv is not None: - pv = args.pv - print(f"# use manual pv=={pv}") - else: - pv = thermo_info['pv'] - if args.pv_err is not None: - pv_err = args.pv_err - print(f"# use manual pv_err=={pv_err}") - else: - pv_err = thermo_info['pv_err'] - e1 = e0 + de + pv - args.shift - e1_err = np.sqrt(de_err[0]**2 + pv_err**2) - print('# Gibbs free ener per mol (stat_err inte_err) [eV]:') - print(print_format % (e1, e1_err, de_err[1])) - free_energy_type=args.type - info['free_energy_type'] = free_energy_type - info['pv'] = pv - info['pv_err'] = pv_err - # info['de'] = de - # info['de_err'] = de_err - info['e1'] = e1 - info['e1_err'] = e1_err - with open(os.path.join(job, 'result.json'), 'w') as result: - result.write(json.dumps(info)) - return info - + e0 += pauling_corr + else : + note_pauling = ' ' + pauling_corr = 0 + # compute integration + de, de_err, thermo_info = hti.post_tasks(job, jdata, natoms = nmols, method = args.inte_method, scheme = args.scheme) + info = thermo_info.copy() + # printing + print_format = '%20.12f %10.3e %10.3e' + hti.print_thermo_info(thermo_info) + if crystal == 'vega' : + print('# free ener of Einstein Mole: %20.8f' % (e0)) + else : + print('# free ener of Einstein Crys: %20.8f' % (e0)) + print('# Pauling corr %s: %20.8f' % (note_pauling, pauling_corr)) + print(('# fe integration ' + print_format) \ + % (de, de_err[0], de_err[1])) + print( '# fe const shift %20.12f' % args.shift) + # if args.type == 'helmholtz' : + print('# Helmholtz free ener per mol (stat_err inte_err) [eV]:') + print(print_format % (e0 + de - args.shift, de_err[0], de_err[1])) + if args.type == 'gibbs' : + if args.pv is not None: + pv = args.pv + print(f"# use manual pv=={pv}") + else: + pv = thermo_info['pv'] + if args.pv_err is not None: + pv_err = args.pv_err + print(f"# use manual pv_err=={pv_err}") + else: + pv_err = thermo_info['pv_err'] + e1 = e0 + de + pv - args.shift + e1_err = np.sqrt(de_err[0]**2 + pv_err**2) + print('# Gibbs free ener per mol (stat_err inte_err) [eV]:') + print(print_format % (e1, e1_err, de_err[1])) + free_energy_type=args.type + info['free_energy_type'] = free_energy_type + info['pv'] = pv + info['pv_err'] = pv_err + # info['de'] = de + # info['de_err'] = de_err + info['e1'] = e1 + info['e1_err'] = e1_err + with open(os.path.join(job, 'result.json'), 'w') as result: + result.write(json.dumps(info)) + return info -if __name__ == '__main__' : - _main() +if __name__ == '__main__': + _main() \ No newline at end of file diff --git a/dpti/hti_liq.py b/dpti/hti_liq.py index ad64ca89..4ca480c1 100755 --- a/dpti/hti_liq.py +++ b/dpti/hti_liq.py @@ -169,7 +169,7 @@ def _gen_lammps_input_ideal (step, ret += 'thermo ${THERMO_FREQ}\n' ret += 'thermo_style custom step ke pe etotal enthalpy temp press vol c_e_diff[1] c_allmsd[*]\n' ret += 'thermo_modify format 9 %.16e\n' - ret += '# dump 1 all custom ${DUMP_FREQ} dump.hti id type x y z vx vy vz\n' + ret += 'dump 1 all custom ${DUMP_FREQ} dump.hti id type x y z vx vy vz\n' if ens == 'nvt' : ret += 'fix 1 all nvt temp ${TEMP} ${TEMP} ${TAU_T}\n' elif ens == 'npt-iso' or ens == 'npt': @@ -467,39 +467,29 @@ def compute_task(job, free_energy_type='helmholtz', scheme='simpson', manual_pv= result.write(json.dumps(info)) return info -def _main (): - parser = argparse.ArgumentParser( - description="Compute liquid free energy by Hamiltonian TI") - subparsers = parser.add_subparsers(title='Valid subcommands', dest='command') +def add_module_subparsers(main_subparsers): + module_parser = main_subparsers.add_parser('hti_liq', help='Hamiltonian thermodynamic integration for atomic liquid') + module_subparsers = module_parser.add_subparsers(help='commands of Hamiltonian thermodynamic integration for atomic liquid', dest='command', required=True) - parser_gen = subparsers.add_parser('gen', help='Generate a job') + parser_gen = module_subparsers.add_parser('gen', help='Generate a job') parser_gen.add_argument('PARAM', type=str , help='json parameter file') parser_gen.add_argument('-o','--output', type=str, default = 'new_job', help='the output folder for the job') parser_gen.add_argument("-z", "--meam", help="whether use meam instead of dp", action="store_true") + parser_gen.set_defaults(func=handle_gen) - parser_comp = subparsers.add_parser('compute', help= 'Compute the result of a job') - parser_comp.add_argument('JOB', type=str , + parser_compute = module_subparsers.add_parser('compute', help= 'Compute the result of a job') + parser_compute.add_argument('JOB', type=str , help='folder of the job') - parser_comp.add_argument('-t','--type', type=str, default = 'helmholtz', + parser_compute.add_argument('-t','--type', type=str, default = 'helmholtz', choices=['helmholtz', 'gibbs'], help='the type of free energy') - parser_comp.add_argument('-g', '--pv', type=float, default = None, + parser_compute.add_argument('-g', '--pv', type=float, default = None, help='press*vol value override to calculate Gibbs free energy') - parser_comp.add_argument('-G', '--pv-err', type=float, default = None, + parser_compute.add_argument('-G', '--pv-err', type=float, default = None, help='press*vol error') - args = parser.parse_args() - - if args.command is None : - parser.print_help() - exit - if args.command == 'gen' : - output = args.output - jdata = json.load(open(args.PARAM, 'r')) - make_tasks(output, jdata, if_meam=args.meam) - elif args.command == 'compute' : - compute_task(job=args.JOB, free_energy_type=args.type, manual_pv=args.pv, manual_pv_err=args.pv_err) + parser_compute.set_defaults(func=handle_compute) # fp_conf = open(os.path.join(args.JOB, 'conf.lmp')) # sys_data = lmp.to_system_data(fp_conf.read().split('\n')) @@ -528,6 +518,10 @@ def _main (): # print('# Gibbs free ener per mol (err) [eV]:') # print(print_format % (e1, e1_err, fe_err[1])) - -if __name__ == '__main__' : - _main() +def handle_gen(args): + output = args.output + jdata = json.load(open(args.PARAM, 'r')) + make_tasks(output, jdata, if_meam=args.meam) + +def handle_compute(args): + compute_task(job=args.JOB, free_energy_type=args.type, manual_pv=args.pv, manual_pv_err=args.pv_err) \ No newline at end of file diff --git a/dpti/hti_water.py b/dpti/hti_water.py index d151008c..3dccaf6b 100755 --- a/dpti/hti_water.py +++ b/dpti/hti_water.py @@ -173,7 +173,7 @@ def _gen_lammps_input (step, ret += 'thermo_modify format 9 %.16e\n' ret += 'thermo_modify format 10 %.16e\n' ret += 'thermo_modify format 11 %.16e\n' - ret += '# dump 1 all custom ${DUMP_FREQ} dump.hti id type x y z\n' + ret += 'dump 1 all custom ${DUMP_FREQ} dump.hti id type x y z\n' if ens == 'nvt' : ret += 'fix 1 all nvt temp ${TEMP} ${TEMP} ${TAU_T}\n' elif ens == 'npt-iso' or ens == 'npt': @@ -597,7 +597,7 @@ def spring_inte(temp, kk, r0) : def compute_ideal_mol(iter_name) : jdata = json.load(open(os.path.join(iter_name, 'in.json'))) ens = jdata['ens'] - mass_map = jdata['mass_map'] + mass_map = get_first_matched_key_from_dict(jdata, ['mass_map', 'model_mass_map']) conf_lines = open(os.path.join(iter_name, 'orig.lmp')).read().split('\n') data_sys = lmp.system_data(conf_lines) vol = np.linalg.det(data_sys['cell']) @@ -671,90 +671,114 @@ def post_tasks(iter_name, natoms, method = 'inte', scheme = 's') : sys_err = ((err0[1]) + (err1[1]) + (err2[1])) return fe, [err,sys_err], tinfo2 - def _main (): parser = argparse.ArgumentParser( - description="Compute free energy by Hamiltonian TI") - subparsers = parser.add_subparsers(title='Valid subcommands', dest='command') + description="Compute free energy of liquid water by Hamiltonian TI") + main_subparsers = parser.add_subparsers(title='modules', description='the subcommands of dpti', help='module-level help', dest='module', required=True) + add_subparsers(main_subparsers) + args = parser.parse_args() + exec_args(args, parser) + +def exec_args(args, parser): + if hasattr(args, 'func'): + args.func(args) + else: + parser.print_help() + +def add_module_subparsers(main_subparsers): + module_parser = main_subparsers.add_parser('hti_water', help='Hamiltonian thermodynamic integration for liquid water') + module_subparsers = module_parser.add_subparsers(help='commands of Hamiltonian thermodynamic integration for liquid water', dest='command', required=True) + add_subparsers(module_subparsers) - parser_gen = subparsers.add_parser('gen', help='Generate a job') +def add_subparsers(module_subparsers): + parser_gen = module_subparsers.add_parser('gen', help='Generate a job') parser_gen.add_argument('PARAM', type=str , help='json parameter file') parser_gen.add_argument('-o','--output', type=str, default = 'new_job', help='the output folder for the job') + parser_gen.set_defaults(func=handle_gen) - parser_comp = subparsers.add_parser('compute', help= 'Compute the result of a job') - parser_comp.add_argument('JOB', type=str , + parser_compute = module_subparsers.add_parser('compute', help= 'Compute the result of a job') + parser_compute.add_argument('JOB', type=str , help='folder of the job') - parser_comp.add_argument('-t','--type', type=str, default = 'helmholtz', + parser_compute.add_argument('-t','--type', type=str, default = 'helmholtz', choices=['helmholtz', 'gibbs'], help='the type of free energy') - parser_comp.add_argument('-m','--inte-method', type=str, default = 'inte', + parser_compute.add_argument('-m','--inte-method', type=str, default = 'inte', choices=['inte', 'mbar'], help='the method of thermodynamic integration') - parser_comp.add_argument('-s','--scheme', type=str, default = 'simpson', + parser_compute.add_argument('-s','--scheme', type=str, default = 'simpson', help='the numeric integration scheme') - parser_comp.add_argument('-g', '--pv', type=float, default = None, + parser_compute.add_argument('-g', '--pv', type=float, default = None, help='press*vol value override to calculate Gibbs free energy') - parser_comp.add_argument('-G', '--pv-err', type=float, default = None, + parser_compute.add_argument('-G', '--pv-err', type=float, default = None, help='press*vol error') + parser_compute.set_defaults(func=handle_compute) - parser_comp = subparsers.add_parser('refine', help= 'Refine the grid of a job') - parser_comp.add_argument('-i', '--input', type=str, required=True, + parser_refine = module_subparsers.add_parser('refine', help= 'Refine the grid of a job') + parser_refine.add_argument('-i', '--input', type=str, required=True, help='input job') - parser_comp.add_argument('-o', '--output', type=str, required=True, + parser_refine.add_argument('-o', '--output', type=str, required=True, help='output job') - parser_comp.add_argument('-e', '--error', type=float, required=True, + parser_refine.add_argument('-e', '--error', type=float, required=True, help='the error required') + parser_refine.set_defaults(func=handle_refine) - args = parser.parse_args() - return exec_args(args=args, parser=None) +def handle_gen(args): + with open(args.PARAM, 'r') as j: + jdata = json.load(j) + make_tasks(args.output, jdata) -def exec_args(args, parser): - if args.command is None : - parser.print_help() - exit - if args.command == 'gen' : - output = args.output - with open(args.PARAM, 'r') as j: - jdata = json.load(j) - make_tasks(output, jdata) - if args.command == 'refine' : - refine_tasks(args.input, args.output, args.error) - elif args.command == 'compute' : - with open(os.path.join(args.JOB, 'conf.lmp'), 'r') as conf_lmp: - # fp_conf = open(os.path.join(args.JOB, 'conf.lmp')) - sys_data = lmp.to_system_data(conf_lmp.read().split('\n')) - natoms = sum(sys_data['atom_numbs']) - with open(os.path.join(args.JOB, 'in.json'), 'r') as j: - jdata = json.load(j) - - if 'copies' in jdata : - natoms *= np.prod(jdata['copies']) - nmols = natoms // 3 - fe, fe_err, thermo_info = post_tasks(args.JOB, nmols, method = args.inte_method) - _print_thermo_info(thermo_info) - print ('# numb atoms: %d' % natoms) - print ('# numb mols: %d' % nmols) - print_format = '%20.12f %10.3e %10.3e' - # if args.type == 'helmholtz' : - print('# Helmholtz free ener per mol (err) [eV]:') - print(print_format % (fe, fe_err[0], fe_err[1])) - if args.type == 'gibbs': - if args.pv is not None: - pv = args.pv - print(f"# use manual pv=={pv}") - else: - pv = thermo_info['pv'] - if args.pv_err is not None: - pv_err = args.pv_err - print(f"# use manual pv_err=={pv_err}") - else: - pv_err = thermo_info['pv_err'] - e1 = fe + pv - e1_err = np.sqrt(fe_err[0]**2 + pv_err**2) - print('# Gibbs free ener per mol (err) [eV]:') - print(print_format % (e1, e1_err, fe_err[1])) - -if __name__ == '__main__' : - _main() +def handle_refine(args): + refine_tasks(args.input, args.output, args.error) + +def handle_compute(args): + job = args.JOB + with open(os.path.join(args.JOB, 'conf.lmp'), 'r') as conf_lmp: + # fp_conf = open(os.path.join(args.JOB, 'conf.lmp')) + sys_data = lmp.to_system_data(conf_lmp.read().split('\n')) + natoms = sum(sys_data['atom_numbs']) + with open(os.path.join(args.JOB, 'in.json'), 'r') as j: + jdata = json.load(j) + + if 'copies' in jdata : + natoms *= np.prod(jdata['copies']) + nmols = natoms // 3 + fe, fe_err, thermo_info = post_tasks(args.JOB, nmols, method = args.inte_method) + info = thermo_info.copy() + _print_thermo_info(thermo_info) + print ('# numb atoms: %d' % natoms) + print ('# numb mols: %d' % nmols) + print_format = '%20.12f %10.3e %10.3e' + # if args.type == 'helmholtz' : + print('# Helmholtz free ener per mol (err) [eV]:') + print(print_format % (fe, fe_err[0], fe_err[1])) + if args.type == 'gibbs': + if args.pv is not None: + pv = args.pv + print(f"# use manual pv=={pv}") + else: + pv = thermo_info['pv'] + if args.pv_err is not None: + pv_err = args.pv_err + print(f"# use manual pv_err=={pv_err}") + else: + pv_err = thermo_info['pv_err'] + e1 = fe + pv + e1_err = np.sqrt(fe_err[0]**2 + pv_err**2) + print('# Gibbs free ener per mol (err) [eV]:') + print(print_format % (e1, e1_err, fe_err[1])) + free_energy_type=args.type + info['free_energy_type'] = free_energy_type + info['pv'] = pv + info['pv_err'] = pv_err + # info['de'] = de + # info['de_err'] = de_err + info['e1'] = e1 + info['e1_err'] = e1_err + with open(os.path.join(job, 'result.json'), 'w') as result: + result.write(json.dumps(info)) + return info + +if __name__ == '__main__': + _main() \ No newline at end of file diff --git a/dpti/lib/lammps.py b/dpti/lib/lammps.py index b21e5967..52498f44 100644 --- a/dpti/lib/lammps.py +++ b/dpti/lib/lammps.py @@ -27,7 +27,7 @@ def get_thermo(filename) : with open(filename, 'r') as fp : fc = fp.read().split('\n') for sl in range(len(fc)) : - if 'Step KinEng PotEng TotEng' in fc[sl] : + if 'Step ' in fc[sl] : break nwords = len(fc[sl+1].split()) data = [] diff --git a/dpti/main.py b/dpti/main.py new file mode 100644 index 00000000..5e4757ab --- /dev/null +++ b/dpti/main.py @@ -0,0 +1,33 @@ +import argparse +from . import equi +from . import hti +from . import hti_liq +from . import hti_ice +from . import hti_water +from . import ti +from . import ti_water +from . import gdi + +# from . import gdi + +def main(): + parser = argparse.ArgumentParser(description="DPTI: An Automatic Workflow Software for Thermodynamic Integration Calculations") + main_subparsers = parser.add_subparsers(title='modules', description='the subcommands of dpti', help='module-level help', dest='module', required=True) + + equi.add_module_subparsers(main_subparsers) + hti.add_module_subparsers(main_subparsers) + hti_liq.add_module_subparsers(main_subparsers) + hti_ice.add_module_subparsers(main_subparsers) + hti_water.add_module_subparsers(main_subparsers) + ti.add_module_subparsers(main_subparsers) + ti_water.add_module_subparsers(main_subparsers) + gdi.add_module_subparsers(main_subparsers) + + args = parser.parse_args() + if hasattr(args, 'func'): + args.func(args) + else: + parser.print_help() + +if __name__ == "__main__": + main() \ No newline at end of file diff --git a/dpti/ti.py b/dpti/ti.py index 396c7881..34e656a8 100755 --- a/dpti/ti.py +++ b/dpti/ti.py @@ -86,13 +86,13 @@ def _gen_lammps_input (conf_file, ret += 'compute allmsd all msd\n' if ens == 'nvt' : ret += 'thermo_style custom step ke pe etotal enthalpy temp press vol c_allmsd[*]\n' - ret += 'thermo_modify 4*8 format %20.6f\n' + ret += 'thermo_modify format 4*8 %20.6f\n' elif 'npt' in ens : ret += 'thermo_style custom step ke pe etotal enthalpy temp press vol c_allmsd[*]\n' - ret += 'thermo_modify 4*8 format %20.6f\n' + ret += 'thermo_modify format 4*8 %20.6f\n' else : raise RuntimeError('unknow ensemble %s\n' % ens) - ret += '# dump 1 all custom ${DUMP_FREQ} traj.dump id type x y z\n' + ret += 'dump 1 all custom ${DUMP_FREQ} traj.dump id type x y z\n' if ens == 'nvt' : ret += 'fix 1 all nvt temp ${TEMP} ${TEMP} ${TAU_T}\n' elif ens == 'npt-iso' or ens == 'npt': @@ -780,51 +780,50 @@ def compute_task(job, inte_method, Eo, Eo_err, To, scheme='simpson'): return info -def _main (): - parser = argparse.ArgumentParser( - description="Compute free energy by TI") - subparsers = parser.add_subparsers(title='Valid subcommands', dest='command', help = 'valid commands') +def add_module_subparsers(main_subparsers): + module_parser = main_subparsers.add_parser('ti', help='thermodynamic integration along isothermal or isobaric paths') + module_subparsers = module_parser.add_subparsers(help='commands of thermodynamic integration along isothermal or isobaric paths', dest='command', required=True) - parser_gen = subparsers.add_parser('gen', help='Generate a job') + parser_gen = module_subparsers.add_parser('gen', help='Generate a job') parser_gen.add_argument('PARAM', type=str , help='json parameter file') parser_gen.add_argument('-o','--output', type=str, default = 'new_job', help='the output folder for the job') parser_gen.add_argument("-z", "--meam", help="whether use meam instead of dp", action="store_true") + parser_gen.set_defaults(func=handle_gen) - parser_comp = subparsers.add_parser('compute', help= 'Compute the result of a job') - parser_comp.add_argument('JOB', type=str , + parser_compute = module_subparsers.add_parser('compute', help= 'Compute the result of a job') + parser_compute.add_argument('JOB', type=str , help='folder of the job') - parser_comp.add_argument('-m','--inte-method', type=str, default = 'inte', + parser_compute.add_argument('-m','--inte-method', type=str, default = 'inte', choices=['inte', 'mbar'], help='the method of thermodynamic integration') - parser_comp.add_argument('-e', '--Eo', type=float, default = 0, + parser_compute.add_argument('-e', '--Eo', type=float, default = 0, help='free energy of starting point') - parser_comp.add_argument('-E', '--Eo-err', type=float, default = 0, + parser_compute.add_argument('-E', '--Eo-err', type=float, default = 0, help='The statistical error of the starting free energy') - parser_comp.add_argument('-t', '--To', type=float, + parser_compute.add_argument('-t', '--To', type=float, help='the starting thermodynamic position') - parser_comp.add_argument('-s', '--scheme', type=str, default = 'simpson', + parser_compute.add_argument('-s', '--scheme', type=str, default = 'simpson', help='the numerical integration scheme') + parser_compute.set_defaults(func=handle_compute) - parser_comp = subparsers.add_parser('refine', help= 'Refine the grid of a job') - parser_comp.add_argument('-i', '--input', type=str, required=True, + parser_refine = module_subparsers.add_parser('refine', help= 'Refine the grid of a job') + parser_refine.add_argument('-i', '--input', type=str, required=True, help='input job') - parser_comp.add_argument('-o', '--output', type=str, required=True, + parser_refine.add_argument('-o', '--output', type=str, required=True, help='output job') - parser_comp.add_argument('-e', '--error', type=float, required=True, + parser_refine.add_argument('-e', '--error', type=float, required=True, help='the error required') - args = parser.parse_args() - - if args.command is None : - parser.print_help() - exit - if args.command == 'gen' : - output = args.output - jdata = json.load(open(args.PARAM, 'r')) - make_tasks(output, jdata, if_meam=args.meam) - elif args.command == 'compute' : - compute_task(args.JOB, inte_method=args.inte_method, Eo=args.Eo, Eo_err=args.Eo_err, To=args.To, scheme=args.scheme) + parser_refine.set_defaults(func=handle_refine) + +def handle_gen(args): + output = args.output + jdata = json.load(open(args.PARAM, 'r')) + make_tasks(output, jdata, if_meam=args.meam) + +def handle_compute(args): + compute_task(args.JOB, inte_method=args.inte_method, Eo=args.Eo, Eo_err=args.Eo_err, To=args.To, scheme=args.scheme) # job = args.JOB # jdata = json.load(open(os.path.join(job, 'in.json'), 'r')) # if args.inte_method == 'inte' : @@ -833,10 +832,6 @@ def _main (): # post_tasks_mbar(job, jdata, args.Eo) # else : # raise RuntimeError('unknow integration method') - elif args.command == 'refine' : - refine_task(args.input, args.output, args.error) - -if __name__ == '__main__' : - _main() - +def handle_refine(args): + refine_task(args.input, args.output, args.error) diff --git a/dpti/ti_water.py b/dpti/ti_water.py index 0f8d9930..0d80f6c1 100755 --- a/dpti/ti_water.py +++ b/dpti/ti_water.py @@ -18,68 +18,81 @@ def _main (): parser = argparse.ArgumentParser( - description="Compute free energy by TI") - subparsers = parser.add_subparsers(title='Valid subcommands', dest='command', help = 'valid commands') + description="thermodynamic integration along isothermal or isobaric paths for water") + main_subparsers = parser.add_subparsers(title='modules', description='the subcommands of dpti', help='module-level help', dest='module', required=True) + add_subparsers(main_subparsers) + args = parser.parse_args() + exec_args(args, parser) + +def exec_args(args, parser): + if hasattr(args, 'func'): + args.func(args) + else: + parser.print_help() + +def add_module_subparsers(main_subparsers): + module_parser = main_subparsers.add_parser('ti_water', help='thermodynamic integration along isothermal or isobaric paths for water') + module_subparsers = module_parser.add_subparsers(help='commands of thermodynamic integration along isothermal or isobaric paths for water', dest='command', required=True) + add_subparsers(module_subparsers) - parser_gen = subparsers.add_parser('gen', help='Generate a job') +def add_subparsers(module_subparsers): + parser_gen = module_subparsers.add_parser('gen', help='Generate a job') parser_gen.add_argument('PARAM', type=str , help='json parameter file') parser_gen.add_argument('-o','--output', type=str, default = 'new_job', help='the output folder for the job') + parser_gen.set_defaults(func=handle_gen) - parser_comp = subparsers.add_parser('compute', help= 'Compute the result of a job') - parser_comp.add_argument('JOB', type=str , + parser_compute = module_subparsers.add_parser('compute', help= 'Compute the result of a job') + parser_compute.add_argument('JOB', type=str , help='folder of the job') - parser_comp.add_argument('-m','--inte-method', type=str, default = 'inte', + parser_compute.add_argument('-m','--inte-method', type=str, default = 'inte', choices=['inte', 'mbar'], help='the method of thermodynamic integration') - parser_comp.add_argument('-e', '--Eo', type=float, default = 0, + parser_compute.add_argument('-e', '--Eo', type=float, default = 0, help='free energy of starting point') - parser_comp.add_argument('-E', '--Eo-err', type=float, default = 0, + parser_compute.add_argument('-E', '--Eo-err', type=float, default = 0, help='The statistical error of the starting free energy') - parser_comp.add_argument('-t', '--To', type=float, + parser_compute.add_argument('-t', '--To', type=float, help='the starting thermodynamic position') - parser_comp.add_argument('-s', '--scheme', type=str, default = 'simpson', + parser_compute.add_argument('-s', '--scheme', type=str, default = 'simpson', help='the numerical integration scheme') - parser_comp.add_argument('-S', '--shift', type=float, default = 0.0, + parser_compute.add_argument('-S', '--shift', type=float, default = 0.0, help='a constant shift in the energy/mole computation, will be removed from FE') + parser_compute.set_defaults(func=handle_compute) - parser_comp = subparsers.add_parser('refine', help= 'Refine the grid of a job') - parser_comp.add_argument('-i', '--input', type=str, required=True, + parser_refine = module_subparsers.add_parser('refine', help= 'Refine the grid of a job') + parser_refine.add_argument('-i', '--input', type=str, required=True, help='input job') - parser_comp.add_argument('-o', '--output', type=str, required=True, + parser_refine.add_argument('-o', '--output', type=str, required=True, help='output job') - parser_comp.add_argument('-e', '--error', type=float, required=True, + parser_refine.add_argument('-e', '--error', type=float, required=True, help='the error required') + parser_refine.set_defaults(func=handle_refine) - args = parser.parse_args() - return exec_args(args=args, parser=parser) +def handle_gen(args): + output = args.output + with open(args.PARAM, 'r') as j: + jdata = json.load(j) + ti.make_tasks(output, jdata) -def exec_args(args, parser=None): - if args.command is None : - parser.print_help() - exit - if args.command == 'gen' : - output = args.output - jdata = json.load(open(args.PARAM, 'r')) - ti.make_tasks(output, jdata) - elif args.command == 'compute' : - job = args.JOB - jdata = json.load(open(os.path.join(job, 'ti_settings.json'), 'r')) - equi_conf = get_task_file_abspath(job, jdata['equi_conf']) - natoms = get_natoms(equi_conf) - if 'copies' in jdata : - natoms *= np.prod(jdata['copies']) - nmols = natoms // 3 - if args.inte_method == 'inte' : - ti.post_tasks(job, jdata, args.Eo, Eo_err = args.Eo_err, To = args.To, natoms = nmols, scheme = args.scheme, shift = args.shift) - elif args.inte_method == 'mbar' : - ti.post_tasks_mbar(job, jdata, args.Eo, natoms = nmols) - else : - raise RuntimeError('unknow integration method') - elif args.command == 'refine' : - ti.refine_task(args.input, args.output, args.error) +def handle_compute(args): + job = args.JOB + jdata = json.load(open(os.path.join(job, 'ti_settings.json'), 'r')) + equi_conf = get_task_file_abspath(job, jdata['equi_conf']) + natoms = get_natoms(equi_conf) + if 'copies' in jdata : + natoms *= np.prod(jdata['copies']) + nmols = natoms // 3 + if args.inte_method == 'inte' : + ti.post_tasks(job, jdata, args.Eo, Eo_err = args.Eo_err, To = args.To, natoms = nmols, scheme = args.scheme, shift = args.shift) + elif args.inte_method == 'mbar' : + ti.post_tasks_mbar(job, jdata, args.Eo, natoms = nmols) + else : + raise RuntimeError('unknow integration method') + +def handle_refine(args): + ti.refine_task(args.input, args.output, args.error) -if __name__ == '__main__' : - _main() - +if __name__ == '__main__': + _main() \ No newline at end of file diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 00000000..e2b191bd --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,45 @@ +[build-system] +requires = ["setuptools", "setuptools_scm", "wheel"] +build-backend = "setuptools.build_meta" + +[project] +name = "dpti" +dynamic = ["version"] +description = "Python dpti for thermodynamics integration" +authors = [{ name = "Deep Modeling Team" }] +license = {file = "LICENSE"} +classifiers = [ + "Programming Language :: Python :: 3.7", + "Programming Language :: Python :: 3.8", + "Programming Language :: Python :: 3.9", + "Programming Language :: Python :: 3.10", + "Programming Language :: Python :: 3.11", + "License :: OSI Approved :: GNU Lesser General Public License v3 (LGPLv3)", +] +readme = "README.md" +requires-python = ">3.6" +keywords = ["free energy", "thermodynamics integration", "deepmd-kit"] +dependencies = [ + "apache-airflow >= 2.0", + "scipy", + "numpy", + "pymbar", + "dargs", + "dpdispatcher >= 0.3", + "sqlalchemy >=1.4.28,<2.0", +] + +[project.urls] +homepage = "https://github.com/deepmodeling/dpti" + +[project.optional-dependencies] +# docs = ["sphinx", "recommonmark", "sphinx_rtd_theme"] + +[project.scripts] +dpti = "dpti.main:main" + +[tool.setuptools.packages.find] +include = ["dpti*"] + +[tool.setuptools_scm] +write_to = "dpti/_version.py" diff --git a/setup.py b/setup.py deleted file mode 100644 index c8973b4d..00000000 --- a/setup.py +++ /dev/null @@ -1,39 +0,0 @@ -#!/usr/bin/env python3 -# -*- coding: utf-8 -*- - -from os import path -# from dpdispatcher import NAME,SHORT_CMD -import setuptools, datetime - -today = datetime.date.today().strftime("%b-%d-%Y") -# with open(path.join(NAME, '_date.py'), 'w') as fp : -# fp.write('date = \'%s\'' % today) - -install_requires=['apache-airflow>2.0', 'scipy', 'numpy', 'pymbar', 'dargs', 'dpdispatcher>=0.3'] - -setuptools.setup( - name='dpti', - use_scm_version={'write_to': 'dpti/_version.py'}, - setup_requires=['setuptools_scm'], - author="Deep Modeling Team", - author_email="", - description="Python dpti for thermodynamics integration", - long_description="", - long_description_content_type="text/markdown", - url="", - python_requires=">3.6", - packages=['dpti', 'dpti/lib', 'dpti/dags'], - classifiers=[ - "Programming Language :: Python :: 3.6", - "License :: OSI Approved :: GNU Lesser General Public License v3 (LGPLv3)", - ], - keywords='free energy thermodynamics integration deepmd-kit', - install_requires=install_requires, - # extras_require={ - # 'docs': ['sphinx', 'recommonmark', 'sphinx_rtd_theme'], - # }, - entry_points={ - # 'console_scripts': [ - # SHORT_CMD+'= dpdispatcher.dpdisp:main'] - } -) diff --git a/tests/benchmark_gdi/deepmd/0/in.lammps b/tests/benchmark_gdi/deepmd/0/in.lammps index e0fff161..a17c5e44 100644 --- a/tests/benchmark_gdi/deepmd/0/in.lammps +++ b/tests/benchmark_gdi/deepmd/0/in.lammps @@ -24,8 +24,8 @@ timestep 0.002 thermo ${THERMO_FREQ} compute allmsd all msd thermo_style custom step ke pe etotal enthalpy temp press vol c_allmsd[*] -thermo_modify 4*8 format %20.6f -# dump 1 all custom ${DUMP_FREQ} traj.dump id type x y z +thermo_modify format 4*8 %20.6f +dump 1 all custom ${DUMP_FREQ} traj.dump id type x y z fix 1 all npt temp ${TEMP} ${TEMP} ${TAU_T} iso ${PRES} ${PRES} ${TAU_P} fix mzero all momentum 10 linear 1 1 1 # --------------------- INITIALIZE ----------------------- diff --git a/tests/benchmark_hti/one_step/task.000006/in.lammps b/tests/benchmark_hti/one_step/task.000006/in.lammps index 06491684..fba1eb28 100644 --- a/tests/benchmark_hti/one_step/task.000006/in.lammps +++ b/tests/benchmark_hti/one_step/task.000006/in.lammps @@ -35,7 +35,7 @@ compute allmsd all msd thermo_style custom step ke pe etotal enthalpy temp press vol v_l_spring c_e_deep c_allmsd[*] thermo_modify format 9 %.16e thermo_modify format 10 %.16e -# dump 1 all custom ${DUMP_FREQ} dump.hti id type x y z vx vy vz +dump 1 all custom ${DUMP_FREQ} dump.hti id type x y z vx vy vz fix 1 all nve fix 2 all langevin ${TEMP} ${TEMP} ${TAU_T} 7858 zero yes # --------------------- INITIALIZE ----------------------- diff --git a/tests/benchmark_hti/three_step/00.lj_on/task.000004/in.lammps b/tests/benchmark_hti/three_step/00.lj_on/task.000004/in.lammps index 5a542cfa..64846297 100644 --- a/tests/benchmark_hti/three_step/00.lj_on/task.000004/in.lammps +++ b/tests/benchmark_hti/three_step/00.lj_on/task.000004/in.lammps @@ -36,7 +36,7 @@ compute allmsd all msd thermo_style custom step ke pe etotal enthalpy temp press vol v_l_spring c_e_diff[1] c_allmsd[*] thermo_modify format 9 %.16e thermo_modify format 10 %.16e -# dump 1 all custom ${DUMP_FREQ} dump.hti id type x y z vx vy vz +dump 1 all custom ${DUMP_FREQ} dump.hti id type x y z vx vy vz fix 1 all nve fix 2 all langevin ${TEMP} ${TEMP} ${TAU_T} 7858 zero yes # --------------------- INITIALIZE ----------------------- diff --git a/tests/benchmark_hti/three_step/01.deep_on/task.000005/in.lammps b/tests/benchmark_hti/three_step/01.deep_on/task.000005/in.lammps index a15d3e1a..e7f620b0 100644 --- a/tests/benchmark_hti/three_step/01.deep_on/task.000005/in.lammps +++ b/tests/benchmark_hti/three_step/01.deep_on/task.000005/in.lammps @@ -38,7 +38,7 @@ compute allmsd all msd thermo_style custom step ke pe etotal enthalpy temp press vol v_l_spring c_e_diff[1] c_allmsd[*] thermo_modify format 9 %.16e thermo_modify format 10 %.16e -# dump 1 all custom ${DUMP_FREQ} dump.hti id type x y z vx vy vz +dump 1 all custom ${DUMP_FREQ} dump.hti id type x y z vx vy vz fix 1 all nve fix 2 all langevin ${TEMP} ${TEMP} ${TAU_T} 7858 zero yes # --------------------- INITIALIZE ----------------------- diff --git a/tests/benchmark_hti/three_step/02.spring_off/task.000006/in.lammps b/tests/benchmark_hti/three_step/02.spring_off/task.000006/in.lammps index c081eb2a..d0803508 100644 --- a/tests/benchmark_hti/three_step/02.spring_off/task.000006/in.lammps +++ b/tests/benchmark_hti/three_step/02.spring_off/task.000006/in.lammps @@ -38,7 +38,7 @@ compute allmsd all msd thermo_style custom step ke pe etotal enthalpy temp press vol v_l_spring c_e_diff[1] c_allmsd[*] thermo_modify format 9 %.16e thermo_modify format 10 %.16e -# dump 1 all custom ${DUMP_FREQ} dump.hti id type x y z vx vy vz +dump 1 all custom ${DUMP_FREQ} dump.hti id type x y z vx vy vz fix 1 all nve fix 2 all langevin ${TEMP} ${TEMP} ${TAU_T} 7858 zero yes # --------------------- INITIALIZE ----------------------- diff --git a/tests/benchmark_hti/three_step_meam/00.lj_on/task.000004/in.lammps b/tests/benchmark_hti/three_step_meam/00.lj_on/task.000004/in.lammps index 5a542cfa..64846297 100644 --- a/tests/benchmark_hti/three_step_meam/00.lj_on/task.000004/in.lammps +++ b/tests/benchmark_hti/three_step_meam/00.lj_on/task.000004/in.lammps @@ -36,7 +36,7 @@ compute allmsd all msd thermo_style custom step ke pe etotal enthalpy temp press vol v_l_spring c_e_diff[1] c_allmsd[*] thermo_modify format 9 %.16e thermo_modify format 10 %.16e -# dump 1 all custom ${DUMP_FREQ} dump.hti id type x y z vx vy vz +dump 1 all custom ${DUMP_FREQ} dump.hti id type x y z vx vy vz fix 1 all nve fix 2 all langevin ${TEMP} ${TEMP} ${TAU_T} 7858 zero yes # --------------------- INITIALIZE ----------------------- diff --git a/tests/benchmark_hti/three_step_meam/01.deep_on/task.000005/in.lammps b/tests/benchmark_hti/three_step_meam/01.deep_on/task.000005/in.lammps index d730efea..5ff0fb9a 100644 --- a/tests/benchmark_hti/three_step_meam/01.deep_on/task.000005/in.lammps +++ b/tests/benchmark_hti/three_step_meam/01.deep_on/task.000005/in.lammps @@ -38,7 +38,7 @@ compute allmsd all msd thermo_style custom step ke pe etotal enthalpy temp press vol v_l_spring c_e_diff[1] c_allmsd[*] thermo_modify format 9 %.16e thermo_modify format 10 %.16e -# dump 1 all custom ${DUMP_FREQ} dump.hti id type x y z vx vy vz +dump 1 all custom ${DUMP_FREQ} dump.hti id type x y z vx vy vz fix 1 all nve fix 2 all langevin ${TEMP} ${TEMP} ${TAU_T} 7858 zero yes # --------------------- INITIALIZE ----------------------- diff --git a/tests/benchmark_hti/three_step_meam/02.spring_off/task.000006/in.lammps b/tests/benchmark_hti/three_step_meam/02.spring_off/task.000006/in.lammps index 72343a03..fe39cc4a 100644 --- a/tests/benchmark_hti/three_step_meam/02.spring_off/task.000006/in.lammps +++ b/tests/benchmark_hti/three_step_meam/02.spring_off/task.000006/in.lammps @@ -38,7 +38,7 @@ compute allmsd all msd thermo_style custom step ke pe etotal enthalpy temp press vol v_l_spring c_e_diff[1] c_allmsd[*] thermo_modify format 9 %.16e thermo_modify format 10 %.16e -# dump 1 all custom ${DUMP_FREQ} dump.hti id type x y z vx vy vz +dump 1 all custom ${DUMP_FREQ} dump.hti id type x y z vx vy vz fix 1 all nve fix 2 all langevin ${TEMP} ${TEMP} ${TAU_T} 7858 zero yes # --------------------- INITIALIZE ----------------------- diff --git a/tests/benchmark_hti/two_step/00.deep_on/task.000005/in.lammps b/tests/benchmark_hti/two_step/00.deep_on/task.000005/in.lammps index 37966886..f14baea9 100644 --- a/tests/benchmark_hti/two_step/00.deep_on/task.000005/in.lammps +++ b/tests/benchmark_hti/two_step/00.deep_on/task.000005/in.lammps @@ -35,7 +35,7 @@ compute allmsd all msd thermo_style custom step ke pe etotal enthalpy temp press vol v_l_spring c_e_deep c_allmsd[*] thermo_modify format 9 %.16e thermo_modify format 10 %.16e -# dump 1 all custom ${DUMP_FREQ} dump.hti id type x y z vx vy vz +dump 1 all custom ${DUMP_FREQ} dump.hti id type x y z vx vy vz fix 1 all nve fix 2 all langevin ${TEMP} ${TEMP} ${TAU_T} 7858 zero yes # --------------------- INITIALIZE ----------------------- diff --git a/tests/benchmark_hti/two_step/00.deep_on/task.000006/in.lammps b/tests/benchmark_hti/two_step/00.deep_on/task.000006/in.lammps index 6329509c..ae45ab4c 100644 --- a/tests/benchmark_hti/two_step/00.deep_on/task.000006/in.lammps +++ b/tests/benchmark_hti/two_step/00.deep_on/task.000006/in.lammps @@ -35,7 +35,7 @@ compute allmsd all msd thermo_style custom step ke pe etotal enthalpy temp press vol v_l_spring c_e_deep c_allmsd[*] thermo_modify format 9 %.16e thermo_modify format 10 %.16e -# dump 1 all custom ${DUMP_FREQ} dump.hti id type x y z vx vy vz +dump 1 all custom ${DUMP_FREQ} dump.hti id type x y z vx vy vz fix 1 all nve fix 2 all langevin ${TEMP} ${TEMP} ${TAU_T} 7858 zero yes # --------------------- INITIALIZE ----------------------- diff --git a/tests/benchmark_hti/two_step/01.spring_off/task.000006/in.lammps b/tests/benchmark_hti/two_step/01.spring_off/task.000006/in.lammps index 1a2f42ea..000bf829 100644 --- a/tests/benchmark_hti/two_step/01.spring_off/task.000006/in.lammps +++ b/tests/benchmark_hti/two_step/01.spring_off/task.000006/in.lammps @@ -34,7 +34,7 @@ compute allmsd all msd thermo_style custom step ke pe etotal enthalpy temp press vol v_l_spring c_e_deep c_allmsd[*] thermo_modify format 9 %.16e thermo_modify format 10 %.16e -# dump 1 all custom ${DUMP_FREQ} dump.hti id type x y z vx vy vz +dump 1 all custom ${DUMP_FREQ} dump.hti id type x y z vx vy vz fix 1 all nve fix 2 all langevin ${TEMP} ${TEMP} ${TAU_T} 7858 zero yes # --------------------- INITIALIZE ----------------------- diff --git a/tests/benchmark_hti_ice/new_job/00.lj_on/task.000003/in.lammps b/tests/benchmark_hti_ice/new_job/00.lj_on/task.000003/in.lammps index 706c0426..cac6f222 100644 --- a/tests/benchmark_hti_ice/new_job/00.lj_on/task.000003/in.lammps +++ b/tests/benchmark_hti_ice/new_job/00.lj_on/task.000003/in.lammps @@ -42,7 +42,7 @@ compute allmsd all msd thermo_style custom step ke pe etotal enthalpy temp press vol v_l_spring c_e_diff[1] c_allmsd[*] thermo_modify format 9 %.16e thermo_modify format 10 %.16e -# dump 1 all custom ${DUMP_FREQ} dump.hti id type x y z vx vy vz +dump 1 all custom ${DUMP_FREQ} dump.hti id type x y z vx vy vz fix 1 all nve fix 2 all langevin ${TEMP} ${TEMP} ${TAU_T} 7858 zero yes # --------------------- INITIALIZE ----------------------- diff --git a/tests/benchmark_hti_ice/new_job/01.deep_on/task.000004/in.lammps b/tests/benchmark_hti_ice/new_job/01.deep_on/task.000004/in.lammps index b66db2ea..b9795360 100644 --- a/tests/benchmark_hti_ice/new_job/01.deep_on/task.000004/in.lammps +++ b/tests/benchmark_hti_ice/new_job/01.deep_on/task.000004/in.lammps @@ -44,7 +44,7 @@ compute allmsd all msd thermo_style custom step ke pe etotal enthalpy temp press vol v_l_spring c_e_diff[1] c_allmsd[*] thermo_modify format 9 %.16e thermo_modify format 10 %.16e -# dump 1 all custom ${DUMP_FREQ} dump.hti id type x y z vx vy vz +dump 1 all custom ${DUMP_FREQ} dump.hti id type x y z vx vy vz fix 1 all nve fix 2 all langevin ${TEMP} ${TEMP} ${TAU_T} 7858 zero yes # --------------------- INITIALIZE ----------------------- diff --git a/tests/benchmark_hti_ice/new_job/02.spring_off/task.000005/in.lammps b/tests/benchmark_hti_ice/new_job/02.spring_off/task.000005/in.lammps index 00626e21..6b51bc0e 100644 --- a/tests/benchmark_hti_ice/new_job/02.spring_off/task.000005/in.lammps +++ b/tests/benchmark_hti_ice/new_job/02.spring_off/task.000005/in.lammps @@ -44,7 +44,7 @@ compute allmsd all msd thermo_style custom step ke pe etotal enthalpy temp press vol v_l_spring c_e_diff[1] c_allmsd[*] thermo_modify format 9 %.16e thermo_modify format 10 %.16e -# dump 1 all custom ${DUMP_FREQ} dump.hti id type x y z vx vy vz +dump 1 all custom ${DUMP_FREQ} dump.hti id type x y z vx vy vz fix 1 all nve fix 2 all langevin ${TEMP} ${TEMP} ${TAU_T} 7858 zero yes # --------------------- INITIALIZE ----------------------- diff --git a/tests/benchmark_hti_liq/three_step/00.soft_on/task.000004/in.lammps b/tests/benchmark_hti_liq/three_step/00.soft_on/task.000004/in.lammps index c118e5e2..530117c4 100644 --- a/tests/benchmark_hti_liq/three_step/00.soft_on/task.000004/in.lammps +++ b/tests/benchmark_hti_liq/three_step/00.soft_on/task.000004/in.lammps @@ -30,7 +30,7 @@ compute allmsd all msd thermo ${THERMO_FREQ} thermo_style custom step ke pe etotal enthalpy temp press vol c_e_diff[1] c_allmsd[*] thermo_modify format 9 %.16e -# dump 1 all custom ${DUMP_FREQ} dump.hti id type x y z vx vy vz +dump 1 all custom ${DUMP_FREQ} dump.hti id type x y z vx vy vz fix 1 all nvt temp ${TEMP} ${TEMP} ${TAU_T} fix mzero all momentum 10 linear 1 1 1 # --------------------- INITIALIZE ----------------------- diff --git a/tests/benchmark_hti_liq/three_step/01.deep_on/task.000005/in.lammps b/tests/benchmark_hti_liq/three_step/01.deep_on/task.000005/in.lammps index 1cae6f68..6f999010 100644 --- a/tests/benchmark_hti_liq/three_step/01.deep_on/task.000005/in.lammps +++ b/tests/benchmark_hti_liq/three_step/01.deep_on/task.000005/in.lammps @@ -32,7 +32,7 @@ compute allmsd all msd thermo ${THERMO_FREQ} thermo_style custom step ke pe etotal enthalpy temp press vol c_e_diff[1] c_allmsd[*] thermo_modify format 9 %.16e -# dump 1 all custom ${DUMP_FREQ} dump.hti id type x y z vx vy vz +dump 1 all custom ${DUMP_FREQ} dump.hti id type x y z vx vy vz fix 1 all nvt temp ${TEMP} ${TEMP} ${TAU_T} fix mzero all momentum 10 linear 1 1 1 # --------------------- INITIALIZE ----------------------- diff --git a/tests/benchmark_hti_liq/three_step/02.soft_off/task.000006/in.lammps b/tests/benchmark_hti_liq/three_step/02.soft_off/task.000006/in.lammps index 49d9ad9f..36f07925 100644 --- a/tests/benchmark_hti_liq/three_step/02.soft_off/task.000006/in.lammps +++ b/tests/benchmark_hti_liq/three_step/02.soft_off/task.000006/in.lammps @@ -33,7 +33,7 @@ compute allmsd all msd thermo ${THERMO_FREQ} thermo_style custom step ke pe etotal enthalpy temp press vol c_e_diff[1] c_allmsd[*] thermo_modify format 9 %.16e -# dump 1 all custom ${DUMP_FREQ} dump.hti id type x y z vx vy vz +dump 1 all custom ${DUMP_FREQ} dump.hti id type x y z vx vy vz fix 1 all nvt temp ${TEMP} ${TEMP} ${TAU_T} fix mzero all momentum 10 linear 1 1 1 # --------------------- INITIALIZE ----------------------- diff --git a/tests/benchmark_hti_liq/three_step_meam/00.soft_on/task.000004/in.lammps b/tests/benchmark_hti_liq/three_step_meam/00.soft_on/task.000004/in.lammps index c118e5e2..530117c4 100644 --- a/tests/benchmark_hti_liq/three_step_meam/00.soft_on/task.000004/in.lammps +++ b/tests/benchmark_hti_liq/three_step_meam/00.soft_on/task.000004/in.lammps @@ -30,7 +30,7 @@ compute allmsd all msd thermo ${THERMO_FREQ} thermo_style custom step ke pe etotal enthalpy temp press vol c_e_diff[1] c_allmsd[*] thermo_modify format 9 %.16e -# dump 1 all custom ${DUMP_FREQ} dump.hti id type x y z vx vy vz +dump 1 all custom ${DUMP_FREQ} dump.hti id type x y z vx vy vz fix 1 all nvt temp ${TEMP} ${TEMP} ${TAU_T} fix mzero all momentum 10 linear 1 1 1 # --------------------- INITIALIZE ----------------------- diff --git a/tests/benchmark_hti_liq/three_step_meam/01.deep_on/task.000005/in.lammps b/tests/benchmark_hti_liq/three_step_meam/01.deep_on/task.000005/in.lammps index 1ec3861c..83796e16 100644 --- a/tests/benchmark_hti_liq/three_step_meam/01.deep_on/task.000005/in.lammps +++ b/tests/benchmark_hti_liq/three_step_meam/01.deep_on/task.000005/in.lammps @@ -32,7 +32,7 @@ compute allmsd all msd thermo ${THERMO_FREQ} thermo_style custom step ke pe etotal enthalpy temp press vol c_e_diff[1] c_allmsd[*] thermo_modify format 9 %.16e -# dump 1 all custom ${DUMP_FREQ} dump.hti id type x y z vx vy vz +dump 1 all custom ${DUMP_FREQ} dump.hti id type x y z vx vy vz fix 1 all nvt temp ${TEMP} ${TEMP} ${TAU_T} fix mzero all momentum 10 linear 1 1 1 # --------------------- INITIALIZE ----------------------- diff --git a/tests/benchmark_hti_liq/three_step_meam/02.soft_off/task.000006/in.lammps b/tests/benchmark_hti_liq/three_step_meam/02.soft_off/task.000006/in.lammps index 01f31dcf..2572cfb0 100644 --- a/tests/benchmark_hti_liq/three_step_meam/02.soft_off/task.000006/in.lammps +++ b/tests/benchmark_hti_liq/three_step_meam/02.soft_off/task.000006/in.lammps @@ -33,7 +33,7 @@ compute allmsd all msd thermo ${THERMO_FREQ} thermo_style custom step ke pe etotal enthalpy temp press vol c_e_diff[1] c_allmsd[*] thermo_modify format 9 %.16e -# dump 1 all custom ${DUMP_FREQ} dump.hti id type x y z vx vy vz +dump 1 all custom ${DUMP_FREQ} dump.hti id type x y z vx vy vz fix 1 all nvt temp ${TEMP} ${TEMP} ${TAU_T} fix mzero all momentum 10 linear 1 1 1 # --------------------- INITIALIZE ----------------------- diff --git a/tests/benchmark_hti_water/new_job/00.angle_on/task.000002/in.lammps b/tests/benchmark_hti_water/new_job/00.angle_on/task.000002/in.lammps index 77f092c6..bf1370fe 100644 --- a/tests/benchmark_hti_water/new_job/00.angle_on/task.000002/in.lammps +++ b/tests/benchmark_hti_water/new_job/00.angle_on/task.000002/in.lammps @@ -40,7 +40,7 @@ thermo_style custom step ke pe etotal enthalpy temp press vol ebond eangle c_ thermo_modify format 9 %.16e thermo_modify format 10 %.16e thermo_modify format 11 %.16e -# dump 1 all custom ${DUMP_FREQ} dump.hti id type x y z +dump 1 all custom ${DUMP_FREQ} dump.hti id type x y z fix 1 all nvt temp ${TEMP} ${TEMP} ${TAU_T} fix mzero all momentum 10 linear 1 1 1 # --------------------- INITIALIZE ----------------------- diff --git a/tests/benchmark_hti_water/new_job/01.deep_on/task.000003/in.lammps b/tests/benchmark_hti_water/new_job/01.deep_on/task.000003/in.lammps index 977b4372..eb004864 100644 --- a/tests/benchmark_hti_water/new_job/01.deep_on/task.000003/in.lammps +++ b/tests/benchmark_hti_water/new_job/01.deep_on/task.000003/in.lammps @@ -41,7 +41,7 @@ thermo_style custom step ke pe etotal enthalpy temp press vol ebond eangle c_ thermo_modify format 9 %.16e thermo_modify format 10 %.16e thermo_modify format 11 %.16e -# dump 1 all custom ${DUMP_FREQ} dump.hti id type x y z +dump 1 all custom ${DUMP_FREQ} dump.hti id type x y z fix 1 all nvt temp ${TEMP} ${TEMP} ${TAU_T} fix mzero all momentum 10 linear 1 1 1 # --------------------- INITIALIZE ----------------------- diff --git a/tests/benchmark_hti_water/new_job/02.bond_angle_off/task.000004/in.lammps b/tests/benchmark_hti_water/new_job/02.bond_angle_off/task.000004/in.lammps index 52bd9fb9..e5279c32 100644 --- a/tests/benchmark_hti_water/new_job/02.bond_angle_off/task.000004/in.lammps +++ b/tests/benchmark_hti_water/new_job/02.bond_angle_off/task.000004/in.lammps @@ -44,7 +44,7 @@ thermo_style custom step ke pe etotal enthalpy temp press vol ebond eangle c_ thermo_modify format 9 %.16e thermo_modify format 10 %.16e thermo_modify format 11 %.16e -# dump 1 all custom ${DUMP_FREQ} dump.hti id type x y z +dump 1 all custom ${DUMP_FREQ} dump.hti id type x y z fix 1 all nvt temp ${TEMP} ${TEMP} ${TAU_T} fix mzero all momentum 10 linear 1 1 1 # --------------------- INITIALIZE ----------------------- diff --git a/tests/benchmark_ti/path-p/in.lammps b/tests/benchmark_ti/path-p/in.lammps index 0fc7e68d..8f1f1d00 100644 --- a/tests/benchmark_ti/path-p/in.lammps +++ b/tests/benchmark_ti/path-p/in.lammps @@ -27,7 +27,7 @@ thermo ${THERMO_FREQ} compute allmsd all msd thermo_style custom step ke pe etotal enthalpy temp press vol c_allmsd[*] thermo_modify 4*8 format %20.6f -# dump 1 all custom ${DUMP_FREQ} traj.dump id type x y z +dump 1 all custom ${DUMP_FREQ} traj.dump id type x y z fix 1 all npt temp ${TEMP} ${TEMP} ${TAU_T} aniso ${PRES} ${PRES} ${TAU_P} couple xy fix mzero all momentum 10 linear 1 1 1 # --------------------- INITIALIZE ----------------------- diff --git a/tests/benchmark_ti/path-p/task.000006/in.lammps b/tests/benchmark_ti/path-p/task.000006/in.lammps index 08689fc8..d7c22e5d 100644 --- a/tests/benchmark_ti/path-p/task.000006/in.lammps +++ b/tests/benchmark_ti/path-p/task.000006/in.lammps @@ -25,8 +25,8 @@ timestep 0.002 thermo ${THERMO_FREQ} compute allmsd all msd thermo_style custom step ke pe etotal enthalpy temp press vol c_allmsd[*] -thermo_modify 4*8 format %20.6f -# dump 1 all custom ${DUMP_FREQ} traj.dump id type x y z +thermo_modify format 4*8 %20.6f +dump 1 all custom ${DUMP_FREQ} traj.dump id type x y z fix 1 all npt temp ${TEMP} ${TEMP} ${TAU_T} aniso ${PRES} ${PRES} ${TAU_P} couple xy fix mzero all momentum 10 linear 1 1 1 # --------------------- INITIALIZE ----------------------- diff --git a/tests/benchmark_ti/path-t/task.000006/in.lammps b/tests/benchmark_ti/path-t/task.000006/in.lammps index d017b97a..3b861f37 100644 --- a/tests/benchmark_ti/path-t/task.000006/in.lammps +++ b/tests/benchmark_ti/path-t/task.000006/in.lammps @@ -26,7 +26,7 @@ thermo ${THERMO_FREQ} compute allmsd all msd thermo_style custom step ke pe etotal enthalpy temp press vol c_allmsd[*] thermo_modify 4*8 format %20.6f -# dump 1 all custom ${DUMP_FREQ} traj.dump id type x y z +dump 1 all custom ${DUMP_FREQ} traj.dump id type x y z fix 1 all npt temp ${TEMP} ${TEMP} ${TAU_T} aniso ${PRES} ${PRES} ${TAU_P} couple xy fix mzero all momentum 10 linear 1 1 1 # --------------------- INITIALIZE ----------------------- diff --git a/tests/benchmark_ti_water/new_job/task.000003/in.lammps b/tests/benchmark_ti_water/new_job/task.000003/in.lammps index 8ee90f51..a43451dd 100644 --- a/tests/benchmark_ti_water/new_job/task.000003/in.lammps +++ b/tests/benchmark_ti_water/new_job/task.000003/in.lammps @@ -26,8 +26,8 @@ timestep 0.0005 thermo ${THERMO_FREQ} compute allmsd all msd thermo_style custom step ke pe etotal enthalpy temp press vol c_allmsd[*] -thermo_modify 4*8 format %20.6f -# dump 1 all custom ${DUMP_FREQ} traj.dump id type x y z +thermo_modify format 4*8 %20.6f +dump 1 all custom ${DUMP_FREQ} traj.dump id type x y z fix 1 all npt temp ${TEMP} ${TEMP} ${TAU_T} iso ${PRES} ${PRES} ${TAU_P} fix mzero all momentum 10 linear 1 1 1 # --------------------- INITIALIZE ----------------------- diff --git a/tests/test_hti_gen_lammps_input.py b/tests/test_hti_gen_lammps_input.py index d49ba642..a0f844f0 100644 --- a/tests/test_hti_gen_lammps_input.py +++ b/tests/test_hti_gen_lammps_input.py @@ -76,7 +76,7 @@ def test_deepmd_lj_on(self, patch_random): thermo_style custom step ke pe etotal enthalpy temp press vol v_l_spring c_e_diff[1] c_allmsd[*] thermo_modify format 9 %.16e thermo_modify format 10 %.16e - # dump 1 all custom ${DUMP_FREQ} dump.hti id type x y z vx vy vz + dump 1 all custom ${DUMP_FREQ} dump.hti id type x y z vx vy vz fix 1 all npt temp ${TEMP} ${TEMP} ${TAU_T} iso ${PRES} ${PRES} ${TAU_P} # --------------------- INITIALIZE ----------------------- velocity all create ${TEMP} 7858 @@ -157,7 +157,7 @@ def test_deepmd_deep_on(self, patch_random): thermo_style custom step ke pe etotal enthalpy temp press vol v_l_spring c_e_diff[1] c_allmsd[*] thermo_modify format 9 %.16e thermo_modify format 10 %.16e - # dump 1 all custom ${DUMP_FREQ} dump.hti id type x y z vx vy vz + dump 1 all custom ${DUMP_FREQ} dump.hti id type x y z vx vy vz fix 1 all npt temp ${TEMP} ${TEMP} ${TAU_T} iso ${PRES} ${PRES} ${TAU_P} # --------------------- INITIALIZE ----------------------- velocity all create ${TEMP} 7858 @@ -236,7 +236,7 @@ def test_deepmd_lj_off(self, patch_random): thermo_style custom step ke pe etotal enthalpy temp press vol v_l_spring c_e_diff[1] c_allmsd[*] thermo_modify format 9 %.16e thermo_modify format 10 %.16e - # dump 1 all custom ${DUMP_FREQ} dump.hti id type x y z vx vy vz + dump 1 all custom ${DUMP_FREQ} dump.hti id type x y z vx vy vz fix 1 all npt temp ${TEMP} ${TEMP} ${TAU_T} iso ${PRES} ${PRES} ${TAU_P} # --------------------- INITIALIZE ----------------------- velocity all create ${TEMP} 7858 @@ -315,7 +315,7 @@ def test_meam_deep_on(self, patch_random): thermo_style custom step ke pe etotal enthalpy temp press vol v_l_spring c_e_diff[1] c_allmsd[*] thermo_modify format 9 %.16e thermo_modify format 10 %.16e - # dump 1 all custom ${DUMP_FREQ} dump.hti id type x y z vx vy vz + dump 1 all custom ${DUMP_FREQ} dump.hti id type x y z vx vy vz fix 1 all npt temp ${TEMP} ${TEMP} ${TAU_T} iso ${PRES} ${PRES} ${TAU_P} # --------------------- INITIALIZE ----------------------- velocity all create ${TEMP} 7858 @@ -395,7 +395,7 @@ def test_meam_spring_off(self, patch_random): thermo_style custom step ke pe etotal enthalpy temp press vol v_l_spring c_e_diff[1] c_allmsd[*] thermo_modify format 9 %.16e thermo_modify format 10 %.16e - # dump 1 all custom ${DUMP_FREQ} dump.hti id type x y z vx vy vz + dump 1 all custom ${DUMP_FREQ} dump.hti id type x y z vx vy vz fix 1 all npt temp ${TEMP} ${TEMP} ${TAU_T} iso ${PRES} ${PRES} ${TAU_P} # --------------------- INITIALIZE ----------------------- velocity all create ${TEMP} 7858 diff --git a/tests/test_hti_ice_gen_lammps_input.py b/tests/test_hti_ice_gen_lammps_input.py index 28549e48..dec2eb74 100644 --- a/tests/test_hti_ice_gen_lammps_input.py +++ b/tests/test_hti_ice_gen_lammps_input.py @@ -23,7 +23,7 @@ def test_hti_ice_tasks(self, patch_random): patch_random.randint = MagicMock(return_value=7858) args = MagicMock(output='tmp_hti_ice/new_job/', switch='three-step', - command='gen', + func = hti_ice.handle_gen, PARAM='benchmark_hti_ice/hti_ice.json' ) hti_ice.exec_args(args=args, parser=None) @@ -44,7 +44,7 @@ def test_hti_ice_old_json_tasks(self, patch_random): patch_random.randint = MagicMock(return_value=7858) args = MagicMock(output='tmp_hti_ice/old_json_job/', switch='three-step', - command='gen', + func = hti_ice.handle_gen, PARAM='benchmark_hti_ice/hti_ice.json.old' ) hti_ice.exec_args(args=args, parser=None) diff --git a/tests/test_hti_liq_gen_lammps_input.py b/tests/test_hti_liq_gen_lammps_input.py index db35366c..c7a2850b 100644 --- a/tests/test_hti_liq_gen_lammps_input.py +++ b/tests/test_hti_liq_gen_lammps_input.py @@ -70,7 +70,7 @@ def test_soft_on(self, patch_random): thermo ${THERMO_FREQ} thermo_style custom step ke pe etotal enthalpy temp press vol c_e_diff[1] c_allmsd[*] thermo_modify format 9 %.16e - # dump 1 all custom ${DUMP_FREQ} dump.hti id type x y z vx vy vz + dump 1 all custom ${DUMP_FREQ} dump.hti id type x y z vx vy vz fix 1 all npt temp ${TEMP} ${TEMP} ${TAU_T} iso ${PRES} ${PRES} ${TAU_P} fix mzero all momentum 10 linear 1 1 1 # --------------------- INITIALIZE ----------------------- @@ -144,7 +144,7 @@ def test_deep_on(self, patch_random): thermo ${THERMO_FREQ} thermo_style custom step ke pe etotal enthalpy temp press vol c_e_diff[1] c_allmsd[*] thermo_modify format 9 %.16e - # dump 1 all custom ${DUMP_FREQ} dump.hti id type x y z vx vy vz + dump 1 all custom ${DUMP_FREQ} dump.hti id type x y z vx vy vz fix 1 all npt temp ${TEMP} ${TEMP} ${TAU_T} iso ${PRES} ${PRES} ${TAU_P} fix mzero all momentum 10 linear 1 1 1 # --------------------- INITIALIZE ----------------------- @@ -221,7 +221,7 @@ def test_soft_off(self, patch_random): thermo ${THERMO_FREQ} thermo_style custom step ke pe etotal enthalpy temp press vol c_e_diff[1] c_allmsd[*] thermo_modify format 9 %.16e - # dump 1 all custom ${DUMP_FREQ} dump.hti id type x y z vx vy vz + dump 1 all custom ${DUMP_FREQ} dump.hti id type x y z vx vy vz fix 1 all npt temp ${TEMP} ${TEMP} ${TAU_T} iso ${PRES} ${PRES} ${TAU_P} fix mzero all momentum 10 linear 1 1 1 # --------------------- INITIALIZE ----------------------- @@ -306,7 +306,7 @@ def test_soft_off(self, patch_random): # thermo_style custom step ke pe etotal enthalpy temp press vol v_l_spring c_e_diff[1] c_allmsd[*] # thermo_modify format 9 %.16e # thermo_modify format 10 %.16e - # # dump 1 all custom ${DUMP_FREQ} dump.hti id type x y z vx vy vz + # dump 1 all custom ${DUMP_FREQ} dump.hti id type x y z vx vy vz # fix 1 all npt temp ${TEMP} ${TEMP} ${TAU_T} iso ${PRES} ${PRES} ${TAU_P} # # --------------------- INITIALIZE ----------------------- # velocity all create ${TEMP} 7858 @@ -386,7 +386,7 @@ def test_soft_off(self, patch_random): # thermo_style custom step ke pe etotal enthalpy temp press vol v_l_spring c_e_diff[1] c_allmsd[*] # thermo_modify format 9 %.16e # thermo_modify format 10 %.16e - # # dump 1 all custom ${DUMP_FREQ} dump.hti id type x y z vx vy vz + # dump 1 all custom ${DUMP_FREQ} dump.hti id type x y z vx vy vz # fix 1 all npt temp ${TEMP} ${TEMP} ${TAU_T} iso ${PRES} ${PRES} ${TAU_P} # # --------------------- INITIALIZE ----------------------- # velocity all create ${TEMP} 7858 @@ -466,7 +466,7 @@ def test_soft_off(self, patch_random): # thermo_style custom step ke pe etotal enthalpy temp press vol v_l_spring c_e_diff[1] c_allmsd[*] # thermo_modify format 9 %.16e # thermo_modify format 10 %.16e - # # dump 1 all custom ${DUMP_FREQ} dump.hti id type x y z vx vy vz + # dump 1 all custom ${DUMP_FREQ} dump.hti id type x y z vx vy vz # fix 1 all npt temp ${TEMP} ${TEMP} ${TAU_T} iso ${PRES} ${PRES} ${TAU_P} # # --------------------- INITIALIZE ----------------------- # velocity all create ${TEMP} 7858 diff --git a/tests/test_hti_water_gen_lammps_input.py b/tests/test_hti_water_gen_lammps_input.py index 6d2c9676..5aa0f37e 100644 --- a/tests/test_hti_water_gen_lammps_input.py +++ b/tests/test_hti_water_gen_lammps_input.py @@ -20,7 +20,7 @@ def setUp(self) : def test_hti_water_gen_tasks(self, patch_random): patch_random.randint = MagicMock(return_value=7858) args = MagicMock(output='tmp_hti_water/new_job/', - command='gen', + func = hti_water.handle_gen, PARAM='benchmark_hti_water/hti_water.json' ) hti_water.exec_args(args=args, parser=None) @@ -40,7 +40,7 @@ def test_hti_water_gen_tasks(self, patch_random): def test_hti_water_gen_old_json_gen_tasks(self, patch_random): patch_random.randint = MagicMock(return_value=7858) args = MagicMock(output='tmp_hti_water/old_json_job/', - command='gen', + func = hti_water.handle_gen, PARAM='benchmark_hti_water/hti_water.json.old' ) hti_water.exec_args(args=args, parser=None) diff --git a/tests/test_lib_utils.py b/tests/test_lib_utils.py index f406dbdf..a36d7d5b 100644 --- a/tests/test_lib_utils.py +++ b/tests/test_lib_utils.py @@ -106,7 +106,7 @@ def test_normal(self): relative_link_file('graph.pb', 'relative_link_file_test_dir/') def test_other_place(self): - relative_link_file('../setup.py', 'relative_link_file_test_dir/') + relative_link_file('../pyproject.toml', 'relative_link_file_test_dir/') def test_abs_path(self): abs_path = os.path.abspath(__file__) diff --git a/tests/test_ti_gen_lammps_input.py b/tests/test_ti_gen_lammps_input.py index e81a050a..dcd55811 100644 --- a/tests/test_ti_gen_lammps_input.py +++ b/tests/test_ti_gen_lammps_input.py @@ -58,8 +58,8 @@ def test_deepmd(self, patch_random): thermo ${THERMO_FREQ} compute allmsd all msd thermo_style custom step ke pe etotal enthalpy temp press vol c_allmsd[*] - thermo_modify 4*8 format %20.6f - # dump 1 all custom ${DUMP_FREQ} traj.dump id type x y z + thermo_modify format 4*8 %20.6f + dump 1 all custom ${DUMP_FREQ} traj.dump id type x y z fix 1 all npt temp ${TEMP} ${TEMP} ${TAU_T} iso ${PRES} ${PRES} ${TAU_P} fix mzero all momentum 10 linear 1 1 1 # --------------------- INITIALIZE ----------------------- @@ -118,8 +118,8 @@ def test_meam(self, patch_random): thermo ${THERMO_FREQ} compute allmsd all msd thermo_style custom step ke pe etotal enthalpy temp press vol c_allmsd[*] - thermo_modify 4*8 format %20.6f - # dump 1 all custom ${DUMP_FREQ} traj.dump id type x y z + thermo_modify format 4*8 %20.6f + dump 1 all custom ${DUMP_FREQ} traj.dump id type x y z fix 1 all npt temp ${TEMP} ${TEMP} ${TAU_T} iso ${PRES} ${PRES} ${TAU_P} fix mzero all momentum 10 linear 1 1 1 # --------------------- INITIALIZE ----------------------- diff --git a/tests/test_ti_water_gen_lammps_input.py b/tests/test_ti_water_gen_lammps_input.py index 6dba3b36..d4a0a7cc 100644 --- a/tests/test_ti_water_gen_lammps_input.py +++ b/tests/test_ti_water_gen_lammps_input.py @@ -21,7 +21,7 @@ def test_ti_water_gen_tasks(self, patch_random): patch_random.randint = MagicMock(return_value=7858) args = MagicMock( output='tmp_ti_water/new_job/', - command='gen', + func = ti_water.handle_gen, PARAM='benchmark_ti_water/ti_water.json' ) ti_water.exec_args(args=args, parser=None) @@ -41,7 +41,7 @@ def test_ti_water_old_json_gen_tasks(self, patch_random): patch_random.randint = MagicMock(return_value=7858) args = MagicMock( output='tmp_ti_water/old_json_job/', - command='gen', + func = ti_water.handle_gen, PARAM='benchmark_ti_water/ti_water.json.old' ) ti_water.exec_args(args=args, parser=None) diff --git a/workflow/DpFreeEnergyWater.py b/workflow/DpFreeEnergyWater.py index 1c4e28ef..2d844e84 100644 --- a/workflow/DpFreeEnergyWater.py +++ b/workflow/DpFreeEnergyWater.py @@ -102,7 +102,7 @@ def NPT_start(start_info): print(task_jdata) cwd = os.getcwd() os.chdir(work_base_abs_dir) - equi.make_task(job_work_dir, task_jdata) + equi.make_task(job_work_dir, task_jdata, if_dump_avg_posi=True) os.chdir(cwd) return job_work_dir @@ -110,7 +110,7 @@ def NPT_start(start_info): @task(trigger_rule='none_failed_or_skipped') def NPT_sim(job_work_dir): task = Task(command='lmp -i in.lammps', task_work_path='./', - forward_files=['in.lammps', '*lmp', 'graph.pb'], backward_files=['log.lammps']) + forward_files=['in.lammps', '*lmp', 'graph.pb'], backward_files=['log.lammps', 'dump.equi']) submission = get_empty_submission(job_work_dir) submission.register_task_list([task]) submission.run_submission() @@ -220,10 +220,10 @@ def HTI_sim(HTI_init_info): task_dir_list = [os.path.relpath(ii, start=job_work_dir ) for ii in task_abs_dir_list] task_list = [ Task(command='lmp -i in.lammps', - task_work_path=ii, forward_files=['in.lammps', '*lmp', 'graph.pb'], backward_files=['log.lammps']) + task_work_path=ii, forward_files=['in.lammps', '*lmp'], backward_files=['log.lammps']) for ii in task_dir_list ] submission = get_empty_submission(job_work_dir) - # submission.forward_common_files = + submission.forward_common_files = ['graph.pb'] submission.register_task_list(task_list=task_list) submission.run_submission() return job_work_dir