Skip to content

Instantly share code, notes, and snippets.

import math
import pybel
def sqr_dist(a, b):
ac = a.coords
bc = b.coords
return (ac[0]-bc[0])**2 + (ac[1]-bc[1])**2 + (ac[2]-bc[2])**2
# Definitions taken from
# http://baoilleach.blogspot.com/2007/07/pybel-hack-that-sd-file.html
@rmcgibbo
rmcgibbo / neb.py
Created January 30, 2013 03:51
Nudged Elastic Band in Python
from __future__ import division
import numpy as np
import IPython as ip
import matplotlib.pyplot as pp
import warnings
from collections import namedtuple
import scipy.optimize
#symbolic algebra
import theano
@andersx
andersx / pbconstraint.py
Created December 4, 2013 09:33
Constraint optimization in Python with Open Babel
import openbabel as ob
# Standard openbabel molecule load
conv = ob.OBConversion()
conv.SetInAndOutFormats('xyz','xyz')
mol = obOBMol()
conv.ReadFile(mol,'my_mol.xyz')
# Define constraints
constraints = ob.OBFFConstraints()
@scientificprotocols
scientificprotocols / protocol.md
Last active February 7, 2022 03:44
Isothermal titration calorimetry to determine the association constants for a ligand bound simultaneously to two specific protein binding sites with different affinities
Authors: Giorgio Pochetti & Roberta Montanari

Abstract

It could be very useful in drug development to determine the relative affinities of a ligand that can bind to a protein with two (or more) different and specific binding sites. X-ray crystallography is a very powerful technique to determine the locations and describe the features of each binding site but it is unuseful to establish their relative affinities. Moreover, the stoichiometry of binding observed in the crystal structure of a complex could be an artifact of the crystallization conditions.

On the contrary, isothermal titration calorimetry (ITC) can be used to assign the correct stoichiometry of the association, depending on the initial and final concentration ratio between ligand and protein, and to establish the affinity for each specific binding site, if combined with structural information from X-ray crystallography.

@platinhom
platinhom / 0-AmberScripts.md
Last active February 8, 2024 02:24
Some scripts for Amber

This gist contains some scripts for Amber.

  • anteligand.sh: Use antechamber to prepare a ligand for Amber
  • complex_tleap.sh: Use tleap to prepare a ligand-protein complex input parameter file (Amber14)
  • checkPDBID_MDprep.sh: After running many preparation jobs for PDB ligand-protein complexes, you should check whether the preparation is done.
  • rename_water.py: rename water to HOH O,H1,H2 for PDB/PQR

Maybe need some other tools installed, such as pdb2pqr and g09 and so on.

@GeauxEric
GeauxEric / dockedpose.py
Last active February 7, 2022 03:46 — forked from baoilleach/dockedpose.py
Using Open Babel to calculate the symmetry-corrected RMSD of a docked pose from a crystal structure
import math
import pybel
def squared_distance(coordsA, coordsB):
"""Find the squared distance between two 3-tuples"""
sqrdist = sum((a - b)**2 for a, b in zip(coordsA, coordsB))
return sqrdist
@PatWalters
PatWalters / split_complex_v2.py
Created October 2, 2018 01:20
An improved script to extract a ligand from a protein-ligand complex and assign bond orders
#!/usr/bin/env python
import sys
from prody import *
from rdkit import Chem
from rdkit.Chem import AllChem
from io import StringIO
import pypdb
@realvjy
realvjy / ChoasLinesShader.metal
Last active June 16, 2025 18:37
Choas Lines - Metal Shader
// Lines
float hash( float n ) {
return fract(sin(n)*753.5453123);
}
// Slight modification of iq's noise function.
float noise(vector_float2 x )
{
vector_float2 p = floor(x);
vector_float2 f = fract(x);
@matthen
matthen / hello_world.py
Last active November 25, 2024 21:51
Hello world in python, using genetic algorithm
"""Hello world, with a genetic algorithm.
https://twitter.com/matthen2/status/1769368467067621791
"""
import random
import time
from dataclasses import dataclass
from itertools import chain
from typing import Iterable, List
@komakai
komakai / add.metal
Created December 13, 2024 03:43
Metal compute shader swift
kernel void add_arrays(device const float* inA [[buffer(0)]],
device const float* inB [[buffer(1)]],
device float* result [[buffer(2)]],
uint index [[thread_position_in_grid]])
{
result[index] = inA[index] + inB[index];
}