<div dir="ltr">Thank you very much. I need to build a toy system to test it, but sounds just about right. I might even hard-code the square of threshold to save another flop, following your philosophy. A flop is a flop :)<div>
<br></div><div>Again, thank you. </div><div><br></div><div>Murat</div></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Thu, Sep 26, 2013 at 12:10 AM, Bogdan Costescu <span dir="ltr">&lt;<a href="mailto:bcostescu@gmail.com" target="_blank">bcostescu@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 class="im">On Wed, Sep 25, 2013 at 5:29 PM, MURAT OZTURK &lt;<a href="mailto:murozturk@ku.edu.tr">murozturk@ku.edu.tr</a>&gt; wrote:<br>

&gt; Is it OK to intorduce the conditional into pdihs(), and bypass even calling<br>
&gt; dopdihs() if r_kj  ( as reported by calling dih_angle() ) is less then<br>
&gt; threshold?<br>
<br>
</div>Yes. It makes sense to abort calculating as soon as you have enough<br>
information to make the decision. You can place your test immediately<br>
after calling dih_angle(), as it gives you r_jk. The code could look<br>
like (based on your own proposal):<br>
<br>
/* outside of the loop */<br>
threshold2 = threshold * threshold;<br>
<br>
for (i = 0; (i &lt; nbonds); )<br>
{<br>
  ...<br>
  phi = dih_angle(...)<br>
  midDist2 = iprod(r_jk, r_jk);<br>
  if (midDist2 &gt; threshold2)<br>
    continue;<br>
  ...<br>
}<br>
<br>
Please note the comparison done on the squares of distances instead of<br>
distances, saving some CPU cycles.<br>
<br>
Good luck!<br>
<span class="HOEnZb"><font color="#888888">Bogdan<br>
</font></span><div class="HOEnZb"><div class="h5">--<br>
gmx-developers mailing list<br>
<a href="mailto:gmx-developers@gromacs.org">gmx-developers@gromacs.org</a><br>
<a href="http://lists.gromacs.org/mailman/listinfo/gmx-developers" target="_blank">http://lists.gromacs.org/mailman/listinfo/gmx-developers</a><br>
Please don&#39;t post (un)subscribe requests to the list. Use the<br>
www interface or send it to <a href="mailto:gmx-developers-request@gromacs.org">gmx-developers-request@gromacs.org</a>.<br>
</div></div></blockquote></div><br></div>