コード例 #1
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)
コード例 #2
0
# 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
    for atom in mol.atoms: