Skip to content

Instantly share code, notes, and snippets.

@adalke
adalke / sccp_smiles.py
Created December 8, 2021 13:19
Program to generate SMILES strings for short chain chlorinated paraffins (SCCP)
# Program to generate SMILES strings for short chain chlorinated paraffins (SCCP).
# These are alkanes with the molecular formula C_{x} H_{2x-y+2} Cl_{y}
# This implementation finds all unique ways to assign the `y`
# chlorines into `x` bin such that no bin has more than 2 chlorines,
# except the first and last may have 3 chlorines, then use those
# counts to create a SMILES string.
## Step 1: Assign chlorine counts for each carbon atom
@adalke
adalke / no_tie_search.py
Last active August 28, 2021 19:19
Find a set of 64-bit fingerprints with no ties in the NxN upper-triangular Tanimoto
# Find a set of 64-bit fingerprints with no ties in the NxN upper-triangular Tanimoto
# Andrew Dalke <dalke@dalkescientific.com>
# 28 August 2021
# Distributed under the terms of the MIT License
# https://opensource.org/licenses/MIT
# See also https://gist.github.com/ihaque/ee2f6de2091b5755219d8533b9bdfd15
import random
from chemfp import bitops
import time
# Prototype implementation of a "toolbox" API for Open Force Field
# See https://github.com/openforcefield/openff-toolkit/issues/966 .
# Vocabulary:
#
# toolkit_wrapper = the existing OpenEyeToolkitWrapper, RDKitToolkitWrapper, etc.
#
# method name = something like "from_smiles" or "get_tagged_smarts_connectivity"
#
# method handler = a function which implement a named method
@adalke
adalke / compare_cip_and_canonical.py
Created August 10, 2015 16:50
patch to use CanonicalRankAtoms instead of AssignStereochemistry
# Script to compare the symmetry class assignments of RDKit's
# AssignStereochemistry and CanonicalRankAtoms.
# The input must come from a file named "x.dat", with one SMILES per
# line.
from rdkit import Chem
from collections import defaultdict
# Group atoms based on their symmetry group assignment values