Exemplo n.º 1
0
def test_benzene_rpa():
    coords, species, vol_ratios = benzene_dimer[0]
    alpha_0, C6, R_vdw = from_volumes(species, vol_ratios)
    ene = MBDGeom(coords, do_rpa=True).mbd_energy(
        alpha_0, C6, R_vdw, 0.83, variant='plain'
    )
    assert ene == approx(-0.007002398506090302, rel=1e-9)
Exemplo n.º 2
0
def test_mbd_coulomb():
    a = 14.4
    beta = 2.0
    enes = []
    for coords, species, vol_ratios in peptide_meoh:
        geom = MBDGeom(coords, get_spectrum=True)
        _, eigs, C = geom.mbd_energy_species(species, vol_ratios, beta=0.83)
        omega_t = np.sqrt(eigs)
        alpha_0, C6, R_vdw = from_volumes(species, vol_ratios)
        omega = 4 * C6 / (3 * alpha_0 ** 2)
        charges = np.ones_like(alpha_0)
        masses = 1 / (alpha_0 * omega ** 2)
        ecoul = geom.coulomb_energy(
            charges, masses, omega_t, 'fermi', R_vdw, beta, a, C
        )
        edip = geom.dipole_energy(
            alpha_0, omega, omega_t, 'fermi,dip', R_vdw, beta, a, C
        )
        C = np.identity(len(omega_t))
        omega_non = np.repeat(omega, 3)
        ecoul_non = geom.coulomb_energy(
            charges, masses, omega_non, 'fermi', R_vdw, beta, a, C
        )
        edip_non = geom.dipole_energy(
            alpha_0, omega, omega_t, 'fermi,dip', R_vdw, beta, a, C
        )
        enes.append(ecoul - edip - (ecoul_non - edip_non))
    ene_int = enes[2] - enes[0] - enes[1]
    assert ene_int == approx(0.0002460638172163822 / 627.503, rel=1e-10)
Exemplo n.º 3
0
    def _set_vdw_parameters(self, atoms=None):
        #TODO: add functionality:
        #        . fractional ionic
        #        . RvdW from alpha

        if hasattr(self, 'custom_beta'):
            self.beta = self.custom_beta
        else:
            self.beta = beta_from_xc(self.xc)

        self.alpha0_TS, self.C6_TS, self.RvdW_TS = \
                from_volumes(atoms.get_chemical_symbols(), self.a_div_a0)