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);
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
Check that the choice of Euler angles isn't singular near that point (each choice of Euler angles has a place where it is singular, meaning very different Euler angle values produce almost the same rotation). How does the instability manifest itself.
I'll try to look more into it later.
On Jan 29, 2010, at 8:46 PM, Javier Ángel Velázquez Muriel <javi@salilab.o rg> 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
participants (3)
-
Andrej Sali
-
Daniel Russel
-
Javier Ángel Velázquez Muriel