Ejemplo n.º 1
0
def makeplot():  # pragma: no cover
    atom1 = np.zeros(3)
    rcut = 2.5
    potAA = BLJCut(2, 0, rcut=rcut)
    potAB = BLJCut(2, 1, rcut=rcut)
    potBB = BLJCut(2, 2, rcut=rcut)
    eAA = []
    eAB = []
    eBB = []
    v = vec_random_ndim(3)
    v /= np.linalg.norm(v)
    rlist = np.arange(.85, 3, .01)
    for r in rlist:
        atom2 = atom1 + r * v
        x = np.array(list(atom1) + list(atom2))
        eAA.append(potAA.getEnergy(x))
        eAB.append(potAB.getEnergy(x))
        eBB.append(potBB.getEnergy(x))

    import matplotlib.pyplot as plt

    plt.plot(rlist, eAA)
    plt.plot(rlist, eAB)
    plt.plot(rlist, eBB)
    plt.show()
Ejemplo n.º 2
0
def makeplot():  # pragma: no cover
    atom1 = np.zeros(3)
    rcut = 2.5
    potAA = BLJCut(2, 0, rcut=rcut)
    potAB = BLJCut(2, 1, rcut=rcut)
    potBB = BLJCut(2, 2, rcut=rcut)
    eAA = []
    eAB = []
    eBB = []
    v = vec_random_ndim(3)
    v /= np.linalg.norm(v)
    rlist = np.arange(.85, 3, .01)
    for r in rlist:
        atom2 = atom1 + r * v
        x = np.array(list(atom1) + list(atom2))
        eAA.append(potAA.getEnergy(x))
        eAB.append(potAB.getEnergy(x))
        eBB.append(potBB.getEnergy(x))

    import matplotlib.pyplot as plt

    plt.plot(rlist, eAA)
    plt.plot(rlist, eAB)
    plt.plot(rlist, eBB)
    plt.show()
Ejemplo n.º 3
0
 def test_rcut2(self):
     pot = BLJCut(2, 1, rcut=self.rcut)
     atom2 = self.atom1 + self.rcut * 0.7 * self.v
     # print np.linalg.norm(atom2 - self.atom1)
     x = np.array(list(self.atom1) + list(atom2))
     e = pot.getEnergy(x)
     self.assertGreater(np.abs(e), 1e-5)
Ejemplo n.º 4
0
 def test_rcut2(self):
     pot = BLJCut(2, 1, rcut=self.rcut)
     atom2 = self.atom1 + self.rcut * 0.7 * self.v
     # print np.linalg.norm(atom2 - self.atom1)
     x = np.array(list(self.atom1) + list(atom2))
     e = pot.getEnergy(x)
     self.assertGreater(np.abs(e), 1e-5)
Ejemplo n.º 5
0
 def test_rcut(self):
     pot = BLJCut(2, 1, rcut=self.rcut)
     atom2 = self.atom1 + self.rcut * 1.001 * self.v
     x = np.array(list(self.atom1) + list(atom2))
     e = pot.getEnergy(x)
     self.assertLess(e, 1e-20)
Ejemplo n.º 6
0
 def test_rcut(self):
     pot = BLJCut(2, 1, rcut=self.rcut)
     atom2 = self.atom1 + self.rcut * 1.001 * self.v
     x = np.array(list(self.atom1) + list(atom2))
     e = pot.getEnergy(x)
     self.assertLess(e, 1e-20)