Created
October 19, 2021 23:25
-
-
Save ljmartin/9ee9766be923b81713c398271b684b0c to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def ShortGI(dist, charge1,charge2,): | |
#These are precomputed coefficients: | |
a=np.array([[ 15.90600036, 3.9534831 , 17.61453176], | |
[ 3.9534831 , 5.21580206, 1.91045387], | |
[ 17.61453176, 1.91045387, 238.75820253]]) | |
b=np.array([[-0.02495 , -0.04539319, -0.00247124], | |
[-0.04539319, -0.2513 , -0.00258662], | |
[-0.00247124, -0.00258662, -0.0013 ]]) | |
a_flat = a.flatten() | |
b_flat = b.flatten() | |
dist = (dist**2).flatten() | |
charges = (charge1[:,None]*charge2).flatten() | |
return ((a_flat[:,None] * np.exp(dist * b_flat[:,None])).sum(0) * charges).sum() | |
def SimilarityMetric(intPrbPrb, intRefRef, intPrbRef,): | |
numerator=intPrbRef | |
denominator=intPrbPrb+intRefRef-intPrbRef | |
return numerator/denominator | |
def mySim(refCoor, prbCoor, refCharge, prbCharge): | |
distPrbPrb = cdist(prbCoor,prbCoor) | |
distPrbRef = cdist(prbCoor,refCoor) | |
distRefRef = cdist(refCoor,refCoor) | |
intPrbPrb=ShortGI(distPrbPrb,prbCharge,prbCharge) | |
intPrbRef=ShortGI(distPrbRef,prbCharge,refCharge) | |
intRefRef=ShortGI(distRefRef,refCharge,refCharge) | |
return SimilarityMetric(intPrbPrb,intRefRef,intPrbRef,'tanimoto') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment