// pcell.fe

// Surface Evolver datafile for fundamental cell for Schwartz' P minimal surface
// Fundamental region is a tetrahedron, 1/48 of a cube.
// Surface is stabilized with a volume constraint, since we know the
//   P-surface equipartitions volume.

// Programmer: Ken Brakke, brakke@susqu.edu, http://www.susqu.edu

/* Commands:
   gogo - typical evolution
   showcube - display unit cell
   showfour - show four unit cells, as on web page
   transforms off - show just single fundamental region
   setcolor - to color one side yellow, as in my web page.

   To turn off showing all the edges in the graphics display,
      hit the "e" key in the graphics window.
*/

constraint 1   // top
function:  z = 1  
content: 
c1: 0.5*y  
c2: -0.5*x  
c3: 0  

constraint 2  // right side
function:  y - x = 0  

constraint 3  // left  side
function:  -y = 0  

constraint 4  // front bottom
function:  x - z = 0  
content: 
c1: x*y /3  
c2: -x^2/3  
c3: 0  

// for displaying multiple copies; see commands showcube and showfour below.
view_transform_generators 9

1,0,0,0   // transform a, reflect in z = 1 plane
0,1,0,0  
0,0,-1,2  
0,0,0,1  

0,1,0,0   // transform b, reflect in x = y plane
1,0,0,0  
0,0,1,0  
0,0,0,1  

1,0,0,0  // transform c, reflect in y = 0 plane
0,-1,0,0  
0,0,1,0  
0,0,0,1  

0,0,1,0  // transform d, reflect in x = z plane
0,1,0,0  
1,0,0,0  
0,0,0,1  

-1,0,0,2  // transform e, reflect in x = 1 plane
 0,1,0,0
 0,0,1,0
 0,0,0,1

 1,0,0,0  // transform f, reflect in y = 1 plane
 0,-1,0,2
 0,0,1,0
 0,0,0,1

-1,0,0,-2  // transform g, reflect in x = -1 plane
 0,1,0,0
 0,0,1,0
 0,0,0,1

 1,0,0,0  // transform h, reflect in y = -1 plane
 0,-1,0,-2
 0,0,1,0
 0,0,0,1

1,0,0,0   // transform i, reflect in z = -1 plane
0,1,0,0  
0,0,-1,-2  
0,0,0,1  


vertices         
1  0.5 0   1     constraints 1 3 
2  0.5 0.5 1     constraints 1 2 
3  0.5 0.5 0.5   constraints 2 4 
4  0.5 0   0.5   constraints 3 4 
5  0   0   0     fixed  bare  // for outlining tetrahedron
6  0   0   1     fixed  bare
7  1   0   1     fixed  bare
8  1   1   1     fixed  bare

edges
1   2 1 constraint 1
2   3 2 constraint 2
3   4 3 constraint 4
4   1 4 constraint 3
5   5 6 fixed bare// for tetrahedron display
6   5 7 fixed bare
7   5 8 fixed bare
8   6 7 fixed bare
9   6 8 fixed bare
10  7 8 fixed bare

facets
1  4 3 2 1 

bodies 
1  1 volume  1/12

read

hessian_normal

band_flag := 0  // whether banding has been done

// command to show full cubic unit cell
showcube := { transform_expr "dcbdcbdcb"; transforms on; 
              if not band_flag then show edge where valence == 1;
              show_trans "Rrrdd";
            }

// command to show two full unit cells
showtwo  := { transform_expr "fdcbdcbdcb"; transforms on; 
              if not band_flag then show edge where valence == 1;
              show_trans "Rrrdd";
            }

// command to show four full unit cells
showfour := { transform_expr "fadcbdcbdcb"; transforms on; 
              if not band_flag then show edge where valence == 1;
              show_trans "Rrrdd";
            }

// command to show eight full unit cells
showeight := { transform_expr "aefdcbdcbdcb"; transforms on;
               if not band_flag then show edge where valence == 1;
              show_trans "Rrrdd";
             }

// command to show 4x4 block of cubes
show64 := { transform_expr "ghiaefdcbdcbdcb"; transforms on;
               if not band_flag then show edge where valence == 1;
              show_trans "Rrrdd";
             }


setcolor := { set facet backcolor yellow }

// To show just one fundamental region, do "transforms off".
// To show tetrahedron outline again, do "show edges".

// A typical evolution
gogo := { g 5; r; g 5; r; g 5; r; g 10;
          u;
          refine edge where on_constraint 2;
          refine edge where on_constraint 4;
          hessian; hessian;
        }

// Less refined, so can do lots of copies
gogo2 := { g 5; r; g 5; r; g 10;
          u;
          refine edge where on_constraint 2;
          refine edge where on_constraint 4;
          hessian; hessian;
        }
