Skip to content

Commit 9b33f26

Browse files
author
abacus_fixer
committed
fix(rhog_io): use whitelist for nspin validation to reject nspin=3
1 parent 38ae309 commit 9b33f26

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

source/source_estate/rhog_io.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ bool elecstate::read_rhog(const std::string& filename,
3737
warn(os_warning, pw_world, "elecstate::read_rhog", "rhog is null");
3838
return false;
3939
}
40-
if (nspin <= 0 || nspin > 4)
40+
if (nspin != 1 && nspin != 2 && nspin != 4)
4141
{
4242
warn(os_warning, pw_world, "elecstate::read_rhog", "nspin must be 1, 2, or 4");
4343
return false;
@@ -228,7 +228,7 @@ bool elecstate::write_rhog(const std::string& fchg,
228228
warn(os_warning, pw_world, "elecstate::write_rhog", "rhog is null");
229229
return false;
230230
}
231-
if (nspin <= 0 || nspin > 4)
231+
if (nspin != 1 && nspin != 2 && nspin != 4)
232232
{
233233
warn(os_warning, pw_world, "elecstate::write_rhog", "nspin must be 1, 2, or 4");
234234
return false;

0 commit comments

Comments
 (0)