當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。