from rdkit.Chem import AllChem
import math


def get_centroid(pdb):
    mol = Chem.MolFromMolFile('%s/chem.sdf'%pdb, sanitize=False)
    try:
        for conf in mol.GetConformers():
            centroid = Chem.rdMolTransforms.ComputeCentroid(conf)
            x = centroid[0]
            y = centroid[1]
            z = centroid[2]
        return "%s %s %s"%(x,y,z)
