00001 // $Id: mmdb_math.h $ 00002 // ================================================================= 00003 // 00004 // CCP4 Coordinate Library: support of coordinate-related 00005 // functionality in protein crystallography applications. 00006 // 00007 // Copyright (C) Eugene Krissinel 2000-2013. 00008 // 00009 // This library is free software: you can redistribute it and/or 00010 // modify it under the terms of the GNU Lesser General Public 00011 // License version 3, modified in accordance with the provisions 00012 // of the license to address the requirements of UK law. 00013 // 00014 // You should have received a copy of the modified GNU Lesser 00015 // General Public License along with this library. If not, copies 00016 // may be downloaded from http://www.ccp4.ac.uk/ccp4license.php 00017 // 00018 // This program is distributed in the hope that it will be useful, 00019 // but WITHOUT ANY WARRANTY; without even the implied warranty of 00020 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00021 // GNU Lesser General Public License for more details. 00022 // 00023 // ================================================================= 00024 // 00025 // 11.09.13 <-- Date of Last Modification. 00026 // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 00027 // ----------------------------------------------------------------- 00028 // 00029 // **** Module : Math <interface> 00030 // ~~~~~~~~~ 00031 // **** Functions : mmdb::math::GetTorsion 00032 // ~~~~~~~~~~~ mmdb::math::GetAngle 00033 // 00034 // (C) E. Krissinel 2000-2013 00035 // 00036 // ================================================================= 00037 // 00038 00039 #ifndef __MMDB_Math__ 00040 #define __MMDB_Math__ 00041 00042 #include "mmdb_mattype.h" 00043 00044 namespace mmdb { 00045 00046 namespace math { 00047 00048 // ------------------------------------------------------------------ 00049 00050 const realtype NO_TORSION = -MaxReal; 00051 00052 // U[0,1,2] = x,y,z 00053 extern realtype GetTorsion ( rvector U, rvector W, rvector V ); 00054 extern realtype GetAngle ( rvector U, rvector V ); 00055 00056 // Calculates the binomial coefficient n choose m, 0<=n<=500, 0<=m<=n 00057 extern realtype Combinations ( int n, int m ); 00058 00059 // Calculates precisely log(1-x) for x<1, including very small x 00060 extern realtype log1mx ( realtype x ); 00061 00062 // Calculates precisely 1 - exp(x) for any x including very small values 00063 extern realtype expc ( realtype x ); 00064 00065 inline double exp10 ( double x ) { return exp(x*ln10); } 00066 00067 // Calculates precisely 1-(1-x)**y including very small x and very large y 00068 extern realtype expc1mx ( realtype x, realtype y ); 00069 00070 } 00071 00072 } 00073 00074 00075 #endif 00076 00077
1.7.2