def calc_f(params, strain):
    """Calculate the elastic free energy in the matrix
    """
    return (
        0.5 * params["c11"] * (strain["e11"] ** 2 + strain["e22"] ** 2)
        + params["c12"] * strain["e11"] * strain["e22"]
        + 2 * params["c44"] * strain["e12"] ** 2
    )