From 95d9dbd2fe316a5380def98cec61f96f47c785b4 Mon Sep 17 00:00:00 2001 From: Chen Nuo <49788094+Cstandardlib@users.noreply.github.com> Date: Tue, 20 Jan 2026 15:07:55 +0800 Subject: [PATCH] Fix compile warning of iteration index(int) undefined behavior --- source/source_hamilt/module_vdw/vdwd2.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/source/source_hamilt/module_vdw/vdwd2.h b/source/source_hamilt/module_vdw/vdwd2.h index 4315204288..4e1e836d57 100644 --- a/source/source_hamilt/module_vdw/vdwd2.h +++ b/source/source_hamilt/module_vdw/vdwd2.h @@ -36,9 +36,9 @@ class Vdwd2 : public Vdw int yidx = para_.period().y / 2; int zidx = para_.period().z / 2; - for (int it1 = 0; it1 != ucell_.ntype; ++it1) + for (int it1 = 0; it1 < ucell_.ntype; ++it1) { - for (int it2 = 0; it2 != ucell_.ntype; ++it2) + for (int it2 = 0; it2 < ucell_.ntype; ++it2) { const double C6_product = sqrt(para_.C6().at(ucell_.atoms[it1].ncpp.psd) * para_.C6().at(ucell_.atoms[it2].ncpp.psd))