예제 #1
0
    def test_return_shape(self):
        """ Test that the return shape of pelectrostatic is the same as input arrays """
        xx, yy, zz = np.meshgrid(
            np.linspace(-10, 10, 16), np.linspace(-10, 10, 16), np.linspace(-10, 10, 16)
        )
        potential = electrostatic(self.crystal, xx, yy, zz)

        self.assertSequenceEqual(xx.shape, potential.shape)
예제 #2
0
def test_return_shape():
    """ Test that the return shape of pelectrostatic is the same as input arrays """
    crystal = Crystal.from_database("C")
    xx, yy, zz = np.meshgrid(np.linspace(-10, 10,
                                         16), np.linspace(-10, 10, 16),
                             np.linspace(-10, 10, 16))
    potential = electrostatic(crystal, xx, yy, zz)

    assert xx.shape == potential.shape
예제 #3
0
    def test_side_effects(self):
        """ Test that mesh arrays are not written to in pelectrostatic """
        xx, yy, zz = np.meshgrid(
            np.linspace(-10, 10, 16), np.linspace(-10, 10, 16), np.linspace(-10, 10, 16)
        )

        xx.setflags(write=False)
        yy.setflags(write=False)
        zz.setflags(write=False)

        potential = electrostatic(self.crystal, xx, yy, zz)