Home My Page Projects Code Snippets Project Openings diderot

# SCM Repository

[diderot] Diff of /tests/examples/sphere/sphere.diderot
 [diderot] / tests / examples / sphere / sphere.diderot

# Diff of /tests/examples/sphere/sphere.diderot

revision 4689, Mon Oct 3 16:58:23 2016 UTC revision 4690, Mon Oct 3 18:27:30 2016 UTC
# Line 21  Line 21
21  real stepMax = rad;     // limit on distance to travel per iter  real stepMax = rad;     // limit on distance to travel per iter
22  int iter = 0;           // which iteration we're on  int iter = 0;           // which iteration we're on
23
24  /* Univariate energy functions */  // Univariate energy functions; see ../circle for alternatives

// phi(0) and phi'(0) are bounded
25  function real  phi(real r) = (1 - r)^4;  function real  phi(real r) = (1 - r)^4;
26  function real phi'(real r) = -4*(1 - r)^3;  function real phi'(real r) = -4*(1 - r)^3;

/*
// electrostatic potential 1/r, scaled to be C^2 continuous with 0 at r==1
function real  phi(real r) =  (1/r)*(1 - r)^3;
function real phi'(real r) = 3 - 1/(r^2) - 2*r;
*/
/*
// Cotangent-based potential from Meyer et al. SMI'05
function real  phi(real r) = 1/tan(r*π/2) + r*π/2 - π/2;
function real phi'(real r) = (π/2)*(1 - (1/sin(r*π/2))^2);
*/

27  // Energy and force from particle at vec3 x  // Energy and force from particle at vec3 x
28  function real enr(vec3 x) = phi(|x|/rad);  function real enr(vec3 x) = phi(|x|/rad);
29  function vec3 frc(vec3 x) = phi'(|x|/rad) * (1/rad) * x/|x|; // chain rule  function vec3 frc(vec3 x) = phi'(|x|/rad) * (1/rad) * x/|x|; // chain rule

Legend:
 Removed from v.4689 changed lines Added in v.4690