Ejemplo n.º 1
0
    def test_galilei_transform(self):
        g = GalileiTransform()
        g.galilei_transform()

        np.testing.assert_allclose(np.copy(g.system_CMS_velocity()),
                                   np.zeros((3, )),
                                   atol=1e-15)
Ejemplo n.º 2
0
    def test_cms_velocity(self):
        parts = self.system.part[:]
        g = GalileiTransform()
        total_mass = np.sum(parts.mass)
        com_v = np.sum(np.multiply(parts.mass.reshape((-1, 1)), parts.v),
                       axis=0) / total_mass

        np.testing.assert_allclose(np.copy(g.system_CMS_velocity()), com_v)
Ejemplo n.º 3
0
    def test_cms(self):
        parts = self.system.part[:]
        g = GalileiTransform()

        total_mass = np.sum(parts.mass)
        com = np.sum(np.multiply(parts.mass.reshape((N_PART, 1)), parts.pos),
                     axis=0) / total_mass

        np.testing.assert_allclose(np.copy(g.system_CMS()), com)
Ejemplo n.º 4
0
    def test_galilei_transform(self):
        g = GalileiTransform()
        no_virtual = self.system.part.select(virtual=False)

        # Center of mass
        np.testing.assert_allclose(
            np.copy(g.system_CMS()),
            np.average(no_virtual.pos, weights=no_virtual.mass, axis=0))
        # Center of mass velocity
        np.testing.assert_allclose(
            np.copy(g.system_CMS_velocity()),
            np.average(no_virtual.v, weights=no_virtual.mass, axis=0))
Ejemplo n.º 5
0
    def test_kill_particle_forces(self):
        g = GalileiTransform()
        g.kill_particle_forces()

        np.testing.assert_array_equal(np.copy(self.system.part[:].f), 0)

        if espressomd.has_features("ROTATION"):
            np.testing.assert_array_less(
                np.copy(self.system.part[:].torque_lab), 0)

            g.kill_particle_forces(torque=True)

            np.testing.assert_array_equal(
                np.copy(self.system.part[:].torque_lab), 0)
Ejemplo n.º 6
0
    def test_kill_particle_motion(self):
        g = GalileiTransform()
        g.kill_particle_motion()

        np.testing.assert_array_equal(np.copy(self.system.part[:].v), 0)

        if espressomd.has_features("ROTATION"):
            np.testing.assert_array_less(
                np.copy(self.system.part[:].omega_lab), 0)

            g.kill_particle_motion(rotation=True)

            np.testing.assert_array_equal(
                np.copy(self.system.part[:].omega_lab), 0)
Ejemplo n.º 7
0
    def test_kill_particle_forces(self):
        g = GalileiTransform()
        g.kill_particle_forces()

        np.testing.assert_array_equal(np.copy(self.system.part[:].f), 0)
Ejemplo n.º 8
0
    def test_kill_particle_motion(self):
        g = GalileiTransform()
        g.kill_particle_motion()

        np.testing.assert_array_equal(np.copy(self.system.part[:].v),
                                      np.zeros((N_PART, 3)))
Ejemplo n.º 9
0
# Set up the DPD friction interaction
system.non_bonded_inter[0, 0].dpd.set_params(weight_function=1,
                                             gamma=gamma,
                                             r_cut=r_cut,
                                             trans_weight_function=0,
                                             trans_gamma=0,
                                             trans_r_cut=0)

# Set up the repulsive interaction
system.non_bonded_inter[0, 0].hat.set_params(F_max=F_max, cutoff=r_cut)

# Warm up and equilibration
system.integrator.run(1000000)

# Reset COM movement
g = GalileiTransform()
g.galilei_transform()

# Set up of correlators to obtain stress autocorrelation functions
dso = espressomd.observables.DPDStress()
plain_old_stress = espressomd.observables.StressTensor()

c_dpd = Correlator(obs1=dso,
                   tau_lin=tau_lin,
                   tau_max=tau_max,
                   delta_N=1,
                   corr_operation="componentwise_product",
                   compress1="discard1")
c_old = Correlator(obs1=plain_old_stress,
                   tau_lin=tau_lin,
                   tau_max=tau_max,