From 25ea1730298d7f5d33fd38efa9e12c6c37b7cde3 Mon Sep 17 00:00:00 2001 From: CalCraven Date: Tue, 3 Oct 2023 10:49:03 -0500 Subject: [PATCH] Print out median values for max and min --- .../csvs/OPLS Ethane at 41 MPa_data.csv | 18 ++++----- .../csvs/OPLS Ethane at 5 MPa_data.csv | 18 ++++----- .../csvs/OPLS Ethane at 70 MPa_data.csv | 36 +++++++++--------- .../generate_comparison_plots.py | 37 +++++++++++++++++++ .../Comparison_Figures/generate_densities.py | 20 ++++++++++ 5 files changed, 93 insertions(+), 36 deletions(-) diff --git a/reproducibility_project/src/analysis/Comparison_Figures/csvs/OPLS Ethane at 41 MPa_data.csv b/reproducibility_project/src/analysis/Comparison_Figures/csvs/OPLS Ethane at 41 MPa_data.csv index a094d9a9..31715408 100644 --- a/reproducibility_project/src/analysis/Comparison_Figures/csvs/OPLS Ethane at 41 MPa_data.csv +++ b/reproducibility_project/src/analysis/Comparison_Figures/csvs/OPLS Ethane at 41 MPa_data.csv @@ -1,37 +1,37 @@ ,Program(Group),T / K,ρ / kg m−3,δρ / kg m−3,u / kJ mol−1,δu / kJ mol−1,statepoint,Relative_Error -0,DL_POLY(BS),98.0,659.22,1.25,-16.759,0.061,temp: 98.0,0.0011377211445378135 +0,DL_POLY(BS),98.0,659.22,1.25,-16.759,0.061,temp: 98.0,-0.06552274178145884 1,DL_POLY(BS),173.0,590.63,1.91,-14.366,0.086,temp: 173.0,0.026344163920897275 2,DL_POLY(BS),248.0,523.63,2.48,-12.241,0.102,temp: 248.0,0.0375724383875568 3,DL_POLY(BS),298.0,478.16,3.03,-10.908,0.113,temp: 298.0,0.09396659999071405 -4,GROMACS(BS),98.0,659.22,0.05,-16.759,0.002,temp: 98.0,0.0011377211445378135 +4,GROMACS(BS),98.0,659.22,0.05,-16.759,0.002,temp: 98.0,-0.06552274178145884 5,GROMACS(BS),173.0,590.66,0.07,-14.365,0.002,temp: 173.0,0.03142482410564051 6,GROMACS(BS),248.0,523.73,0.11,-12.245,0.003,temp: 248.0,0.056677068076155676 7,GROMACS(BS),298.0,478.13,0.15,-10.908,0.004,temp: 298.0,0.08768665395172569 -8,GROMACS(KL),98.0,660.02,0.09,-16.787,0.003,temp: 98.0,0.12249464322959451 +8,GROMACS(KL),98.0,660.02,0.09,-16.787,0.003,temp: 98.0,0.05575328413791601 9,GROMACS(KL),173.0,590.8,0.1,-14.371,0.003,temp: 173.0,0.05513457163446153 10,GROMACS(KL),248.0,524.04,0.08,-12.256,0.003,temp: 248.0,0.1159014201107883 11,GROMACS(KL),298.0,477.99,0.12,-10.905,0.003,temp: 298.0,0.05838023910314501 -12,LAMMPS(AA),98.0,659.17,0.85,-16.758,0.032,temp: 98.0,-0.006447086485789009 +12,LAMMPS(AA),98.0,659.17,0.85,-16.758,0.032,temp: 98.0,-0.07310249340143053 13,LAMMPS(AA),173.0,590.47,1.17,-14.361,0.037,temp: 173.0,-0.0007526903977525743 14,LAMMPS(AA),248.0,523.55,1.88,-12.241,0.053,temp: 248.0,0.02228873463667335 15,LAMMPS(AA),298.0,477.87,6.77,-10.904,0.061,temp: 298.0,0.033260454947215315 -16,LAMMPS(KL),98.0,658.96,0.8,-16.758,0.03,temp: 98.0,-0.03830327853310648 +16,LAMMPS(KL),98.0,658.96,0.8,-16.758,0.03,temp: 98.0,-0.10493745020525652 17,LAMMPS(KL),173.0,590.44,1.2,-14.366,0.039,temp: 173.0,-0.005833350582495811 18,LAMMPS(KL),248.0,523.3,1.86,-12.238,0.054,temp: 248.0,-0.025472839584812983 19,LAMMPS(KL),298.0,477.43,2.22,-10.893,0.059,temp: 298.0,-0.05884542029118957 -20,ms2(KL),98.0,658.92,0.13,-16.748,0.003,temp: 98.0,-0.04437112463737139 +20,ms2(KL),98.0,658.92,0.13,-16.748,0.003,temp: 98.0,-0.11100125150123732 21,ms2(KL),173.0,590.09,0.13,-14.347,0.003,temp: 173.0,-0.06510771940455799 22,ms2(KL),248.0,522.71,0.16,-12.215,0.003,temp: 248.0,-0.1381901547475051 23,ms2(KL),298.0,477.15,0.2,-10.88,0.003,temp: 298.0,-0.11745824998836282 -24,ms2(PB),98.0,659.09,0.05,-16.744,0.002,temp: 98.0,-0.018582778694284333 +24,ms2(PB),98.0,659.09,0.05,-16.744,0.002,temp: 98.0,-0.08523009599335768 25,ms2(PB),173.0,590.26,0.07,-14.344,0.002,temp: 173.0,-0.03631731169099373 26,ms2(PB),248.0,523.07,0.11,-12.219,0.003,temp: 248.0,-0.06941348786856216 27,ms2(PB),298.0,477.06,0.14,-10.871,0.004,temp: 298.0,-0.13629808810530414 -28,Tinker(AA),98.0,659.1,1.2,,,temp: 98.0,-0.01706581716822242 +28,Tinker(AA),98.0,659.1,1.2,,,temp: 98.0,-0.08371414566936679 29,Tinker(AA),173.0,590.5,1.4,,,temp: 173.0,0.004327969786990662 30,Tinker(AA),248.0,523.4,1.4,,,temp: 248.0,-0.006368209896214106 31,Tinker(AA),298.0,477.9,1.4,,,temp: 298.0,0.03954040098619179 -32,TOWHEE(BS),98.0,,,,,temp: 98.0, +32,TOWHEE(BS),98.0,663.17,,,,temp: 98.0,0.5332776361954781 33,TOWHEE(BS),173.0,590.42,0.3,-14.362,0.01,temp: 173.0,-0.009220457372343888 34,TOWHEE(BS),248.0,523.47,0.37,-12.238,0.011,temp: 248.0,0.007005030885811624 35,TOWHEE(BS),298.0,477.71,0.35,-10.897,0.01,temp: 298.0,-0.00023259059402823293 diff --git a/reproducibility_project/src/analysis/Comparison_Figures/csvs/OPLS Ethane at 5 MPa_data.csv b/reproducibility_project/src/analysis/Comparison_Figures/csvs/OPLS Ethane at 5 MPa_data.csv index 14b9bf40..f18b1ea1 100644 --- a/reproducibility_project/src/analysis/Comparison_Figures/csvs/OPLS Ethane at 5 MPa_data.csv +++ b/reproducibility_project/src/analysis/Comparison_Figures/csvs/OPLS Ethane at 5 MPa_data.csv @@ -1,37 +1,37 @@ ,Program(Group),T / K,ρ / kg m−3,δρ / kg m−3,u / kJ mol−1,δu / kJ mol−1,statepoint,Relative_Error -0,DL_POLY(BS),98.0,646.13,1.36,-16.529,0.062,temp: 98.0,-0.01005888315445661 +0,DL_POLY(BS),98.0,646.13,1.36,-16.529,0.062,temp: 98.0,-0.05018829203396733 1,DL_POLY(BS),173.0,567.39,2.08,-13.866,0.086,temp: 173.0,0.050353256503779954 2,DL_POLY(BS),248.0,477.8,3.32,-11.194,0.011,temp: 248.0,0.08355424392720442 3,DL_POLY(BS),298.0,394.04,4.86,-9.009,0.131,temp: 298.0,1.9725340449024766 -4,GROMACS(BS),98.0,646.48,0.05,-16.542,0.002,temp: 98.0,0.04410433383113176 +4,GROMACS(BS),98.0,646.48,0.05,-16.542,0.002,temp: 98.0,0.003953187386258293 5,GROMACS(BS),173.0,567.56,0.09,-13.87,0.003,temp: 173.0,0.08033009792432234 6,GROMACS(BS),248.0,478.4,0.16,-11.207,0.004,temp: 248.0,0.20923472225778816 7,GROMACS(BS),298.0,393.74,0.26,-9.001,0.006,temp: 298.0,1.8948978652926096 -8,GROMACS(KL),98.0,647.03,0.16,-16.56,0.006,temp: 98.0,0.12921796052275805 +8,GROMACS(KL),98.0,647.03,0.16,-16.56,0.006,temp: 98.0,0.08903265504660028 9,GROMACS(KL),173.0,567.23,0.14,-13.86,0.005,temp: 173.0,0.02213975869620946 10,GROMACS(KL),248.0,475.32,2.9,-11.14,0.067,temp: 248.0,-0.43592506650590834 11,GROMACS(KL),298.0,354.88,25.0,-8.205,0.5,temp: 298.0,-8.16157526683842 -12,LAMMPS(AA),98.0,646.18,0.83,-16.531,0.029,temp: 98.0,-0.0023212807279515252 +12,LAMMPS(AA),98.0,646.18,0.83,-16.531,0.029,temp: 98.0,-0.04245379497394264 13,LAMMPS(AA),173.0,567.03,1.57,-13.855,0.046,temp: 173.0,-0.013127113563268688 14,LAMMPS(AA),248.0,477.72,2.99,-11.192,0.079,temp: 248.0,0.0667968468164623 15,LAMMPS(AA),298.0,392.15,7.16,-8.968,0.154,temp: 298.0,1.4834261133603233 -16,LAMMPS(KL),98.0,645.96,0.85,-16.532,0.03,temp: 98.0,-0.03636673140459149 +16,LAMMPS(KL),98.0,645.96,0.85,-16.532,0.03,temp: 98.0,-0.07648558203806889 17,LAMMPS(KL),173.0,567.12,1.63,-13.865,0.05,temp: 173.0,0.002742978953498484 18,LAMMPS(KL),248.0,477.61,3.22,-11.193,0.082,temp: 248.0,0.04375542578918445 19,LAMMPS(KL),298.0,392.37,6.47,-8.977,0.146,temp: 298.0,1.5403593117408971 -20,ms2(KL),98.0,645.93,0.12,-16.523,0.003,temp: 98.0,-0.04100929286051213 +20,ms2(KL),98.0,645.93,0.12,-16.523,0.003,temp: 98.0,-0.08112628027410129 21,ms2(KL),173.0,566.68,0.13,-13.843,0.003,temp: 173.0,-0.07484414001734542 22,ms2(KL),248.0,477.24,0.29,-11.178,0.005,temp: 248.0,-0.033747535848014217 23,ms2(KL),298.0,376.01,18.57,-9.209,0.044,temp: 298.0,-2.693400349650347 -24,ms2(PB),98.0,645.95,0.07,-16.513,0.002,temp: 98.0,-0.03791425188989251 +24,ms2(PB),98.0,645.95,0.07,-16.513,0.002,temp: 98.0,-0.07803248145007383 25,ms2(PB),173.0,566.75,0.09,-13.838,0.003,temp: 173.0,-0.06250073472652207 26,ms2(PB),248.0,476.76,0.2,-11.16,0.005,temp: 248.0,-0.13429191851249073 27,ms2(PB),298.0,391.04,0.47,-8.93,0.01,temp: 298.0,1.1961722488038384 -28,Tinker(AA),98.0,645.9,1.2,,,temp: 98.0,-0.045651854316415184 +28,Tinker(AA),98.0,645.9,1.2,,,temp: 98.0,-0.08576697851011611 29,Tinker(AA),173.0,567.0,1.3,,,temp: 173.0,-0.018417144402184397 30,Tinker(AA),248.0,478.3,1.6,,,temp: 248.0,0.1882879758693635 31,Tinker(AA),298.0,392.7,2.0,,,temp: 298.0,1.6257591093117432 -32,TOWHEE(BS),98.0,,,,,temp: 98.0, +32,TOWHEE(BS),98.0,648.53,,,,temp: 98.0,0.3210675668475522 33,TOWHEE(BS),173.0,567.18,0.35,-13.862,0.01,temp: 173.0,0.0133230406313299 34,TOWHEE(BS),248.0,477.46,0.28,-11.187,0.007,temp: 248.0,0.01233530620652958 35,TOWHEE(BS),298.0,390.83,0.82,-8.938,0.019,temp: 298.0,1.1418269230769242 diff --git a/reproducibility_project/src/analysis/Comparison_Figures/csvs/OPLS Ethane at 70 MPa_data.csv b/reproducibility_project/src/analysis/Comparison_Figures/csvs/OPLS Ethane at 70 MPa_data.csv index a9dab7b0..62c379f0 100644 --- a/reproducibility_project/src/analysis/Comparison_Figures/csvs/OPLS Ethane at 70 MPa_data.csv +++ b/reproducibility_project/src/analysis/Comparison_Figures/csvs/OPLS Ethane at 70 MPa_data.csv @@ -1,37 +1,37 @@ ,Program(Group),T / K,ρ / kg m−3,δρ / kg m−3,u / kJ mol−1,δu / kJ mol−1,statepoint,Relative_Error -0,DL_POLY(BS),98.0,668.53,1.15,-16.907,0.059,temp: 98.0,0.020571744895408837 -1,DL_POLY(BS),173.0,605.46,1.83,-14.659,0.086,temp: 173.0,0.03304365066253271 +0,DL_POLY(BS),98.0,668.53,1.15,-16.907,0.059,temp: 98.0,-0.07207973280673272 +1,DL_POLY(BS),173.0,605.46,1.83,-14.659,0.086,temp: 173.0,0.01798772429591776 2,DL_POLY(BS),248.0,546.57,2.3,-12.733,0.102,temp: 248.0,0.03396062194712044 3,DL_POLY(BS),298.0,508.63,2.53,-11.57,0.11,temp: 298.0,0.011360781272193598 -4,GROMACS(BS),98.0,668.48,0.04,-16.904,0.002,temp: 98.0,0.013091110387996718 -5,GROMACS(BS),173.0,605.51,0.06,-14.66,0.002,temp: 173.0,0.0413045633281565 +4,GROMACS(BS),98.0,668.48,0.04,-16.904,0.002,temp: 98.0,-0.07955343782124982 +5,GROMACS(BS),173.0,605.51,0.06,-14.66,0.002,temp: 173.0,0.026247393615460333 6,GROMACS(BS),248.0,546.79,0.08,-12.738,0.002,temp: 248.0,0.07422531144127438 7,GROMACS(BS),298.0,508.83,0.1,-11.575,0.003,temp: 298.0,0.05068656259899953 -8,GROMACS(KL),98.0,669.11,0.09,-16.925,0.004,temp: 98.0,0.10734710518147442 -9,GROMACS(KL),173.0,605.44,0.08,-14.659,0.003,temp: 173.0,0.029739285596283197 +8,GROMACS(KL),98.0,669.11,0.09,-16.925,0.004,temp: 98.0,0.014615245361750658 +9,GROMACS(KL),173.0,605.44,0.08,-14.659,0.003,temp: 173.0,0.014683856568100728 10,GROMACS(KL),248.0,546.66,0.05,-12.737,0.002,temp: 248.0,0.05043254037653854 11,GROMACS(KL),298.0,508.8,0.15,-11.576,0.004,temp: 298.0,0.04478769539998367 -12,LAMMPS(AA),98.0,668.25,0.68,-16.896,0.026,temp: 98.0,-0.021319808346133038 -13,LAMMPS(AA),173.0,605.29,0.97,-14.654,0.032,temp: 173.0,0.004956547599374272 +12,LAMMPS(AA),98.0,668.25,0.68,-16.896,0.026,temp: 98.0,-0.11393248088806247 +13,LAMMPS(AA),173.0,605.29,0.97,-14.654,0.032,temp: 173.0,-0.010095151390564555 14,LAMMPS(AA),248.0,546.39,1.35,-12.727,0.04,temp: 248.0,0.001016785088242621 15,LAMMPS(AA),298.0,508.67,1.79,-11.573,0.05,temp: 298.0,0.019225937537559256 -16,LAMMPS(KL),98.0,668.09,0.79,-16.898,0.03,temp: 98.0,-0.045257838769868816 -17,LAMMPS(KL),173.0,605.19,1.09,-14.657,0.037,temp: 173.0,-0.0115652777318733 +16,LAMMPS(KL),98.0,668.09,0.79,-16.898,0.03,temp: 98.0,-0.13784833693453422 +17,LAMMPS(KL),173.0,605.19,1.09,-14.657,0.037,temp: 173.0,-0.026614490029649707 18,LAMMPS(KL),248.0,546.26,1.38,-12.729,0.041,temp: 248.0,-0.02277598597649322 19,LAMMPS(KL),298.0,508.34,1.82,-11.568,0.053,temp: 298.0,-0.045661601651682274 -20,ms2(KL),98.0,668.03,0.1,-16.887,0.002,temp: 98.0,-0.05423460017878037 -21,ms2(KL),173.0,604.92,0.1,-14.639,0.002,temp: 173.0,-0.056174206126298094 +20,ms2(KL),98.0,668.03,0.1,-16.887,0.002,temp: 98.0,-0.14681678295197173 +21,ms2(KL),173.0,604.92,0.1,-14.639,0.002,temp: 173.0,-0.07121670435523596 22,ms2(KL),248.0,545.82,0.12,-12.71,0.002,temp: 248.0,-0.10330536496482193 23,ms2(KL),298.0,508.27,0.15,-11.559,0.003,temp: 298.0,-0.05942562511606379 -24,ms2(PB),98.0,668.25,0.06,-16.885,0.002,temp: 98.0,-0.021319808346133038 -25,ms2(PB),173.0,604.97,0.06,-14.633,0.002,temp: 173.0,-0.04791329346065552 +24,ms2(PB),98.0,668.25,0.06,-16.885,0.002,temp: 98.0,-0.11393248088806247 +25,ms2(PB),173.0,604.97,0.06,-14.633,0.002,temp: 173.0,-0.0629570350356746 26,ms2(PB),248.0,546.12,0.09,-12.711,0.003,temp: 248.0,-0.0483989702000533 27,ms2(PB),298.0,508.28,0.11,-11.552,0.003,temp: 298.0,-0.05745933604972517 -28,Tinker(AA),98.0,668.4,1.0,,,temp: 98.0,0.001122095176120322 -29,Tinker(AA),173.0,605.3,1.3,,,temp: 173.0,0.006608730132499029 +28,Tinker(AA),98.0,668.4,1.0,,,temp: 98.0,-0.09151136584449418 +29,Tinker(AA),173.0,605.3,1.3,,,temp: 173.0,-0.008443217526656041 30,Tinker(AA),248.0,546.4,1.5,,,temp: 248.0,0.0028469982470668547 31,Tinker(AA),298.0,508.7,1.5,,,temp: 298.0,0.025124804736575117 -32,TOWHEE(BS),98.0,,,,,temp: 98.0, -33,TOWHEE(BS),173.0,,,,,temp: 173.0, +32,TOWHEE(BS),98.0,673.97,,,,temp: 98.0,0.7410593727734759 +33,TOWHEE(BS),173.0,606.08,,,,temp: 173.0,0.12040762385833957 34,TOWHEE(BS),248.0,546.45,0.3,-12.731,0.009,temp: 248.0,0.011998064041208829 35,TOWHEE(BS),298.0,508.63,0.35,-11.571,0.01,temp: 298.0,0.011360781272193598 diff --git a/reproducibility_project/src/analysis/Comparison_Figures/generate_comparison_plots.py b/reproducibility_project/src/analysis/Comparison_Figures/generate_comparison_plots.py index c5384065..60aa440d 100644 --- a/reproducibility_project/src/analysis/Comparison_Figures/generate_comparison_plots.py +++ b/reproducibility_project/src/analysis/Comparison_Figures/generate_comparison_plots.py @@ -1061,3 +1061,40 @@ def print_errors_for_text(df): plot_rr_mosdef_mosdef_avg(densityDF.copy()) print_errors_for_text(densityDF.copy()) + + ## Print out relative errors for max and min + + import copy + + mosdefDF = pd.read_csv("csvs/job_density_data.csv", index_col=0) + mosdefDF.insert( + len(mosdefDF.columns), + "pressure", + np.full(len(mosdefDF.index), 0.101325), + ) + hasse_dfList = _load_all_rr_data() + + # 4 combine data into one dataframe + densityDF = mosdefDF.loc[ + mosdefDF["molecule"] != "pentaneUA-flexible_bonds" + ].copy() + densityDF = pd.concat([densityDF, *hasse_dfList], ignore_index=True) + df = copy.deepcopy(densityDF) + df = _mask_df(df) + init_rows = df.shape[0] + df = df[df["density"].notna()] # drop bad rows + print(f"Removed {init_rows-df.shape[0]} rows") + mosdf = copy.copy(df.loc[df["associated_work"] == "MoSDeF"]) + + groupREList = ["molecule", "temperature", "forcefield"] + mosdf["Relative_Error"] = mosdf.groupby(groupREList)['density'].transform(calculate_relative_error) + maxval = mosdf["Relative_Error"].max() + medval = mosdf["Relative_Error"].median() + print("MoSDeF max and median values: ", maxval, medval) + + RRdf = copy.copy(df.loc[df["associated_work"] == "RR"]) + groupREList = ["molecule", "temperature", "forcefield", "pressure"] + RRdf["Relative_Error"] = RRDF.groupby(groupREList)['density'].transform(calculate_relative_error) + maxval = RRdf["Relative_Error"].max() + medval = RRdf["Relative_Error"].median() + print("Round robin max and median values: ", maxval, medval) diff --git a/reproducibility_project/src/analysis/Comparison_Figures/generate_densities.py b/reproducibility_project/src/analysis/Comparison_Figures/generate_densities.py index 5d0ce339..2a00af7e 100644 --- a/reproducibility_project/src/analysis/Comparison_Figures/generate_densities.py +++ b/reproducibility_project/src/analysis/Comparison_Figures/generate_densities.py @@ -139,6 +139,26 @@ def _generate_csv_from_PDF(molecule): headerInt = int(4 * np.floor(i / 4)) header = newDF.iloc[headerInt]["Program(Group)"] newDF.iloc[i]["Program(Group)"] = header + + manAddDict = { #manually add missing densities + (5, 98.0):"648.53", (41, 98.0):"663.17", (70, 98.0):"673.97", (70, 173.0):"606.08" + } + if molecule in [ + "OPLS Ethane at 5 MPa", "OPLS Ethane at 41 MPa" + ]: + press = int(molecule.split(" ")[-2]) + newDF.loc[(newDF["Program(Group)"] == "TOWHEE(BS)") & (newDF["T / K"] == "98.0"), "ρ / kg m−3"] = manAddDict[ + (press, 98.0)] + print(f"ADDED "+ str(newDF.loc[(newDF["Program(Group)"] == "TOWHEE(BS)") & (newDF["T / K"] == "98.0"), "ρ / kg m−3"])) + elif molecule == "OPLS Ethane at 70 MPa": + press = int(molecule.split(" ")[-2]) + newDF.loc[(newDF["Program(Group)"] == "TOWHEE(BS)") & (newDF["T / K"] == "98.0"), "ρ / kg m−3"] = manAddDict[ + (press, 98.0)] + newDF.loc[(newDF["Program(Group)"] == "TOWHEE(BS)") & (newDF["T / K"] == "173.0"), "ρ / kg m−3"] = manAddDict[ + (press, 173.0)] + print(f"ADDED "+ str(newDF.loc[(newDF["Program(Group)"] == "TOWHEE(BS)") & (newDF["T / K"] == "98.0"), "ρ / kg m−3"])) + print(f"ADDED "+ str(newDF.loc[(newDF["Program(Group)"] == "TOWHEE(BS)") & (newDF["T / K"] == "173.0"), "ρ / kg m−3"])) + # we will change the data type # of id column to str by giving