Example #1
0
def test__ring_puckering():
    smi = 'CC1CCCCC1'
    ich = smiles.inchi(smi)
    geo = inchi.geometry(ich)
    zma = geom.zmatrix(geo)
    gra = zmat.graph(zma)
    rings_atoms = graph.rings_atom_keys(gra)
    val_dct = zmat.value_dictionary(zma)
    coos = zmat.coordinates(zma)
    geo = zmat.geometry(zma)
    da_names = zmat.dihedral_angle_names(zma)

    for ring_atoms in rings_atoms:
        rotate_hyds = []
        ngbs = graph.atom_sorted_neighbor_atom_keys(gra, ring_atoms[0])
        symbs = geom.symbols(geo)
        for ngb in ngbs:
            if symbs[ngb] == 'H':
                rotate_hyds.append(ngb)
        ring_value_dct = {}
        for da_name in da_names:
            da_idxs = list(coos[da_name])[0]
            if len(list(set(da_idxs) & set(ring_atoms))) == 4:
                print(da_name, da_idxs)
                ring_value_dct[da_name] = val_dct[da_name]
        dist_value_dct = {}
        for i, _ in enumerate(ring_atoms):
            dist_value_dct[i] = zmat.distance(zma, ring_atoms[i - 1],
                                              ring_atoms[i])

        samp_range_dct = {}
        for key, value in ring_value_dct.items():
            samp_range_dct[key] = (value - numpy.pi / 4, value + numpy.pi / 4)

        print(zmat.samples(zma, 5, samp_range_dct))
Example #2
0
def test__change_zmatrix_row_values():
    """ test automol.geom.change_zmatrix_row_values
    """
    ref_geo = (('O', (0.0, 0.0, 0.0)), ('C', (0.0, 0.0, 2.6100437640951895)),
               ('H', (0.0, 1.795784435, -0.9004532847666584)),
               ('N', (2.149523799, 1.6103368939, 3.8411840715311034)),
               ('H', (3.101869570, 0.04614797866, 4.810112185573969)),
               ('H', (1.052147147, 2.2771937846, 5.430572110076959)))
    ref_zma = geom.zmatrix(ref_geo)
    ref_vals = geom.zmatrix_row_values(ref_geo, 3, idx1=1, idx2=0, idx3=2)

    geo = geom.change_zmatrix_row_values(ref_geo,
                                         3,
                                         dist=1.0,
                                         idx1=1,
                                         ang=120.,
                                         idx2=0,
                                         dih=0.,
                                         idx3=2)

    # First, check that the change resulted in these values
    vals = geom.zmatrix_row_values(geo, 3, idx1=1, idx2=0, idx3=2)
    assert numpy.allclose(vals, (1., 120., 0.))

    # Now, check that the other z-matrix values weren't affected. To do so,
    # change back to the original values and compare z-matrices.
    geo = geom.change_zmatrix_row_values(geo,
                                         3,
                                         dist=ref_vals[0],
                                         idx1=1,
                                         ang=ref_vals[1],
                                         idx2=0,
                                         dih=ref_vals[2],
                                         idx3=2)
    zma = geom.zmatrix(geo)
    assert automol.zmat.almost_equal(zma, ref_zma)
Example #3
0
import routines.pf.thermo as thermo
from autofile import io_ as io
from automol import geom

geostr = io.read_file('geom.xyz')
geo = geom.from_string(geostr)
zma = geom.zmatrix(geo, [[1, 5], [5, 6]])
frm_key = [5, 6]
brk_key = [1, 5]
rxnclass = 'h_abstraction'

thermo.heatform.get_cbhzed_ts(zma, rxnclass, frm_key, brk_key)
Example #4
0
ICH1 = 'InChI=1S/C6H12/c1-2-4-6-5-3-1/h1-6H2'
# benzene
ICH2 = 'InChI=1S/C6H6/c1-2-4-6-5-3-1/h1-6H'
# cyclic-ether
ICH3 = 'InChI=1S/C7H14O/c1-2-4-6-8-7-5-3-1/h1-7H2'
# 1-propylcyclopentane
ICH4 = 'InChI=1S/C8H16/c1-2-5-8-6-3-4-7-8/h8H,2-7H2,1H3'
# polycycle: cyclohexane+cyclopentane
ICH5 = 'InChI=1S/C9H16/c1-2-5-9-7-3-6-8(9)4-1/h8-9H,1-7H2/t8-,9-/m1/s1'

GEO1 = inchi.geometry(ICH1)
GEO2 = inchi.geometry(ICH2)
GEO3 = inchi.geometry(ICH3)
GEO4 = inchi.geometry(ICH4)
GEO5 = inchi.geometry(ICH5)
ZMA1 = geom.zmatrix(GEO1)
ZMA2 = geom.zmatrix(GEO2)
ZMA3 = geom.zmatrix(GEO3)
ZMA4 = geom.zmatrix(GEO4)
ZMA5 = geom.zmatrix(GEO5)


def test__rings():
    """ test graph.rings
    """
    c5h5n5o_cgr = ({
        0: ('C', 1, None),
        1: ('C', 0, None),
        2: ('C', 0, None),
        3: ('C', 0, None),
        4: ('C', 0, None),