def dipole(atomtype, coordinates, connectivity, ATOM, MPOLE, CHGPEN, POLARIZE, REPEL): ATOMID = katom.returnatomid(atomtype, coordinates, connectivity, ATOM, MPOLE, CHGPEN, POLARIZE, REPEL) config.rotmat(ATOMID) em, eminter, nem = empole3.empole3a(ATOMID) config.dfield0(ATOMID) induce.induce0m(ATOMID) dx, dy, dz, qdx, qdy, qdz = epolar3.compute_dipoles(ATOMID) print(template.header) print(template.analyze_m.format(dx, dy, dz, qdx, qdy, qdz))
def test_epolar3m(self): kep = -0.96210636 knep = 27 tconfig.setup(key, xyz, dloop=True) config.rotmat(tconfig.ATOMID) config.dfield0(tconfig.ATOMID) induce.induce0m(tconfig.ATOMID) ep, einter, nep = epolar3.epolar3m(tconfig.ATOMID) self.assertEqual(round(kep, 4), round(ep, 4)) self.assertEqual(knep, nep)
def test_epolar3a(self): kep = -0.96210636 keinter = -0.96210636 knep = 9 tconfig.setup(key, xyz, dloop=True) config.rotmat(tconfig.ATOMID) config.dfield0(tconfig.ATOMID) induce.induce0m(tconfig.ATOMID) config.param_dict['epolar3a'] = True ep, einter, nep = epolar3.epolar3(tconfig.ATOMID) self.assertEqual(round(kep, 4), round(ep, 4)) self.assertEqual(round(keinter, 4), round(einter, 4)) self.assertEqual(knep, nep)
def energy(atomtype, coordinates, connectivity, ATOM, MPOLE, CHGPEN, POLARIZE, REPEL): ATOMID = katom.returnatomid(atomtype, coordinates, connectivity, ATOM, MPOLE, CHGPEN, POLARIZE, REPEL) config.rotmat(ATOMID) em, eminter, nem = empole3.empole3a(ATOMID) config.dfield0(ATOMID) if len(ATOM) == len(REPEL): config.rfield0(ATOMID) if len(ATOM) == len(POLARIZE): induce.induce0m(ATOMID) ep, epinter, nep = epolar3.epolar3(ATOMID) else: ep, epinter, nep = 0,0,0 if len(ATOM) == len(REPEL): er, erinter, ner = erepel3.erepel3a(ATOMID) else: er, erinter, ner = 0,0,0 exchind, exchind_inter, exchind_ne = erepel3.exchangeinduce(ATOMID) e = em + ep + er + exchind einter = eminter + epinter + erinter + exchind_inter print(template.header) print(template.analyze_e.format(einter, e, em, nem, er, ner, ep, nep, exchind, exchind_ne, ep+exchind))
def test_induce0m(self): kuind = [[2.38082614e-02, -7.18338014e-20, 4.60949086e-03], [3.35357882e-02, 6.41583027e-19, 8.46639724e-04], [9.13084719e-03, 9.98402841e-20, -5.18881980e-03], [4.11632270e-02, -1.59110481e-19, -8.14876329e-03], [6.05978292e-03, 5.06831844e-03, -5.04490841e-03], [6.05978292e-03, -5.06831844e-03, -5.04490841e-03]] tconfig.setup(key, xyz, dloop=True) config.rotmat(tconfig.ATOMID) config.dfield0(tconfig.ATOMID) induce.induce0m(tconfig.ATOMID) n = len(tconfig.ATOMID) for i in range(n): self.assertListEqual(list(np.round(kuind[i], 3)), list(np.round(tconfig.ATOMID[i].uind, 3)))