# Copyright (c) 2009-2019 The Regents of the University of Michigan
# This file is part of the HOOMD-blue project, released under the BSD 3-Clause License.

# Maintainer: mphoward

import unittest
import numpy as np
import hoomd
from hoomd import md
from hoomd import mpcd

# unit tests for mpcd slit streaming geometry
class mpcd_stream_slit_test(unittest.TestCase):
    def setUp(self):
        # establish the simulation context
        hoomd.context.initialize()

        # set the decomposition in z for mpi builds
        if hoomd.comm.get_num_ranks() > 1:
            hoomd.comm.decomposition(nz=2)

        # default testing configuration
        hoomd.init.read_snapshot(hoomd.data.make_snapshot(N=0, box=hoomd.data.boxdim(L=10.)))

        # initialize the system from the starting snapshot
        snap = mpcd.data.make_snapshot(N=2)
        snap.particles.position[:] = [[4.95,-4.95,3.85],[0.,0.,-3.8]]
        snap.particles.velocity[:] = [[1.,-1.,1.],[-1.,-1.,-1.]]
        self.s = mpcd.init.read_snapshot(snap)

        mpcd.integrator(dt=0.1)

    # test creation can happen (with all parameters set)
    def test_create(self):
        mpcd.stream.slit(H=4., V=0.1, boundary="no_slip", period=2)

    # test for setting parameters
    def test_set_params(self):
        slit = mpcd.stream.slit(H=4.)
        self.assertAlmostEqual(slit.H, 4.)
        self.assertAlmostEqual(slit.V, 0.)
        self.assertEqual(slit.boundary, "no_slip")
        self.assertAlmostEqual(slit._cpp.geometry.getH(), 4.)
        self.assertAlmostEqual(slit._cpp.geometry.getVelocity(), 0.)
        self.assertEqual(slit._cpp.geometry.getBoundaryCondition(), mpcd._mpcd.boundary.no_slip)

        # change H and also ensure other parameters stay the same
        slit.set_params(H=2.)
        self.assertAlmostEqual(slit.H, 2.)
        self.assertAlmostEqual(slit.V, 0.)
        self.assertEqual(slit.boundary, "no_slip")
        self.assertAlmostEqual(slit._cpp.geometry.getH(), 2.)
        self.assertAlmostEqual(slit._cpp.geometry.getVelocity(), 0.)
        self.assertEqual(slit._cpp.geometry.getBoundaryCondition(), mpcd._mpcd.boundary.no_slip)

        # change V
        slit.set_params(V=0.1)
        self.assertAlmostEqual(slit.V, 0.1)
        self.assertAlmostEqual(slit._cpp.geometry.getVelocity(), 0.1)

        # change BCs
        slit.set_params(boundary="slip")
        self.assertEqual(slit.boundary, "slip")
        self.assertEqual(slit._cpp.geometry.getBoundaryCondition(), mpcd._mpcd.boundary.slip)

    # test for invalid boundary conditions being set
    def test_bad_boundary(self):
        slit = mpcd.stream.slit(H=4.)
        slit.set_params(boundary="no_slip")
        slit.set_params(boundary="slip")

        with self.assertRaises(ValueError):
            slit.set_params(boundary="invalid")

    # test basic stepping behavior with no slip boundary conditions
    def test_step_noslip(self):
        mpcd.stream.slit(H=4.)

        # take one step
        hoomd.run(1)
        snap = self.s.take_snapshot()
        if hoomd.comm.get_rank() == 0:
            np.testing.assert_array_almost_equal(snap.particles.position[0], [-4.95,4.95,3.95])
            np.testing.assert_array_almost_equal(snap.particles.velocity[0], [1.,-1.,1.])
            np.testing.assert_array_almost_equal(snap.particles.position[1], [-0.1,-0.1,-3.9])
            np.testing.assert_array_almost_equal(snap.particles.velocity[1], [-1.,-1.,-1.])

        # take another step where one particle will now hit the wall
        hoomd.run(1)
        snap = self.s.take_snapshot()
        if hoomd.comm.get_rank() == 0:
            np.testing.assert_array_almost_equal(snap.particles.position[0], [-4.95,4.95,3.95])
            np.testing.assert_array_almost_equal(snap.particles.velocity[0], [-1.,1.,-1.])
            np.testing.assert_array_almost_equal(snap.particles.position[1], [-0.2,-0.2,-4.0])
            np.testing.assert_array_almost_equal(snap.particles.velocity[1], [-1.,-1.,-1.])

        # take another step, wrapping the second particle through the boundary
        hoomd.run(1)
        snap = self.s.take_snapshot()
        if hoomd.comm.get_rank() == 0:
            np.testing.assert_array_almost_equal(snap.particles.position[0], [4.95,-4.95,3.85])
            np.testing.assert_array_almost_equal(snap.particles.velocity[0], [-1.,1.,-1.])
            np.testing.assert_array_almost_equal(snap.particles.position[1], [-0.1,-0.1,-3.9])
            np.testing.assert_array_almost_equal(snap.particles.velocity[1], [1.,1.,1.])

    def test_step_moving_wall(self):
        mpcd.stream.slit(H=4., boundary="no_slip", V=1.0, period=3)

        # change velocity of lower particle so it is translating relative to wall
        snap = self.s.take_snapshot()
        if hoomd.comm.get_rank() == 0:
            snap.particles.velocity[1] = [-2.,-1.,-1.]
        self.s.restore_snapshot(snap)

        # run one step and check bounce back of particles
        hoomd.run(1)
        snap = self.s.take_snapshot()
        if hoomd.comm.get_rank() == 0:
            # the first particle is matched exactly to the wall speed, and so it will translate at
            # same velocity along +x for 3 steps. It will bounce back in y and z to where it started.
            # (vx stays the same, and vy and vz flip.)
            np.testing.assert_array_almost_equal(snap.particles.position[0], [-4.75,-4.95,3.85])
            np.testing.assert_array_almost_equal(snap.particles.velocity[0], [1.,1.,-1.])

            # the second particle has y and z velocities flip again, and since it started closer,
            # it moves relative to original position.
            np.testing.assert_array_almost_equal(snap.particles.position[1], [-0.4,-0.1,-3.9])
            np.testing.assert_array_almost_equal(snap.particles.velocity[1], [0.,1.,1.])

    # test basic stepping behavior with slip boundary conditions
    def test_step_slip(self):
        mpcd.stream.slit(H=4., boundary="slip")

        # take one step
        hoomd.run(1)
        snap = self.s.take_snapshot()
        if hoomd.comm.get_rank() == 0:
            np.testing.assert_array_almost_equal(snap.particles.position[0], [-4.95,4.95,3.95])
            np.testing.assert_array_almost_equal(snap.particles.velocity[0], [1.,-1.,1.])
            np.testing.assert_array_almost_equal(snap.particles.position[1], [-0.1,-0.1,-3.9])
            np.testing.assert_array_almost_equal(snap.particles.velocity[1], [-1.,-1.,-1.])

        # take another step where one particle will now hit the wall
        hoomd.run(1)
        snap = self.s.take_snapshot()
        if hoomd.comm.get_rank() == 0:
            np.testing.assert_array_almost_equal(snap.particles.position[0], [-4.85,4.85,3.95])
            np.testing.assert_array_almost_equal(snap.particles.velocity[0], [1.,-1.,-1.])
            np.testing.assert_array_almost_equal(snap.particles.position[1], [-0.2,-0.2,-4.0])
            np.testing.assert_array_almost_equal(snap.particles.velocity[1], [-1.,-1.,-1.])

        # take another step, wrapping the second particle through the boundary
        hoomd.run(1)
        snap = self.s.take_snapshot()
        if hoomd.comm.get_rank() == 0:
            np.testing.assert_array_almost_equal(snap.particles.position[0], [-4.75,4.75,3.85])
            np.testing.assert_array_almost_equal(snap.particles.velocity[0], [1.,-1.,-1.])
            np.testing.assert_array_almost_equal(snap.particles.position[1], [-0.3,-0.3,-3.9])
            np.testing.assert_array_almost_equal(snap.particles.velocity[1], [-1.,-1.,1.])

    # test that setting the slit size too large raises an error
    def test_validate_box(self):
        # initial configuration is invalid
        slit = mpcd.stream.slit(H=10.)
        with self.assertRaises(RuntimeError):
            hoomd.run(1)

        # now it should be valid
        slit.set_params(H=4.)
        hoomd.run(2)

        # make sure we can invalidate it again
        slit.set_params(H=10.)
        with self.assertRaises(RuntimeError):
            hoomd.run(1)

    # test that particles out of bounds can be caught
    def test_out_of_bounds(self):
        slit = mpcd.stream.slit(H=3.8)
        with self.assertRaises(RuntimeError):
            hoomd.run(1)

        slit.set_params(H=3.85)
        hoomd.run(1)

    # test that virtual particle filler can be attached, removed, and updated
    def test_filler(self):
        # initialization of a filler
        slit = mpcd.stream.slit(H=4.)
        slit.set_filler(density=5., kT=1.0, seed=42, type='A')
        self.assertTrue(slit._filler is not None)

        # run should be able to setup the filler, although this all happens silently
        hoomd.run(1)

        # changing the geometry should still be OK with a run
        slit.set_params(V=1.0)
        hoomd.run(1)

        # changing filler should be allowed
        slit.set_filler(density=10., kT=1.5, seed=7)
        self.assertTrue(slit._filler is not None)
        hoomd.run(1)

        # assert an error is raised if we set a bad particle type
        with self.assertRaises(RuntimeError):
            slit.set_filler(density=5., kT=1.0, seed=42, type='B')

        # assert an error is raised if we set a bad density
        with self.assertRaises(RuntimeError):
            slit.set_filler(density=-1.0, kT=1.0, seed=42)

        # removing the filler should still allow a run
        slit.remove_filler()
        self.assertTrue(slit._filler is None)
        hoomd.run(1)

    def tearDown(self):
        del self.s

