From ca424772dfad1131c36f56e409408e4574c03c58 Mon Sep 17 00:00:00 2001 From: jtclemm <63308469+jtclemm@users.noreply.github.com> Date: Thu, 11 Jun 2020 14:10:26 -0600 Subject: [PATCH] Improving clarity of loops --- src/atom.cpp | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/src/atom.cpp b/src/atom.cpp index 8613ea7682..f46c0abe15 100644 --- a/src/atom.cpp +++ b/src/atom.cpp @@ -2072,14 +2072,14 @@ void Atom::add_callback(int flag) memory->grow(extra_grow,nextra_grow_max,"atom:extra_grow"); } - for(i = 0; i < nextra_grow; i ++) + for(i = 0; i < nextra_grow; i++) if(ifix < extra_grow[i]) break; if(i == nextra_grow) { extra_grow[nextra_grow] = ifix; } else { - for(j = nextra_grow-1; j >= i; j --) - extra_grow[j+1] = extra_grow[j]; + for(j = nextra_grow; j > i; j--) + extra_grow[j] = extra_grow[j-1]; extra_grow[i] = ifix; } @@ -2090,14 +2090,14 @@ void Atom::add_callback(int flag) memory->grow(extra_restart,nextra_restart_max,"atom:extra_restart"); } - for(i = 0; i < nextra_restart; i ++) + for(i = 0; i < nextra_restart; i++) if(ifix < extra_restart[i]) break; if(i == nextra_restart) { extra_restart[nextra_restart] = ifix; } else { - for(j = nextra_restart-1; j >= i; j --) - extra_restart[j+1] = extra_restart[j]; + for(j = nextra_restart; j > i; j--) + extra_restart[j] = extra_restart[j-1]; extra_restart[i] = ifix; } @@ -2108,14 +2108,14 @@ void Atom::add_callback(int flag) memory->grow(extra_border,nextra_border_max,"atom:extra_border"); } - for(i = 0; i < nextra_border; i ++) + for(i = 0; i < nextra_border; i++) if(ifix < extra_border[i]) break; if(i == nextra_border) { extra_border[nextra_border] = ifix; } else { - for(j = nextra_border-1; j >= i; j --) - extra_border[j+1] = extra_border[j]; + for(j = nextra_border; j > i; j--) + extra_border[j] = extra_border[j-1]; extra_border[i] = ifix; }