check the modeller code to see how it is done well :)
On Jan 29, 2010, at 8:46 PM, Javier Ángel Velázquez Muriel wrote:
> That function enters into numerical instability when > sin_tilt_sin_psi==0, which produces psi ==0. I've tried to fixe it, > and i think is correct, but now the code throws the exception. The > input and output are "apart". Can anybody help me to fix it? Anything > that I missed? > > double psi= std::atan2(sin_tilt_sin_psi, cos_psi_sin_tilt); > if(almost_equal(sin_tilt_sin_psi,0,1e-6)) { > double sin_tilt= 0; > double tilt= std::atan2(sin_tilt, cos_tilt); > } else { > double sin_tilt= sin_tilt_sin_psi/std::sin(psi); > double tilt= std::atan2(sin_tilt, cos_tilt); > } > // double cos_rot= cos_rot_sin_tilt/sin_tilt; > // double sin_rot= sin_rot_sin_tilt/sin_tilt; > // double rot= std::atan2(sin_rot, cos_rot); > double rot= std::atan2(sin_rot, cos_rot); > _______________________________________________ > IMP-dev mailing list > IMP-dev@salilab.org > https://salilab.org/mailman/listinfo/imp-dev
-- Andrej Sali, Ph.D. Professor, Department of Bioengineering and Therapeutic Sciences Director, California Institute for Quantitative Biosciences at UCSF Department of Pharmaceutical Chemistry University of California at San Francisco UCSF MC 2552 Byers Hall Room 503B 1700 4th Street San Francisco, CA 94158-2330, USA Tel +1 (415) 514-4227; Fax +1 (415) 514-4231 Assistant, Ms. Hilary Mahon, Tel +1 (415)514-4228; Lab +1 (415) 514-4233, 4258 Email sali@salilab.org; Web http://salilab.org