当前位置: 首页>>代码示例>>Python>>正文


Python Chem.GetPeriodicTable方法代码示例

本文整理汇总了Python中rdkit.Chem.GetPeriodicTable方法的典型用法代码示例。如果您正苦于以下问题:Python Chem.GetPeriodicTable方法的具体用法?Python Chem.GetPeriodicTable怎么用?Python Chem.GetPeriodicTable使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在rdkit.Chem的用法示例。


在下文中一共展示了Chem.GetPeriodicTable方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: get_AC

# 需要导入模块: from rdkit import Chem [as 别名]
# 或者: from rdkit.Chem import GetPeriodicTable [as 别名]
def get_AC(mol, covalent_factor=1.3):
    """

    Generate adjacent matrix from atoms and coordinates.

    AC is a (num_atoms, num_atoms) matrix with 1 being covalent bond and 0 is not


    covalent_factor - 1.3 is an arbitrary factor

    args:
        mol - rdkit molobj with 3D conformer

    optional
        covalent_factor - increase covalent bond length threshold with facto

    returns:
        AC - adjacent matrix

    """

    # Calculate distance matrix
    dMat = Chem.Get3DDistanceMatrix(mol)

    pt = Chem.GetPeriodicTable()
    num_atoms = mol.GetNumAtoms()
    AC = np.zeros((num_atoms, num_atoms), dtype=int)

    for i in range(num_atoms):
        a_i = mol.GetAtomWithIdx(i)
        Rcov_i = pt.GetRcovalent(a_i.GetAtomicNum()) * covalent_factor
        for j in range(i + 1, num_atoms):
            a_j = mol.GetAtomWithIdx(j)
            Rcov_j = pt.GetRcovalent(a_j.GetAtomicNum()) * covalent_factor
            if dMat[i, j] <= Rcov_i + Rcov_j:
                AC[i, j] = 1
                AC[j, i] = 1

    return AC 
开发者ID:jensengroup,项目名称:xyz2mol,代码行数:41,代码来源:xyz2mol.py

示例2: _CalculateEState

# 需要导入模块: from rdkit import Chem [as 别名]
# 或者: from rdkit.Chem import GetPeriodicTable [as 别名]
def _CalculateEState(mol, skipH=1):
    """
    #################################################################
    **Internal used only**

    Get the EState value of each atom in a molecule
    #################################################################
    """
    mol = Chem.AddHs(mol)
    if skipH == 1:
        mol = Chem.RemoveHs(mol)
    tb1 = Chem.GetPeriodicTable()
    nAtoms = mol.GetNumAtoms()
    Is = numpy.zeros(nAtoms, numpy.float)
    for i in range(nAtoms):
        at = mol.GetAtomWithIdx(i)
        atNum = at.GetAtomicNum()
        d = at.GetDegree()
        if d > 0:
            h = at.GetTotalNumHs()
            dv = tb1.GetNOuterElecs(atNum) - h
            # dv=numpy.array(_AtomHKDeltas(at),'d')
            N = _GetPrincipleQuantumNumber(atNum)
            Is[i] = (4.0 / (N * N) * dv + 1) / d
    dists = Chem.GetDistanceMatrix(mol, useBO=0, useAtomWts=0)
    dists += 1
    accum = numpy.zeros(nAtoms, numpy.float)
    for i in range(nAtoms):
        for j in range(i + 1, nAtoms):
            p = dists[i, j]
            if p < 1e6:
                temp = (Is[i] - Is[j]) / (p * p)
                accum[i] += temp
                accum[j] -= temp
    res = accum + Is
    return res 
开发者ID:gadsbyfly,项目名称:PyBioMed,代码行数:38,代码来源:estate.py

示例3: xyz2AC

# 需要导入模块: from rdkit import Chem [as 别名]
# 或者: from rdkit.Chem import GetPeriodicTable [as 别名]
def xyz2AC(atomicNumList,xyz):
    import numpy as np
    mol = get_proto_mol(atomicNumList)

    conf = Chem.Conformer(mol.GetNumAtoms())
    for i in range(mol.GetNumAtoms()):
        conf.SetAtomPosition(i,(xyz[i][0],xyz[i][1],xyz[i][2]))
    mol.AddConformer(conf)

    dMat = Chem.Get3DDistanceMatrix(mol)
    pt = Chem.GetPeriodicTable()

    num_atoms = len(atomicNumList)
    AC = np.zeros((num_atoms,num_atoms)).astype(int)

    for i in range(num_atoms):
        a_i = mol.GetAtomWithIdx(i)
        Rcov_i = pt.GetRcovalent(a_i.GetAtomicNum())*1.30
        for j in range(i+1,num_atoms):
            a_j = mol.GetAtomWithIdx(j)
            Rcov_j = pt.GetRcovalent(a_j.GetAtomicNum())*1.30
            if dMat[i,j] <= Rcov_i + Rcov_j:
                AC[i,j] = 1
                AC[j,i] = 1

    return AC,mol 
开发者ID:boschresearch,项目名称:BCAI_kaggle_CHAMPS,代码行数:28,代码来源:xyz2mol.py

示例4: rdkit_invariants_from_atom

# 需要导入模块: from rdkit import Chem [as 别名]
# 或者: from rdkit.Chem import GetPeriodicTable [as 别名]
def rdkit_invariants_from_atom(atom):
    """Get the 6 atom invariants RDKit uses for its Morgan fingerprints.

    Parameters
    ----------
    atom : RDKit Atom
        Input atom

    Returns
    -------
    1-D array if int64: Array of 6 invariants
    """
    delta_mass = int(
        atom.GetMass()
        - Chem.GetPeriodicTable().GetAtomicWeight(atom.GetAtomicNum())
    )
    return np.array(
        [
            atom.GetAtomicNum(),
            atom.GetTotalDegree(),
            atom.GetTotalNumHs(),
            atom.GetFormalCharge(),
            delta_mass,
            int(atom.IsInRing()),
        ],
        dtype=IDENT_DTYPE,
    ) 
开发者ID:keiserlab,项目名称:e3fp,代码行数:29,代码来源:fprinter.py


注:本文中的rdkit.Chem.GetPeriodicTable方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。