예제 #1
0
def as_subgroup(topgroup, axes, subgroup=None):
    from pyscf.symm import std_symb
    from pyscf.symm.param import SUBGROUP

    groupname, axes = get_subgroup(topgroup, axes)

    if isinstance(subgroup, (str, unicode)):
        subgroup = std_symb(subgroup)
        if groupname == 'C2v' and subgroup == 'Cs':
            axes = numpy.einsum('ij,kj->ki',
                                rotation_mat(axes[1], numpy.pi / 2), axes)

        elif (groupname == 'D2' and re.search(r'D\d+d', topgroup)
              and subgroup in ('C2v', 'Cs')):
            # Special treatment for D2d, D4d, .... get_subgroup gives D2 by
            # default while C2v is also D2d's subgroup.
            groupname = 'C2v'
            axes = numpy.einsum('ij,kj->ki',
                                rotation_mat(axes[2], numpy.pi / 4), axes)

        elif topgroup in ('Td', 'T', 'Th') and subgroup == 'C2v':
            x, y, z = axes
            x = _normalize(x + y)
            y = numpy.cross(z, x)
            axes = numpy.array((x, y, z))

        elif subgroup not in SUBGROUP[groupname]:
            raise PointGroupSymmetryError('%s not in Ablien subgroup of %s' %
                                          (subgroup, topgroup))

        groupname = subgroup
    return groupname, axes
예제 #2
0
def as_subgroup(topgroup, axes, subgroup=None):
    from pyscf.symm import std_symb
    from pyscf.symm.param import SUBGROUP

    groupname, axes = get_subgroup(topgroup, axes)

    if isinstance(subgroup, (str, unicode)):
        subgroup = std_symb(subgroup)
        if (groupname == 'D2' and re.search(r'D\d+d', topgroup)
                and subgroup in ('C2v', 'Cs')):
            # Special treatment for D2d, D4d, .... get_subgroup gives D2 by
            # default while C2v is also D2d's subgroup.
            groupname = 'C2v'
            axes = numpy.einsum('ij,kj->ki',
                                rotation_mat(axes[2], numpy.pi / 4), axes)

        if subgroup not in SUBGROUP[groupname]:
            raise RuntimeError('%s not in Ablien subgroup of %s' %
                               (subgroup, topgroup))

        if subgroup == 'Cs' and groupname == 'C2v':
            axes = numpy.einsum('ij,kj->ki',
                                rotation_mat(axes[1], numpy.pi / 2), axes)

        groupname = subgroup
    return groupname, axes
예제 #3
0
파일: geom.py 프로젝트: chrinide/pyscf
def as_subgroup(topgroup, axes, subgroup=None):
    from pyscf.symm import std_symb
    from pyscf.symm.param import SUBGROUP

    groupname, axes = get_subgroup(topgroup, axes)

    if isinstance(subgroup, (str, unicode)):
        subgroup = std_symb(subgroup)
        if (groupname == 'D2' and re.search(r'D\d+d', topgroup) and
            subgroup in ('C2v', 'Cs')):
            # Special treatment for D2d, D4d, .... get_subgroup gives D2 by
            # default while C2v is also D2d's subgroup.
            groupname = 'C2v'
            axes = numpy.einsum('ij,kj->ki', rotation_mat(axes[2], numpy.pi/4), axes)

        if subgroup not in SUBGROUP[groupname]:
            raise RuntimeError('%s not in Ablien subgroup of %s' %
                               (subgroup, topgroup))

        if subgroup == 'Cs' and groupname == 'C2v':
            axes = numpy.einsum('ij,kj->ki', rotation_mat(axes[1], numpy.pi/2), axes)

        groupname = subgroup
    return groupname, axes