Example #1
0
def test_sum_mep():
    reactant = ReactantComplex(Molecule(smiles='C', charge=0, mult=1))
    product = ProductComplex(Molecule(smiles='C', charge=0, mult=1))
    product.graph.remove_edge(0, 1)
    product.graph.remove_edge(0, 2)

    # Fictitious PES
    pes = PES2d(reactant,
                product,
                r1s=np.linspace(1, 2, 3),
                r1_idxs=(0, 1),
                r2s=np.linspace(1, 2, 3),
                r2_idxs=(0, 2))

    # Energies are all 0 apart from at the 'saddle point' (1, 1)
    for i in range(3):
        for j in range(3):
            pes.species[i, j] = deepcopy(reactant)
            pes.species[i, j].energy = 0

            if i == j == 2:
                pes.species[i, j].graph = product.graph

    pes.species[1, 1].energy = 1
    mep_sum = mep.get_sum_energy_mep(saddle_point_r1r2=(1.5, 1.5), pes_2d=pes)

    # Energy over the saddle point is 1 both sides -> 2 Ha
    assert mep_sum == 2
Example #2
0
def test_get_closest_species():

    assert type(get_closest_species(pes=pes, point=(0, 0))) is ReactantComplex
    assert type(get_closest_species(pes=pes, point=(1, 1))) is ReactantComplex

    pes2 = PES2d(reactant=reactant, product=product,
                 r1s=np.linspace(1, 5, 5), r1_idxs=(0, 1),
                 r2s=np.linspace(1, 5, 5), r2_idxs=(2, 3))

    with pytest.raises(NoClosestSpecies):
        get_closest_species(pes=pes2, point=(4, 4))
Example #3
0
from autode.mol_graphs import make_graph
from autode.exceptions import NoClosestSpecies
from autode.pes.pes import FormingBond, BreakingBond
from autode.reactions.reaction import Reaction
from autode.species.molecule import Reactant, Product
import pytest
import numpy as np

mol = Species(name='H2', charge=0, mult=1, atoms=[Atom('H'), Atom('H', z=1.0)])
make_graph(mol)
reactant = ReactantComplex(mol, mol)
product = ProductComplex(mol, mol)

pes = PES2d(reactant=reactant,
            product=reactant,
            r1s=np.linspace(1, 3, 3),
            r1_idxs=(0, 1),
            r2s=np.linspace(1, 0, 2),
            r2_idxs=(2, 3))


def test_2d_pes_class():

    assert reactant.n_atoms == 4

    assert pes.rs.shape == (3, 2)
    assert pes.species.shape == (3, 2)

    assert pes.rs[0, 0] == (1, 1)
    assert pes.rs[1, 1] == (2, 0)
    assert pes.rs[2, 1] == (3, 0)