Ejemplo n.º 1
0
    def test_to_atomistic2(self):
        x0 = np.array(list(range(self.nrigid * 6)), dtype=float)
        x2 = x0.reshape([-1, 3])
        for p in x2[self.nrigid:, :]:
            p /= np.linalg.norm(p)
        atomistic = self.topology.to_atomistic(x0).flatten()

        from pele.potentials import LJ
        lj = LJ()
        e, g = lj.getEnergyGradient(atomistic.reshape(-1))
        grb = self.topology.transform_gradient(x0, g)
        rbpot = RBPotentialWrapper(self.topology, lj)
        print(rbpot.getEnergy(x0))
Ejemplo n.º 2
0
 def test_to_atomistic2(self):
     x0 = np.array(list(range(self.nrigid * 6)), dtype=float)
     x2 = x0.reshape([-1,3])
     for p in x2[self.nrigid:,:]:
         p /= np.linalg.norm(p)
     atomistic = self.topology.to_atomistic(x0).flatten()
     
     from pele.potentials import LJ
     lj = LJ()
     e, g = lj.getEnergyGradient(atomistic.reshape(-1))
     grb = self.topology.transform_gradient(x0, g)
     rbpot = RBPotentialWrapper(self.topology, lj)
     print(rbpot.getEnergy(x0))
Ejemplo n.º 3
0
    def test_pot_wrapper(self):
        from pele.angleaxis import _cpp_aa
        from pele.potentials import LJ
        rbpot_cpp = _cpp_aa.RBPotentialWrapper(self.topology, LJ())
        rbpot = RBPotentialWrapper(self.topology, LJ())

        self.assertAlmostEqual(rbpot_cpp.getEnergy(self.x0),
                               rbpot.getEnergy(self.x0), 4)

        e1, grad1 = rbpot_cpp.getEnergyGradient(self.x0)
        e2, grad2 = rbpot.getEnergyGradient(self.x0)
        self.assertAlmostEqual(e1, e2, 4)
        for g1, g2 in zip(grad1, grad2):
            self.assertAlmostEqual(g1, g2, 3)
Ejemplo n.º 4
0
 def test_pot_wrapper(self):
     from pele.angleaxis import _cpp_aa
     from pele.potentials import LJ
     rbpot_cpp = _cpp_aa.RBPotentialWrapper(self.topology, LJ())
     rbpot = RBPotentialWrapper(self.topology, LJ())
     
     self.assertAlmostEqual(rbpot_cpp.getEnergy(self.x0), 
                            rbpot.getEnergy(self.x0), 4)
     
     e1, grad1 = rbpot_cpp.getEnergyGradient(self.x0)
     e2, grad2 = rbpot.getEnergyGradient(self.x0)
     self.assertAlmostEqual(e1, e2, 4)
     for g1, g2 in zip(grad1, grad2):
         self.assertAlmostEqual(g1, g2, 3) 
Ejemplo n.º 5
0
    def setUp(self):
        nrigid = 3
        self.topology = RBTopology()
        self.topology.add_sites([make_otp() for i in range(nrigid)])
        self.topology.finalize_setup()

        cartesian_potential = LJ()
        self.pot = RBPotentialWrapper(self.topology, cartesian_potential)

        self.x0 = _x03
        self.x0 = np.array(self.x0)
        self.e0 = -17.3387670023
        assert nrigid * 6 == self.x0.size

        self.x0atomistic = _x03_atomistic
        self.nrigid = nrigid
Ejemplo n.º 6
0
 def setUp(self):
     nrigid = 3
     self.topology = RBTopology()
     self.topology.add_sites([self.make_otp() for i in xrange(nrigid)])
     
     cartesian_potential = LJ()
     self.pot = RBPotentialWrapper(self.topology, cartesian_potential)
     
     self.x0 = [2.550757898788, 2.591553038507, 3.696836364193, 
             2.623281513163, 3.415794212648, 3.310786279789, 
             1.791383852327, 2.264321752809, 4.306217333671, 
             0.761945654023, -0.805817782109, 1.166981882601, 
             0.442065301864, -2.747066418223, -1.784325262714, 
             -1.520905562598, 0.403670860200, -0.729768985400, ]
     self.x0 = np.array(self.x0)
     self.e0 = -17.3387670023
     assert nrigid * 6 == self.x0.size
     
     self.x0atomistic = [ 3.064051819556, 2.474533745459, 3.646107658946,
                         2.412011983074, 2.941152759499, 4.243695098053, 
                         2.176209893734, 2.358972610563, 3.200706335581, 
                         2.786627589565, 3.211876105193, 2.850924310983, 
                         1.962626909252, 3.436918873216, 3.370903763850,
                         3.120590040673, 3.598587659535, 3.710530764535, 
                         1.697360211099, 2.317229950712, 4.823998989452, 
                         2.283487958310, 1.840698306602, 4.168734267290, 
                         1.393303387573, 2.635037001113, 3.925918744272, ]
     self.nrigid = nrigid
