Beispiel #1
0
  def test_qcnm_two_displace(self):
    qcnm = interaction.QCNM(5.4, 25.93, 1.757, 6.2, 1.771, 3, 3.35, 5.0/6.0, "Displace")
    vcut = -0.070061513109323251

    Vn = lambda r: 25.93*((1.757/r)**6.2 - (1.771/r)**3)/(1+np.exp((r-3.35)*1.2))
    Fn = lambda r: 25.93*( (6.2*(1.757/r)**6.2 - 3*(1.771/r)**3)/(r*( 1 + np.exp((r-3.35)*1.2) )) +
    ((1.757/r)**6.2 - (1.771/r)**3)*1.2*np.exp((r-3.35)*1.2)/(( 1 + np.exp((r-3.35)*1.2))**2)  )

    f = qcnm.pair_force(np.array([1.74397555, 0.0, 0.0]),
                      np.array([0.0, 0.0, 0.0]))
    e = qcnm.pair_energ(np.array([1.74397555, 0.0, 0.0]),
                      np.array([0.0, 0.0, 0.0]))
    np.testing.assert_almost_equal(e, Vn(1.74397555)-vcut, 5)
    np.testing.assert_array_almost_equal(f, np.array([Fn(1.74397555), 0, 0]), 2)
    f = qcnm.pair_force(np.array([0.0, 2.1376525, 0.0]),
                      np.array([0.0, 0.0, 0.0]))
    e = qcnm.pair_energ(np.array([0.0, 2.1376525, 0.0]),
                      np.array([0.0, 0.0, 0.0]))
    np.testing.assert_array_almost_equal(f, np.zeros(3), 5)
    np.testing.assert_almost_equal(e, Vn(2.1376525)-vcut, 5)
    f = qcnm.pair_force(np.array([0.0, 7.0, 0.0]),
                      np.array([0.0, 0.0, 0.0]))
    e = qcnm.pair_energ(np.array([0.0, 7.0, 0.0]),
                      np.array([0.0, 0.0, 0.0]))
    np.testing.assert_array_almost_equal(f, np.zeros(3))
    np.testing.assert_almost_equal(e, 0.0)
Beispiel #2
0
 def test_qcnm_forces_diff(self):
   qcnm = interaction.QCNM(5.4, 25.93, 1.757, 6.2, 1.771, 3, 3.35, 5.0/6.0, "Displace")
   f, e = qcnm.forces(self.four_by3, self.four_by3, pairs=np.array([[0, 2], [0, 3], [1, 2], [1, 3]], dtype=np.int64))
   force_by_hand = np.array([[4633.5736442640737, 0.0, 0.0], [6.4549676553989599, 0.0, 0.0],
                             [-4640.0286119194725, 0.0, 0.0], [0.0, 0.0, 0.0]])
   np.testing.assert_array_almost_equal(f, force_by_hand, 3)
Beispiel #3
0
 def test_qcnm_forces_equal(self):
   qcnm = interaction.QCNM(5.4, 25.93, 1.757, 6.2, 1.771, 3, 3.35, 5.0/6.0, "Displace")
   f, e = qcnm.forces(self.four_by3, self.four_by3)
   force_by_hand = np.array([[0.0, 0.0, 0.0], [4640.0286119194725, 0.0, 0.0],
                             [-4640.0286119194725, 0.0, 0.0], [0.0, 0.0, 0.0]])
   np.testing.assert_array_almost_equal(f, force_by_hand, 2)
Beispiel #4
0
 def test_create_qcnm(self):
   interaction.QCNM(5.4, 25.93, 1.757, 6.2, 1.771, 3, 3.35, 5.0/6.0, "None")