implement surface tension automatic differentiation