示例#1
0
def test_water_631ppgss():
    mol = Molecule(geometry=water, basis='6-31ppgss')
    mol.RHF()
    #p 6D int=acc2e=14 scf(conver=12) rhf/6-31++G** symmetry=none
    assert_allclose(mol.energy.real, -75.9924381487, atol=1e-12)
    ref_dipole = np.array([0.0, 2.4046, 0.0])
    assert_allclose(mol.mu, ref_dipole, atol=1e-4)
示例#2
0
def test_mp2_spinorbital():
    helium_dimer = """
    0 1
    He   0.0 0.0 0.0
    He   0.0 0.0 0.75
    """
    
    # init molecule and build integrals
    mol = Molecule(geometry=helium_dimer,basis='cc-pvDZ')
    
    # do the SCF
    mol.RHF()
    
    # do MP2
    PostSCF(mol).MP2()
    emp2_spatial = mol.emp2.real
    PostSCF(mol).MP2(spin_orbital=True)
    emp2_spin = mol.emp2.real
   
    # consistency check 
    assert np.allclose(emp2_spatial,emp2_spin)
    
    # G16 reference SCF energy
    assert np.allclose(-5.29648041091,mol.energy.real)
    
    # G16 reference MP2 energy
    assert np.allclose(-5.3545864180140,emp2_spatial)
示例#3
0
def test_formaldehyde_sto3g():
    mol = Molecule(geometry=formaldehyde, basis='sto-3g')
    mol.RHF()
    #p 6D int=acc2e=14 scf(conver=12) rhf/6-31++G** symmetry=none
    assert_allclose(mol.energy.real, -112.351590112, atol=1e-12)
    ref_dipole = np.array([0.0, 0.0, -1.4821])
    assert_allclose(mol.mu, ref_dipole, atol=1e-4)
示例#4
0
def test_hydrogen_sto3g():
    mol = Molecule(geometry=hydrogen, basis='sto-3g')
    mol.RHF()
    assert_allclose(mol.energy.real, -1.11675930740, atol=1e-12)
    mol.forces()
    ref_forces = np.array([[0.000000000, -0.000000000, -0.027679601],
                           [-0.000000000, 0.000000000, 0.027679601]])
    assert_allclose(mol._forces, ref_forces, atol=1e-12)
示例#5
0
def test_tdhf():

    water = """
    0 1
    O    0.000000      -0.075791844    0.000000
    H    0.866811829    0.601435779    0.000000
    H   -0.866811829    0.601435779    0.000000
    """

    # init molecule and build integrals
    mol = Molecule(geometry=water, basis='sto-3g')

    # do the SCF
    mol.RHF()

    # now do TDHF
    PostSCF(mol).TDHF()

    # G16 reference UTDHF excitation energies (full; no FC, 50-50, nosym)
    # note I have manually expanded triplets in G16 to the full degeneracy
    # because at this moment we don't handle spin conserved excitations
    '''
    # td(nstates=100,50-50,full) nosymm uhf/sto-3g int=acc2e=14
    
    test
    
    0 1
    O    0.000000      -0.075791844    0.000000
    H    0.866811829    0.601435779    0.000000
    H   -0.866811829    0.601435779    0.000000

    '''

    gau_ref = [7.7597,7.7597,7.7597,8.1564,8.1564,8.1564,9.5955,9.5955,9.5955,\
               9.6540]

    assert np.allclose(np.asarray(gau_ref), mol.tdhf_omega[:10])

    ref_omega = mol.tdhf_omega

    # check consistency in solution algorithms for TDHF
    PostSCF(mol).TDHF(alg='reduced')
    assert np.allclose(mol.tdhf_omega, ref_omega)
    PostSCF(mol).TDHF(alg='full')
    assert np.allclose(mol.tdhf_omega, ref_omega)
示例#6
0
def test_cisd():

    water = """
    0 1
    O    0.000000      -0.075791844    0.000000
    H    0.866811829    0.601435779    0.000000
    H   -0.866811829    0.601435779    0.000000
    """

    # init molecule and build integrals
    mol = Molecule(geometry=water, basis='sto-3g')

    # do the SCF
    mol.RHF()

    # now do FCI
    PostSCF(mol).CISD()

    # G16 reference SCF energy
    assert np.allclose(-74.9420799245, mol.energy.real)

    # G16 reference CISD energy
    assert np.allclose(-75.011223006, mol.ecisd.real)
示例#7
0
def test_fci():

    water = """
    0 1
    O    0.000000      -0.075791844    0.000000
    H    0.866811829    0.601435779    0.000000
    H   -0.866811829    0.601435779    0.000000
    """

    # init molecule and build integrals
    mol = Molecule(geometry=water, basis='sto-3g')

    # do the SCF
    mol.RHF()

    # now do FCI
    PostSCF(mol).FCI()

    # Psi4 reference SCF energy
    assert np.allclose(-74.9420798986, mol.energy.real)

    # Psi4 reference FCI energy
    assert np.allclose(-75.0129801827, mol.efci.real)
