@@ -33,6 +33,7 @@ class ASEInterfaceTest(ut.TestCase):
3333 def setUp (self ):
3434 self .system .part .add (pos = [0. , 0. , 0. ], f = [1. , - 1. , 0. ], type = 0 )
3535 self .system .part .add (pos = [0. , 0. , 1. ], f = [0. , 12. , 0. ], type = 1 )
36+ self .system .part .add (pos = [11. , 13. , 12. ], f = [0. , 0. , - 8. ], type = 1 )
3637 self .system .ase = espressomd .plugins .ase .ASEInterface (
3738 type_mapping = {0 : "H" , 1 : "O" },
3839 )
@@ -43,15 +44,18 @@ def tearDown(self):
4344 def test_ase_get (self ):
4445 """Test the ``ASEInterface.get()`` method."""
4546 # Create a simple ASE atoms object
46- atoms = self .system .ase .get ()
47- self .assertIsInstance (atoms , ase .Atoms )
48- self .assertEqual (set (atoms .get_chemical_symbols ()), {"H" , "O" })
49- np .testing .assert_equal (atoms .pbc , np .copy (self .system .periodicity ))
50- np .testing .assert_allclose (atoms .cell , np .diag (self .system .box_l ))
51- np .testing .assert_allclose (atoms .get_positions (),
52- [[0. , 0. , 0. ], [0. , 0. , 1. ]])
53- np .testing .assert_allclose (atoms .get_forces (),
54- [[1. , - 1. , 0. ], [0. , 12. , 0. ]])
47+ for folded in [True , False ]:
48+ atoms = self .system .ase .get (folded = folded )
49+ self .assertIsInstance (atoms , ase .Atoms )
50+ self .assertEqual (set (atoms .get_chemical_symbols ()), {"H" , "O" })
51+ np .testing .assert_equal (
52+ atoms .pbc , np .copy (self .system .periodicity ))
53+ np .testing .assert_allclose (atoms .cell , np .diag (self .system .box_l ))
54+ positions_ref = self .system .part .all (
55+ ).pos_folded if folded else self .system .part .all ().pos
56+ np .testing .assert_allclose (atoms .get_positions (), positions_ref )
57+ np .testing .assert_allclose (atoms .get_forces (),
58+ [[1. , - 1. , 0. ], [0. , 12. , 0. ], [0. , 0. , - 8. ]])
5559
5660 @utx .skipIfMissingFeatures ("VIRTUAL_SITES_RELATIVE" )
5761 def test_exceptions (self ):
0 commit comments