From c05b7fc1ad0f8b125d63328b0d7db5766f2f70de Mon Sep 17 00:00:00 2001 From: NellyMitnik Date: Thu, 15 Aug 2024 19:38:00 +0300 Subject: [PATCH] Tests: Backup files before restart RMG --- t3/runners/rmg_runner.py | 12 +- .../iteration_1/RMG/RMG.log | 1 + .../iteration_1/RMG/chemkin/chem.inp | 1 + .../iteration_1/RMG/chemkin/chem0113.inp | 1 + .../RMG/chemkin/chem_annotated.inp | 89 ++++++++ .../iteration_1/RMG/chemkin/chem_edge.inp | 1 + .../RMG/chemkin/chem_edge_annotated.inp | 1 + .../RMG/chemkin/species_dictionary.txt | 21 ++ .../RMG/chemkin/species_edge_dictionary.txt | 121 +++++++++++ .../iteration_1/RMG/chemkin/tran.dat | 6 + .../iteration_1/RMG/pdep/network1_2.py | 205 ++++++++++++++++++ .../iteration_1/RMG/pdep/network2_1.py | 162 ++++++++++++++ tests/test_functional.py | 34 +++ 13 files changed, 649 insertions(+), 6 deletions(-) create mode 100644 tests/data/backup_rmg_files_before_restart/iteration_1/RMG/RMG.log create mode 100755 tests/data/backup_rmg_files_before_restart/iteration_1/RMG/chemkin/chem.inp create mode 100755 tests/data/backup_rmg_files_before_restart/iteration_1/RMG/chemkin/chem0113.inp create mode 100755 tests/data/backup_rmg_files_before_restart/iteration_1/RMG/chemkin/chem_annotated.inp create mode 100755 tests/data/backup_rmg_files_before_restart/iteration_1/RMG/chemkin/chem_edge.inp create mode 100755 tests/data/backup_rmg_files_before_restart/iteration_1/RMG/chemkin/chem_edge_annotated.inp create mode 100755 tests/data/backup_rmg_files_before_restart/iteration_1/RMG/chemkin/species_dictionary.txt create mode 100755 tests/data/backup_rmg_files_before_restart/iteration_1/RMG/chemkin/species_edge_dictionary.txt create mode 100755 tests/data/backup_rmg_files_before_restart/iteration_1/RMG/chemkin/tran.dat create mode 100755 tests/data/backup_rmg_files_before_restart/iteration_1/RMG/pdep/network1_2.py create mode 100755 tests/data/backup_rmg_files_before_restart/iteration_1/RMG/pdep/network2_1.py diff --git a/t3/runners/rmg_runner.py b/t3/runners/rmg_runner.py index b6f3debfc..97465e7f3 100644 --- a/t3/runners/rmg_runner.py +++ b/t3/runners/rmg_runner.py @@ -3,14 +3,14 @@ Should be executed locally on the head node using the t3 environment. """ -from typing import TYPE_CHECKING, List, Optional, Tuple - import datetime import os import shutil import time +from typing import TYPE_CHECKING, List, Optional, Tuple -from arc.job.local import _determine_job_id, change_mode, execute_command, parse_running_jobs_ids, submit_job +from arc.job.local import (_determine_job_id, change_mode, execute_command, + parse_running_jobs_ids, submit_job) from t3.imports import local_t3_path, settings, submit_scripts @@ -391,7 +391,7 @@ def backup_rmg_files(project_directory: str): project_directory (str): The path to the RMG folder. """ restart_backup_dir = os.path.join(project_directory, - f'restart_backup_{datetime.datetime.now().strftime("%b%d_%Y_%H:%M:%S")}') + f'restart_backup_{datetime.datetime.now().strftime("%b%d_%Y_%H-%M-%S")}') os.mkdir(restart_backup_dir) os.mkdir(os.path.join(restart_backup_dir, 'chemkin')) files = ['RMG.log', @@ -400,11 +400,11 @@ def backup_rmg_files(project_directory: str): ] folders = ['pdep'] for file in files: - if os.path.isfile(os.path.join(project_directory, file)): + if os.path.exists(os.path.join(project_directory, file)): shutil.copy(src=os.path.join(project_directory, file), dst=os.path.join(restart_backup_dir, file)) for folder in folders: - if os.path.isdir(os.path.join(project_directory, folder)): + if os.path.exists(os.path.join(project_directory, folder)): shutil.copytree(src=os.path.join(project_directory, folder), dst=os.path.join(restart_backup_dir, folder)) diff --git a/tests/data/backup_rmg_files_before_restart/iteration_1/RMG/RMG.log b/tests/data/backup_rmg_files_before_restart/iteration_1/RMG/RMG.log new file mode 100644 index 000000000..c953cc1b9 --- /dev/null +++ b/tests/data/backup_rmg_files_before_restart/iteration_1/RMG/RMG.log @@ -0,0 +1 @@ +dummy RMG log file diff --git a/tests/data/backup_rmg_files_before_restart/iteration_1/RMG/chemkin/chem.inp b/tests/data/backup_rmg_files_before_restart/iteration_1/RMG/chemkin/chem.inp new file mode 100755 index 000000000..4be38ad70 --- /dev/null +++ b/tests/data/backup_rmg_files_before_restart/iteration_1/RMG/chemkin/chem.inp @@ -0,0 +1 @@ +dummy chem.inp diff --git a/tests/data/backup_rmg_files_before_restart/iteration_1/RMG/chemkin/chem0113.inp b/tests/data/backup_rmg_files_before_restart/iteration_1/RMG/chemkin/chem0113.inp new file mode 100755 index 000000000..421376db9 --- /dev/null +++ b/tests/data/backup_rmg_files_before_restart/iteration_1/RMG/chemkin/chem0113.inp @@ -0,0 +1 @@ +dummy diff --git a/tests/data/backup_rmg_files_before_restart/iteration_1/RMG/chemkin/chem_annotated.inp b/tests/data/backup_rmg_files_before_restart/iteration_1/RMG/chemkin/chem_annotated.inp new file mode 100755 index 000000000..6c4ae586a --- /dev/null +++ b/tests/data/backup_rmg_files_before_restart/iteration_1/RMG/chemkin/chem_annotated.inp @@ -0,0 +1,89 @@ +ELEMENTS + H + D /2.014/ + T /3.016/ + C + CI /13.003/ + O + OI /17.999/ + N + Ne + Ar + He + Si + S + F + Cl + Br + I + X /195.083/ +END + +SPECIES + Ar ! Ar + Ne ! Ne + furfuryl(1) ! furfuryl(1) +END + + + +THERM ALL + 300.000 1000.000 5000.000 + +! Thermo library: primaryThermoLibrary +Ar Ar 1 G 200.000 6000.000 1000.00 1 + 2.50000000E+00 0.00000000E+00 0.00000000E+00 0.00000000E+00 0.00000000E+00 2 +-7.45375000E+02 4.37967000E+00 2.50000000E+00 0.00000000E+00 0.00000000E+00 3 + 0.00000000E+00 0.00000000E+00-7.45375000E+02 4.37967000E+00 4 + +! Thermo library: primaryThermoLibrary +Ne Ne 1 G 200.000 6000.000 1000.00 1 + 2.50000000E+00 0.00000000E+00 0.00000000E+00 0.00000000E+00 0.00000000E+00 2 +-7.45375000E+02 3.35532000E+00 2.50000000E+00 0.00000000E+00 0.00000000E+00 3 + 0.00000000E+00 0.00000000E+00-7.45375000E+02 3.35532000E+00 4 + +! Thermo library: 2FFOH_thermo +furfuryl(1) C 5H 6O 2 G 10.000 3000.000 992.72 1 + 6.39130000E+00 3.56842000E-02-1.91804000E-05 4.95507000E-09-4.98206000E-13 2 +-3.04566000E+04-4.85274000E+00 3.89525000E+00 2.62426000E-02 2.45489000E-05 3 +-4.41978000E-08 1.68630000E-11-2.90002000E+04 1.20103000E+01 4 + +END + + + +REACTIONS KCAL/MOLE MOLES + +! Reaction index: Chemkin #1; RMG #1 +! Library reaction: C2H2_init +! Flux pairs: acetylene(2), C4H4(17); acetylene(2), C4H4(17); +acetylene(2)+acetylene(2)<=>C4H4(17) 1.000e+00 0.000 0.000 + PLOG/ 0.000987 1.280e+54 -12.650 68.650 / + PLOG/ 0.000987 1.770e+88 -24.080 73.900 / + PLOG/ 0.009869 3.090e+36 -7.640 56.790 / + PLOG/ 0.009869 1.490e+62 -14.560 79.730 / + PLOG/ 0.098690 2.690e+52 -11.490 76.010 / + PLOG/ 0.098690 2.480e+41 -9.120 58.940 / + PLOG/ 0.986900 2.640e+44 -8.980 74.000 / + PLOG/ 0.986900 3.000e+33 -6.640 56.150 / + PLOG/ 9.869000 4.300e+23 -3.600 52.310 / + PLOG/ 9.869000 7.660e+33 -5.840 69.450 / + PLOG/ 98.690000 6.500e+26 -3.750 67.720 / + PLOG/ 98.690000 9.560e+11 0.000 47.720 / + +! Reaction index: Chemkin #1221; RMG #45542 +! PDep reaction: PDepNetwork #226 +! Flux pairs: CHCHO(202), C2H2O(15133); +CHCHO(202)(+M)<=>C2H2O(15133)(+M) 1.000e+00 0.000 0.000 + TCHEB/ 300.000 2000.000 / + PCHEB/ 0.005 98.692 / + CHEB/ 6 4/ + CHEB/ -1.944e+00 2.172e+00 7.470e-04 -1.384e-03 / + CHEB/ 7.878e+00 4.088e-02 1.565e-03 -2.606e-03 / + CHEB/ -1.853e-01 3.476e-02 1.717e-03 -2.170e-03 / + CHEB/ -4.447e-02 2.642e-02 1.817e-03 -1.576e-03 / + CHEB/ -2.767e-02 1.779e-02 1.748e-03 -9.650e-04 / + CHEB/ -2.493e-02 1.046e-02 1.480e-03 -4.577e-04 / + +END + diff --git a/tests/data/backup_rmg_files_before_restart/iteration_1/RMG/chemkin/chem_edge.inp b/tests/data/backup_rmg_files_before_restart/iteration_1/RMG/chemkin/chem_edge.inp new file mode 100755 index 000000000..0812cacc7 --- /dev/null +++ b/tests/data/backup_rmg_files_before_restart/iteration_1/RMG/chemkin/chem_edge.inp @@ -0,0 +1 @@ +dummy chem edge file diff --git a/tests/data/backup_rmg_files_before_restart/iteration_1/RMG/chemkin/chem_edge_annotated.inp b/tests/data/backup_rmg_files_before_restart/iteration_1/RMG/chemkin/chem_edge_annotated.inp new file mode 100755 index 000000000..1a3709fee --- /dev/null +++ b/tests/data/backup_rmg_files_before_restart/iteration_1/RMG/chemkin/chem_edge_annotated.inp @@ -0,0 +1 @@ +dummy chem edge annotated file diff --git a/tests/data/backup_rmg_files_before_restart/iteration_1/RMG/chemkin/species_dictionary.txt b/tests/data/backup_rmg_files_before_restart/iteration_1/RMG/chemkin/species_dictionary.txt new file mode 100755 index 000000000..62e956a86 --- /dev/null +++ b/tests/data/backup_rmg_files_before_restart/iteration_1/RMG/chemkin/species_dictionary.txt @@ -0,0 +1,21 @@ +Ar +1 Ar u0 p4 c0 + +Ne +1 Ne u0 p4 c0 + +furfuryl(1) +1 O u0 p2 c0 {4,S} {7,S} +2 O u0 p2 c0 {3,S} {13,S} +3 C u0 p0 c0 {2,S} {4,S} {8,S} {9,S} +4 C u0 p0 c0 {1,S} {3,S} {5,D} +5 C u0 p0 c0 {4,D} {6,S} {10,S} +6 C u0 p0 c0 {5,S} {7,D} {11,S} +7 C u0 p0 c0 {1,S} {6,D} {12,S} +8 H u0 p0 c0 {3,S} +9 H u0 p0 c0 {3,S} +10 H u0 p0 c0 {5,S} +11 H u0 p0 c0 {6,S} +12 H u0 p0 c0 {7,S} +13 H u0 p0 c0 {2,S} + diff --git a/tests/data/backup_rmg_files_before_restart/iteration_1/RMG/chemkin/species_edge_dictionary.txt b/tests/data/backup_rmg_files_before_restart/iteration_1/RMG/chemkin/species_edge_dictionary.txt new file mode 100755 index 000000000..98208d18e --- /dev/null +++ b/tests/data/backup_rmg_files_before_restart/iteration_1/RMG/chemkin/species_edge_dictionary.txt @@ -0,0 +1,121 @@ +Ar +1 Ar u0 p4 c0 + +Ne +1 Ne u0 p4 c0 + +furfuryl(1) +1 O u0 p2 c0 {4,S} {7,S} +2 O u0 p2 c0 {3,S} {13,S} +3 C u0 p0 c0 {2,S} {4,S} {8,S} {9,S} +4 C u0 p0 c0 {1,S} {3,S} {5,D} +5 C u0 p0 c0 {4,D} {6,S} {10,S} +6 C u0 p0 c0 {5,S} {7,D} {11,S} +7 C u0 p0 c0 {1,S} {6,D} {12,S} +8 H u0 p0 c0 {3,S} +9 H u0 p0 c0 {3,S} +10 H u0 p0 c0 {5,S} +11 H u0 p0 c0 {6,S} +12 H u0 p0 c0 {7,S} +13 H u0 p0 c0 {2,S} + +C8H11O(18549) +multiplicity 2 +1 O u0 p2 c0 {2,S} {4,S} +2 C u0 p0 c0 {1,S} {5,S} {6,S} {10,S} +3 C u0 p0 c0 {5,S} {8,S} {11,S} {12,S} +4 C u0 p0 c0 {1,S} {7,S} {13,S} {14,S} +5 C u1 p0 c0 {2,S} {3,S} {15,S} +6 C u0 p0 c0 {2,S} {7,D} {16,S} +7 C u0 p0 c0 {4,S} {6,D} {17,S} +8 C u0 p0 c0 {3,S} {9,D} {18,S} +9 C u0 p0 c0 {8,D} {19,S} {20,S} +10 H u0 p0 c0 {2,S} +11 H u0 p0 c0 {3,S} +12 H u0 p0 c0 {3,S} +13 H u0 p0 c0 {4,S} +14 H u0 p0 c0 {4,S} +15 H u0 p0 c0 {5,S} +16 H u0 p0 c0 {6,S} +17 H u0 p0 c0 {7,S} +18 H u0 p0 c0 {8,S} +19 H u0 p0 c0 {9,S} +20 H u0 p0 c0 {9,S} + +C8H12O2(20177) +1 O u0 p2 c0 {3,S} {6,S} +2 O u0 p2 c0 {10,D} +3 C u0 p0 c0 {1,S} {4,S} {5,S} {8,S} +4 C u0 p0 c0 {3,S} {7,S} {10,S} {11,S} +5 C u0 p0 c0 {3,S} {14,S} {15,S} {19,S} +6 C u0 p0 c0 {1,S} {9,S} {12,S} {13,S} +7 C u0 p0 c0 {4,S} {16,S} {17,S} {18,S} +8 C u0 p0 c0 {3,S} {9,D} {21,S} +9 C u0 p0 c0 {6,S} {8,D} {20,S} +10 C u0 p0 c0 {2,D} {4,S} {22,S} +11 H u0 p0 c0 {4,S} +12 H u0 p0 c0 {6,S} +13 H u0 p0 c0 {6,S} +14 H u0 p0 c0 {5,S} +15 H u0 p0 c0 {5,S} +16 H u0 p0 c0 {7,S} +17 H u0 p0 c0 {7,S} +18 H u0 p0 c0 {7,S} +19 H u0 p0 c0 {5,S} +20 H u0 p0 c0 {9,S} +21 H u0 p0 c0 {8,S} +22 H u0 p0 c0 {10,S} + +C3H4O2(20308) +multiplicity 3 +1 O u0 p2 c0 {3,S} {9,S} +2 O u0 p2 c0 {5,D} +3 C u0 p0 c0 {1,S} {4,S} {5,S} {6,S} +4 C u1 p0 c0 {3,S} {7,S} {8,S} +5 C u1 p0 c0 {2,D} {3,S} +6 H u0 p0 c0 {3,S} +7 H u0 p0 c0 {4,S} +8 H u0 p0 c0 {4,S} +9 H u0 p0 c0 {1,S} + +C4H6O2(20309) +multiplicity 3 +1 O u0 p2 c0 {3,S} {12,S} +2 O u0 p2 c0 {6,D} +3 C u0 p0 c0 {1,S} {4,S} {6,S} {7,S} +4 C u0 p0 c0 {3,S} {5,S} {8,S} {9,S} +5 C u1 p0 c0 {4,S} {10,S} {11,S} +6 C u1 p0 c0 {2,D} {3,S} +7 H u0 p0 c0 {3,S} +8 H u0 p0 c0 {4,S} +9 H u0 p0 c0 {4,S} +10 H u0 p0 c0 {5,S} +11 H u0 p0 c0 {5,S} +12 H u0 p0 c0 {1,S} + +C3H7O(20310) +multiplicity 2 +1 O u0 p2 c0 {2,S} {11,S} +2 C u0 p0 c0 {1,S} {3,S} {4,S} {5,S} +3 C u0 p0 c0 {2,S} {6,S} {7,S} {8,S} +4 C u1 p0 c0 {2,S} {9,S} {10,S} +5 H u0 p0 c0 {2,S} +6 H u0 p0 c0 {3,S} +7 H u0 p0 c0 {3,S} +8 H u0 p0 c0 {3,S} +9 H u0 p0 c0 {4,S} +10 H u0 p0 c0 {4,S} +11 H u0 p0 c0 {1,S} + +[CH]CC-2(20311) +multiplicity 3 +1 C u0 p0 c0 {2,S} {3,S} {4,S} {5,S} +2 C u0 p0 c0 {1,S} {6,S} {7,S} {8,S} +3 C u2 p0 c0 {1,S} {9,S} +4 H u0 p0 c0 {1,S} +5 H u0 p0 c0 {1,S} +6 H u0 p0 c0 {2,S} +7 H u0 p0 c0 {2,S} +8 H u0 p0 c0 {2,S} +9 H u0 p0 c0 {3,S} + diff --git a/tests/data/backup_rmg_files_before_restart/iteration_1/RMG/chemkin/tran.dat b/tests/data/backup_rmg_files_before_restart/iteration_1/RMG/chemkin/tran.dat new file mode 100755 index 000000000..924ef97ae --- /dev/null +++ b/tests/data/backup_rmg_files_before_restart/iteration_1/RMG/chemkin/tran.dat @@ -0,0 +1,6 @@ +! Species Shape LJ-depth LJ-diam DiplMom Polzblty RotRelaxNum Data +! Name Index epsilon/k_B sigma mu alpha Zrot Source +Ar 0 136.500 3.330 0.000 0.000 0.000 ! NOx2018 +Ne 0 148.600 3.758 0.000 0.000 0.000 ! Epsilon & sigma estimated with fixed Lennard Jones Parameters. This is the fallback method! Try improving transport databases! +furfuryl(1) 2 501.522 6.610 0.000 0.000 0.000 ! Epsilon & sigma estimated with Tc=651.33 K, Pc=32.77 bar (from Joback method) +C2H2O(15133) 2 357.876 4.998 0.000 0.000 0.000 ! Epsilon & sigma estimated with Tc=464.77 K, Pc=54.07 bar (from Joback method) diff --git a/tests/data/backup_rmg_files_before_restart/iteration_1/RMG/pdep/network1_2.py b/tests/data/backup_rmg_files_before_restart/iteration_1/RMG/pdep/network1_2.py new file mode 100755 index 000000000..52f441224 --- /dev/null +++ b/tests/data/backup_rmg_files_before_restart/iteration_1/RMG/pdep/network1_2.py @@ -0,0 +1,205 @@ +species( + label = 'HCOH(189)', + structure = adjacencyList("""1 O u0 p1 c+1 {2,D} {4,S} +2 C u0 p1 c-1 {1,D} {3,S} +3 H u0 p0 c0 {2,S} +4 H u0 p0 c0 {1,S} +"""), + E0 = (98.8073,'kJ/mol'), + modes = [ + HarmonicOscillator(frequencies=([1005.83,1006.45,1710.52,1900.49,1901.93,1902.12],'cm^-1')), + ], + spinMultiplicity = 1, + opticalIsomers = 1, + molecularWeight = (30.026,'amu'), + energyTransferModel = SingleExponentialDown(alpha0=(3.5886,'kJ/mol'), T0=(300,'K'), n=0.85), + thermo = NASA(polynomials=[NASAPolynomial(coeffs=[4.09305,-0.004728,2.65298e-05,-2.62736e-08,8.32851e-12,11882.7,4.17582], Tmin=(100,'K'), Tmax=(1030.21,'K')), NASAPolynomial(coeffs=[2.9525,0.0077518,-3.36376e-06,6.57069e-10,-4.76172e-14,11690.5,7.63865], Tmin=(1030.21,'K'), Tmax=(5000,'K'))], Tmin=(100,'K'), Tmax=(5000,'K'), E0=(98.8073,'kJ/mol'), Cp0=(33.2579,'J/(mol*K)'), CpInf=(83.1447,'J/(mol*K)'), label="""HCOH(S)""", comment="""Thermo library: thermo_DFT_CCSDTF12_BAC"""), +) + +species( + label = 'FORMALDEHYDE(16)', + structure = adjacencyList("""1 O u0 p2 c0 {2,D} +2 C u0 p0 c0 {1,D} {3,S} {4,S} +3 H u0 p0 c0 {2,S} +4 H u0 p0 c0 {2,S} +"""), + E0 = (-121.605,'kJ/mol'), + modes = [ + HarmonicOscillator(frequencies=([2950,3100,1380,975,1025,1650],'cm^-1')), + ], + spinMultiplicity = 1, + opticalIsomers = 1, + molecularWeight = (30.026,'amu'), + energyTransferModel = SingleExponentialDown(alpha0=(3.5886,'kJ/mol'), T0=(300,'K'), n=0.85), + thermo = NASA(polynomials=[NASAPolynomial(coeffs=[4.03191,-0.0019319,8.88979e-06,2.99012e-09,-7.9075e-12,-14627.3,3.4758], Tmin=(10,'K'), Tmax=(601.531,'K')), NASAPolynomial(coeffs=[1.39956,0.00949141,-4.43189e-06,9.4843e-10,-7.43389e-14,-14200.6,15.7519], Tmin=(601.531,'K'), Tmax=(3000,'K'))], Tmin=(10,'K'), Tmax=(3000,'K'), E0=(-121.607,'kJ/mol'), Cp0=(33.2579,'J/(mol*K)'), CpInf=(83.1447,'J/(mol*K)'), label="""P388""", comment="""Thermo library: 2FFOH_thermo"""), +) + +species( + label = 'H2(20)', + structure = adjacencyList("""1 H u0 p0 c0 {2,S} +2 H u0 p0 c0 {1,S} +"""), + E0 = (-8.60349,'kJ/mol'), + modes = [ + HarmonicOscillator(frequencies=([3765.59],'cm^-1')), + ], + spinMultiplicity = 1, + opticalIsomers = 1, + molecularWeight = (2.01594,'amu'), + energyTransferModel = SingleExponentialDown(alpha0=(3.5886,'kJ/mol'), T0=(300,'K'), n=0.85), + thermo = NASA(polynomials=[NASAPolynomial(coeffs=[3.43536,0.000212707,-2.78618e-07,3.40261e-10,-7.76018e-14,-1031.36,-3.90842], Tmin=(100,'K'), Tmax=(1959.09,'K')), NASAPolynomial(coeffs=[2.78813,0.000587692,1.58987e-07,-5.52691e-11,4.34276e-15,-596.121,0.112965], Tmin=(1959.09,'K'), Tmax=(5000,'K'))], Tmin=(100,'K'), Tmax=(5000,'K'), E0=(-8.60349,'kJ/mol'), Cp0=(29.1007,'J/(mol*K)'), CpInf=(37.4151,'J/(mol*K)'), label="""H2""", comment="""Thermo library: primaryThermoLibrary"""), +) + +species( + label = 'CO(18)', + structure = adjacencyList("""1 O u0 p1 c+1 {2,T} +2 C u0 p1 c-1 {1,T} +"""), + E0 = (-118.741,'kJ/mol'), + modes = [ + HarmonicOscillator(frequencies=([2193.04],'cm^-1')), + ], + spinMultiplicity = 1, + opticalIsomers = 1, + molecularWeight = (28.01,'amu'), + energyTransferModel = SingleExponentialDown(alpha0=(3.5886,'kJ/mol'), T0=(300,'K'), n=0.85), + thermo = NASA(polynomials=[NASAPolynomial(coeffs=[3.56838,-0.000852135,2.4892e-06,-1.56333e-09,3.13602e-13,-14284.3,3.57912], Tmin=(100,'K'), Tmax=(1571.62,'K')), NASAPolynomial(coeffs=[2.91303,0.00164662,-6.88638e-07,1.21042e-10,-7.84056e-15,-14180.9,6.71064], Tmin=(1571.62,'K'), Tmax=(5000,'K'))], Tmin=(100,'K'), Tmax=(5000,'K'), E0=(-118.741,'kJ/mol'), Cp0=(29.1007,'J/(mol*K)'), CpInf=(37.4151,'J/(mol*K)'), label="""CO""", comment="""Thermo library: primaryThermoLibrary"""), +) + +species( + label = 'H(40)', + structure = adjacencyList("""multiplicity 2 +1 H u1 p0 c0 +"""), + E0 = (211.805,'kJ/mol'), + spinMultiplicity = 1, + opticalIsomers = 1, + molecularWeight = (1.00797,'amu'), + energyTransferModel = SingleExponentialDown(alpha0=(3.5886,'kJ/mol'), T0=(300,'K'), n=0.85), + thermo = NASA(polynomials=[NASAPolynomial(coeffs=[2.5,-3.01681e-12,3.74582e-15,-1.50857e-18,1.86626e-22,25474.2,-0.444973], Tmin=(100,'K'), Tmax=(4879.8,'K')), NASAPolynomial(coeffs=[4.28461,-0.00145495,4.44804e-07,-6.0436e-11,3.07922e-15,23723.1,-11.8931], Tmin=(4879.8,'K'), Tmax=(5000,'K'))], Tmin=(100,'K'), Tmax=(5000,'K'), E0=(211.805,'kJ/mol'), Cp0=(20.7862,'J/(mol*K)'), CpInf=(20.7862,'J/(mol*K)'), label="""H""", comment="""Thermo library: primaryThermoLibrary"""), +) + +species( + label = 'CHO(100)', + structure = adjacencyList("""multiplicity 2 +1 O u0 p2 c0 {2,D} +2 C u1 p0 c0 {1,D} {3,S} +3 H u0 p0 c0 {2,S} +"""), + E0 = (33.4995,'kJ/mol'), + modes = [ + HarmonicOscillator(frequencies=([1110.15,1948.69,2643.94],'cm^-1')), + ], + spinMultiplicity = 2, + opticalIsomers = 1, + molecularWeight = (29.018,'amu'), + energyTransferModel = SingleExponentialDown(alpha0=(3.5886,'kJ/mol'), T0=(300,'K'), n=0.85), + thermo = NASA(polynomials=[NASAPolynomial(coeffs=[4.01437,-0.000845987,4.50981e-06,3.99869e-10,-2.79968e-12,4028.33,4.15361], Tmin=(10,'K'), Tmax=(630.566,'K')), NASAPolynomial(coeffs=[2.68857,0.00476829,-2.19444e-06,4.56083e-10,-3.40533e-14,4251.12,10.3792], Tmin=(630.566,'K'), Tmax=(3000,'K'))], Tmin=(10,'K'), Tmax=(3000,'K'), E0=(33.4989,'kJ/mol'), Cp0=(33.2579,'J/(mol*K)'), CpInf=(58.2013,'J/(mol*K)'), label="""P387""", comment="""Thermo library: 2FFOH_thermo"""), +) + +species( + label = 'Ar', + structure = adjacencyList("""1 Ar u0 p4 c0 +"""), + E0 = (-6.19738,'kJ/mol'), + spinMultiplicity = 1, + opticalIsomers = 1, + molecularWeight = (39.8775,'amu'), + energyTransferModel = SingleExponentialDown(alpha0=(3.5886,'kJ/mol'), T0=(300,'K'), n=0.85), + thermo = NASA(polynomials=[NASAPolynomial(coeffs=[2.5,0,0,0,0,-745.375,4.37967], Tmin=(200,'K'), Tmax=(1000,'K')), NASAPolynomial(coeffs=[2.5,0,0,0,0,-745.375,4.37967], Tmin=(1000,'K'), Tmax=(6000,'K'))], Tmin=(200,'K'), Tmax=(6000,'K'), E0=(-6.19738,'kJ/mol'), Cp0=(20.7862,'J/(mol*K)'), CpInf=(20.7862,'J/(mol*K)'), label="""Ar""", comment="""Thermo library: primaryThermoLibrary"""), +) + +transitionState( + label = 'TS1', + E0 = (195.29,'kJ/mol'), + spinMultiplicity = 1, + opticalIsomers = 1, +) + +transitionState( + label = 'TS2', + E0 = (267.907,'kJ/mol'), + spinMultiplicity = 1, + opticalIsomers = 1, +) + +transitionState( + label = 'TS3', + E0 = (141.681,'kJ/mol'), + spinMultiplicity = 1, + opticalIsomers = 1, +) + +transitionState( + label = 'TS4', + E0 = (206.849,'kJ/mol'), + spinMultiplicity = 1, + opticalIsomers = 1, +) + +reaction( + label = 'reaction1', + reactants = ['HCOH(189)'], + products = ['FORMALDEHYDE(16)'], + transitionState = 'TS1', + kinetics = Arrhenius(A=(5.2e+13,'s^-1'), n=0, Ea=(32109,'cal/mol'), T0=(1,'K'), comment="""Reaction library: 'NOx2018'"""), +) + +reaction( + label = 'reaction2', + reactants = ['HCOH(189)'], + products = ['H2(20)', 'CO(18)'], + transitionState = 'TS2', + kinetics = Arrhenius(A=(6.6e+13,'s^-1'), n=0, Ea=(49465,'cal/mol'), T0=(1,'K'), comment="""Reaction library: 'NOx2018'"""), +) + +reaction( + label = 'reaction3', + reactants = ['FORMALDEHYDE(16)'], + products = ['H2(20)', 'CO(18)'], + transitionState = 'TS3', + kinetics = Arrhenius(A=(3.7e+13,'s^-1'), n=0, Ea=(71976,'cal/mol'), T0=(1,'K'), comment="""Kinetics taken from the arrheniusHigh attribute of a Troe/Lindemann exprssion. Originally from reaction library FFCM1(-)"""), +) + +reaction( + label = 'reaction4', + reactants = ['H(40)', 'CHO(100)'], + products = ['FORMALDEHYDE(16)'], + transitionState = 'TS4', + kinetics = Arrhenius(A=(1.913e+14,'cm^3/(mol*s)'), n=-0.033, Ea=(-142,'cal/mol'), T0=(1,'K'), comment="""Kinetics taken from the arrheniusHigh attribute of a Troe/Lindemann exprssion. Originally from reaction library FFCM1(-)"""), +) + +network( + label = 'PDepNetwork #1', + isomers = [ + 'HCOH(189)', + 'FORMALDEHYDE(16)', + ], + reactants = [ + ('H2(20)', 'CO(18)'), + ('H(40)', 'CHO(100)'), + ], + bathGas = { + 'Ar': 1, + }, +) + +pressureDependence( + label = 'PDepNetwork #1', + Tmin = (300,'K'), + Tmax = (2000,'K'), + Tcount = 10, + Tlist = ([301.578,314.572,342.653,390.652,467.665,589.953,785.229,1092.98,1528.1,1932.59],'K'), + Pmin = (0.005,'bar'), + Pmax = (100,'bar'), + Pcount = 10, + Plist = ([0.0053143,0.00857753,0.0213227,0.0746744,0.325889,1.53426,6.69574,23.4492,58.2919,94.0857],'bar'), + maximumGrainSize = (2,'kJ/mol'), + minimumGrainCount = 250, + method = 'modified strong collision', + interpolationModel = ('Chebyshev', 6, 4), + activeKRotor = True, + activeJRotor = True, + rmgmode = True, +) + diff --git a/tests/data/backup_rmg_files_before_restart/iteration_1/RMG/pdep/network2_1.py b/tests/data/backup_rmg_files_before_restart/iteration_1/RMG/pdep/network2_1.py new file mode 100755 index 000000000..63989113f --- /dev/null +++ b/tests/data/backup_rmg_files_before_restart/iteration_1/RMG/pdep/network2_1.py @@ -0,0 +1,162 @@ +species( + label = 'HOCH2O(193)', + structure = adjacencyList("""multiplicity 2 +1 O u0 p2 c0 {3,S} {6,S} +2 O u1 p2 c0 {3,S} +3 C u0 p0 c0 {1,S} {2,S} {4,S} {5,S} +4 H u0 p0 c0 {3,S} +5 H u0 p0 c0 {3,S} +6 H u0 p0 c0 {1,S} +"""), + E0 = (-181.906,'kJ/mol'), + modes = [ + HarmonicOscillator(frequencies=([3615,1277.5,1000,2750,2850,1437.5,1250,1305,750,350,244.256],'cm^-1')), + HinderedRotor(inertia=(0.00282506,'amu*angstrom^2'), symmetry=1, barrier=(0.119627,'kJ/mol'), semiclassical=False), + ], + spinMultiplicity = 2, + opticalIsomers = 1, + molecularWeight = (47.0334,'amu'), + energyTransferModel = SingleExponentialDown(alpha0=(3.5886,'kJ/mol'), T0=(300,'K'), n=0.85), + thermo = NASA(polynomials=[NASAPolynomial(coeffs=[3.3898,0.00588265,2.76836e-05,-4.16177e-08,1.6744e-11,-21849.4,10.4839], Tmin=(100,'K'), Tmax=(944.176,'K')), NASAPolynomial(coeffs=[8.146,0.00487903,-1.13894e-06,2.10345e-10,-1.79653e-14,-23601,-16.7081], Tmin=(944.176,'K'), Tmax=(5000,'K'))], Tmin=(100,'K'), Tmax=(5000,'K'), E0=(-181.906,'kJ/mol'), Cp0=(33.2579,'J/(mol*K)'), CpInf=(128.874,'J/(mol*K)'), label="""HOCH2O""", comment="""Thermo library: DFT_QCI_thermo"""), +) + +species( + label = 'OH(25)', + structure = adjacencyList("""multiplicity 2 +1 O u1 p2 c0 {2,S} +2 H u0 p0 c0 {1,S} +"""), + E0 = (28.3945,'kJ/mol'), + modes = [ + HarmonicOscillator(frequencies=([3668.68],'cm^-1')), + ], + spinMultiplicity = 2, + opticalIsomers = 1, + molecularWeight = (17.0074,'amu'), + energyTransferModel = SingleExponentialDown(alpha0=(3.5886,'kJ/mol'), T0=(300,'K'), n=0.85), + thermo = NASA(polynomials=[NASAPolynomial(coeffs=[3.51457,2.92734e-05,-5.32151e-07,1.01948e-09,-3.85939e-13,3414.25,2.10435], Tmin=(100,'K'), Tmax=(1145.76,'K')), NASAPolynomial(coeffs=[3.07194,0.00060402,-1.39806e-08,-2.13441e-11,2.48061e-15,3579.39,4.57801], Tmin=(1145.76,'K'), Tmax=(5000,'K'))], Tmin=(100,'K'), Tmax=(5000,'K'), E0=(28.3945,'kJ/mol'), Cp0=(29.1007,'J/(mol*K)'), CpInf=(37.4151,'J/(mol*K)'), label="""OH(D)""", comment="""Thermo library: primaryThermoLibrary"""), +) + +species( + label = 'FORMALDEHYDE(16)', + structure = adjacencyList("""1 O u0 p2 c0 {2,D} +2 C u0 p0 c0 {1,D} {3,S} {4,S} +3 H u0 p0 c0 {2,S} +4 H u0 p0 c0 {2,S} +"""), + E0 = (-121.605,'kJ/mol'), + modes = [ + HarmonicOscillator(frequencies=([2950,3100,1380,975,1025,1650],'cm^-1')), + ], + spinMultiplicity = 1, + opticalIsomers = 1, + molecularWeight = (30.026,'amu'), + collisionModel = TransportData(shapeIndex=2, epsilon=(4140.61,'J/mol'), sigma=(3.59,'angstroms'), dipoleMoment=(0,'De'), polarizability=(0,'angstroms^3'), rotrelaxcollnum=2.0, comment="""NOx2018"""), + energyTransferModel = SingleExponentialDown(alpha0=(3.5886,'kJ/mol'), T0=(300,'K'), n=0.85), + thermo = NASA(polynomials=[NASAPolynomial(coeffs=[4.03191,-0.0019319,8.88979e-06,2.99012e-09,-7.9075e-12,-14627.3,3.4758], Tmin=(10,'K'), Tmax=(601.531,'K')), NASAPolynomial(coeffs=[1.39956,0.00949141,-4.43189e-06,9.4843e-10,-7.43389e-14,-14200.6,15.7519], Tmin=(601.531,'K'), Tmax=(3000,'K'))], Tmin=(10,'K'), Tmax=(3000,'K'), E0=(-121.607,'kJ/mol'), Cp0=(33.2579,'J/(mol*K)'), CpInf=(83.1447,'J/(mol*K)'), label="""P388""", comment="""Thermo library: 2FFOH_thermo"""), +) + +species( + label = 'H(40)', + structure = adjacencyList("""multiplicity 2 +1 H u1 p0 c0 +"""), + E0 = (211.805,'kJ/mol'), + spinMultiplicity = 1, + opticalIsomers = 1, + molecularWeight = (1.00797,'amu'), + energyTransferModel = SingleExponentialDown(alpha0=(3.5886,'kJ/mol'), T0=(300,'K'), n=0.85), + thermo = NASA(polynomials=[NASAPolynomial(coeffs=[2.5,-3.01681e-12,3.74582e-15,-1.50857e-18,1.86626e-22,25474.2,-0.444973], Tmin=(100,'K'), Tmax=(4879.8,'K')), NASAPolynomial(coeffs=[4.28461,-0.00145495,4.44804e-07,-6.0436e-11,3.07922e-15,23723.1,-11.8931], Tmin=(4879.8,'K'), Tmax=(5000,'K'))], Tmin=(100,'K'), Tmax=(5000,'K'), E0=(211.805,'kJ/mol'), Cp0=(20.7862,'J/(mol*K)'), CpInf=(20.7862,'J/(mol*K)'), label="""H""", comment="""Thermo library: primaryThermoLibrary"""), +) + +species( + label = 'HOCHO(194)', + structure = adjacencyList("""1 O u0 p2 c0 {3,S} {5,S} +2 O u0 p2 c0 {3,D} +3 C u0 p0 c0 {1,S} {2,D} {4,S} +4 H u0 p0 c0 {3,S} +5 H u0 p0 c0 {1,S} +"""), + E0 = (-389.41,'kJ/mol'), + spinMultiplicity = 1, + opticalIsomers = 1, + molecularWeight = (46.0254,'amu'), + energyTransferModel = SingleExponentialDown(alpha0=(3.5886,'kJ/mol'), T0=(300,'K'), n=0.85), + thermo = NASA(polynomials=[NASAPolynomial(coeffs=[3.76241,-0.000943854,3.38779e-05,-4.04983e-08,1.43987e-11,-46821.2,7.63276], Tmin=(100,'K'), Tmax=(993.731,'K')), NASAPolynomial(coeffs=[5.645,0.00755182,-3.20851e-06,6.58919e-10,-5.05055e-14,-47989,-5.43104], Tmin=(993.731,'K'), Tmax=(5000,'K'))], Tmin=(100,'K'), Tmax=(5000,'K'), E0=(-389.41,'kJ/mol'), Cp0=(33.2579,'J/(mol*K)'), CpInf=(103.931,'J/(mol*K)'), label="""formic_acid""", comment="""Thermo library: thermo_DFT_CCSDTF12_BAC"""), +) + +species( + label = 'Ar', + structure = adjacencyList("""1 Ar u0 p4 c0 +"""), + E0 = (-6.19738,'kJ/mol'), + spinMultiplicity = 1, + opticalIsomers = 1, + molecularWeight = (39.8775,'amu'), + collisionModel = TransportData(shapeIndex=0, epsilon=(1134.93,'J/mol'), sigma=(3.33,'angstroms'), dipoleMoment=(0,'De'), polarizability=(0,'angstroms^3'), rotrelaxcollnum=0.0, comment="""NOx2018"""), + energyTransferModel = SingleExponentialDown(alpha0=(3.5886,'kJ/mol'), T0=(300,'K'), n=0.85), + thermo = NASA(polynomials=[NASAPolynomial(coeffs=[2.5,0,0,0,0,-745.375,4.37967], Tmin=(200,'K'), Tmax=(1000,'K')), NASAPolynomial(coeffs=[2.5,0,0,0,0,-745.375,4.37967], Tmin=(1000,'K'), Tmax=(6000,'K'))], Tmin=(200,'K'), Tmax=(6000,'K'), E0=(-6.19738,'kJ/mol'), Cp0=(20.7862,'J/(mol*K)'), CpInf=(20.7862,'J/(mol*K)'), label="""Ar""", comment="""Thermo library: primaryThermoLibrary"""), +) + +transitionState( + label = 'TS1', + E0 = (15.685,'kJ/mol'), + spinMultiplicity = 1, + opticalIsomers = 1, +) + +transitionState( + label = 'TS2', + E0 = (-28.5848,'kJ/mol'), + spinMultiplicity = 1, + opticalIsomers = 1, +) + +reaction( + label = 'reaction1', + reactants = ['OH(25)', 'FORMALDEHYDE(16)'], + products = ['HOCH2O(193)'], + transitionState = 'TS1', + kinetics = Arrhenius(A=(6.3e+06,'cm^3/(mol*s)'), n=1.63, Ea=(4282,'cal/mol'), T0=(1,'K'), comment="""Reaction library: 'NOx2018'"""), +) + +reaction( + label = 'reaction2', + reactants = ['HOCH2O(193)'], + products = ['H(40)', 'HOCHO(194)'], + transitionState = 'TS2', + kinetics = Arrhenius(A=(1e+14,'s^-1'), n=0, Ea=(14900,'cal/mol'), T0=(1,'K'), comment="""Reaction library: 'NOx2018'"""), +) + +network( + label = 'PDepNetwork #2', + isomers = [ + 'HOCH2O(193)', + ], + reactants = [ + ('OH(25)', 'FORMALDEHYDE(16)'), + ], + bathGas = { + 'Ar': 1, + }, +) + +pressureDependence( + label = 'PDepNetwork #2', + Tmin = (300,'K'), + Tmax = (2000,'K'), + Tcount = 10, + Tlist = ([301.578,314.572,342.653,390.652,467.665,589.953,785.229,1092.98,1528.1,1932.59],'K'), + Pmin = (0.005,'bar'), + Pmax = (100,'bar'), + Pcount = 10, + Plist = ([0.0053143,0.00857753,0.0213227,0.0746744,0.325889,1.53426,6.69574,23.4492,58.2919,94.0857],'bar'), + maximumGrainSize = (2,'kJ/mol'), + minimumGrainCount = 250, + method = 'modified strong collision', + interpolationModel = ('Chebyshev', 6, 4), + activeKRotor = True, + activeJRotor = True, + rmgmode = True, +) + diff --git a/tests/test_functional.py b/tests/test_functional.py index ffa321a4f..f7d67d0cd 100644 --- a/tests/test_functional.py +++ b/tests/test_functional.py @@ -13,6 +13,7 @@ from t3 import T3 from t3.common import DATA_BASE_PATH +from t3.runners.rmg_runner import backup_rmg_files from t3.utils.dependencies import check_dependencies @@ -104,6 +105,39 @@ def test_computing_thermo(): assert expected_line_dict['exists'] is True +def test_rmg_files_backup_before_restart(): + """ + Test for backup key files and folder from an RMG run before restarting it + 1.pdep folder + 2.chem_annotated + 3.chem_edge_annotated + 4.RMG log files + """ + backup_test_directory = os.path.join(DATA_BASE_PATH, 'backup_rmg_files_before_restart','iteration_1', 'RMG') + backup_rmg_files(backup_test_directory) + # Find the backup directory (there should only be one per restart) + backup_directories = [d for d in os.listdir(backup_test_directory) if d.startswith('restart_backup')] + assert len(backup_directories) == 1 ,"There should be one backup directory per restart" + + # Path to the backup directory + backup_directory = os.path.join(backup_test_directory, backup_directories[0]) + + # Check if the backup directory and the chemkin subdirectory were created + assert os.path.exists(backup_directory), "Backup directory was not created" + assert os.path.exists(os.path.join(backup_directory, 'chemkin')) , "chemkin directory was not created in backup" + + # Check if the necessary files were copied + assert os.path.exists(os.path.join(backup_directory, 'RMG.log')) , "RMG.log was not backed up." + assert os.path.exists(os.path.join(backup_directory, 'chemkin', 'chem_annotated.inp')), "chem_annotated.inp was not backed up" + assert os.path.exists(os.path.join(backup_directory, 'chemkin', 'chem_edge_annotated.inp')), "chem_edge_annotated.inp was not backed up" + + # Check if the pdep folder was copied + assert os.path.exists(os.path.join(backup_directory, 'pdep')), "pdep directory was not backed up" + assert os.path.exists(os.path.join(backup_directory, 'pdep', 'network1_2.py')), "pdep1_2.py was not backed up" + + shutil.rmtree(backup_directory, ignore_errors=True) + + def delete_selective_content_from_test_dirs(test_dir: str): """remove directories created by the test_minimal_example functional test""" for (_, dirs, files) in os.walk(test_dir):