<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 calc_vsite3out_param() function in vsite_parm.cpp calculates the weights (called a, b, c in the code) to locate the virtual site (i) out of the k-j-l plane later on in vsite.cpp. </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 = ( pijk + (pijk*std::cos(akjl)-pijl) * std::cos(akjl) / gmx::square(std::sin(akjl)) ) / bjk;</div><div class="">b = ( pijl + (pijl*std::cos(akjl)-pijk) * std::cos(akjl) / gmx::square(std::sin(akjl)) ) / bjl;</div><div class="">c = -std::sqrt( gmx::square(bij) -</div><div class=""> ( gmx::square(pijk) - 2*pijk*pijl*std::cos(akjl) + gmx::square(pijl) )</div><div class=""> / gmx::square(std::sin(akjl)) )</div><div class=""> / ( 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 documentation, unfortunately. </div><div class="">Is there some reference for the way that a, b, and c are calculated here? </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. </div><div class=""><br class=""></div><div class="">Best,</div><div class="">Mohammad</div></span></div></body></html>