if __name__ == '__main__':
    unittest.main(argv = ['test.py', '-v'])

[((9563, 9600), 'unittest.main', 'unittest.main', ([], {'argv': "['test.py', '-v']"}), "(argv=['test.py', '-v'])\n", (9576, 9600), False, 'import unittest\n'), ((440, 466), 'hoomd.context.initialize', 'hoomd.context.initialize', ([], {}), '()\n', (464, 466), False, 'import hoomd\n'), ((816, 844), 'hoomd.mpcd.data.make_snapshot', 'mpcd.data.make_snapshot', ([], {'N': '(2)'}), '(N=2)\n', (839, 844), False, 'from hoomd import mpcd\n'), ((997, 1026), 'hoomd.mpcd.init.read_snapshot', 'mpcd.init.read_snapshot', (['snap'], {}), '(snap)\n', (1020, 1026), False, 'from hoomd import mpcd\n'), ((1036, 1059), 'hoomd.mpcd.integrator', 'mpcd.integrator', ([], {'dt': '(0.1)'}), '(dt=0.1)\n', (1051, 1059), False, 'from hoomd import mpcd\n'), ((1153, 1213), 'hoomd.mpcd.stream.slit', 'mpcd.stream.slit', ([], {'H': '(4.0)', 'V': '(0.1)', 'boundary': '"""no_slip"""', 'period': '(2)'}), "(H=4.0, V=0.1, boundary='no_slip', period=2)\n", (1169, 1213), False, 'from hoomd import mpcd\n'), ((1294, 1317), 'hoomd.mpcd.stream.slit', 'mpcd.stream.slit', ([], {'H': '(4.0)'}), '(H=4.0)\n', (1310, 1317), False, 'from hoomd import mpcd\n'), ((2616, 2639), 'hoomd.mpcd.stream.slit', 'mpcd.stream.slit', ([], {'H': '(4.0)'}), '(H=4.0)\n', (2632, 2639), False, 'from hoomd import mpcd\n'), ((2926, 2949), 'hoomd.mpcd.stream.slit', 'mpcd.stream.slit', ([], {'H': '(4.0)'}), '(H=4.0)\n', (2942, 2949), False, 'from hoomd import mpcd\n'), ((2982, 2994), 'hoomd.run', 'hoomd.run', (['(1)'], {}), '(1)\n', (2991, 2994), False, 'import hoomd\n'), ((3523, 3535), 'hoomd.run', 'hoomd.run', (['(1)'], {}), '(1)\n', (3532, 3535), False, 'import hoomd\n'), ((4075, 4087), 'hoomd.run', 'hoomd.run', (['(1)'], {}), '(1)\n', (4084, 4087), False, 'import hoomd\n'), ((4582, 4642), 'hoomd.mpcd.stream.slit', 'mpcd.stream.slit', ([], {'H': '(4.0)', 'boundary': '"""no_slip"""', 'V': '(1.0)', 'period': '(3)'}), "(H=4.0, boundary='no_slip', V=1.0, period=3)\n", (4598, 4642), False, 'from hoomd import mpcd\n'), ((4962, 4974), 'hoomd.run', 'hoomd.run', (['(1)'], {}), '(1)\n', (4971, 4974), False, 'import hoomd\n'), ((5936, 5976), 'hoomd.mpcd.stream.slit', 'mpcd.stream.slit', ([], {'H': '(4.0)', 'boundary': '"""slip"""'}), "(H=4.0, boundary='slip')\n", (5952, 5976), False, 'from hoomd import mpcd\n'), ((6009, 6021), 'hoomd.run', 'hoomd.run', (['(1)'], {}), '(1)\n', (6018, 6021), False, 'import hoomd\n'), ((6550, 6562), 'hoomd.run', 'hoomd.run', (['(1)'], {}), '(1)\n', (6559, 6562), False, 'import hoomd\n'), ((7102, 7114), 'hoomd.run', 'hoomd.run', (['(1)'], {}), '(1)\n', (7111, 7114), False, 'import hoomd\n'), ((7721, 7745), 'hoomd.mpcd.stream.slit', 'mpcd.stream.slit', ([], {'H': '(10.0)'}), '(H=10.0)\n', (7737, 7745), False, 'from hoomd import mpcd\n'), ((7888, 7900), 'hoomd.run', 'hoomd.run', (['(2)'], {}), '(2)\n', (7897, 7900), False, 'import hoomd\n'), ((8155, 8178), 'hoomd.mpcd.stream.slit', 'mpcd.stream.slit', ([], {'H': '(3.8)'}), '(H=3.8)\n', (8171, 8178), False, 'from hoomd import mpcd\n'), ((8291, 8303), 'hoomd.run', 'hoomd.run', (['(1)'], {}), '(1)\n', (8300, 8303), False, 'import hoomd\n'), ((8462, 8485), 'hoomd.mpcd.stream.slit', 'mpcd.stream.slit', ([], {'H': '(4.0)'}), '(H=4.0)\n', (8478, 8485), False, 'from hoomd import mpcd\n'), ((8692, 8704), 'hoomd.run', 'hoomd.run', (['(1)'], {}), '(1)\n', (8701, 8704), False, 'import hoomd\n'), ((8807, 8819), 'hoomd.run', 'hoomd.run', (['(1)'], {}), '(1)\n', (8816, 8819), False, 'import hoomd\n'), ((8976, 8988), 'hoomd.run', 'hoomd.run', (['(1)'], {}), '(1)\n', (8985, 8988), False, 'import hoomd\n'), ((9474, 9486), 'hoomd.run', 'hoomd.run', (['(1)'], {}), '(1)\n', (9483, 9486), False, 'import hoomd\n'), ((531, 557), 'hoomd.comm.get_num_ranks', 'hoomd.comm.get_num_ranks', ([], {}), '()\n', (555, 557), False, 'import hoomd\n'), ((575, 605), 'hoomd.comm.decomposition', 'hoomd.comm.decomposition', ([], {'nz': '(2)'}), '(nz=2)\n', (599, 605), False, 'import hoomd\n'), ((3044, 3065), 'hoomd.comm.get_rank', 'hoomd.comm.get_rank', ([], {}), '()\n', (3063, 3065), False, 'import hoomd\n'), ((3084, 3174), 'numpy.testing.assert_array_almost_equal', 'np.testing.assert_array_almost_equal', (['snap.particles.position[0]', '[-4.95, 4.95, 3.95]'], {}), '(snap.particles.position[0], [-4.95, \n    4.95, 3.95])\n', (3120, 3174), True, 'import numpy as np\n'), ((3180, 3266), 'numpy.testing.assert_array_almost_equal', 'np.testing.assert_array_almost_equal', (['snap.particles.velocity[0]', '[1.0, -1.0, 1.0]'], {}), '(snap.particles.velocity[0], [1.0, -1.0,\n    1.0])\n', (3216, 3266), True, 'import numpy as np\n'), ((3270, 3359), 'numpy.testing.assert_array_almost_equal', 'np.testing.assert_array_almost_equal', (['snap.particles.position[1]', '[-0.1, -0.1, -3.9]'], {}), '(snap.particles.position[1], [-0.1, -\n    0.1, -3.9])\n', (3306, 3359), True, 'import numpy as np\n'), ((3365, 3454), 'numpy.testing.assert_array_almost_equal', 'np.testing.assert_array_almost_equal', (['snap.particles.velocity[1]', '[-1.0, -1.0, -1.0]'], {}), '(snap.particles.velocity[1], [-1.0, -\n    1.0, -1.0])\n', (3401, 3454), True, 'import numpy as np\n'), ((3585, 3606), 'hoomd.comm.get_rank', 'hoomd.comm.get_rank', ([], {}), '()\n', (3604, 3606), False, 'import hoomd\n'), ((3625, 3715), 'numpy.testing.assert_array_almost_equal', 'np.testing.assert_array_almost_equal', (['snap.particles.position[0]', '[-4.95, 4.95, 3.95]'], {}), '(snap.particles.position[0], [-4.95, \n    4.95, 3.95])\n', (3661, 3715), True, 'import numpy as np\n'), ((3721, 3808), 'numpy.testing.assert_array_almost_equal', 'np.testing.assert_array_almost_equal', (['snap.particles.velocity[0]', '[-1.0, 1.0, -1.0]'], {}), '(snap.particles.velocity[0], [-1.0, 1.0,\n    -1.0])\n', (3757, 3808), True, 'import numpy as np\n'), ((3812, 3901), 'numpy.testing.assert_array_almost_equal', 'np.testing.assert_array_almost_equal', (['snap.particles.position[1]', '[-0.2, -0.2, -4.0]'], {}), '(snap.particles.position[1], [-0.2, -\n    0.2, -4.0])\n', (3848, 3901), True, 'import numpy as np\n'), ((3907, 3996), 'numpy.testing.assert_array_almost_equal', 'np.testing.assert_array_almost_equal', (['snap.particles.velocity[1]', '[-1.0, -1.0, -1.0]'], {}), '(snap.particles.velocity[1], [-1.0, -\n    1.0, -1.0])\n', (3943, 3996), True, 'import numpy as np\n'), ((4137, 4158), 'hoomd.comm.get_rank', 'hoomd.comm.get_rank', ([], {}), '()\n', (4156, 4158), False, 'import hoomd\n'), ((4177, 4267), 'numpy.testing.assert_array_almost_equal', 'np.testing.assert_array_almost_equal', (['snap.particles.position[0]', '[4.95, -4.95, 3.85]'], {}), '(snap.particles.position[0], [4.95, -\n    4.95, 3.85])\n', (4213, 4267), True, 'import numpy as np\n'), ((4273, 4360), 'numpy.testing.assert_array_almost_equal', 'np.testing.assert_array_almost_equal', (['snap.particles.velocity[0]', '[-1.0, 1.0, -1.0]'], {}), '(snap.particles.velocity[0], [-1.0, 1.0,\n    -1.0])\n', (4309, 4360), True, 'import numpy as np\n'), ((4364, 4453), 'numpy.testing.assert_array_almost_equal', 'np.testing.assert_array_almost_equal', (['snap.particles.position[1]', '[-0.1, -0.1, -3.9]'], {}), '(snap.particles.position[1], [-0.1, -\n    0.1, -3.9])\n', (4400, 4453), True, 'import numpy as np\n'), ((4459, 4544), 'numpy.testing.assert_array_almost_equal', 'np.testing.assert_array_almost_equal', (['snap.particles.velocity[1]', '[1.0, 1.0, 1.0]'], {}), '(snap.particles.velocity[1], [1.0, 1.0,\n    1.0])\n', (4495, 4544), True, 'import numpy as np\n'), ((4774, 4795), 'hoomd.comm.get_rank', 'hoomd.comm.get_rank', ([], {}), '()\n', (4793, 4795), False, 'import hoomd\n'), ((5024, 5045), 'hoomd.comm.get_rank', 'hoomd.comm.get_rank', ([], {}), '()\n', (5043, 5045), False, 'import hoomd\n'), ((5320, 5411), 'numpy.testing.assert_array_almost_equal', 'np.testing.assert_array_almost_equal', (['snap.particles.position[0]', '[-4.75, -4.95, 3.85]'], {}), '(snap.particles.position[0], [-4.75, -\n    4.95, 3.85])\n', (5356, 5411), True, 'import numpy as np\n'), ((5417, 5503), 'numpy.testing.assert_array_almost_equal', 'np.testing.assert_array_almost_equal', (['snap.particles.velocity[0]', '[1.0, 1.0, -1.0]'], {}), '(snap.particles.velocity[0], [1.0, 1.0,\n    -1.0])\n', (5453, 5503), True, 'import numpy as np\n'), ((5660, 5749), 'numpy.testing.assert_array_almost_equal', 'np.testing.assert_array_almost_equal', (['snap.particles.position[1]', '[-0.4, -0.1, -3.9]'], {}), '(snap.particles.position[1], [-0.4, -\n    0.1, -3.9])\n', (5696, 5749), True, 'import numpy as np\n'), ((5755, 5840), 'numpy.testing.assert_array_almost_equal', 'np.testing.assert_array_almost_equal', (['snap.particles.velocity[1]', '[0.0, 1.0, 1.0]'], {}), '(snap.particles.velocity[1], [0.0, 1.0,\n    1.0])\n', (5791, 5840), True, 'import numpy as np\n'), ((6071, 6092), 'hoomd.comm.get_rank', 'hoomd.comm.get_rank', ([], {}), '()\n', (6090, 6092), False, 'import hoomd\n'), ((6111, 6201), 'numpy.testing.assert_array_almost_equal', 'np.testing.assert_array_almost_equal', (['snap.particles.position[0]', '[-4.95, 4.95, 3.95]'], {}), '(snap.particles.position[0], [-4.95, \n    4.95, 3.95])\n', (6147, 6201), True, 'import numpy as np\n'), ((6207, 6293), 'numpy.testing.assert_array_almost_equal', 'np.testing.assert_array_almost_equal', (['snap.particles.velocity[0]', '[1.0, -1.0, 1.0]'], {}), '(snap.particles.velocity[0], [1.0, -1.0,\n    1.0])\n', (6243, 6293), True, 'import numpy as np\n'), ((6297, 6386), 'numpy.testing.assert_array_almost_equal', 'np.testing.assert_array_almost_equal', (['snap.particles.position[1]', '[-0.1, -0.1, -3.9]'], {}), '(snap.particles.position[1], [-0.1, -\n    0.1, -3.9])\n', (6333, 6386), True, 'import numpy as np\n'), ((6392, 6481), 'numpy.testing.assert_array_almost_equal', 'np.testing.assert_array_almost_equal', (['snap.particles.velocity[1]', '[-1.0, -1.0, -1.0]'], {}), '(snap.particles.velocity[1], [-1.0, -\n    1.0, -1.0])\n', (6428, 6481), True, 'import numpy as np\n'), ((6612, 6633), 'hoomd.comm.get_rank', 'hoomd.comm.get_rank', ([], {}), '()\n', (6631, 6633), False, 'import hoomd\n'), ((6652, 6742), 'numpy.testing.assert_array_almost_equal', 'np.testing.assert_array_almost_equal', (['snap.particles.position[0]', '[-4.85, 4.85, 3.95]'], {}), '(snap.particles.position[0], [-4.85, \n    4.85, 3.95])\n', (6688, 6742), True, 'import numpy as np\n'), ((6748, 6835), 'numpy.testing.assert_array_almost_equal', 'np.testing.assert_array_almost_equal', (['snap.particles.velocity[0]', '[1.0, -1.0, -1.0]'], {}), '(snap.particles.velocity[0], [1.0, -1.0,\n    -1.0])\n', (6784, 6835), True, 'import numpy as np\n'), ((6839, 6928), 'numpy.testing.assert_array_almost_equal', 'np.testing.assert_array_almost_equal', (['snap.particles.position[1]', '[-0.2, -0.2, -4.0]'], {}), '(snap.particles.position[1], [-0.2, -\n    0.2, -4.0])\n', (6875, 6928), True, 'import numpy as np\n'), ((6934, 7023), 'numpy.testing.assert_array_almost_equal', 'np.testing.assert_array_almost_equal', (['snap.particles.velocity[1]', '[-1.0, -1.0, -1.0]'], {}), '(snap.particles.velocity[1], [-1.0, -\n    1.0, -1.0])\n', (6970, 7023), True, 'import numpy as np\n'), ((7164, 7185), 'hoomd.comm.get_rank', 'hoomd.comm.get_rank', ([], {}), '()\n', (7183, 7185), False, 'import hoomd\n'), ((7204, 7294), 'numpy.testing.assert_array_almost_equal', 'np.testing.assert_array_almost_equal', (['snap.particles.position[0]', '[-4.75, 4.75, 3.85]'], {}), '(snap.particles.position[0], [-4.75, \n    4.75, 3.85])\n', (7240, 7294), True, 'import numpy as np\n'), ((7300, 7387), 'numpy.testing.assert_array_almost_equal', 'np.testing.assert_array_almost_equal', (['snap.particles.velocity[0]', '[1.0, -1.0, -1.0]'], {}), '(snap.particles.velocity[0], [1.0, -1.0,\n    -1.0])\n', (7336, 7387), True, 'import numpy as np\n'), ((7391, 7480), 'numpy.testing.assert_array_almost_equal', 'np.testing.assert_array_almost_equal', (['snap.particles.position[1]', '[-0.3, -0.3, -3.9]'], {}), '(snap.particles.position[1], [-0.3, -\n    0.3, -3.9])\n', (7427, 7480), True, 'import numpy as np\n'), ((7486, 7574), 'numpy.testing.assert_array_almost_equal', 'np.testing.assert_array_almost_equal', (['snap.particles.velocity[1]', '[-1.0, -1.0, 1.0]'], {}), '(snap.particles.velocity[1], [-1.0, -\n    1.0, 1.0])\n', (7522, 7574), True, 'import numpy as np\n'), ((7803, 7815), 'hoomd.run', 'hoomd.run', (['(1)'], {}), '(1)\n', (7812, 7815), False, 'import hoomd\n'), ((8038, 8050), 'hoomd.run', 'hoomd.run', (['(1)'], {}), '(1)\n', (8047, 8050), False, 'import hoomd\n'), ((8237, 8249), 'hoomd.run', 'hoomd.run', (['(1)'], {}), '(1)\n', (8246, 8249), False, 'import hoomd\n'), ((714, 739), 'hoomd.data.boxdim', 'hoomd.data.boxdim', ([], {'L': '(10.0)'}), '(L=10.0)\n', (731, 739), False, 'import hoomd\n')]