Ejemplo n.º 7
0
    def _create_potential(self):
        """construct the potential which will compute the energy and gradient in atomistic (cartesian) coordinates
        
        The bonded (hinged) sides interact with an attractive harmonic potential.  Each atom 
        in the bond has a single interaction partner.
        
        The loosly attractive sides interact with an LJ potential.  These interactions are
        not specific.  Each atom interacts with every other one.
        
        All atoms repel each other with a WCA potential. 
        """
        parser = MolAtomIndexParser(self.aatopology, self.nrigid)
        
        # this is currently only set up for a tetrahedron
        assert self.nrigid == 4
        # do hinges
        harmonic_atoms1 = []
        harmonic_atoms2 = []
        harmonic_atoms1 += parser.get_atom_indices(0, EDGE1_TYPE)
        harmonic_atoms2 += parser.get_atom_indices(1, EDGE1_TYPE)
         
        harmonic_atoms1 += parser.get_atom_indices(0, EDGE2_TYPE)
        harmonic_atoms2 += parser.get_atom_indices(2, EDGE1_TYPE)
        
        harmonic_atoms1 += parser.get_atom_indices(0, EDGE3_TYPE)
        harmonic_atoms2 += parser.get_atom_indices(3, EDGE1_TYPE)
        
        self.harmonic_atoms = np.array(harmonic_atoms1 + harmonic_atoms2, np.integer)

        harmonic_atoms1 = np.array(harmonic_atoms1, dtype=np.integer).ravel()
        harmonic_atoms2 = np.array(harmonic_atoms2, dtype=np.integer).ravel()
        
        
        for i, j in zip(harmonic_atoms1, harmonic_atoms2):
            self.draw_bonds.append((i,j))
        
        # do attractive part
        lj_atoms = []
        lj_atoms += parser.get_atom_indices(1, EDGE2_TYPE)
        lj_atoms += parser.get_atom_indices(1, EDGE3_TYPE)
        lj_atoms += parser.get_atom_indices(2, EDGE2_TYPE)
        lj_atoms += parser.get_atom_indices(2, EDGE3_TYPE)
        lj_atoms += parser.get_atom_indices(3, EDGE2_TYPE)
        lj_atoms += parser.get_atom_indices(3, EDGE3_TYPE)
        lj_atoms = np.array(sorted(lj_atoms)).ravel()
        
        self.lj_atoms = lj_atoms
        
        self.extra_atoms = []
        for i in range(self.nrigid):
            self.extra_atoms += parser.get_atom_indices(i, OTHER_TYPE)
        
        plate_pot = PlatePotential(harmonic_atoms1, harmonic_atoms2, lj_atoms, k=10)
        # wrap it so it can be used with angle axis coordinates
        pot = RBPotentialWrapper(self.aatopology.cpp_topology, plate_pot)
#            self.aasystem.set_cpp_topology(self.pot.topology)
#            raise Exception
        return pot
Ejemplo n.º 8
0
    def get_potential(self):
        """construct the rigid body potential"""
        try:
            return self.pot
        except AttributeError:
            # construct the potential which will compute the energy and gradient in atomistic (cartesian) coordinates
            cartesian_potential = LJ()
            # wrap it so it can be used with angle axis coordinates
            self.pot = RBPotentialWrapper(self.aatopology.cpp_topology, cartesian_potential)
#            self.aasystem.set_cpp_topology(self.pot.topology)
            return self.pot
Ejemplo n.º 9
0
    def get_potential(self):
        """construct the rigid body potential"""
        try:
            return self.pot
        except AttributeError:
            # construct the potential which will compute the energy and gradient 
            # in atomistic (cartesian) coordinates
            # NOTE: Currently the LJCut potential only deals with cubic boxes
            cartesian_potential = LJCut(rcut=self.cut, boxvec=self.boxvec)
