示例#1
0
def test__MolecStruct_is_radical():
    """ test pyx2z.MolecStruct.is_radical()
    """
    asymbs = ['O', 'H']
    coords = [(-1.2516025626, 2.3683550357, 0.0000000000),
              (-1.5749323743, 3.2380324089, -0.2828764736)]
    m = _molec_geom_obj(asymbs, coords)
    s = pyx2z.MolecStruct(m, [])
    assert s.is_radical(0) is True
    assert s.is_radical(1) is False
    asymbs = ['H']
    coords = [(0., 0., 0.)]
    m = _molec_geom_obj(asymbs, coords)
    s = pyx2z.MolecStruct(m, [])
    assert s.is_radical(0) is True
示例#2
0
def test__MolecStruct_size():
    """ test pyx2z.MolecStruct.size()
    """
    asymbs = ['O', 'H', 'H']
    coords = [(-1.2516025626, 2.3683550357, 0.0000000000),
              (-0.2816025626, 2.3683550357, 0.0000000000),
              (-1.5749323743, 3.2380324089, -0.2828764736)]
    m = _molec_geom_obj(asymbs, coords)
    s = pyx2z.MolecStruct(m, [])
    assert s.size() == 3
    asymbs = ['H']
    coords = [(0., 0., 0.)]
    m = _molec_geom_obj(asymbs, coords)
    s = pyx2z.MolecStruct(m, [])
    assert s.size() == 1
示例#3
0
def from_geometry(geo):
    """ x2z molecule object from a geometry
    """
    _mg = pyx2z.MolecGeom()
    for sym, xyz in geo:
        _atm = pyx2z.Atom(sym)
        _atm[0], _atm[1], _atm[2] = xyz
        _mg.push_back(_atm)
    _ps = pyx2z.PrimStruct(_mg)
    x2m = pyx2z.MolecStruct(_ps)
    return x2m
示例#4
0
def test__MolecStruct_resonance_count():
    """ test pyx2z.MolecStruct.resonance_count()
    """
    asymbs = ['C', 'C', 'C', 'H', 'H', 'H', 'H', 'H']
    coords = [(1.10206, 0.05263, 0.02517), (2.44012, 0.03045, 0.01354),
              (3.23570, 0.06292, 1.20436), (2.86296, -0.38925, 2.11637),
              (4.29058, 0.30031, 1.12619), (0.54568, -0.01805, -0.90370),
              (0.53167, 0.14904, 0.94292), (2.97493, -0.03212, -0.93001)]
    m = _molec_geom_obj(asymbs, coords)
    s = pyx2z.MolecStruct(m, [])
    assert s.resonance_count() == 2
示例#5
0
def from_geometry(geo, ts_bnds=()):
    """ x2z molecule object from a geometry
    """
    _mg = pyx2z.MolecGeom()
    for sym, xyz in geo:
        _atm = pyx2z.Atom(sym)
        _atm[0], _atm[1], _atm[2] = xyz
        _mg.push_back(_atm)

    ts_bnds = list(map(list, ts_bnds))
    x2m = pyx2z.MolecStruct(_mg, ts_bnds)
    return x2m
示例#6
0
def test__MolecStruct_resonance_averaged_bond_order():
    """ test pyx2z.MolecStruct.resonance_averaged_bond_order()
    """
    asymbs = ['O', 'H', 'H']
    coords = [(-1.2516025626, 2.3683550357, 0.0000000000),
              (-0.2816025626, 2.3683550357, 0.0000000000),
              (-1.5749323743, 3.2380324089, -0.2828764736)]
    m = _molec_geom_obj(asymbs, coords)
    s = pyx2z.MolecStruct(m, [])
    assert s.resonance_averaged_bond_order(0, 1) == 1.
    assert s.resonance_averaged_bond_order(0, 2) == 1.
    assert s.resonance_averaged_bond_order(1, 2) == 0.
示例#7
0
def test__MolecStruct_bond_order():
    """ test pyx2z.MolecStruct.bond_order()
    """
    asymbs = ['C', 'C', 'C', 'H', 'H', 'H', 'H', 'H']
    coords = [(1.10206, 0.05263, 0.02517), (2.44012, 0.03045, 0.01354),
              (3.23570, 0.06292, 1.20436), (2.86296, -0.38925, 2.11637),
              (4.29058, 0.30031, 1.12619), (0.54568, -0.01805, -0.90370),
              (0.53167, 0.14904, 0.94292), (2.97493, -0.03212, -0.93001)]
    m = _molec_geom_obj(asymbs, coords)
    s = pyx2z.MolecStruct(pyx2z.PrimStruct(m))
    assert s.bond_order(0, 1, 0) == 2
    assert s.bond_order(1, 2, 0) == 1
    assert s.bond_order(0, 1, 1) == 1
    assert s.bond_order(1, 2, 1) == 2
示例#8
0
def test__rotational_group_indices():
    """ test pyx2z.rotational_group_indices()
    """
    asymbs = ['C', 'C', 'C', 'H', 'H', 'H', 'H', 'H', 'H', 'H', 'H']
    coords = [
        (-1.232983, -0.321673, -0.105358), (1.243527, 0.070589, -0.288927),
        (-0.013971, 0.332706, 0.522469), (-1.409212, 0.063988, -1.114625),
        (-1.106163, -1.407114, -0.169728), (-2.124468, -0.118860, 0.496321),
        (1.145567, 0.468640, -1.303997), (2.106311, 0.551275, 0.182712),
        (1.448625, -1.002453, -0.359095), (-0.179317, 1.412994, 0.600234),
        (0.122085, -0.050093, 1.539995)
    ]
    m = _molec_geom_obj(asymbs, coords)
    s = pyx2z.MolecStruct(m, [])
    indices = pyx2z.rotational_group_indices(s)
    print(indices)
示例#9
0
def test__MolecStruct_atom_ordering():
    """ test pyx2z.MolecStruct.atom_ordering()
    """
    asymbs = ['C', 'O', 'C', 'H', 'H', 'H', 'C', 'H', 'H', 'H']
    coords = [(-2.2704178657, 2.9586871732, -0.0000000000),
              (-2.0230332171, 1.7537576097, 0.0000000000),
              (-1.3903791691, 3.9451234997, 0.7188849720),
              (-0.5605839137, 3.4182459749, 1.1980823377),
              (-1.9710320856, 4.4623547554, 1.4866301464),
              (-0.9857357677, 4.6646475866, 0.0028769813),
              (-3.4679340657, 3.5185797384, -0.7188849720),
              (-4.0230068872, 2.7073743052, -1.1980823377),
              (-3.1380484986, 4.2227540733, -1.4866301464),
              (-4.1233452839, 4.0204635187, -0.0028769813)]
    m = _molec_geom_obj(asymbs, coords)
    s = pyx2z.MolecStruct(m, [])
    assert s.atom_ordering() == [0, 1, 2, 6, 3, 4, 5, 7, 8, 9]
示例#10
0
def test__rotational_bond_coordinates():
    """ test pyx2z.rotational_bond_coordinates()
    """
    asymbs = ['C', 'O', 'C', 'H', 'H', 'H', 'C', 'H', 'H', 'H']
    coords = [(-2.2704178657, 2.9586871732, -0.0000000000),
              (-2.0230332171, 1.7537576097, 0.0000000000),
              (-1.3903791691, 3.9451234997, 0.7188849720),
              (-0.5605839137, 3.4182459749, 1.1980823377),
              (-1.9710320856, 4.4623547554, 1.4866301464),
              (-0.9857357677, 4.6646475866, 0.0028769813),
              (-3.4679340657, 3.5185797384, -0.7188849720),
              (-4.0230068872, 2.7073743052, -1.1980823377),
              (-3.1380484986, 4.2227540733, -1.4866301464),
              (-4.1233452839, 4.0204635187, -0.0028769813)]
    m = _molec_geom_obj(asymbs, coords)
    s = pyx2z.MolecStruct(pyx2z.PrimStruct(m))
    coords = pyx2z.rotational_bond_coordinates(s)
    assert coords == ['D4', 'D7']
示例#11
0
def from_geometry(geo, ts_bnds=()):
    """ Generate an x2z molecule object from a geometry.

        :param geo: molecular geometry
        :type geo: automol geometry data structure
        :param ts_bnds: keys for the breaking/forming bonds in a TS
        :type ts_bnds: tuple(frozenset(int))
        :rtype: x2z molecule object
    """

    _mg = pyx2z.MolecGeom()
    for sym, xyz in geo:
        _atm = pyx2z.Atom(sym)
        _atm[0], _atm[1], _atm[2] = xyz
        _mg.push_back(_atm)

    ts_bnds = list(map(list, ts_bnds))
    x2m = pyx2z.MolecStruct(_mg, ts_bnds)

    return x2m
示例#12
0
def _pyx2z_molec_struct(mgeo):
    x2zps = _pyx2z_prim_struct(mgeo)
    return pyx2z.MolecStruct(x2zps)