Python rdkit.Chem.GetPeriodicTable() Examples
The following are 4
code examples of rdkit.Chem.GetPeriodicTable().
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example.
You may also want to check out all available functions/classes of the module
rdkit.Chem
, or try the search function
.
Example #1
Source File: xyz2mol.py From xyz2mol with MIT License | 5 votes |
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
Example #2
Source File: estate.py From PyBioMed with BSD 3-Clause "New" or "Revised" License | 5 votes |
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
Example #3
Source File: xyz2mol.py From BCAI_kaggle_CHAMPS with MIT License | 5 votes |
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
Example #4
Source File: fprinter.py From e3fp with GNU Lesser General Public License v3.0 | 5 votes |
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, )