def ComputeBarycenter(dRes):
    """Compute the barycenter of an amino acid.
    Input: a dico containing information about a residual.
           For instance dBPDB[resnumber].
    Output: coordinates (x,y,z)
    """

    n = len(dRes["atomlist"])
    x = []
    y = []
    z = []

    for atom in dRes["atomlist"]:
        x.append(float(dRes[atom]["x"]))
        y.append(float(dRes[atom]["y"]))
        z.append(float(dRes[atom]["z"]))

    xbar = sum(x) / n
    ybar = sum(y) / n
    zbar = sum(z) / n

    return (xbar, ybar, zbar)