Changed indentation

This commit is contained in:
Trung Nguyen
2024-07-09 08:22:37 -05:00
parent 170c12d5df
commit a72cffd198

View File

@ -13,6 +13,9 @@ UPDATE: July 5, 2024:
+ simplify the build configuration (no need to build the Python module)
+ specify tolerances for individual quantities for any input script to override the global values
TODO:
+ distribute the input list across multiple processes via multiprocessing
Example usage:
1) Simple use (using the provided tools/regression-tests/config.yaml and the examples/ folder at the top level)
python3 run_tests.py --lmp-bin=/path/to/lmp_binary
@ -134,7 +137,7 @@ def extract_data_to_yaml(inputFileName):
docs += "]\n"
# load the docs into a YAML data struture
#print(docs)
try:
yaml_struct = yaml.load_all(docs, Loader=Loader)
thermo = list(yaml_struct)
@ -157,20 +160,20 @@ def get_lammps_build_configuration(lmp_binary):
packages = ""
reading = False
row = 0
for l in output:
if l != "":
if l == "Installed packages:":
for line in output:
if line != "":
if line == "Installed packages:":
reading = True
n = row
if "List of individual style options" in l:
if "List of individual style options" in line:
reading = False
if reading == True and row > n:
packages += l.strip() + " "
packages += line.strip() + " "
if "OS:" in l:
operating_system = l
if "Git info" in l:
GitInfo = l
if "OS:" in line:
operating_system = line
if "Git info" in line:
GitInfo = line
row += 1
@ -178,10 +181,10 @@ def get_lammps_build_configuration(lmp_binary):
row = 0
compile_flags = ""
for l in output:
if l != "":
if "-DLAMMPS" in l:
compile_flags += " " + l.strip()
for line in output:
if line != "":
if "-DLAMMPS" in line:
compile_flags += " " + line.strip()
row += 1
@ -333,25 +336,25 @@ def iterate(lmp_binary, input_list, config, results, removeAnnotatedInput=False)
# restore the nprocs value in the configuration
config['nprocs'] = saved_nprocs
# process thermo output
# process error code from the run
if returncode != 0:
print(f"ERROR: Failed with {input_test}. Check the log file for the run output.\n")
logger.info(f"\n{error}")
continue
# process thermo output
thermo = extract_data_to_yaml("log.lammps")
num_runs = len(thermo)
if num_runs == 0:
print(f"ERROR: Failed with {input_test}. Check the log file for the run output.\n")
#print(f"{output}")
logger.info(f"The run terminated with the following output:\n")
logger.info(f"\n{output}")
result.status = "error"
results.append(result)
continue
print(f"Comparing thermo output from log.lammps with the reference log file {thermo_ref_file}")
print(f"Comparing thermo output from log.lammps against the reference log file {thermo_ref_file}")
if num_runs != num_runs_ref:
print(f"ERROR: Number of runs in log.lammps ({num_runs}) is not the same as that in the reference log ({num_runs_ref})")
result.status = "error"
@ -606,6 +609,7 @@ if __name__ == "__main__":
example_subfolders.append('../../examples/srd')
all_results = []
# default setting
if inplace_input == True:
# save current working dir