#            cartesian_potential = LJCutCellLists(rcut=self.cut, boxvec=self.boxvec)
            # wrap it so it can be used with angle axis coordinates
            self.pot = RBPotentialWrapper(self.aatopology.cpp_topology, cartesian_potential)
#            self.aasystem.set_cpp_topology(self.pot.topology)
            return self.pot
Ejemplo n.º 10
0
 def test_to_atomistic2(self):
     x0 = np.array(range(self.nrigid * 6), dtype=float);
     x2 = x0.reshape([-1,3])
     for p in x2[self.nrigid:,:]:
         p /= np.linalg.norm(p);
     print x0
     print "range to atomistic"
     print x0
     atomistic = self.topology.to_atomistic(x0).flatten()
     print atomistic
     print atomistic.size
     print atomistic[14]
     print atomistic[23]
     
     from pele.potentials import LJ
     lj = LJ()
     e, g = lj.getEnergyGradient(atomistic.reshape(-1))
     grb = self.topology.transform_gradient(x0, g);
     print "transformed gradient"
     print grb
     
     print "rbpotential"
     rbpot = RBPotentialWrapper(self.topology, lj);
     print rbpot.getEnergy(x0);
Ejemplo n.º 11
0
 def setUp(self):
     nrigid = 3
     self.topology = RBTopology()
     self.topology.add_sites([make_otp() for i in range(nrigid)])
     self.topology.finalize_setup()
     
     cartesian_potential = LJ()
     self.pot = RBPotentialWrapper(self.topology, cartesian_potential)
     
     self.x0 = _x03
     self.x0 = np.array(self.x0)
     self.e0 = -17.3387670023
     assert nrigid * 6 == self.x0.size
     
     self.x0atomistic = _x03_atomistic
     self.nrigid = nrigid
Ejemplo n.º 12
0
class TestOTPExplicit(unittest.TestCase):
    def setUp(self):
        nrigid = 3
        self.topology = RBTopology()
        self.topology.add_sites([make_otp() for i in range(nrigid)])
        self.topology.finalize_setup()

        cartesian_potential = LJ()
        self.pot = RBPotentialWrapper(self.topology, cartesian_potential)

        self.x0 = _x03
        self.x0 = np.array(self.x0)
        self.e0 = -17.3387670023
        assert nrigid * 6 == self.x0.size

        self.x0atomistic = _x03_atomistic
        self.nrigid = nrigid

    def test_energy(self):
        e = self.pot.getEnergy(self.x0)
        self.assertAlmostEqual(e, self.e0, delta=1e-4)

    def test_energy_gradient(self):
        e = self.pot.getEnergy(self.x0)
        gnum = self.pot.NumericalDerivative(self.x0)

        e2, g = self.pot.getEnergyGradient(self.x0)
        self.assertAlmostEqual(e, e2, delta=1e-4)

        for i in range(g.size):
            self.assertAlmostEqual(g[i], gnum[i], 2)

    def test_to_atomistic(self):
        xatom = self.topology.to_atomistic(self.x0).flatten()
        for i in range(xatom.size):
            self.assertAlmostEqual(xatom[i], self.x0atomistic[i], 2)

    def test_site_to_atomistic(self):
        rf = make_otp()
        p = np.array([1., 2, 3])
        p /= np.linalg.norm(p)
        com = np.array([4., 5, 6])
        print("otp to atomistic")
        print(rf.to_atomistic(com, p))

        print("otp transform grad")
        g = np.array(list(range(9)), dtype=float).reshape([-1, 3])
        print(g.reshape(-1))

        print(rf.transform_grad(p, g))

    def test_to_atomistic2(self):
        x0 = np.array(list(range(self.nrigid * 6)), dtype=float)
        x2 = x0.reshape([-1, 3])
        for p in x2[self.nrigid:, :]:
            p /= np.linalg.norm(p)
        atomistic = self.topology.to_atomistic(x0).flatten()

        from pele.potentials import LJ
        lj = LJ()
        e, g = lj.getEnergyGradient(atomistic.reshape(-1))
        grb = self.topology.transform_gradient(x0, g)
        rbpot = RBPotentialWrapper(self.topology, lj)
        print(rbpot.getEnergy(x0))
