Skip to content
Snippets Groups Projects
Commit a7983061 authored by Kurt A. O'Hearn's avatar Kurt A. O'Hearn
Browse files

Tools: fix geometry file extension auto-detection for run_md_custom. Add...

Tools: fix geometry file extension auto-detection for run_md_custom. Add missing restart-related control file keywords.
parent a7121f92
No related branches found
No related tags found
No related merge requests found
...@@ -117,6 +117,10 @@ class TestCase(): ...@@ -117,6 +117,10 @@ class TestCase():
r'(?P<key>\btraj_format\b\s+)\S+(?P<comment>.*)', r'\g<key>%s\g<comment>' % x, l), \ r'(?P<key>\btraj_format\b\s+)\S+(?P<comment>.*)', r'\g<key>%s\g<comment>' % x, l), \
'traj_title': lambda l, x: sub( 'traj_title': lambda l, x: sub(
r'(?P<key>\btraj_title\b\s+)\S+(?P<comment>.*)', r'\g<key>%s\g<comment>' % x, l), \ r'(?P<key>\btraj_title\b\s+)\S+(?P<comment>.*)', r'\g<key>%s\g<comment>' % x, l), \
'restart_format': lambda l, x: sub(
r'(?P<key>\brestart_format\b\s+)\S+(?P<comment>.*)', r'\g<key>%s\g<comment>' % x, l), \
'restart_freq': lambda l, x: sub(
r'(?P<key>\brestart_freq\b\s+)\S+(?P<comment>.*)', r'\g<key>%s\g<comment>' % x, l), \
} }
self.__params['geo_format'] = geo_format self.__params['geo_format'] = geo_format
self.__min_step = min_step self.__min_step = min_step
...@@ -190,9 +194,9 @@ test_forces 0 ! 0: normal run, 1: at every tim ...@@ -190,9 +194,9 @@ test_forces 0 ! 0: normal run, 1: at every tim
molec_anal 0 ! 1: outputs newly formed molecules as the simulation progresses molec_anal 0 ! 1: outputs newly formed molecules as the simulation progresses
freq_molec_anal 0 ! perform molecular analysis at every 'this many' timesteps freq_molec_anal 0 ! perform molecular analysis at every 'this many' timesteps
dipole_anal 0 ! 1: calculate a electric dipole moment of the system dipole_anal 0 ! 1: calculate a electric dipole moment of the system
freq_dipole_anal 1 ! calculate electric dipole moment at every 'this many' steps freq_dipole_anal 0 ! calculate electric dipole moment at every 'this many' steps
diffusion_coef 0 ! 1: calculate diffusion coefficient of the system diffusion_coef 0 ! 1: calculate diffusion coefficient of the system
freq_diffusion_coef 1 ! calculate diffusion coefficient at every 'this many' steps freq_diffusion_coef 0 ! calculate diffusion coefficient at every 'this many' steps
restrict_type 2 ! -1: all types of atoms, 0 and up: only this type of atoms restrict_type 2 ! -1: all types of atoms, 0 and up: only this type of atoms
restart_format 1 ! 0: restarts in ASCII 1: restarts in binary restart_format 1 ! 0: restarts in ASCII 1: restarts in binary
...@@ -439,7 +443,6 @@ restart_freq 0 ! 0: do not output any restart f ...@@ -439,7 +443,6 @@ restart_freq 0 ! 0: do not output any restart f
#SBATCH --cpus-per-task=28 #SBATCH --cpus-per-task=28
#SBATCH --constraint=lac #SBATCH --constraint=lac
module purge
module load {0} module load {0}
""".format(' '.join(modules)) """.format(' '.join(modules))
job_script += """\ job_script += """\
...@@ -669,6 +672,8 @@ if __name__ == '__main__': ...@@ -669,6 +672,8 @@ if __name__ == '__main__':
'traj_format': ['0'], 'traj_format': ['0'],
'traj_compress': ['0'], 'traj_compress': ['0'],
'traj_title': [None], 'traj_title': [None],
'restart_format': ['0'],
'restart_freq': ['0'],
} }
return data_dir, control_params_dict return data_dir, control_params_dict
...@@ -825,23 +830,28 @@ if __name__ == '__main__': ...@@ -825,23 +830,28 @@ if __name__ == '__main__':
_, control_params_dict = setup_defaults(base_dir) _, control_params_dict = setup_defaults(base_dir)
# overwrite default control file parameter values if supplied via command line args # overwrite default control file parameter values if supplied via command line args
geo_format = None
if args.params: if args.params:
for param in args.params: for param in args.params:
if param[0] in control_params_dict: if param[0] in control_params_dict:
control_params_dict[param[0]] = param[1].split(',') control_params_dict[param[0]] = param[1].split(',')
if param[0] == 'geo_format':
geo_format = param[1].split(',')
else: else:
print("[ERROR] Invalid parameter {0}. Terminating...".format(param[0])) print("[ERROR] Invalid parameter {0}. Terminating...".format(param[0]))
exit(-1) exit(-1)
geo_base, geo_ext = path.splitext(args.geo_file[0]) geo_base, geo_ext = path.splitext(args.geo_file[0])
# infer geometry file format by file extension
if geo_ext.lower() == '.pdb': if not geo_format:
geo_format = ['1'] # infer geometry file format by file extension
elif geo_ext.lower() == '.geo': if geo_ext.lower() == '.pdb':
geo_format = ['0'] geo_format = ['1']
else: elif geo_ext.lower() == '.geo':
print("[ERROR] unrecognized geometry format {0}. Terminating...".format(ext)) geo_format = ['0']
exit(-1) else:
print("[ERROR] unrecognized geometry format {0}. Terminating...".format(geo_ext))
exit(-1)
test_case = TestCase(geo_base, args.geo_file[0], args.ffield_file[0], test_case = TestCase(geo_base, args.geo_file[0], args.ffield_file[0],
params=control_params_dict, geo_format=geo_format) params=control_params_dict, geo_format=geo_format)
...@@ -881,7 +891,6 @@ if __name__ == '__main__': ...@@ -881,7 +891,6 @@ if __name__ == '__main__':
print("[ERROR] Invalid parameter {0}. Terminating...".format(param[0])) print("[ERROR] Invalid parameter {0}. Terminating...".format(param[0]))
exit(-1) exit(-1)
test_cases = setup_test_cases(args.data_sets, data_dir, control_params_dict, test_cases = setup_test_cases(args.data_sets, data_dir, control_params_dict,
header_fmt_str=header_fmt_str, header_str=header_str, body_fmt_str=body_fmt_str, header_fmt_str=header_fmt_str, header_str=header_str, body_fmt_str=body_fmt_str,
result_file=result_file, min_step=min_step, max_step=max_step) result_file=result_file, min_step=min_step, max_step=max_step)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment