Esempio n. 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(pyx2z.PrimStruct(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(pyx2z.PrimStruct(m))
    assert s.is_radical(0) is True
Esempio n. 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(pyx2z.PrimStruct(m))
    assert s.size() == 3
    asymbs = ['H']
    coords = [(0., 0., 0.)]
    m = _molec_geom_obj(asymbs, coords)
    s = pyx2z.MolecStruct(pyx2z.PrimStruct(m))
    assert s.size() == 1
Esempio n. 3
0
def test__PrimStruct_connected_group():
    """ test pyx2z.PrimStruct.connected_group()
    """
    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)
    p = pyx2z.PrimStruct(m, [[0, 1]])
    assert p.connected_group() == [[2, 0, 1]]
Esempio n. 4
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
Esempio n. 5
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(pyx2z.PrimStruct(m))
    assert s.resonance_count() == 2
Esempio n. 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(pyx2z.PrimStruct(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.
Esempio n. 7
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(pyx2z.PrimStruct(m))
    indices = pyx2z.rotational_group_indices(s)
    print(indices)
Esempio n. 8
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(pyx2z.PrimStruct(m))
    assert s.atom_ordering() == [0, 1, 2, 6, 3, 4, 5, 7, 8, 9]
Esempio n. 9
0
def test__PrimStruct_is_connected():
    """ test pyx2z.PrimStruct.is_connected()
    """
    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)
    p = pyx2z.PrimStruct(m, [[0, 1]])
    assert p.is_connected(0, 0) is True
    assert p.is_connected(0, 1) is True
    assert p.is_connected(0, 2) is True
    assert p.is_connected(1, 0) is True
    assert p.is_connected(1, 1) is True
    assert p.is_connected(1, 2) is False
    assert p.is_connected(2, 0) is True
    assert p.is_connected(2, 1) is False
    assert p.is_connected(2, 2) is True
Esempio n. 10
0
def test__PrimStruct_group_stoicheometry():
    """ test pyx2z.PrimStruct.group_stoicheometry()
    """
    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)
    p = pyx2z.PrimStruct(m, [])
    assert p.group_stoicheometry([5, 2, 3, 4]) == 'C1H3'
    assert p.group_stoicheometry([9, 6, 7, 8]) == 'C1H3'
    assert p.group_stoicheometry([5, 2, 0, 1, 3, 4]) == 'C2H3O1'
    assert p.group_stoicheometry([9, 6, 0, 1, 7, 8]) == 'C2H3O1'
Esempio n. 11
0
def _pyx2z_prim_struct(mgeo):
    x2zmg = _pyx2z_molec_geom(mgeo)
    return pyx2z.PrimStruct(x2zmg)