<html><head><meta http-equiv="Content-Type" content="text/html charset=us-ascii"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><span style="font-size: 14px;" class="">Hello developers,</span><div class=""><span style="font-size: 14px;" class=""><br class=""></span></div><div class=""><span style="font-size: 14px;" class="">The&nbsp;calc_vsite3out_param() function in vsite_parm.cpp calculates the&nbsp;weights (called a, b, c in the code) to&nbsp;locate the&nbsp;virtual site (i) out of the k-j-l plane later on in vsite.cpp.&nbsp;</span></div><div class=""><br class=""></div><div class=""><span style="font-size: 14px;" class="">I copied some part of the code here:</span></div><div class=""><span style="font-size: 14px;" class=""><br class=""></span></div><div class=""><span style="font-size: 14px;" class=""><div class="">pijk = std::cos(aijk)*bij;</div><div class="">pijl = std::cos(aijl)*bij;</div><div class="">a &nbsp; &nbsp;= ( pijk + (pijk*std::cos(akjl)-pijl) * std::cos(akjl) / gmx::square(std::sin(akjl)) ) / bjk;</div><div class="">b &nbsp; &nbsp;= ( pijl + (pijl*std::cos(akjl)-pijk) * std::cos(akjl) / gmx::square(std::sin(akjl)) ) / bjl;</div><div class="">c &nbsp; &nbsp;= -std::sqrt( gmx::square(bij) -</div><div class="">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;( gmx::square(pijk) - 2*pijk*pijl*std::cos(akjl) + gmx::square(pijl) )</div><div class="">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;/ gmx::square(std::sin(akjl)) )</div><div class="">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; / ( bjk*bjl*std::sin(akjl) );</div><div class=""><br class=""></div><div class="">There are a lot of projections going on here which make the code confusing without any&nbsp;documentation, unfortunately.&nbsp;</div><div class="">Is there some&nbsp;reference for the way that a, b, and c are calculated here?&nbsp;</div><div class=""><br class=""></div><div class="">BTW, what if the number under the SQRT is negative? Then c will be NAN. There is no checking to make sure that we are not calculating the SQRT of a negative number.&nbsp;</div><div class=""><br class=""></div><div class="">Best,</div><div class="">Mohammad</div></span></div></body></html>