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