12 #ifndef __RD_MMFFPARAMS_H__ 13 #define __RD_MMFFPARAMS_H__ 22 #include <boost/cstdint.hpp> 25 #define M_PI 3.14159265358979323846 42 return ((x < 1.0e-10) && (x > -1.0e-10));
182 return ((std::find(d_params.begin(), d_params.end(),
183 atomType) != d_params.end()) ?
true :
false);
189 std::vector<boost::uint8_t> d_params;
217 #ifdef RDKIT_MMFF_PARAMS_USE_STD_MAP 218 std::map<const unsigned int, MMFFDef>::const_iterator res;
219 res = d_params.find(atomType);
221 return ((res != d_params.end()) ? &((*res).second) : NULL);
223 return ((atomType && (atomType <= d_params.size()))
224 ? &d_params[atomType - 1] : NULL);
231 #ifdef RDKIT_MMFF_PARAMS_USE_STD_MAP 232 std::map<const unsigned int, MMFFDef> d_params;
234 std::vector<MMFFDef> d_params;
263 #ifdef RDKIT_MMFF_PARAMS_USE_STD_MAP 264 std::map<const unsigned int, MMFFProp>::const_iterator res;
265 res = d_params.find(atomType);
267 return ((res != d_params.end()) ? &((*res).second) : NULL);
269 std::pair<std::vector<boost::uint8_t>::const_iterator,
270 std::vector<boost::uint8_t>::const_iterator> bounds =
271 std::equal_range(d_iAtomType.begin(), d_iAtomType.end(), atomType);
273 return ((bounds.first != bounds.second)
274 ? &d_params[bounds.first - d_iAtomType.begin()] : NULL);
281 #ifdef RDKIT_MMFF_PARAMS_USE_STD_MAP 282 std::map<const unsigned int, MMFFProp> d_params;
284 std::vector<MMFFProp> d_params;
285 std::vector<boost::uint8_t> d_iAtomType;
314 #ifdef RDKIT_MMFF_PARAMS_USE_STD_MAP 315 std::map<const unsigned int, MMFFPBCI>::const_iterator res;
316 res = d_params.find(atomType);
318 return ((res != d_params.end()) ? &((*res).second) : NULL);
320 return ((atomType && (atomType <= d_params.size()))
321 ? &d_params[atomType - 1] : NULL);
328 #ifdef RDKIT_MMFF_PARAMS_USE_STD_MAP 329 std::map<const unsigned int, MMFFPBCI> d_params;
331 std::vector<MMFFPBCI> d_params;
360 const unsigned int iAtomType,
const unsigned int jAtomType) {
363 const MMFFChg *mmffChgParams = NULL;
364 unsigned int canIAtomType = iAtomType;
365 unsigned int canJAtomType = jAtomType;
366 if (iAtomType > jAtomType) {
367 canIAtomType = jAtomType;
368 canJAtomType = iAtomType;
371 #ifdef RDKIT_MMFF_PARAMS_USE_STD_MAP 372 std::map<const unsigned int, std::map<const unsigned int, MMFFChg> >::const_iterator res1;
373 std::map<const unsigned int, MMFFChg>::const_iterator res2;
374 res1 = d_params[bondType].find(canIAtomType);
375 if (res1 != d_params[bondType].end()) {
376 res2 = ((*res1).second).find(canJAtomType);
377 if (res2 != ((*res1).second).end()) {
378 mmffChgParams = &((*res2).second);
382 std::pair<std::vector<boost::uint8_t>::const_iterator,
383 std::vector<boost::uint8_t>::const_iterator> bounds;
385 bounds = std::equal_range(d_iAtomType.begin(), d_iAtomType.end(), canIAtomType);
386 if (bounds.first != bounds.second) {
387 bounds = std::equal_range(d_jAtomType.begin() + (bounds.first - d_iAtomType.begin()),
388 d_jAtomType.begin() + (bounds.second - d_iAtomType.begin()), canJAtomType);
389 if (bounds.first != bounds.second) {
390 bounds = std::equal_range
391 (d_bondType.begin() + (bounds.first - d_jAtomType.begin()),
392 d_bondType.begin() + (bounds.second - d_jAtomType.begin()), bondType);
393 if (bounds.first != bounds.second) {
394 mmffChgParams = &d_params[bounds.first - d_bondType.begin()];
400 return std::make_pair(sign, mmffChgParams);
407 #ifdef RDKIT_MMFF_PARAMS_USE_STD_MAP 408 std::map<
const unsigned int, std::map<
const unsigned int,
409 std::map<const unsigned int, MMFFChg> > > d_params;
411 std::vector<MMFFChg> d_params;
412 std::vector<boost::uint8_t> d_iAtomType;
413 std::vector<boost::uint8_t> d_jAtomType;
414 std::vector<boost::uint8_t> d_bondType;
443 const unsigned int atomType,
const unsigned int nbrAtomType) {
445 const MMFFBond *mmffBondParams = NULL;
446 unsigned int canAtomType = atomType;
447 unsigned int canNbrAtomType = nbrAtomType;
448 if (atomType > nbrAtomType) {
449 canAtomType = nbrAtomType;
450 canNbrAtomType = atomType;
452 #ifdef RDKIT_MMFF_PARAMS_USE_STD_MAP 453 std::map<
const unsigned int, std::map<
const unsigned int,
454 std::map<const unsigned int, MMFFBond> > >::const_iterator res1;
455 std::map<
const unsigned int,
456 std::map<const unsigned int, MMFFBond> >::const_iterator res2;
457 std::map<const unsigned int, MMFFBond>::const_iterator res3;
458 res1 = d_params.find(bondType);
459 if (res1 != d_params.end()) {
460 res2 = ((*res1).second).find(canAtomType);
461 if (res2 != ((*res1).second).end()) {
462 res3 = ((*res2).second).find(canNbrAtomType);
463 if (res3 != ((*res2).second).end()) {
464 mmffBondParams = &((*res3).second);
469 std::pair<std::vector<boost::uint8_t>::const_iterator,
470 std::vector<boost::uint8_t>::const_iterator> bounds;
471 bounds = std::equal_range(d_iAtomType.begin(), d_iAtomType.end(), canAtomType);
472 if (bounds.first != bounds.second) {
473 bounds = std::equal_range(d_jAtomType.begin() + (bounds.first - d_iAtomType.begin()),
474 d_jAtomType.begin() + (bounds.second - d_iAtomType.begin()), canNbrAtomType);
475 if (bounds.first != bounds.second) {
476 bounds = std::equal_range
477 (d_bondType.begin() + (bounds.first - d_jAtomType.begin()),
478 d_bondType.begin() + (bounds.second - d_jAtomType.begin()), bondType);
479 if (bounds.first != bounds.second) {
480 mmffBondParams = &d_params[bounds.first - d_bondType.begin()];
486 return mmffBondParams;
492 #ifdef RDKIT_MMFF_PARAMS_USE_STD_MAP 493 std::map<
const unsigned int, std::map<
const unsigned int,
494 std::map<const unsigned int, MMFFBond> > > d_params;
496 std::vector<MMFFBond> d_params;
497 std::vector<boost::uint8_t> d_iAtomType;
498 std::vector<boost::uint8_t> d_jAtomType;
499 std::vector<boost::uint8_t> d_bondType;
529 const MMFFBond *mmffBndkParams = NULL;
530 unsigned int canAtomicNum = atomicNum;
531 unsigned int canNbrAtomicNum = nbrAtomicNum;
532 if (atomicNum > nbrAtomicNum) {
533 canAtomicNum = nbrAtomicNum;
534 canNbrAtomicNum = atomicNum;
536 #ifdef RDKIT_MMFF_PARAMS_USE_STD_MAP 537 std::map<
const unsigned int,
538 std::map<const unsigned int, MMFFBond> >::const_iterator res1;
539 std::map<const unsigned int, MMFFBond>::const_iterator res2;
540 res1 = d_params.find(canAtomicNum);
541 if (res1 != d_params.end()) {
542 res2 = ((*res1).second).find(canNbrAtomicNum);
543 if (res2 != ((*res1).second).end()) {
544 mmffBndkParams = &((*res2).second);
548 std::pair<std::vector<boost::uint8_t>::const_iterator,
549 std::vector<boost::uint8_t>::const_iterator> bounds;
550 bounds = std::equal_range
551 (d_iAtomicNum.begin(), d_iAtomicNum.end(), canAtomicNum);
552 if (bounds.first != bounds.second) {
553 bounds = std::equal_range
554 (d_jAtomicNum.begin() + (bounds.first - d_iAtomicNum.begin()),
555 d_jAtomicNum.begin() + (bounds.second - d_iAtomicNum.begin()),
557 if (bounds.first != bounds.second) {
558 mmffBndkParams = &d_params[bounds.first - d_jAtomicNum.begin()];
563 return mmffBndkParams;
569 #ifdef RDKIT_MMFF_PARAMS_USE_STD_MAP 570 std::map<const unsigned int, std::map<const unsigned int, MMFFBond> > d_params;
572 std::vector<MMFFBond> d_params;
573 std::vector<boost::uint8_t> d_iAtomicNum;
574 std::vector<boost::uint8_t> d_jAtomicNum;
605 unsigned int canIRow = iRow;
606 unsigned int canJRow = jRow;
611 #ifdef RDKIT_MMFF_PARAMS_USE_STD_MAP 612 std::map<
const unsigned int,
613 std::map<const unsigned int, MMFFHerschbachLaurie> >::const_iterator res1;
614 std::map<const unsigned int, MMFFHerschbachLaurie>::const_iterator res2;
615 res1 = d_params.find(canIRow);
616 if (res1 != d_params.end()) {
617 res2 = ((*res1).second).find(canJRow);
618 if (res2 != ((*res1).second).end()) {
619 mmffHerschbachLaurieParams = &((*res2).second);
623 std::pair<std::vector<boost::uint8_t>::const_iterator,
624 std::vector<boost::uint8_t>::const_iterator> bounds;
625 bounds = std::equal_range
626 (d_iRow.begin(), d_iRow.end(), canIRow);
627 if (bounds.first != bounds.second) {
628 bounds = std::equal_range
629 (d_jRow.begin() + (bounds.first - d_iRow.begin()),
630 d_jRow.begin() + (bounds.second - d_iRow.begin()),
632 if (bounds.first != bounds.second) {
633 mmffHerschbachLaurieParams = &d_params[bounds.first - d_jRow.begin()];
638 return mmffHerschbachLaurieParams;
644 #ifdef RDKIT_MMFF_PARAMS_USE_STD_MAP 645 std::map<const unsigned int, std::map<const unsigned int, MMFFHerschbachLaurie> > d_params;
647 std::vector<MMFFHerschbachLaurie> d_params;
648 std::vector<boost::uint8_t> d_iRow;
649 std::vector<boost::uint8_t> d_jRow;
678 #ifdef RDKIT_MMFF_PARAMS_USE_STD_MAP 679 std::map<const unsigned int, MMFFCovRadPauEle>::const_iterator res;
680 res = d_params.find(atomicNum);
682 return ((res != d_params.end()) ? &((*res).second) : NULL);
684 std::pair<std::vector<boost::uint8_t>::const_iterator,
685 std::vector<boost::uint8_t>::const_iterator> bounds =
686 std::equal_range(d_atomicNum.begin(), d_atomicNum.end(), atomicNum);
688 return ((bounds.first != bounds.second)
689 ? &d_params[bounds.first - d_atomicNum.begin()] : NULL);
696 #ifdef RDKIT_MMFF_PARAMS_USE_STD_MAP 697 std::map<const unsigned int, MMFFCovRadPauEle> d_params;
699 std::vector<MMFFCovRadPauEle> d_params;
700 std::vector<boost::uint8_t> d_atomicNum;
729 const unsigned int iAtomType,
const unsigned int jAtomType,
730 const unsigned int kAtomType ) {
734 unsigned int iter = 0;
740 #ifdef RDKIT_MMFF_PARAMS_USE_STD_MAP 741 std::map<
const unsigned int, std::map<
const unsigned int, std::map<
const unsigned int,
742 std::map<const unsigned int, MMFFAngle> > > >::const_iterator res1;
743 std::map<
const unsigned int, std::map<
const unsigned int, std::map<
const unsigned int,
745 std::map<const unsigned int, std::map<const unsigned int, MMFFAngle> >::const_iterator res3;
746 std::map<const unsigned int, MMFFAngle>::const_iterator res4;
747 while ((iter < 4) && (!mmffAngleParams)) {
748 unsigned int canIAtomType = (*mmffDef)(iAtomType)->
eqLevel[iter];
749 unsigned int canKAtomType = (*mmffDef)(kAtomType)->
eqLevel[iter];
750 if (canIAtomType > canKAtomType) {
751 unsigned int temp = canKAtomType;
752 canKAtomType = canIAtomType;
755 res1 = d_params.find(angleType);
756 if (res1 != d_params.end()) {
757 res2 = ((*res1).second).find(canIAtomType);
758 if (res2 != ((*res1).second).end()) {
759 res3 = ((*res2).second).find(jAtomType);
760 if (res3 != ((*res2).second).end()) {
761 res4 = ((*res3).second).find(canKAtomType);
762 if (res4 != ((*res3).second).end()) {
763 mmffAngleParams = &((*res4).second);
771 std::pair<std::vector<boost::uint8_t>::const_iterator,
772 std::vector<boost::uint8_t>::const_iterator> jBounds =
773 std::equal_range(d_jAtomType.begin(), d_jAtomType.end(), jAtomType);
774 std::pair<std::vector<boost::uint8_t>::const_iterator,
775 std::vector<boost::uint8_t>::const_iterator> bounds;
776 if (jBounds.first != jBounds.second) {
777 while ((iter < 4) && (!mmffAngleParams)) {
778 unsigned int canIAtomType = (*mmffDef)(iAtomType)->
eqLevel[iter];
779 unsigned int canKAtomType = (*mmffDef)(kAtomType)->
eqLevel[iter];
780 if (canIAtomType > canKAtomType) {
781 unsigned int temp = canKAtomType;
782 canKAtomType = canIAtomType;
785 bounds = std::equal_range
786 (d_iAtomType.begin() + (jBounds.first - d_jAtomType.begin()),
787 d_iAtomType.begin() + (jBounds.second - d_jAtomType.begin()),
789 if (bounds.first != bounds.second) {
790 bounds = std::equal_range
791 (d_kAtomType.begin() + (bounds.first - d_iAtomType.begin()),
792 d_kAtomType.begin() + (bounds.second - d_iAtomType.begin()),
794 if (bounds.first != bounds.second) {
795 bounds = std::equal_range
796 (d_angleType.begin() + (bounds.first - d_kAtomType.begin()),
797 d_angleType.begin() + (bounds.second - d_kAtomType.begin()), angleType);
798 if (bounds.first != bounds.second) {
799 mmffAngleParams = &d_params[bounds.first - d_angleType.begin()];
808 return mmffAngleParams;
814 #ifdef RDKIT_MMFF_PARAMS_USE_STD_MAP 815 std::map<
const unsigned int, std::map<
const unsigned int,
816 std::map<const unsigned int, std::map<const unsigned int, MMFFAngle> > > > d_params;
818 std::vector<MMFFAngle> d_params;
819 std::vector<boost::uint8_t> d_iAtomType;
820 std::vector<boost::uint8_t> d_jAtomType;
821 std::vector<boost::uint8_t> d_kAtomType;
822 std::vector<boost::uint8_t> d_angleType;
850 const std::pair<bool, const MMFFStbn *> getMMFFStbnParams
851 (
const unsigned int stretchBendType,
const unsigned int bondType1,
852 const unsigned int bondType2,
const unsigned int iAtomType,
853 const unsigned int jAtomType,
const unsigned int kAtomType) {
855 const MMFFStbn *mmffStbnParams = NULL;
857 unsigned int canIAtomType = iAtomType;
858 unsigned int canKAtomType = kAtomType;
859 unsigned int canStretchBendType = stretchBendType;
860 if (iAtomType > kAtomType) {
861 canIAtomType = kAtomType;
862 canKAtomType = iAtomType;
865 else if (iAtomType == kAtomType) {
866 swap = (bondType1 < bondType2);
868 #ifdef RDKIT_MMFF_PARAMS_USE_STD_MAP 869 std::map<
const unsigned int, std::map<
const unsigned int, std::map<
const unsigned int,
870 std::map<const unsigned int, MMFFStbn> > > >::const_iterator res1;
871 std::map<
const unsigned int, std::map<
const unsigned int, std::map<
const unsigned int,
873 std::map<const unsigned int, std::map<const unsigned int, MMFFStbn> >::const_iterator res3;
874 std::map<const unsigned int, MMFFStbn>::const_iterator res4;
875 res1 = d_params.find(canStretchBendType);
876 if (res1 != d_params.end()) {
877 res2 = ((*res1).second).find(canIAtomType);
878 if (res2 != ((*res1).second).end()) {
879 res3 = ((*res2).second).find(jAtomType);
880 if (res3 != ((*res2).second).end()) {
881 res4 = ((*res3).second).find(canKAtomType);
882 if (res4 != ((*res3).second).end()) {
883 mmffStbnParams = &((*res4).second);
889 std::pair<std::vector<boost::uint8_t>::const_iterator,
890 std::vector<boost::uint8_t>::const_iterator> jBounds =
891 std::equal_range(d_jAtomType.begin(), d_jAtomType.end(), jAtomType);
892 std::pair<std::vector<boost::uint8_t>::const_iterator,
893 std::vector<boost::uint8_t>::const_iterator> bounds;
894 if (jBounds.first != jBounds.second) {
895 bounds = std::equal_range
896 (d_iAtomType.begin() + (jBounds.first - d_jAtomType.begin()),
897 d_iAtomType.begin() + (jBounds.second - d_jAtomType.begin()),
899 if (bounds.first != bounds.second) {
900 bounds = std::equal_range
901 (d_kAtomType.begin() + (bounds.first - d_iAtomType.begin()),
902 d_kAtomType.begin() + (bounds.second - d_iAtomType.begin()),
904 if (bounds.first != bounds.second) {
905 bounds = std::equal_range
906 (d_stretchBendType.begin() + (bounds.first - d_kAtomType.begin()),
907 d_stretchBendType.begin() + (bounds.second - d_kAtomType.begin()),
909 if (bounds.first != bounds.second) {
910 mmffStbnParams = &d_params[bounds.first - d_stretchBendType.begin()];
917 return std::make_pair(swap, mmffStbnParams);
923 #ifdef RDKIT_MMFF_PARAMS_USE_STD_MAP 924 std::map<
const unsigned int, std::map<
const unsigned int,
925 std::map<const unsigned int, std::map<const unsigned int, MMFFStbn> > > > d_params;
927 std::vector<MMFFStbn> d_params;
928 std::vector<boost::uint8_t> d_iAtomType;
929 std::vector<boost::uint8_t> d_jAtomType;
930 std::vector<boost::uint8_t> d_kAtomType;
931 std::vector<boost::uint8_t> d_stretchBendType;
960 const unsigned int periodicTableRow2,
const unsigned int periodicTableRow3) {
962 std::map<
const unsigned int, std::map<
const unsigned int, std::map<
const unsigned int,
964 std::map<const unsigned int, std::map<const unsigned int, MMFFStbn> >::const_iterator res2;
965 std::map<const unsigned int, MMFFStbn>::const_iterator res3;
966 const MMFFStbn *mmffDfsbParams = NULL;
968 unsigned int canPeriodicTableRow1 = periodicTableRow1;
969 unsigned int canPeriodicTableRow3 = periodicTableRow3;
970 if (periodicTableRow1 > periodicTableRow3) {
971 canPeriodicTableRow1 = periodicTableRow3;
972 canPeriodicTableRow3 = periodicTableRow1;
975 res1 = d_params.find(canPeriodicTableRow1);
976 if (res1 != d_params.end()) {
977 res2 = ((*res1).second).find(periodicTableRow2);
978 if (res2 != ((*res1).second).end()) {
979 res3 = ((*res2).second).find(canPeriodicTableRow3);
980 if (res3 != ((*res2).second).end()) {
981 mmffDfsbParams = &((*res3).second);
986 return std::make_pair(swap, mmffDfsbParams);
992 std::map<
const unsigned int, std::map<
const unsigned int,
993 std::map<const unsigned int, MMFFStbn> > > d_params;
1016 (
const bool isMMFFs =
false,
const std::string &mmffOop =
"");
1022 const unsigned int kAtomType,
const unsigned int lAtomType) {
1025 const MMFFOop *mmffOopParams = NULL;
1026 unsigned int iter = 0;
1027 std::vector<unsigned int> canIKLAtomType(3);
1032 #ifdef RDKIT_MMFF_PARAMS_USE_STD_MAP 1033 std::map<
const unsigned int, std::map<
const unsigned int, std::map<
const unsigned int,
1034 std::map<const unsigned int, MMFFOop> > > >::const_iterator res1;
1035 std::map<
const unsigned int, std::map<
const unsigned int, std::map<
const unsigned int,
1036 MMFFOop> > >::const_iterator res2;
1037 std::map<const unsigned int, std::map<const unsigned int, MMFFOop> >::const_iterator res3;
1038 std::map<const unsigned int, MMFFOop>::const_iterator res4;
1039 while ((iter < 4) && (!mmffOopParams)) {
1040 canIKLAtomType[0] = (*mmffDef)(iAtomType)->
eqLevel[iter];
1041 unsigned int canJAtomType = jAtomType;
1042 canIKLAtomType[1] = (*mmffDef)(kAtomType)->
eqLevel[iter];
1043 canIKLAtomType[2] = (*mmffDef)(lAtomType)->
eqLevel[iter];
1044 std::sort(canIKLAtomType.begin(), canIKLAtomType.end());
1045 res1 = d_params.find(canIKLAtomType[0]);
1046 if (res1 != d_params.end()) {
1047 res2 = ((*res1).second).find(canJAtomType);
1048 if (res2 != ((*res1).second).end()) {
1049 res3 = ((*res2).second).find(canIKLAtomType[1]);
1050 if (res3 != ((*res2).second).end()) {
1051 res4 = ((*res3).second).find(canIKLAtomType[2]);
1052 if (res4 != ((*res3).second).end()) {
1053 mmffOopParams = &((*res4).second);
1061 std::pair<std::vector<boost::uint8_t>::const_iterator,
1062 std::vector<boost::uint8_t>::const_iterator> jBounds =
1063 std::equal_range(d_jAtomType.begin(), d_jAtomType.end(), jAtomType);
1064 std::pair<std::vector<boost::uint8_t>::const_iterator,
1065 std::vector<boost::uint8_t>::const_iterator> bounds;
1066 if (jBounds.first != jBounds.second) {
1067 while ((iter < 4) && (!mmffOopParams)) {
1068 canIKLAtomType[0] = (*mmffDef)(iAtomType)->
eqLevel[iter];
1069 canIKLAtomType[1] = (*mmffDef)(kAtomType)->
eqLevel[iter];
1070 canIKLAtomType[2] = (*mmffDef)(lAtomType)->
eqLevel[iter];
1071 std::sort(canIKLAtomType.begin(), canIKLAtomType.end());
1072 bounds = std::equal_range
1073 (d_iAtomType.begin() + (jBounds.first - d_jAtomType.begin()),
1074 d_iAtomType.begin() + (jBounds.second - d_jAtomType.begin()),
1076 if (bounds.first != bounds.second) {
1077 bounds = std::equal_range
1078 (d_kAtomType.begin() + (bounds.first - d_iAtomType.begin()),
1079 d_kAtomType.begin() + (bounds.second - d_iAtomType.begin()),
1081 if (bounds.first != bounds.second) {
1082 bounds = std::equal_range
1083 (d_lAtomType.begin() + (bounds.first - d_kAtomType.begin()),
1084 d_lAtomType.begin() + (bounds.second - d_kAtomType.begin()),
1086 if (bounds.first != bounds.second) {
1087 mmffOopParams = &d_params[bounds.first - d_lAtomType.begin()];
1096 return mmffOopParams;
1102 #ifdef RDKIT_MMFF_PARAMS_USE_STD_MAP 1103 std::map<
const unsigned int, std::map<
const unsigned int,
1104 std::map<const unsigned int, std::map<const unsigned int, MMFFOop> > > > d_params;
1106 std::vector<MMFFOop> d_params;
1107 std::vector<boost::uint8_t> d_iAtomType;
1108 std::vector<boost::uint8_t> d_jAtomType;
1109 std::vector<boost::uint8_t> d_kAtomType;
1110 std::vector<boost::uint8_t> d_lAtomType;
1133 static MMFFTorCollection *getMMFFTor(
const bool isMMFFs,
const std::string &mmffTor =
"");
1138 const std::pair<const unsigned int, const MMFFTor *> getMMFFTorParams
1139 (
const std::pair<unsigned int, unsigned int> torType,
1140 const unsigned int iAtomType,
const unsigned int jAtomType,
1141 const unsigned int kAtomType,
const unsigned int lAtomType)
1144 const MMFFTor *mmffTorParams = NULL;
1145 unsigned int iter = 0;
1146 unsigned int iWildCard = 0;
1147 unsigned int lWildCard = 0;
1148 unsigned int canTorType = torType.first;
1149 unsigned int maxIter = 5;
1154 #ifdef RDKIT_MMFF_PARAMS_USE_STD_MAP 1155 std::map<
const unsigned int,
1156 std::map<
const unsigned int, std::map<
const unsigned int,
1157 std::map<
const unsigned int, std::map<
const unsigned int,
1158 MMFFTor> > > > >::const_iterator res1;
1159 std::map<
const unsigned int,
1160 std::map<
const unsigned int, std::map<
const unsigned int,
1161 std::map<const unsigned int, MMFFTor> > > >::const_iterator res2;
1162 std::map<
const unsigned int,
1163 std::map<
const unsigned int, std::map<
const unsigned int,
1164 MMFFTor> > >::const_iterator res3;
1165 std::map<
const unsigned int,
1166 std::map<const unsigned int, MMFFTor> >::const_iterator res4;
1167 std::map<const unsigned int, MMFFTor>::const_iterator res5;
1169 std::pair<std::vector<boost::uint8_t>::const_iterator,
1170 std::vector<boost::uint8_t>::const_iterator> jBounds;
1171 std::pair<std::vector<boost::uint8_t>::const_iterator,
1172 std::vector<boost::uint8_t>::const_iterator> bounds;
1175 while (((iter < maxIter) && ((!mmffTorParams) || (maxIter == 4)))
1176 || ((iter == 4) && (torType.first == 5) && torType.second)) {
1182 if ((maxIter == 5) && (iter == 4)) {
1185 canTorType = torType.second;
1193 else if (iter == 2) {
1197 unsigned int canIAtomType = (*mmffDef)(iAtomType)->
eqLevel[iWildCard];
1198 unsigned int canJAtomType = jAtomType;
1199 unsigned int canKAtomType = kAtomType;
1200 unsigned int canLAtomType = (*mmffDef)(lAtomType)->
eqLevel[lWildCard];
1201 if (canJAtomType > canKAtomType) {
1202 unsigned int temp = canKAtomType;
1203 canKAtomType = canJAtomType;
1204 canJAtomType = temp;
1205 temp = canLAtomType;
1206 canLAtomType = canIAtomType;
1207 canIAtomType = temp;
1209 else if ((canJAtomType == canKAtomType)
1210 && (canIAtomType > canLAtomType)) {
1211 unsigned int temp = canLAtomType;
1212 canLAtomType = canIAtomType;
1213 canIAtomType = temp;
1215 #ifdef RDKIT_MMFF_PARAMS_USE_STD_MAP 1216 res1 = d_params.find(canTorType);
1217 if (res1 != d_params.end()) {
1218 res2 = ((*res1).second).find(canIAtomType);
1219 if (res2 != ((*res1).second).end()) {
1220 res3 = ((*res2).second).find(canJAtomType);
1221 if (res3 != ((*res2).second).end()) {
1222 res4 = ((*res3).second).find(canKAtomType);
1223 if (res4 != ((*res3).second).end()) {
1224 res5 = ((*res4).second).find(canLAtomType);
1225 if (res5 != ((*res4).second).end()) {
1226 mmffTorParams = &((*res5).second);
1236 jBounds = std::equal_range(d_jAtomType.begin(), d_jAtomType.end(), canJAtomType);
1237 if (jBounds.first != jBounds.second) {
1238 bounds = std::equal_range
1239 (d_kAtomType.begin() + (jBounds.first - d_jAtomType.begin()),
1240 d_kAtomType.begin() + (jBounds.second - d_jAtomType.begin()),
1242 if (bounds.first != bounds.second) {
1243 bounds = std::equal_range
1244 (d_iAtomType.begin() + (bounds.first - d_kAtomType.begin()),
1245 d_iAtomType.begin() + (bounds.second - d_kAtomType.begin()),
1247 if (bounds.first != bounds.second) {
1248 bounds = std::equal_range
1249 (d_lAtomType.begin() + (bounds.first - d_iAtomType.begin()),
1250 d_lAtomType.begin() + (bounds.second - d_iAtomType.begin()),
1252 if (bounds.first != bounds.second) {
1253 bounds = std::equal_range
1254 (d_torType.begin() + (bounds.first - d_lAtomType.begin()),
1255 d_torType.begin() + (bounds.second - d_lAtomType.begin()),
1257 if (bounds.first != bounds.second) {
1258 mmffTorParams = &d_params[bounds.first - d_torType.begin()];
1271 return std::make_pair(canTorType, mmffTorParams);
1277 #ifdef RDKIT_MMFF_PARAMS_USE_STD_MAP 1278 std::map<
const unsigned int,
1279 std::map<
const unsigned int, std::map<
const unsigned int,
1280 std::map<
const unsigned int, std::map<
const unsigned int,
1283 std::vector<MMFFTor> d_params;
1284 std::vector<boost::uint8_t> d_iAtomType;
1285 std::vector<boost::uint8_t> d_jAtomType;
1286 std::vector<boost::uint8_t> d_kAtomType;
1287 std::vector<boost::uint8_t> d_lAtomType;
1288 std::vector<boost::uint8_t> d_torType;
1322 #ifdef RDKIT_MMFF_PARAMS_USE_STD_MAP 1323 std::map<const unsigned int, MMFFVdW>::const_iterator res;
1324 res = d_params.find(atomType);
1326 return (res != d_params.end() ? &((*res).second) : NULL);
1328 std::pair<std::vector<boost::uint8_t>::const_iterator,
1329 std::vector<boost::uint8_t>::const_iterator> bounds =
1330 std::equal_range(d_atomType.begin(), d_atomType.end(), atomType);
1332 return ((bounds.first != bounds.second)
1333 ? &d_params[bounds.first - d_atomType.begin()] : NULL);
1340 #ifdef RDKIT_MMFF_PARAMS_USE_STD_MAP 1341 std::map<const unsigned int, MMFFVdW> d_params;
1343 std::vector<MMFFVdW> d_params;
1344 std::vector<boost::uint8_t> d_atomType;
const MMFFPBCI * operator()(const unsigned int atomType) const
Looks up the parameters for a particular key and returns them.
class to store MMFF parameters for angle bending
static MMFFDefCollection * getMMFFDef(const std::string &mmffDef="")
gets a pointer to the singleton MMFFDefCollection
const MMFFVdW * operator()(const unsigned int atomType) const
Looks up the parameters for a particular key and returns them.
bool isDoubleZero(const double x)
bool isMMFFAromatic(const unsigned int atomType) const
Looks up the parameters for a particular key and returns them.
class to store MMFF parameters for non-bonded Van der Waals
double power
gets a pointer to the singleton MMFFVdWCollection
const MMFFHerschbachLaurie * operator()(const int iRow, const int jRow)
Looks up the parameters for a particular key and returns them.
const MMFFOop * operator()(const unsigned int iAtomType, const unsigned int jAtomType, const unsigned int kAtomType, const unsigned int lAtomType)
Looks up the parameters for a particular key and returns them.
const MMFFBond * operator()(const int atomicNum, const int nbrAtomicNum)
Looks up the parameters for a particular key and returns them.
const MMFFDef * operator()(const unsigned int atomType) const
Looks up the parameters for a particular key and returns them.
const std::pair< int, const MMFFChg * > getMMFFChgParams(const unsigned int bondType, const unsigned int iAtomType, const unsigned int jAtomType)
Looks up the parameters for a particular key and returns them.
const MMFFCovRadPauEle * operator()(const unsigned int atomicNum) const
Looks up the parameters for a particular key and returns them.
const MMFFProp * operator()(const unsigned int atomType) const
Looks up the parameters for a particular key and returns them.
const double MDYNE_A_TO_KCAL_MOL
class to store MMFF parameters for stretch-bending
void clipToOne(double &x)
class to store MMFF parameters for bond stretching
class to store MMFF parameters for out-of-plane bending
boost::uint8_t eqLevel[4]
const MMFFBond * operator()(const unsigned int bondType, const unsigned int atomType, const unsigned int nbrAtomType)
Looks up the parameters for a particular key and returns them.
const std::pair< bool, const MMFFStbn * > getMMFFDfsbParams(const unsigned int periodicTableRow1, const unsigned int periodicTableRow2, const unsigned int periodicTableRow3)
Looks up the parameters for a particular key and returns them.
class to store MMFF parameters for torsions
class to store MMFF atom type equivalence levels
class to store MMFF Partial Bond Charge Increments
const MMFFAngle * operator()(const unsigned int angleType, const unsigned int iAtomType, const unsigned int jAtomType, const unsigned int kAtomType)
Looks up the parameters for a particular key and returns them.
class to store MMFF Properties