def test_momentum_getter(self):
     momentum = self.engine.momentum
     state = self.engine.simulation.context.getState(getVelocities=True)
     velocities = state.getVelocities(asNumpy=True)
     assert_equal_array_array(
         momentum.velocities / (u.nanometers / u.picoseconds),
         velocities / (u.nanometers / u.picoseconds))
 def test_configuration_getter(self):
     config = self.engine.configuration
     state = self.engine.simulation.context.getState(getPositions=True)
     positions = state.getPositions(asNumpy=True)
     assert_equal_array_array(
         config.coordinates / u.nanometers,
         positions / u.nanometers
     )
 def test_momentum_getter(self):
     momentum = self.engine.momentum
     state = self.engine.simulation.context.getState(getVelocities=True)
     velocities = state.getVelocities(asNumpy=True)
     assert_equal_array_array(
         momentum.velocities / (u.nanometers / u.picoseconds),
         velocities / (u.nanometers / u.picoseconds)
     )
Beispiel #4
0
 def test_snapshot_get(self):
     snap = self.engine.current_snapshot
     state = self.engine.simulation.context.getState(getVelocities=True,
                                                     getPositions=True)
     pos = state.getPositions(asNumpy=True) / u.nanometers
     vel = state.getVelocities(asNumpy=True) / (u.nanometers / u.picoseconds)
     assert_equal_array_array(snap.coordinates / u.nanometers, pos)
     assert_equal_array_array(snap.velocities / (u.nanometers / u.picoseconds),
                              vel)
 def test_snapshot_get(self):
     snap = self.engine.current_snapshot
     state = self.engine.simulation.context.getState(getVelocities=True,
                                                     getPositions=True)
     pos = state.getPositions(asNumpy=True) / u.nanometers
     vel = state.getVelocities(asNumpy=True) / (u.nanometers / u.picoseconds)
     assert_equal_array_array(snap.coordinates / u.nanometers, pos)
     assert_equal_array_array(snap.velocities / (u.nanometers / u.picoseconds),
                              vel)
 def test_convert_to_3Ndim(v):
     assert_equal_array_array(convert_to_3Ndim([1.0, 2.0]),
                              np.array([[1.0, 2.0, 0.0]]))
     assert_equal_array_array(convert_to_3Ndim([1.0, 2.0, 3.0]), 
                              np.array([[1.0, 2.0, 3.0]]))
     assert_equal_array_array(convert_to_3Ndim([1.0, 2.0, 3.0, 4.0]),
                              np.array([[1.0, 2.0, 3.0], [4.0, 0.0, 0.0]]))
Beispiel #7
0
    def test_convert_to_3Ndim(v):
        raise SkipTest

        assert_equal_array_array(toy.convert_to_3Ndim([1.0, 2.0]),
                                 np.array([[1.0, 2.0, 0.0]]))
        assert_equal_array_array(toy.convert_to_3Ndim([1.0, 2.0, 3.0]),
                                 np.array([[1.0, 2.0, 3.0]]))
        assert_equal_array_array(toy.convert_to_3Ndim([1.0, 2.0, 3.0, 4.0]),
                                 np.array([[1.0, 2.0, 3.0], [4.0, 0.0, 0.0]]))
Beispiel #8
0
    def test_convert_to_3Ndim(v):
        raise SkipTest

        assert_equal_array_array(toy.convert_to_3Ndim([1.0, 2.0]),
                                 np.array([[1.0, 2.0, 0.0]]))
        assert_equal_array_array(toy.convert_to_3Ndim([1.0, 2.0, 3.0]),
                                 np.array([[1.0, 2.0, 3.0]]))
        assert_equal_array_array(toy.convert_to_3Ndim([1.0, 2.0, 3.0, 4.0]),
                                 np.array([[1.0, 2.0, 3.0], [4.0, 0.0, 0.0]]))
Beispiel #9
0
 def test_list_even(self):
     result = make_list_of_pairs([0, 1, 2, 3, 4, 5])
     assert_equal_array_array(result, self.correct)
Beispiel #10
0
 def test_list_of_list_pairs(self):
     result = make_list_of_pairs([[0, 1], [2, 3], [4, 5]])
     assert_equal_array_array(result, self.correct)
 def test_list_even(self):
     result = make_list_of_pairs([0, 1, 2, 3, 4, 5])
     assert_equal_array_array(result, self.correct)
 def test_list_of_list_pairs(self):
     result = make_list_of_pairs([[0, 1], [2, 3], [4, 5]])
     assert_equal_array_array(result, self.correct)
 def test_configuration_getter(self):
     config = self.engine.configuration
     state = self.engine.simulation.context.getState(getPositions=True)
     positions = state.getPositions(asNumpy=True)
     assert_equal_array_array(config.coordinates / u.nanometers,
                              positions / u.nanometers)