<ahref="unitcell_8cc.html">Go to the documentation of this file.</a><divclass="fragment"><divclass="line"><aname="l00001"></a><spanclass="lineno"> 1</span> <spanclass="comment">// Voro++, a 3D cell-based Voronoi library</span></div>
<divclass="line"><aname="l00008"></a><spanclass="lineno"> 8</span> <spanclass="comment"> * \brief Function implementations for the unitcell class. */</span></div>
<divclass="line"><aname="l00013"></a><spanclass="lineno"> 13</span> <spanclass="preprocessor">#include "<aclass="code"href="unitcell_8hh.html"title="Header file for the unitcell class.">unitcell.hh</a>"</span></div>
<divclass="line"><aname="l00014"></a><spanclass="lineno"> 14</span> <spanclass="preprocessor">#include "<aclass="code"href="cell_8hh.html"title="Header file for the voronoicell and related classes.">cell.hh</a>"</span></div>
<divclass="line"><aname="l00018"></a><spanclass="lineno"> 18</span> <spanclass="comment">/** Initializes the unit cell class for a particular non-orthogonal periodic</span></div>
<divclass="line"><aname="l00019"></a><spanclass="lineno"> 19</span> <spanclass="comment"> * geometry, corresponding to a parallelepiped with sides given by three</span></div>
<divclass="line"><aname="l00020"></a><spanclass="lineno"> 20</span> <spanclass="comment"> * vectors. The class constructs the unit Voronoi cell corresponding to this</span></div>
<divclass="line"><aname="l00022"></a><spanclass="lineno"> 22</span> <spanclass="comment"> * \param[in] (bx_) The x coordinate of the first unit vector.</span></div>
<divclass="line"><aname="l00023"></a><spanclass="lineno"> 23</span> <spanclass="comment"> * \param[in] (bxy_,by_) The x and y coordinates of the second unit vector.</span></div>
<divclass="line"><aname="l00024"></a><spanclass="lineno"> 24</span> <spanclass="comment"> * \param[in] (bxz_,byz_,bz_) The x, y, and z coordinates of the third unit</span></div>
<divclass="line"><aname="l00030"></a><spanclass="lineno"> 30</span> <spanclass="comment">// Initialize the Voronoi cell to be a very large rectangular box</span></div>
<divclass="line"><aname="l00034"></a><spanclass="lineno"> 34</span> <spanclass="comment">// Repeatedly cut the cell by shells of periodic image particles</span></div>
<divclass="line"><aname="l00037"></a><spanclass="lineno"> 37</span> <spanclass="comment">// Check to see if any of the planes from the current shell</span></div>
<divclass="line"><aname="l00038"></a><spanclass="lineno"> 38</span> <spanclass="comment">// will cut the cell</span></div>
<divclass="line"><aname="l00041"></a><spanclass="lineno"> 41</span> <spanclass="comment">// If they do, apply the plane cuts from the current</span></div>
<divclass="line"><aname="l00058"></a><spanclass="lineno"> 58</span> <spanclass="comment">// Calculate a bound on the maximum y and z coordinates</span></div>
<divclass="line"><aname="l00059"></a><spanclass="lineno"> 59</span> <spanclass="comment">// that could possibly cut the cell. This is based upon</span></div>
<divclass="line"><aname="l00060"></a><spanclass="lineno"> 60</span> <spanclass="comment">// a geometric result that particles with z>l can't cut</span></div>
<divclass="line"><aname="l00061"></a><spanclass="lineno"> 61</span> <spanclass="comment">// a cell lying within the paraboloid</span></div>
<divclass="line"><aname="l00062"></a><spanclass="lineno"> 62</span> <spanclass="comment">// z<=(l*l-x*x-y*y)/(2*l). It is always a tighter bound</span></div>
<divclass="line"><aname="l00063"></a><spanclass="lineno"> 63</span> <spanclass="comment">// than the one based on computing the maximum radius</span></div>
<divclass="line"><aname="l00064"></a><spanclass="lineno"> 64</span> <spanclass="comment">// of a Voronoi cell vertex.</span></div>
<divclass="line"><aname="l00079"></a><spanclass="lineno"> 79</span> <spanclass="comment">// If the routine makes it here, then the unit cell still hasn't been</span></div>
<divclass="line"><aname="l00080"></a><spanclass="lineno"> 80</span> <spanclass="comment">// completely bounded by the plane cuts. Give the memory error code,</span></div>
<divclass="line"><aname="l00081"></a><spanclass="lineno"> 81</span> <spanclass="comment">// because this is mainly a case of hitting a safe limit, than any</span></div>
<divclass="line"><aname="l00086"></a><spanclass="lineno"> 86</span> <spanclass="comment">/** Applies a pair of opposing plane cuts from a periodic image point</span></div>
<divclass="line"><aname="l00087"></a><spanclass="lineno"> 87</span> <spanclass="comment"> * to the unit Voronoi cell.</span></div>
<divclass="line"><aname="l00088"></a><spanclass="lineno"> 88</span> <spanclass="comment"> * \param[in] (i,j,k) the index of the periodic image to consider. */</span></div>
<divclass="line"><aname="l00095"></a><spanclass="lineno"> 95</span> <spanclass="comment">/** Calculates whether the unit Voronoi cell intersects a given periodic image</span></div>
<divclass="line"><aname="l00096"></a><spanclass="lineno"> 96</span> <spanclass="comment"> * of the domain.</span></div>
<divclass="line"><aname="l00097"></a><spanclass="lineno"> 97</span> <spanclass="comment"> * \param[in] (dx,dy,dz) the displacement of the periodic image.</span></div>
<divclass="line"><aname="l00098"></a><spanclass="lineno"> 98</span> <spanclass="comment"> * \param[out] vol the proportion of the unit cell volume within this image,</span></div>
<divclass="line"><aname="l00099"></a><spanclass="lineno"> 99</span> <spanclass="comment"> * only computed in the case that the two intersect.</span></div>
<divclass="line"><aname="l00100"></a><spanclass="lineno"> 100</span> <spanclass="comment"> * \return True if they intersect, false otherwise. */</span></div>
<divclass="line"><aname="l00103"></a><spanclass="lineno"> 103</span> <aclass="code"href="classvoro_1_1voronoicell.html"title="Extension of the voronoicell_base class to represent a Voronoi cell without neighbor information...">voronoicell</a> c;</div>
<divclass="line"><aname="l00116"></a><spanclass="lineno"> 116</span> <spanclass="comment">/** Computes a list of periodic domain images that intersect the unit Voronoi cell.</span></div>
<divclass="line"><aname="l00117"></a><spanclass="lineno"> 117</span> <spanclass="comment"> * \param[out] vi a vector containing triplets (i,j,k) corresponding to domain</span></div>
<divclass="line"><aname="l00118"></a><spanclass="lineno"> 118</span> <spanclass="comment"> * images that intersect the unit Voronoi cell, when it is</span></div>
<divclass="line"><aname="l00119"></a><spanclass="lineno"> 119</span> <spanclass="comment"> * centered in the middle of the primary domain.</span></div>
<divclass="line"><aname="l00120"></a><spanclass="lineno"> 120</span> <spanclass="comment"> * \param[out] vd a vector containing the fraction of the Voronoi cell volume</span></div>
<divclass="line"><aname="l00121"></a><spanclass="lineno"> 121</span> <spanclass="comment"> * within each corresponding image listed in vi. */</span></div>
<divclass="line"><aname="l00133"></a><spanclass="lineno"> 133</span> <spanclass="comment">// Set up the queue and add (0,0,0) image to it</span></div>
<divclass="line"><aname="l00153"></a><spanclass="lineno"> 153</span> <spanclass="comment">// Add neighbors to the queue if they have not been</span></div>
<divclass="line"><aname="l00169"></a><spanclass="lineno"> 169</span> <spanclass="comment">/** Tests to see if a shell of periodic images could possibly cut the periodic</span></div>
<divclass="line"><aname="l00170"></a><spanclass="lineno"> 170</span> <spanclass="comment"> * unit cell.</span></div>
<divclass="line"><aname="l00171"></a><spanclass="lineno"> 171</span> <spanclass="comment"> * \param[in] l the index of the shell to consider.</span></div>
<divclass="line"><aname="l00172"></a><spanclass="lineno"> 172</span> <spanclass="comment"> * \return True if a point in the shell cuts the cell, false otherwise. */</span></div>
<divclass="line"><aname="l00191"></a><spanclass="lineno"> 191</span> <spanclass="comment">/** Tests to see if a plane cut from a particular periodic image will cut th</span></div>
<divclass="line"><aname="l00192"></a><spanclass="lineno"> 192</span> <spanclass="comment"> * unit Voronoi cell.</span></div>
<divclass="line"><aname="l00193"></a><spanclass="lineno"> 193</span> <spanclass="comment"> * \param[in] (i,j,k) the index of the periodic image to consider.</span></div>
<divclass="line"><aname="l00194"></a><spanclass="lineno"> 194</span> <spanclass="comment"> * \return True if the image cuts the cell, false otherwise. */</span></div>
<divclass="line"><aname="l00201"></a><spanclass="lineno"> 201</span> <spanclass="comment">/** Draws the periodic domain in gnuplot format.</span></div>
<divclass="line"><aname="l00202"></a><spanclass="lineno"> 202</span> <spanclass="comment"> * \param[in] fp the file handle to write to. */</span></div>
<divclass="line"><aname="l00210"></a><spanclass="lineno"> 210</span> <spanclass="comment">/** Draws the periodic domain in POV-Ray format.</span></div>
<divclass="line"><aname="l00211"></a><spanclass="lineno"> 211</span> <spanclass="comment"> * \param[in] fp the file handle to write to. */</span></div>