Ejemplo n.º 13
0
class TestOTPExplicit(unittest.TestCase):
    def make_otp(self):
        """this constructs a single OTP molecule"""
        otp = RigidFragment()
        otp.add_atom("O", np.array([0.0, -2. / 3 * np.sin(7. * pi / 24.),
                                    0.0]), 1.)
        otp.add_atom(
            "O",
            np.array([cos(7. * pi / 24.), 1. / 3. * sin(7. * pi / 24.), 0.0]),
            1.)
        otp.add_atom(
            "O",
            np.array([-cos(7. * pi / 24.), 1. / 3. * sin(7. * pi / 24), 0.0]),
            1.)
        otp.finalize_setup()
        return otp

    def setUp(self):
        nrigid = 3
        self.topology = RBTopology()
        self.topology.add_sites([self.make_otp() for i in xrange(nrigid)])
        self.topology.finalize_setup()

        cartesian_potential = LJ()
        self.pot = RBPotentialWrapper(self.topology, cartesian_potential)

        self.x0 = _x03
        self.x0 = np.array(self.x0)
        self.e0 = -17.3387670023
        assert nrigid * 6 == self.x0.size

        self.x0atomistic = _x03_atomistic
        self.nrigid = nrigid

    def test_energy(self):
        e = self.pot.getEnergy(self.x0)
        self.assertAlmostEqual(e, self.e0, delta=1e-4)

    def test_energy_gradient(self):
        e = self.pot.getEnergy(self.x0)
        gnum = self.pot.NumericalDerivative(self.x0)

        e2, g = self.pot.getEnergyGradient(self.x0)
        self.assertAlmostEqual(e, e2, delta=1e-4)

        for i in xrange(g.size):
            self.assertAlmostEqual(g[i], gnum[i], 2)

    def test_to_atomistic(self):
        xatom = self.topology.to_atomistic(self.x0).flatten()
        for i in xrange(xatom.size):
            self.assertAlmostEqual(xatom[i], self.x0atomistic[i], 2)

    def test_site_to_atomistic(self):
        rf = self.make_otp()
        p = np.array([1., 2, 3])
        p /= np.linalg.norm(p)
        com = np.array([4., 5, 6])
        print "otp to atomistic"
        print rf.to_atomistic(com, p)

        print "otp transform grad"
        g = np.array(range(9), dtype=float).reshape([-1, 3])
        print g.reshape(-1)

        print rf.transform_grad(p, g)

    def test_to_atomistic2(self):
        x0 = np.array(range(self.nrigid * 6), dtype=float)
        x2 = x0.reshape([-1, 3])
        for p in x2[self.nrigid:, :]:
            p /= np.linalg.norm(p)
        atomistic = self.topology.to_atomistic(x0).flatten()

        from pele.potentials import LJ
        lj = LJ()
        e, g = lj.getEnergyGradient(atomistic.reshape(-1))
        grb = self.topology.transform_gradient(x0, g)
        rbpot = RBPotentialWrapper(self.topology, lj)
        print rbpot.getEnergy(x0)
