コード例 #1
0
ファイル: test_vmat.py プロジェクト: kevinmooreiii/autochem
def test__from_data():
    """ test vmat.from_data
    """
    vma1 = vmat.from_data(
        syms=vmat.symbols(CH4O_VMA),
        key_mat=vmat.key_matrix(CH4O_VMA),
        name_mat=vmat.name_matrix(CH4O_VMA),
    )
    assert vma1 == CH4O_VMA

    vma2 = vmat.from_data(
        syms=vmat.symbols(CH4O_VMA_NO_NONES),
        key_mat=vmat.key_matrix(CH4O_VMA_NO_NONES),
        name_mat=vmat.name_matrix(CH4O_VMA_NO_NONES),
    )
    assert vma2 == CH4O_VMA

    vma1 = list(map(list, vma1))
    vma2 = list(map(list, vma2))

    assert vmat.is_valid(vma1)
    assert vmat.is_valid(vma2)

    vma1[0] += [None]
    vma2[0][1] = vma2[0][1] + (None,)

    assert not vmat.is_valid(vma1)
    assert not vmat.is_valid(vma2)
コード例 #2
0
def from_data(symbs,
              key_mat,
              val_mat,
              name_mat=None,
              one_indexed=False,
              angstrom=False,
              degree=False):
    """ Z-Matrix constructor

        :param symbs: atomic symbols
        :type symbs: tuple[str]
        :param key_mat: key/index columns of the z-matrix, zero-indexed
        :type key_mat: tuple[tuple[float, float or None, float or None]]
        :param val_mat: z-matrix coordinate values
        :type val_mat: tuple[tuple[float, float or None, float or None]]
        :param name_mat: coordinate name columns of the z-matrix
        :type name_mat; tuple[tuple[str, str or None, str or None]]
        :param one_indexed: are the keys in `key_mat` one-indexed?
        :type one_indexed: bool
        :param angstrom: are distance values in `val_mat` in angstroms?
        :type angstrom: bool
        :param degree: are angle values in `val_mat` in degrees?
        :type degree: bool
        :rtype: automol Z-Matrix data structure
    """
    vma = vmat.from_data(symbs, key_mat, name_mat, one_indexed=one_indexed)
    val_mat = _value_matrix(val_mat, angstrom=angstrom, degree=degree)

    symbs, key_mat, name_mat = zip(*vma)
    zma = tuple(zip(symbs, key_mat, name_mat, val_mat))

    return zma
コード例 #3
0
def vmatrix(zma):
    """ Parse and return the V-Matrix component of a Z-Matrix.

        :param zma: Z-Matrix
        :type zma: automol Z-Matrix data structure
    """
    return vmat.from_data(symbs=symbols(zma),
                          key_mat=key_matrix(zma),
                          name_mat=name_matrix(zma))
コード例 #4
0
ファイル: test_vmat.py プロジェクト: sjklipp/autochem
def test__from_data():
    """ test vmat.from_data
    """
    vma = vmat.from_data(
        symbs=vmat.symbols(CH4O_VMA),
        key_mat=vmat.key_matrix(CH4O_VMA),
        name_mat=vmat.name_matrix(CH4O_VMA),
    )
    assert vma == CH4O_VMA
コード例 #5
0
def vmatrix(zma):
    """ convert z-matrix to v-matrix
    """
    return vmat.from_data(syms=symbols(zma),
                          key_mat=key_matrix(zma),
                          name_mat=name_matrix(zma))