diff --git a/examples/melt/in.melt b/examples/melt/in.melt index f169dc2ffc..b94eb97aee 100644 --- a/examples/melt/in.melt +++ b/examples/melt/in.melt @@ -30,4 +30,6 @@ fix 1 all nve #dump_modify 3 pad 3 thermo 50 + #REG:ADD thermo 10 + #REG:ADD thermo_style yaml run 250 diff --git a/examples/melt/thermo.in.melt.yaml b/examples/melt/thermo.in.melt.yaml new file mode 100644 index 0000000000..ecb38a615b --- /dev/null +++ b/examples/melt/thermo.in.melt.yaml @@ -0,0 +1,30 @@ +--- +keywords: ['Step', 'Temp', 'KinEng', 'PotEng', 'E_bond', 'E_angle', 'E_dihed', 'E_impro', 'E_vdwl', 'E_coul', 'E_long', 'Press', ] +data: + - [0, 3, 4.498875, -6.77336805325309, 0, 0, 0, 0, -6.77336805325309, 0, 0, -3.70335042008559, ] + - [10, 2.10321748289327, 3.15403751778382, -5.43205056762964, 0, 0, 0, 0, -5.43205056762964, 0, 0, 2.44664612874199, ] + - [20, 1.66698827387667, 2.4998572902123, -4.78557898994314, 0, 0, 0, 0, -4.78557898994314, 0, 0, 5.7194842453284, ] + - [30, 1.64463591181311, 2.46633712925273, -4.75014983253114, 0, 0, 0, 0, -4.75014983253114, 0, 0, 5.83511134604229, ] + - [40, 1.65983694888923, 2.48913298447801, -4.77212731730918, 0, 0, 0, 0, -4.77212731730918, 0, 0, 5.71855964813656, ] + - [50, 1.68428652677302, 2.52579818271199, -4.80824944183235, 0, 0, 0, 0, -4.80824944183235, 0, 0, 5.5666131491923, ] + - [60, 1.66815815080248, 2.50161166689717, -4.78367061989279, 0, 0, 0, 0, -4.78367061989279, 0, 0, 5.67528005338882, ] + - [70, 1.66402179226008, 2.49540868021802, -4.77686685471957, 0, 0, 0, 0, -4.77686685471957, 0, 0, 5.71440814999079, ] + - [80, 1.6463068175025, 2.46884286119719, -4.7503425133881, 0, 0, 0, 0, -4.7503425133881, 0, 0, 5.82878230162724, ] + - [90, 1.65213476173072, 2.47758259206044, -4.75887395274472, 0, 0, 0, 0, -4.75887395274472, 0, 0, 5.78857522212723, ] + - [100, 1.67125773589965, 2.50625988219851, -4.78756088755821, 0, 0, 0, 0, -4.78756088755821, 0, 0, 5.66139134808918, ] + - [110, 1.63826089869192, 2.45677700020087, -4.73847959372321, 0, 0, 0, 0, -4.73847959372321, 0, 0, 5.83433671147024, ] + - [120, 1.66397998337157, 2.49534598256359, -4.77733017817545, 0, 0, 0, 0, -4.77733017817545, 0, 0, 5.7161276162825, ] + - [130, 1.64420426664086, 2.46568982336129, -4.74721609415452, 0, 0, 0, 0, -4.74721609415452, 0, 0, 5.85416096284122, ] + - [140, 1.63799069414866, 2.45637179471268, -4.73761038924631, 0, 0, 0, 0, -4.73761038924631, 0, 0, 5.8924664923107, ] + - [150, 1.64447506913092, 2.46609592554545, -4.74710336860059, 0, 0, 0, 0, -4.74710336860059, 0, 0, 5.86142109924274, ] + - [160, 1.66028563222537, 2.48980584122597, -4.77053696912806, 0, 0, 0, 0, -4.77053696912806, 0, 0, 5.78149200803179, ] + - [170, 1.64800156341178, 2.47138434453138, -4.75152678764742, 0, 0, 0, 0, -4.75152678764742, 0, 0, 5.87559878509103, ] + - [180, 1.61506777079168, 2.42199600577348, -4.70280109442303, 0, 0, 0, 0, -4.70280109442303, 0, 0, 6.06457648357222, ] + - [190, 1.65753628644168, 2.48568285355511, -4.76714288367232, 0, 0, 0, 0, -4.76714288367232, 0, 0, 5.81285286411193, ] + - [200, 1.64715424139984, 2.47011367925923, -4.75090528585447, 0, 0, 0, 0, -4.75090528585447, 0, 0, 5.88054312674685, ] + - [210, 1.63561771848911, 2.45281322108923, -4.73307042686537, 0, 0, 0, 0, -4.73307042686537, 0, 0, 5.98187394543464, ] + - [220, 1.63598264224576, 2.4533604698778, -4.73411363245931, 0, 0, 0, 0, -4.73411363245931, 0, 0, 5.99506689751106, ] + - [230, 1.64254851953143, 2.46320682360233, -4.74376812701158, 0, 0, 0, 0, -4.74376812701158, 0, 0, 5.92494093901652, ] + - [240, 1.64699582794229, 2.46987611847796, -4.75091222082099, 0, 0, 0, 0, -4.75091222082099, 0, 0, 5.8750140904026, ] + - [250, 1.66455966684989, 2.49621529039977, -4.77743273563228, 0, 0, 0, 0, -4.77743273563228, 0, 0, 5.75260890051261, ] +... diff --git a/tools/regression-tests/run_tests.py b/tools/regression-tests/run_tests.py index 6d72c01b02..7645660621 100644 --- a/tools/regression-tests/run_tests.py +++ b/tools/regression-tests/run_tests.py @@ -1,10 +1,15 @@ ''' -UPDATE: Oct 25, 2023: - Launching the LAMMPS binary under testing using a configuration defined in a yaml file (e.g. config.yaml) - this way we can launch LAMMPS with mpirun with more flexibility. Also it simplifies the build configuration. +UPDATE: Dec 10, 2023: + Launching the LAMMPS binary under testing using a configuration defined in a yaml file (e.g. config.yaml). + This way we can: + + launch tests with mpirun with multiple procs + + specify what LAMMPS binary version to test + + simplify the build configuration + Example usage: + python3 run_tests.py --lmp-bin=/path/to/lmp_binary --config-file=config.yaml --gen-ref=False - python3 run_tests.py --lmp-bin=/path/to/lmp_binary --config-file=config.yaml --gen-ref=False +-------------------------------------------------------------------------------------------------------------- Original plan: using the LAMMPS Python module The following steps are for setting up regression tests with the LAMMPS Python module @@ -158,12 +163,12 @@ def has_markers(input): ''' Iterate over a list of input files ''' -def iterate(input_list): +def iterate(input_list, removeAnnotatedInput=False): num_tests = len(input_list) test_id = 0 # iterative over the input scripts for input in input_list: - input_test = input + '.test' + input_test = 'test.' + input if os.path.isfile(input) == True: if has_markers(input): @@ -233,9 +238,15 @@ def iterate(input_list): test_id = test_id + 1 + # remove the annotated input script + if removeAnnotatedInput == True: + cmd_str = "rm " + input_test + os.system(cmd_str) + + ''' TODO: - - automate tagging the example input scripts of the installed packages + - automate annotating the example input scripts of the installed packages ''' if __name__ == "__main__": @@ -275,26 +286,28 @@ if __name__ == "__main__": packages = get_installed_packages(lmp_binary) print(f"List of installed packages: {packages}") - # list of input scripts with markers #REG:SUB and #REG:ADD - #input_list=['in.lj', 'in.rhodo', 'in.eam'] - #iterate(input_list) + # Using inplace input scripts - automated = True - if automated == True: + inplace_input = True + if inplace_input == True: # save current working dir p = subprocess.run("pwd", shell=True, text=True, capture_output=True) pwd = p.stdout.split('\n')[0] print("Working dir" + pwd) - # change dir to an example + # change dir to a folder under examples/ + # TODO: loop through the subfolders under examples/, depending on the installed packages + directory = "../../examples/melt" print("Entering " + directory) os.chdir(directory) + # create a symbolic link to the lammps binary at the present directory cmd_str = "ln -s " + lmp_binary + " lmp" os.system(cmd_str) input_list=['in.melt'] + # iterate through the input scripts iterate(input_list) # unlink the symbolic link @@ -302,4 +315,9 @@ if __name__ == "__main__": os.system(cmd_str) # get back to the working dir cmd_str = "cd " + pwd - os.system(cmd_str) \ No newline at end of file + os.system(cmd_str) + + else: + # or using the input scripts in the working directory + input_list=['in.lj', 'in.rhodo', 'in.eam'] + iterate(input_list)