From d487ab10e2672f50f0212b1a179536e53f976441 Mon Sep 17 00:00:00 2001 From: Steve Plimpton Date: Tue, 17 May 2022 12:00:40 -0600 Subject: [PATCH] doc page and unittest tweaks --- doc/src/delete_atoms.rst | 50 ++++++++++++------------- unittest/commands/test_delete_atoms.cpp | 28 +++++++------- 2 files changed, 39 insertions(+), 39 deletions(-) diff --git a/doc/src/delete_atoms.rst b/doc/src/delete_atoms.rst index 4b74ea66f6..9777f16cc9 100644 --- a/doc/src/delete_atoms.rst +++ b/doc/src/delete_atoms.rst @@ -10,7 +10,7 @@ Syntax delete_atoms style args keyword value ... -* style = *group* or *region* or *overlap* or *partial* or *variable* +* style = *group* or *region* or *overlap* or *random* or *variable* .. parsed-literal:: @@ -20,14 +20,14 @@ Syntax cutoff = delete one atom from pairs of atoms within the cutoff (distance units) group1-ID = one atom in pair must be in this group group2-ID = other atom in pair must be in this group - *random* args = ranstyle value flag group-ID region-ID seed + *random* args = ranstyle value eflag group-ID region-ID seed ranstyle = *fraction* or *count* for *fraction*: value = fraction (0.0 to 1.0) of eligible atoms to delete - flag = no/off for fast approximate deletion, yes/on for exact deletion + eflag = *no* for fast approximate deletion, *yes* for exact deletion for *count*: value = number of atoms to delete - flag = no/off for warning if count > eligible atoms, yes/on for error + eflag = *no* for warning if count > eligible atoms, *yes* for error group-ID = group within which to perform deletions region-ID = region within which to perform deletions or NULL to only impose the group criterion @@ -52,9 +52,9 @@ Examples delete_atoms region sphere compress no delete_atoms overlap 0.3 all all delete_atoms overlap 0.5 solvent colloid - delete_atoms random fraction 0.1 1 all cube 482793 bond yes - delete_atoms random fraction 0.3 0 polymer NULL 482793 bond yes - delete_atoms random count 500 0 ions NULL 482793 + delete_atoms random fraction 0.1 yes all cube 482793 bond yes + delete_atoms random fraction 0.3 no polymer NULL 482793 bond yes + delete_atoms random count 500 no ions NULL 482793 detele_atoms variable checkers Description @@ -90,31 +90,31 @@ be deleted when running on different numbers of processors. For style *random* a subset of eligible atoms are deleted. Which atoms to delete are chosen randomly using the specified random number -*seed*. In all cases, which atoms are deleted may vary when running -on different numbers of processors. +*seed*. Which atoms are deleted may vary when running on different +numbers of processors. -For *ranstyle* = *fraction*, the specified fraction *value*(0.0 to 1.0) of -eligible atoms are deleted. If the *flag* is set to no/off/0, then the -number of deleted atoms will be approximate, but the operation will -always be fast. If instead the *flag* is set to yes/on/1, then the -number deleted will be match the requested fraction as close as -possible, but for very large systems the selection of deleted atoms will -take additional time to determine. +For *ranstyle* = *fraction*, the specified fractional *value* (0.0 to +1.0) of eligible atoms are deleted. If *eflag* is set to *no*, then +the number of deleted atoms will be approximate, but the operation +will be fast. If *eflag* is set to *yes*, then the number deleted +will match the requested fraction, but for large systems the selection +of deleted atoms may take additional time to determine. For *ranstyle* = *count*, the specified integer *value* is the number -of eligible atoms are deleted. If the *flag* is set to no/off/0, then -if the requested number is larger then the number of eligible atoms, a +of eligible atoms are deleted. If *eflag* is set to *no*, then if the +requested number is larger then the number of eligible atoms, a warning is issued and only the eligible atoms are deleted instead of -the requested *value*. If the *flag* is set to yes/on/1, an error is -triggered instead and LAMMPS will exit. For very large systems the -selection of atoms to delete may take additional time same as for -requesting the exact fraction with time as *pstyle* = *fraction*. +the requested *value*. If *eflag* is set to *yes*, an error is +triggered instead and LAMMPS will exit. For large systems the +selection of atoms to delete may take additional time to determine, +the same as for requesting an exact fraction with *pstyle* = +*fraction*. -Which atoms are eligible for deletion for style *partial* is determined +Which atoms are eligible for deletion for style *random* is determined by the specified *group-ID* and *region-ID*. To be eligible, an atom must be in both the specified group and region. If *group-ID* = all, -there is effectively no group criterion. If *region-ID* is specified as -NULL, no region criterion is imposed. +there is effectively no group criterion. If *region-ID* is specified +as NULL, no region criterion is imposed. For style *variable*, all atoms for which the atom-style variable with the given name evaluates to non-zero will be deleted. Additional atoms diff --git a/unittest/commands/test_delete_atoms.cpp b/unittest/commands/test_delete_atoms.cpp index 3812163a7a..34498e9fa2 100644 --- a/unittest/commands/test_delete_atoms.cpp +++ b/unittest/commands/test_delete_atoms.cpp @@ -111,7 +111,7 @@ TEST_F(DeleteAtomsTest, Simple) ASSERT_EQ(atom->natoms, 392); HIDE_OUTPUT([&] { - command("delete_atoms partial fraction 0.5 yes all right 43252"); + command("delete_atoms random fraction 0.5 yes all right 43252"); }); ASSERT_EQ(atom->natoms, 364); @@ -122,22 +122,22 @@ TEST_F(DeleteAtomsTest, Simple) ASSERT_EQ(atom->natoms, 178); HIDE_OUTPUT([&] { - command("delete_atoms partial count 3 no bottom right 443252"); + command("delete_atoms random count 3 no bottom right 443252"); }); ASSERT_EQ(atom->natoms, 175); HIDE_OUTPUT([&] { - command("delete_atoms partial count 50 no all NULL 434325"); + command("delete_atoms random count 50 no all NULL 434325"); }); ASSERT_EQ(atom->natoms, 125); HIDE_OUTPUT([&] { - command("delete_atoms partial fraction 0.2 no all NULL 34325"); + command("delete_atoms random fraction 0.2 no all NULL 34325"); }); ASSERT_EQ(atom->natoms, 104); HIDE_OUTPUT([&] { - command("delete_atoms partial count 50 no bottom right 77325"); + command("delete_atoms random count 50 no bottom right 77325"); }); ASSERT_EQ(atom->natoms, 102); @@ -146,16 +146,16 @@ TEST_F(DeleteAtomsTest, Simple) TEST_FAILURE(".*ERROR: Unknown delete_atoms sub-command: xxx.*", command("delete_atoms xxx");); TEST_FAILURE(".*ERROR: The delete_atoms 'porosity' keyword has been removed.*", command("delete_atoms porosity 0.5 all right 4325234");); - TEST_FAILURE(".*ERROR: Illegal delete_atoms partial command: missing argument.*", - command("delete_atoms partial count 50 bottom right 77325");); - TEST_FAILURE(".*ERROR: Illegal delete_atoms partial command: missing argument.*", - command("delete_atoms partial fraction 0.4 bottom right 77325");); - TEST_FAILURE(".*ERROR: Delete_atoms partial count has invalid value: -5.*", - command("delete_atoms partial count -5 no bottom right 77325");); + TEST_FAILURE(".*ERROR: Illegal delete_atoms random command: missing argument.*", + command("delete_atoms random count 50 bottom right 77325");); + TEST_FAILURE(".*ERROR: Illegal delete_atoms random command: missing argument.*", + command("delete_atoms random fraction 0.4 bottom right 77325");); + TEST_FAILURE(".*ERROR: Delete_atoms random count has invalid value: -5.*", + command("delete_atoms random count -5 no bottom right 77325");); TEST_FAILURE(".*ERROR: Delete_atoms count of 5 exceeds number of eligible atoms 0.*", - command("delete_atoms partial count 5 yes bottom right 77325");); - TEST_FAILURE(".*ERROR: Delete_atoms partial fraction has invalid value: -0.4.*", - command("delete_atoms partial fraction -0.4 no bottom right 77325");); + command("delete_atoms random count 5 yes bottom right 77325");); + TEST_FAILURE(".*ERROR: Delete_atoms random fraction has invalid value: -0.4.*", + command("delete_atoms random fraction -0.4 no bottom right 77325");); } } // namespace LAMMPS_NS