Skip to content

Commit 50cef8c

Browse files
authored
Merge pull request #369 from anyangml2nd/fix/nve-slope-clip
Fix: NVEmd slope clip
2 parents ea81883 + 063ad5e commit 50cef8c

File tree

3 files changed

+5
-5
lines changed

3 files changed

+5
-5
lines changed

lambench/metrics/utils.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ def aggregated_nve_md_results(results: dict[str, dict[str, float]]) -> dict[str,
110110
aggregated_result = {}
111111
success_count = len(results)
112112
for test_system, result in results.items():
113-
if result["steps"] != NVEMD_NSTEPS:
113+
if result["steps"] != NVEMD_NSTEPS or result["slope"] >= 50:
114114
success_count -= 1
115115
continue # Skip the incomplete simulation
116116
for k, v in result.items():

lambench/metrics/vishelper/metrics_calculations.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -190,10 +190,10 @@ def _calculate_instability_error(self, cell: dict, lambda_0: float = 5e-4) -> fl
190190
return 5
191191
else:
192192
slope = cell.get("slope", None)
193-
if slope is None:
193+
if slope is None or np.log10(slope / lambda_0) >= 5:
194194
return 5
195195
else:
196-
return np.clip(np.log10(cell["slope"] / lambda_0), a_min=0, a_max=None)
196+
return np.clip(np.log10(slope / lambda_0), a_min=0, a_max=None)
197197

198198
def calculate_efficiency_results(self) -> dict[str, float]:
199199
efficiency_results = self.fetcher.fetch_inference_efficiency_results()

tests/tasks/calculator/test_nve_md.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -141,13 +141,13 @@ def test_aggregated_results():
141141
"Gd2Si4Ni2": {
142142
"simulation_time": 2374.1,
143143
"steps": 10000,
144-
"slope": 4580.2,
144+
"slope": 4.5802,
145145
"momenta_diff": 200020.2,
146146
},
147147
}
148148
result = aggregated_nve_md_results(results)
149149
np.testing.assert_almost_equal(result["simulation_time"], 2374.1, decimal=3)
150150
assert result["steps"] == 10000, "Should skip incomplete test."
151-
assert result["slope"] == 4580.2, "Should skip incomplete test."
151+
assert result["slope"] == 4.5802, "Should skip incomplete test."
152152
np.testing.assert_almost_equal(result["momenta_diff"], 200020.2, decimal=3)
153153
assert result["success_rate"] == 0.5, "Should have 1 success."

0 commit comments

Comments
 (0)