diff --git a/unittest/commands/test_delete_atoms.cpp b/unittest/commands/test_delete_atoms.cpp index d7c37d7311..3812163a7a 100644 --- a/unittest/commands/test_delete_atoms.cpp +++ b/unittest/commands/test_delete_atoms.cpp @@ -70,8 +70,10 @@ protected: command("region left block -2.0 -1.0 INF INF INF INF"); command("region right block 0.5 2.0 INF INF INF INF"); command("region top block INF INF -2.0 -1.0 INF INF"); + command("region bottom block INF INF 0.0 4.0 INF INF"); command("set region left type 2"); command("set region right type 3"); + command("group bottom region bottom"); command("group top region top"); END_HIDE_OUTPUT(); } @@ -109,19 +111,51 @@ TEST_F(DeleteAtomsTest, Simple) ASSERT_EQ(atom->natoms, 392); HIDE_OUTPUT([&] { - command("delete_atoms porosity all right 0.5 43252"); + command("delete_atoms partial fraction 0.5 yes all right 43252"); }); - ASSERT_EQ(atom->natoms, 362); + ASSERT_EQ(atom->natoms, 364); HIDE_OUTPUT([&] { command("variable checker atom sin(4*PI*x/lx)*sin(4*PI*y/ly)*sin(4*PI*z/lz)>0"); command("delete_atoms variable checker"); }); - ASSERT_EQ(atom->natoms, 177); + ASSERT_EQ(atom->natoms, 178); + + HIDE_OUTPUT([&] { + command("delete_atoms partial count 3 no bottom right 443252"); + }); + ASSERT_EQ(atom->natoms, 175); + + HIDE_OUTPUT([&] { + command("delete_atoms partial count 50 no all NULL 434325"); + }); + ASSERT_EQ(atom->natoms, 125); + + HIDE_OUTPUT([&] { + command("delete_atoms partial fraction 0.2 no all NULL 34325"); + }); + ASSERT_EQ(atom->natoms, 104); + + HIDE_OUTPUT([&] { + command("delete_atoms partial count 50 no bottom right 77325"); + }); + ASSERT_EQ(atom->natoms, 102); TEST_FAILURE(".*ERROR: Illegal delete_atoms command: missing argument.*", command("delete_atoms");); 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: 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");); } } // namespace LAMMPS_NS