Exemplo n.º 1
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)
Exemplo n.º 2
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)
Exemplo n.º 3
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()
Exemplo n.º 4
0
 def setUp(self):
     natoms = 50
     rcut = 1.6
     ntypeA = int(natoms * 0.8)
     self.x0 = _x0.copy()
     boxl = 7.
     boxvec = np.array([boxl] * 3)
     self.pot = BLJCut(natoms, ntypeA, rcut=rcut, boxvec=boxvec)
     self.pot_fortran = LJpshift(natoms, ntypeA, boxl=boxl, rcut=rcut)
     self.e0 = 6971.685336750815
Exemplo n.º 5
0
    def setUp(self):
        natoms = 50
        rcut = 1.6
        ntypeA = int(natoms * 0.8)
        self.x0 = _x0.copy()
        self.pot = BLJCut(natoms, ntypeA, rcut=rcut)

        self.e0 = 1412.0144910476681

        self.pot_fortran = LJpshift(natoms, ntypeA, rcut=rcut)
Exemplo n.º 6
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()
Exemplo n.º 7
0
    def setUp(self):
        np.random.seed(1)
        current_dir = os.path.dirname(__file__)
        xyz = read_xyz(open(current_dir + "/_blj13_min.xyz", "r"))
        self.xmin = xyz.coords.reshape(-1).copy()
        ntypeA, self.Emin, rcut, epsAA, sigAA, epsBB, sigBB, epsAB, sigAB = list(map(float, xyz.title.split()[1::2]))
        ntypeA = int(ntypeA)
        self.rcut = rcut

        natoms = self.xmin.size // 3

        self.pot = BLJCut(natoms, ntypeA, rcut=rcut, sigAA=sigAA, epsAA=epsAA,
                          epsBB=epsBB, sigBB=sigBB, epsAB=epsAB, sigAB=sigAB)
        self.xrandom = np.random.uniform(-1, 1, self.xmin.size) * 5.
Exemplo n.º 8
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)
Exemplo n.º 9
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)