Пример #1
0
def compute_charge_dictionary(molecule):
    """Create a dictionary with partial charges for each atom in the molecule.

  This function assumes that the charges for the molecule are
  already computed (it can be done with
  rdkit_util.compute_charges(molecule))
  """

    charge_dictionary = {}
    for i, atom in enumerate(molecule.GetAtoms()):
        charge_dictionary[i] = get_partial_charge(atom)
    return charge_dictionary
Пример #2
0
def is_salt_bridge(atom_i, atom_j):
  """Check if two atoms have correct charges to form a salt bridge"""
  if np.abs(2.0 - np.abs(
      get_partial_charge(atom_i) - get_partial_charge(atom_j))) < 0.01:
    return True
  return False
Пример #3
0
 def test_get_partial_charge(self):
   from rdkit import Chem
   mol = Chem.MolFromSmiles("CC")
   atom = mol.GetAtoms()[0]
   partial_charge = get_partial_charge(atom)
   assert partial_charge == 0