コード例 #1
0
    def test_cpp_potential(self):
        python_topology, atom_indices = self.make_atom_indices_python_topology()
        cpp_topology, atom_indices = self.make_atom_indices_cpp_topology(atom_indices=atom_indices.copy())
        
        lj = LJ()
        
        pot_python = pythonRBPotentialWrapper(python_topology, lj)
        pot_cpp = pythonRBPotentialWrapper(cpp_topology, lj)
        
        coords = self.get_random_rbcoords()

        e_python = pot_python.getEnergy(coords.copy())
        e_cpp = pot_cpp.getEnergy(coords.copy())
        self.assertAlmostEqual(e_python, e_cpp)

        e1, g_python = pot_python.getEnergyGradient(coords.copy())
        e2, g_cpp = pot_cpp.getEnergyGradient(coords.copy())
        assert_arrays_almost_equal(self, g_python, g_cpp)
コード例 #2
0
    def test_potential(self):
        topology, atom_indices = self.make_atom_indices_python_topology()

        normal_topology = self.make_normal_python_topology()

        lj = LJ()

        pot = pythonRBPotentialWrapper(topology, lj)
        pot_normal = pythonRBPotentialWrapper(normal_topology, lj)

        coords = self.get_random_rbcoords()

        energy_atom_indices = pot.getEnergy(coords.copy())
        energy_normal = pot_normal.getEnergy(coords.copy())
        self.assertAlmostEqual(energy_atom_indices, energy_normal)

        e1, gei = pot.getEnergyGradient(coords.copy())
        e2, gnorm = pot_normal.getEnergyGradient(coords.copy())
        assert_arrays_almost_equal(self, gei, gnorm)
コード例 #3
0
    def test_cpp_potential(self):
        python_topology, atom_indices = self.make_atom_indices_python_topology(
        )
        cpp_topology, atom_indices = self.make_atom_indices_cpp_topology(
            atom_indices=atom_indices.copy())

        lj = LJ()

        pot_python = pythonRBPotentialWrapper(python_topology, lj)
        pot_cpp = pythonRBPotentialWrapper(cpp_topology, lj)

        coords = self.get_random_rbcoords()

        e_python = pot_python.getEnergy(coords.copy())
        e_cpp = pot_cpp.getEnergy(coords.copy())
        self.assertAlmostEqual(e_python, e_cpp)

        e1, g_python = pot_python.getEnergyGradient(coords.copy())
        e2, g_cpp = pot_cpp.getEnergyGradient(coords.copy())
        assert_arrays_almost_equal(self, g_python, g_cpp)
コード例 #4
0
    def test_potential(self):
        topology, atom_indices = self.make_atom_indices_python_topology()
        
        
        normal_topology = self.make_normal_python_topology()

        lj = LJ()
        
        pot = pythonRBPotentialWrapper(topology, lj)
        pot_normal = pythonRBPotentialWrapper(normal_topology, lj)
        
        coords = self.get_random_rbcoords()

        energy_atom_indices = pot.getEnergy(coords.copy())
        energy_normal = pot_normal.getEnergy(coords.copy())
        self.assertAlmostEqual(energy_atom_indices, energy_normal)

        e1, gei = pot.getEnergyGradient(coords.copy())
        e2, gnorm = pot_normal.getEnergyGradient(coords.copy())
        assert_arrays_almost_equal(self, gei, gnorm)