示例#8
0
def test_cis():

    water = """
    0 1
    O    0.000000      -0.075791844    0.000000
    H    0.866811829    0.601435779    0.000000
    H   -0.866811829    0.601435779    0.000000
    """

    # init molecule and build integrals
    mol = Molecule(geometry=water, basis='3-21G')

    # do the SCF
    mol.RHF()

    # now do FCI
    PostSCF(mol).CIS()

    # G16 reference UCIS excitation energies (full; no FC, 50-50, nosym)
    # note I have manually expanded triplets in G16 to the full degeneracy
    # because at this moment we don't handle spin conserved excitations
    '''
    #p cis(nstate=40,full) uhf/3-21G int=acc2e=14 nosymm

    water
    
    0 1
    O    0.000000      -0.075791844    0.000000
    H    0.866811829    0.601435779    0.000000
    H   -0.866811829    0.601435779    0.000000

    '''

    gau_ref = [6.5822,6.5822,6.5822,7.7597,7.8156,7.8156,7.8156,8.4377,8.4377, \
               8.4377, 9.0903,9.0903,9.0903,9.3334,10.5493]

    assert np.allclose(np.asarray(gau_ref), mol.cis_omega[:15])
示例#9
0
# a a half of a femtosecond of molecular dynamics and plots
# energy as a function of time

# Molecular geometry input
h2 = """
0 1
H 0.0 0.0 0.74
H 0.0 0.0 0.00
"""

# init molecule and build integrals
mol = Molecule(geometry=h2,basis='sto-3g')
mol.build()

# do the SCF, compute initial forces on the atoms
mol.RHF()
mol.forces()

# BOMD parameters
dt = 5     # time step
steps = 100  # number steps

# saved lists for plotting data
X = []
Y = []
Z = []
E = []

# main BOMD loop
for _ in tqdm(range(steps)):
    # update positions
示例#10
0
def test_water_321g():
    mol = Molecule(geometry=water, basis='3-21g')
    mol.RHF()
    assert_allclose(mol.energy.real, -75.5613125965, atol=1e-12)
示例#11
0
import numpy as np
from mmd.molecule import Molecule
from mmd.realtime import RealTime
from mmd.utils.spectrum import genSpectra

hydrogen = """
0 1
H  0.0 0.0 0.0  
H  0.0 0.0 0.74 
"""

# init molecule and build integrals
mol = Molecule(geometry=hydrogen, basis='3-21G')

# do the SCF
mol.RHF()


# define the applied field envelope as a function of time
# here, is is a narrow gaussian envelope centered at t = 0.
def gaussian(t):
    return np.exp(-50 * (t**2))


# create realtime object, setting parameters and pulse envelopes
rt = RealTime(mol, numsteps=1000, stepsize=0.05, field=0.0001, pulse=gaussian)

# propagate with Magnus2
rt.Magnus2(direction='z')
m2 = rt.dipole
示例#12
0
def test_water_DZ():
    mol = Molecule(geometry=water, basis='DZ')
    mol.RHF()
    assert_allclose(mol.energy.real, -75.977878975377, atol=1e-12)
    ref_dipole = np.array([0.0, 2.7222, 0.0])
    assert_allclose(mol.mu, ref_dipole, atol=1e-4)
示例#13
0
def test_methane_321g():
    mol = Molecule(geometry=methane, basis='3-21G')
    mol.RHF(direct=False)  # we need the two-electron integrals
    PostSCF(mol).MP2()
    assert_allclose(mol.energy.real, -39.9768654272)
    assert_allclose(mol.emp2.real, -40.076963354817)
示例#14
0
文件: test010.py 项目: trex47/MD-copy
def test_methane_sto3g():
    mol = Molecule(geometry=methane, basis='sto-3g')
    mol.RHF(direct=True)
    assert_allclose(mol.energy.real, -39.726850324347, atol=1e-12)
示例#15
0
def test_water_sto3g():
    mol = Molecule(geometry=water, basis='sto-3g')
    mol.RHF(conver=1e-14)
    assert_allclose(mol.energy.real, -74.942079928192, atol=1e-12)
    ref_dipole = np.array([0.0, 1.5340, 0.0])
    assert_allclose(mol.mu, ref_dipole, atol=1e-4)
示例#16
0
文件: test007.py 项目: trex47/MD-copy
def test_helium_ccpvtz():
    mol = Molecule(geometry=helium, basis='cc-pvtz')
    mol.RHF()
    assert_allclose(mol.energy.real, -2.86115357403, atol=1e-12)