Ejemplo n.º 14
0
class TestOTPExplicit(unittest.TestCase):
    
    def setUp(self):
        nrigid = 3
        self.topology = RBTopology()
        self.topology.add_sites([make_otp() for i in range(nrigid)])
        self.topology.finalize_setup()
        
        cartesian_potential = LJ()
        self.pot = RBPotentialWrapper(self.topology, cartesian_potential)
        
        self.x0 = _x03
        self.x0 = np.array(self.x0)
        self.e0 = -17.3387670023
        assert nrigid * 6 == self.x0.size
        
        self.x0atomistic = _x03_atomistic
        self.nrigid = nrigid
    
    def test_energy(self):
        e = self.pot.getEnergy(self.x0)
        self.assertAlmostEqual(e, self.e0, delta=1e-4)

    def test_energy_gradient(self):
        e = self.pot.getEnergy(self.x0)
        gnum = self.pot.NumericalDerivative(self.x0)
         
        e2, g = self.pot.getEnergyGradient(self.x0)
        self.assertAlmostEqual(e, e2, delta=1e-4)
         
        for i in range(g.size):
            self.assertAlmostEqual(g[i], gnum[i], 2)
    
    def test_to_atomistic(self):
        xatom = self.topology.to_atomistic(self.x0).flatten()
        for i in range(xatom.size):
            self.assertAlmostEqual(xatom[i], self.x0atomistic[i], 2)
    
    def test_site_to_atomistic(self):
        rf = make_otp()
        p = np.array([1., 2, 3])
        p /= np.linalg.norm(p)
        com = np.array([4., 5, 6])
        print("otp to atomistic")
        print(rf.to_atomistic(com, p))
        

        print("otp transform grad")
        g = np.array(list(range(9)), dtype=float).reshape([-1,3])
        print(g.reshape(-1))
        
        print(rf.transform_grad(p, g))
    
    def test_to_atomistic2(self):
        x0 = np.array(list(range(self.nrigid * 6)), dtype=float)
        x2 = x0.reshape([-1,3])
        for p in x2[self.nrigid:,:]:
            p /= np.linalg.norm(p)
        atomistic = self.topology.to_atomistic(x0).flatten()
        
        from pele.potentials import LJ
        lj = LJ()
        e, g = lj.getEnergyGradient(atomistic.reshape(-1))
        grb = self.topology.transform_gradient(x0, g)
        rbpot = RBPotentialWrapper(self.topology, lj)
        print(rbpot.getEnergy(x0))
Ejemplo n.º 15
0
class TestOTP(unittest.TestCase):
    
    def make_otp(self):
        """this constructs a single OTP molecule"""
        otp = RigidFragment()
        otp.add_atom("O", np.array([0.0, -2./3 * np.sin( 7.*pi/24.), 0.0]), 1.)
        otp.add_atom("O", np.array([cos( 7.*pi/24.),  1./3. * sin( 7.* pi/24.), 0.0]), 1.)
        otp.add_atom("O", np.array([-cos( 7.* pi/24.),  1./3. * sin( 7.*pi/24), 0.0]), 1.)
        otp.finalize_setup()
        print "otp"
        print otp.atom_positions
        return otp

    
    def setUp(self):
        nrigid = 3
        self.topology = RBTopology()
        self.topology.add_sites([self.make_otp() for i in xrange(nrigid)])
        
        cartesian_potential = LJ()
        self.pot = RBPotentialWrapper(self.topology, cartesian_potential)
        
        self.x0 = [2.550757898788, 2.591553038507, 3.696836364193, 
                2.623281513163, 3.415794212648, 3.310786279789, 
                1.791383852327, 2.264321752809, 4.306217333671, 
                0.761945654023, -0.805817782109, 1.166981882601, 
                0.442065301864, -2.747066418223, -1.784325262714, 
                -1.520905562598, 0.403670860200, -0.729768985400, ]
        self.x0 = np.array(self.x0)
        self.e0 = -17.3387670023
        assert nrigid * 6 == self.x0.size
        
        self.x0atomistic = [ 3.064051819556, 2.474533745459, 3.646107658946,
                            2.412011983074, 2.941152759499, 4.243695098053, 
                            2.176209893734, 2.358972610563, 3.200706335581, 
                            2.786627589565, 3.211876105193, 2.850924310983, 
                            1.962626909252, 3.436918873216, 3.370903763850,
                            3.120590040673, 3.598587659535, 3.710530764535, 
                            1.697360211099, 2.317229950712, 4.823998989452, 
                            2.283487958310, 1.840698306602, 4.168734267290, 
                            1.393303387573, 2.635037001113, 3.925918744272, ]
        self.nrigid = nrigid
    
    def test_energy(self):
        e = self.pot.getEnergy(self.x0)
        self.assertAlmostEqual(e, self.e0, delta=1e-4)

    def test_energy_gradient(self):
        e = self.pot.getEnergy(self.x0)
        gnum = self.pot.NumericalDerivative(self.x0)
         
        e2, g = self.pot.getEnergyGradient(self.x0)
        self.assertAlmostEqual(e, e2, delta=1e-4)
         
        for i in xrange(g.size):
            self.assertAlmostEqual(g[i], gnum[i], 2)
    
    def test_to_atomistic(self):
        xatom = self.topology.to_atomistic(self.x0).flatten()
        for i in xrange(xatom.size):
            self.assertAlmostEqual(xatom[i], self.x0atomistic[i], 2)
    
    def test_site_to_atomistic(self):
        rf = self.make_otp()
        p = np.array([1., 2, 3])
        p /= np.linalg.norm(p)
        com = np.array([4., 5, 6])
        print "otp to atomistic"
        print rf.to_atomistic(com, p)
        

        print "otp transform grad"
        g = np.array(range(9), dtype=float).reshape([-1,3])
        print g.reshape(-1)
        
        print rf.transform_grad(p, g)
    
    def test_to_atomistic2(self):
        x0 = np.array(range(self.nrigid * 6), dtype=float);
        x2 = x0.reshape([-1,3])
        for p in x2[self.nrigid:,:]:
            p /= np.linalg.norm(p);
        print x0
        print "range to atomistic"
        print x0
        atomistic = self.topology.to_atomistic(x0).flatten()
        print atomistic
        print atomistic.size
        print atomistic[14]
        print atomistic[23]
        
        from pele.potentials import LJ
        lj = LJ()
        e, g = lj.getEnergyGradient(atomistic.reshape(-1))
        grb = self.topology.transform_gradient(x0, g);
        print "transformed gradient"
        print grb
        
        print "rbpotential"
        rbpot = RBPotentialWrapper(self.topology, lj);
        print rbpot.getEnergy(x0);
