def sphere_constrained_cubic(dr, a, alpha):
sqrt3 = np.sqrt(<NUM_LIT:3>)<EOL>b_coeff = a*<NUM_LIT:0.5>/sqrt3*(<NUM_LIT:1> - <NUM_LIT>*sqrt3*alpha)/(<NUM_LIT> + a*a)<EOL>rscl = np.clip(dr, -<NUM_LIT:0.5>*sqrt3, <NUM_LIT:0.5>*sqrt3)<EOL>a, d = rscl + <NUM_LIT:0.5>*sqrt3, rscl - <NUM_LIT:0.5>*sqrt3<EOL>return alpha*d*a*rscl + b_coeff*d*a - d/sqrt3<EOL>
Sphere generated by a cubic interpolant constrained to be (1,0) on
(r0-sqrt(3)/2, r0+sqrt(3)/2), the size of the cube in the (111) direction.