<div dir="ltr">Dear Matt Budde,<div>Thank for your details comments and the direction tutorial to the source code. I will take a look and try to see what I can do.  😉</div><div>Thanks</div><div>Khieu<br><div class="gmail_extra"><br><div class="gmail_quote">On Thu, Feb 1, 2018 at 8:29 PM, Matt Budde <span dir="ltr">&lt;<a href="mailto:matt.d.budde@gmail.com" target="_blank">matt.d.budde@gmail.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">If the 

<span style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:small;font-style:normal;font-variant-ligatures:normal;font-variant-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline"><span> </span>&quot;comment closed surface&quot;</span> is present in the ply file header, camino checks the locations of each walker at each step to determine if it is still intra/extra as you&#39;d like it to be, which is computationally intensive and slow.   This check is in the code somewhere around line 580 in DiffusionSimulation.java<div><br></div><div><div>                <span style="white-space:pre-wrap">        </span>if(p==0.0){</div><div>                <span style="white-space:pre-wrap">                </span>if(substrate.intracellular(<wbr>walker[i])!=isIntra[i]){            <span style="white-space:pre-wrap">                </span></div><div>                <span style="white-space:pre-wrap">                        </span>logger.severe(&quot;walker pos: &quot;+walker[i].r[0]+&quot;  &quot;+walker[i].r[1]+&quot;  &quot;+walker[i].r[2]);</div><div>                <span style="white-space:pre-wrap">                        </span></div><div>                <span style="white-space:pre-wrap">                        </span>throw new LoggedException(&quot;t= &quot;+t+&quot; i= &quot;+i+&quot; has crossed. isIntra=&quot;+isIntra[i]);</div><div>                <span style="white-space:pre-wrap">                </span>}</div><div>                <span style="white-space:pre-wrap">        </span>}</div></div><div><br></div><div>The substrate.intracellular function first checks to see if this is a convexHull mesh (has the &quot;closed surface&quot;).  If not, it simply returns false.</div><div><br></div><div>There&#39;s a couple of workarounds that depending on your programming experience could be used to avoid those step:</div><div><br></div><div>1) comment out the lines above to avoid checking at each timestep and recompile.  Obviously, if the walker jumps between intra/extra spaces, you won&#39;t catch it.  Be sure to inspect your trajectories using matlab to plot/visualize the walkers and make sure you don&#39;t get strange behavior.  It should still initialize the walkers to the intra (which is slow to begin the simulation), but doesn&#39;t check at each subsequent step.</div><div><br></div><div>2) set your permeability to something very very small (1e-300)? which will also avoid this if statement.  

<span style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:small;font-style:normal;font-variant-ligatures:normal;font-variant-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline">However, because the permeability is non-zero, it may affect the results.  </span>Obviously check this against the non-mesh version to see how it performs, I haven&#39;t tested it, but conceivably it could work.  </div><div><br></div><div>3) if you remove the &quot;comment closed surface&quot; in the ply file header, it will also avoid checking at each step.  In this case you can&#39;t set the initial positions to intra/extracellular.  If you are only interested in &quot;-initial uniform&quot;, that is not a problem.  You could initialize the runs with uniform setting and edit the trajectory files in matlab to only save the intracellular walkers.  This approach is least recommended, but exists as a possibility.  You could at least give it a try to see what kind of speed improvement you get.</div><div><br></div><div>Matt (Hall) may have some better insight to this or can tell me if I&#39;ve mis-stated, but option 1 has worked for me in the past to 

<span style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:small;font-style:normal;font-variant-ligatures:normal;font-variant-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline">considerably</span>

speed up the mesh simulations.</div><div><br></div><div>-matt (budde)</div><div><br></div><div><br></div></div></blockquote></div>
</div></div></div>