Ejemplo n.º 16
0
class TestOTPExplicit(unittest.TestCase):
    
    def make_otp(self):
        """this constructs a single OTP molecule"""
        otp = RigidFragment()
        otp.add_atom("O", np.array([0.0, -2./3 * np.sin( 7.*pi/24.), 0.0]), 1.)
        otp.add_atom("O", np.array([cos( 7.*pi/24.),  1./3. * sin( 7.* pi/24.), 0.0]), 1.)
        otp.add_atom("O", np.array([-cos( 7.* pi/24.),  1./3. * sin( 7.*pi/24), 0.0]), 1.)
        otp.finalize_setup()
        return otp

    
    def setUp(self):
        nrigid = 3
        self.topology = RBTopology()
        self.topology.add_sites([self.make_otp() for i in xrange(nrigid)])
        self.topology.finalize_setup()
        
        cartesian_potential = LJ()
        self.pot = RBPotentialWrapper(self.topology, cartesian_potential)
        
        self.x0 = _x03
        self.x0 = np.array(self.x0)
        self.e0 = -17.3387670023
        assert nrigid * 6 == self.x0.size
        
        self.x0atomistic = _x03_atomistic
        self.nrigid = nrigid
    
    def test_energy(self):
        e = self.pot.getEnergy(self.x0)
        self.assertAlmostEqual(e, self.e0, delta=1e-4)

    def test_energy_gradient(self):
        e = self.pot.getEnergy(self.x0)
        gnum = self.pot.NumericalDerivative(self.x0)
         
        e2, g = self.pot.getEnergyGradient(self.x0)
        self.assertAlmostEqual(e, e2, delta=1e-4)
         
        for i in xrange(g.size):
            self.assertAlmostEqual(g[i], gnum[i], 2)
    
    def test_to_atomistic(self):
        xatom = self.topology.to_atomistic(self.x0).flatten()
        for i in xrange(xatom.size):
            self.assertAlmostEqual(xatom[i], self.x0atomistic[i], 2)
    
    def test_site_to_atomistic(self):
        rf = self.make_otp()
        p = np.array([1., 2, 3])
        p /= np.linalg.norm(p)
        com = np.array([4., 5, 6])
        print "otp to atomistic"
        print rf.to_atomistic(com, p)
        

        print "otp transform grad"
        g = np.array(range(9), dtype=float).reshape([-1,3])
        print g.reshape(-1)
        
        print rf.transform_grad(p, g)
    
    def test_to_atomistic2(self):
        x0 = np.array(range(self.nrigid * 6), dtype=float)
        x2 = x0.reshape([-1,3])
        for p in x2[self.nrigid:,:]:
            p /= np.linalg.norm(p)
        atomistic = self.topology.to_atomistic(x0).flatten()
        
        from pele.potentials import LJ
        lj = LJ()
        e, g = lj.getEnergyGradient(atomistic.reshape(-1))
        grb = self.topology.transform_gradient(x0, g)
        rbpot = RBPotentialWrapper(self.topology, lj)
        print rbpot.getEnergy(x0)