13 #ifndef __RD_MMFFPARAMS_H__ 14 #define __RD_MMFFPARAMS_H__ 27 #define M_PI 3.14159265358979323846 44 return ((x < 1.0e-10) && (x > -1.0e-10));
49 }
else if (x < -1.0) {
57 std::uint8_t eqLevel[4];
179 const std::uint8_t *aromatic_types = NULL);
185 return ((std::find(d_params.begin(), d_params.end(), atomType) !=
194 static class std::unique_ptr<MMFFAromCollection> ds_instance;
195 std::vector<std::uint8_t> d_params;
224 #ifdef RDKIT_MMFF_PARAMS_USE_STD_MAP 225 std::map<const unsigned int, MMFFDef>::const_iterator res;
226 res = d_params.find(atomType);
228 return ((res != d_params.end()) ? &((*res).second) : NULL);
230 return ((atomType && (atomType <= d_params.size()))
231 ? &d_params[atomType - 1]
239 static class std::unique_ptr<MMFFDefCollection> ds_instance;
240 #ifdef RDKIT_MMFF_PARAMS_USE_STD_MAP 241 std::map<const unsigned int, MMFFDef> d_params;
243 std::vector<MMFFDef> d_params;
272 #ifdef RDKIT_MMFF_PARAMS_USE_STD_MAP 273 std::map<const unsigned int, MMFFProp>::const_iterator res;
274 res = d_params.find(atomType);
276 return ((res != d_params.end()) ? &((*res).second) : NULL);
278 std::pair<std::vector<std::uint8_t>::const_iterator,
279 std::vector<std::uint8_t>::const_iterator> bounds =
280 std::equal_range(d_iAtomType.begin(), d_iAtomType.end(), atomType);
282 return ((bounds.first != bounds.second)
283 ? &d_params[bounds.first - d_iAtomType.begin()]
291 static class std::unique_ptr<MMFFPropCollection> ds_instance;
292 #ifdef RDKIT_MMFF_PARAMS_USE_STD_MAP 293 std::map<const unsigned int, MMFFProp> d_params;
295 std::vector<MMFFProp> d_params;
296 std::vector<std::uint8_t> d_iAtomType;
325 #ifdef RDKIT_MMFF_PARAMS_USE_STD_MAP 326 std::map<const unsigned int, MMFFPBCI>::const_iterator res;
327 res = d_params.find(atomType);
329 return ((res != d_params.end()) ? &((*res).second) : NULL);
331 return ((atomType && (atomType <= d_params.size()))
332 ? &d_params[atomType - 1]
340 static class std::unique_ptr<MMFFPBCICollection> ds_instance;
341 #ifdef RDKIT_MMFF_PARAMS_USE_STD_MAP 342 std::map<const unsigned int, MMFFPBCI> d_params;
344 std::vector<MMFFPBCI> d_params;
373 const unsigned int bondType,
const unsigned int iAtomType,
374 const unsigned int jAtomType) {
376 const MMFFChg *mmffChgParams = NULL;
377 unsigned int canIAtomType = iAtomType;
378 unsigned int canJAtomType = jAtomType;
379 if (iAtomType > jAtomType) {
380 canIAtomType = jAtomType;
381 canJAtomType = iAtomType;
384 #ifdef RDKIT_MMFF_PARAMS_USE_STD_MAP 385 std::map<
const unsigned int,
386 std::map<const unsigned int, MMFFChg> >::const_iterator res1;
387 std::map<const unsigned int, MMFFChg>::const_iterator res2;
388 res1 = d_params[bondType].find(canIAtomType);
389 if (res1 != d_params[bondType].end()) {
390 res2 = ((*res1).second).find(canJAtomType);
391 if (res2 != ((*res1).second).end()) {
392 mmffChgParams = &((*res2).second);
396 std::pair<std::vector<std::uint8_t>::const_iterator,
397 std::vector<std::uint8_t>::const_iterator> bounds;
400 std::equal_range(d_iAtomType.begin(), d_iAtomType.end(), canIAtomType);
401 if (bounds.first != bounds.second) {
402 bounds = std::equal_range(
403 d_jAtomType.begin() + (bounds.first - d_iAtomType.begin()),
404 d_jAtomType.begin() + (bounds.second - d_iAtomType.begin()),
406 if (bounds.first != bounds.second) {
407 bounds = std::equal_range(
408 d_bondType.begin() + (bounds.first - d_jAtomType.begin()),
409 d_bondType.begin() + (bounds.second - d_jAtomType.begin()),
411 if (bounds.first != bounds.second) {
412 mmffChgParams = &d_params[bounds.first - d_bondType.begin()];
418 return std::make_pair(sign, mmffChgParams);
424 static class std::unique_ptr<MMFFChgCollection> ds_instance;
426 #ifdef RDKIT_MMFF_PARAMS_USE_STD_MAP 429 std::map<const unsigned int, std::map<const unsigned int, MMFFChg> > >
432 std::vector<MMFFChg> d_params;
433 std::vector<std::uint8_t> d_iAtomType;
434 std::vector<std::uint8_t> d_jAtomType;
435 std::vector<std::uint8_t> d_bondType;
464 const unsigned int atomType,
465 const unsigned int nbrAtomType) {
466 const MMFFBond *mmffBondParams = NULL;
467 unsigned int canAtomType = atomType;
468 unsigned int canNbrAtomType = nbrAtomType;
469 if (atomType > nbrAtomType) {
470 canAtomType = nbrAtomType;
471 canNbrAtomType = atomType;
473 #ifdef RDKIT_MMFF_PARAMS_USE_STD_MAP 474 std::map<
const unsigned int,
475 std::map<
const unsigned int,
476 std::map<const unsigned int, MMFFBond> > >::const_iterator
478 std::map<
const unsigned int,
479 std::map<const unsigned int, MMFFBond> >::const_iterator res2;
480 std::map<const unsigned int, MMFFBond>::const_iterator res3;
481 res1 = d_params.find(bondType);
482 if (res1 != d_params.end()) {
483 res2 = ((*res1).second).find(canAtomType);
484 if (res2 != ((*res1).second).end()) {
485 res3 = ((*res2).second).find(canNbrAtomType);
486 if (res3 != ((*res2).second).end()) {
487 mmffBondParams = &((*res3).second);
492 std::pair<std::vector<std::uint8_t>::const_iterator,
493 std::vector<std::uint8_t>::const_iterator> bounds;
495 std::equal_range(d_iAtomType.begin(), d_iAtomType.end(), canAtomType);
496 if (bounds.first != bounds.second) {
497 bounds = std::equal_range(
498 d_jAtomType.begin() + (bounds.first - d_iAtomType.begin()),
499 d_jAtomType.begin() + (bounds.second - d_iAtomType.begin()),
501 if (bounds.first != bounds.second) {
502 bounds = std::equal_range(
503 d_bondType.begin() + (bounds.first - d_jAtomType.begin()),
504 d_bondType.begin() + (bounds.second - d_jAtomType.begin()),
506 if (bounds.first != bounds.second) {
507 mmffBondParams = &d_params[bounds.first - d_bondType.begin()];
513 return mmffBondParams;
519 static class std::unique_ptr<MMFFBondCollection> ds_instance;
520 #ifdef RDKIT_MMFF_PARAMS_USE_STD_MAP 523 std::map<const unsigned int, std::map<const unsigned int, MMFFBond> > >
526 std::vector<MMFFBond> d_params;
527 std::vector<std::uint8_t> d_iAtomType;
528 std::vector<std::uint8_t> d_jAtomType;
529 std::vector<std::uint8_t> d_bondType;
558 const MMFFBond *mmffBndkParams = NULL;
559 unsigned int canAtomicNum = atomicNum;
560 unsigned int canNbrAtomicNum = nbrAtomicNum;
561 if (atomicNum > nbrAtomicNum) {
562 canAtomicNum = nbrAtomicNum;
563 canNbrAtomicNum = atomicNum;
565 #ifdef RDKIT_MMFF_PARAMS_USE_STD_MAP 566 std::map<
const unsigned int,
567 std::map<const unsigned int, MMFFBond> >::const_iterator res1;
568 std::map<const unsigned int, MMFFBond>::const_iterator res2;
569 res1 = d_params.find(canAtomicNum);
570 if (res1 != d_params.end()) {
571 res2 = ((*res1).second).find(canNbrAtomicNum);
572 if (res2 != ((*res1).second).end()) {
573 mmffBndkParams = &((*res2).second);
577 std::pair<std::vector<std::uint8_t>::const_iterator,
578 std::vector<std::uint8_t>::const_iterator> bounds;
579 bounds = std::equal_range(d_iAtomicNum.begin(), d_iAtomicNum.end(),
581 if (bounds.first != bounds.second) {
582 bounds = std::equal_range(
583 d_jAtomicNum.begin() + (bounds.first - d_iAtomicNum.begin()),
584 d_jAtomicNum.begin() + (bounds.second - d_iAtomicNum.begin()),
586 if (bounds.first != bounds.second) {
587 mmffBndkParams = &d_params[bounds.first - d_jAtomicNum.begin()];
592 return mmffBndkParams;
598 static class std::unique_ptr<MMFFBndkCollection> ds_instance;
599 #ifdef RDKIT_MMFF_PARAMS_USE_STD_MAP 600 std::map<const unsigned int, std::map<const unsigned int, MMFFBond> >
603 std::vector<MMFFBond> d_params;
604 std::vector<std::uint8_t> d_iAtomicNum;
605 std::vector<std::uint8_t> d_jAtomicNum;
632 const std::string &mmffHerschbachLaurie =
"");
639 unsigned int canIRow = iRow;
640 unsigned int canJRow = jRow;
645 #ifdef RDKIT_MMFF_PARAMS_USE_STD_MAP 646 std::map<
const unsigned int,
647 std::map<
const unsigned int,
649 std::map<const unsigned int, MMFFHerschbachLaurie>::const_iterator res2;
650 res1 = d_params.find(canIRow);
651 if (res1 != d_params.end()) {
652 res2 = ((*res1).second).find(canJRow);
653 if (res2 != ((*res1).second).end()) {
654 mmffHerschbachLaurieParams = &((*res2).second);
658 std::pair<std::vector<std::uint8_t>::const_iterator,
659 std::vector<std::uint8_t>::const_iterator> bounds;
660 bounds = std::equal_range(d_iRow.begin(), d_iRow.end(), canIRow);
661 if (bounds.first != bounds.second) {
662 bounds = std::equal_range(
663 d_jRow.begin() + (bounds.first - d_iRow.begin()),
664 d_jRow.begin() + (bounds.second - d_iRow.begin()), canJRow);
665 if (bounds.first != bounds.second) {
666 mmffHerschbachLaurieParams = &d_params[bounds.first - d_jRow.begin()];
671 return mmffHerschbachLaurieParams;
677 static class std::unique_ptr<MMFFHerschbachLaurieCollection> ds_instance;
678 #ifdef RDKIT_MMFF_PARAMS_USE_STD_MAP 679 std::map<
const unsigned int,
680 std::map<const unsigned int, MMFFHerschbachLaurie> >
683 std::vector<MMFFHerschbachLaurie> d_params;
684 std::vector<std::uint8_t> d_iRow;
685 std::vector<std::uint8_t> d_jRow;
712 const std::string &mmffCovRadPauEle =
"");
718 #ifdef RDKIT_MMFF_PARAMS_USE_STD_MAP 719 std::map<const unsigned int, MMFFCovRadPauEle>::const_iterator res;
720 res = d_params.find(atomicNum);
722 return ((res != d_params.end()) ? &((*res).second) : NULL);
724 std::pair<std::vector<std::uint8_t>::const_iterator,
725 std::vector<std::uint8_t>::const_iterator> bounds =
726 std::equal_range(d_atomicNum.begin(), d_atomicNum.end(), atomicNum);
728 return ((bounds.first != bounds.second)
729 ? &d_params[bounds.first - d_atomicNum.begin()]
737 static class std::unique_ptr<MMFFCovRadPauEleCollection> ds_instance;
738 #ifdef RDKIT_MMFF_PARAMS_USE_STD_MAP 739 std::map<const unsigned int, MMFFCovRadPauEle>
742 std::vector<MMFFCovRadPauEle> d_params;
743 std::vector<std::uint8_t> d_atomicNum;
772 const unsigned int iAtomType,
773 const unsigned int jAtomType,
774 const unsigned int kAtomType) {
777 unsigned int iter = 0;
783 #ifdef RDKIT_MMFF_PARAMS_USE_STD_MAP 784 std::map<
const unsigned int,
785 std::map<
const unsigned int,
786 std::map<
const unsigned int,
787 std::map<const unsigned int, MMFFAngle> > > >::
789 std::map<
const unsigned int,
790 std::map<
const unsigned int,
791 std::map<const unsigned int, MMFFAngle> > >::
793 std::map<
const unsigned int,
794 std::map<const unsigned int, MMFFAngle> >::const_iterator res3;
795 std::map<const unsigned int, MMFFAngle>::const_iterator res4;
796 while ((iter < 4) && (!mmffAngleParams)) {
797 unsigned int canIAtomType = (*mmffDef)(iAtomType)->eqLevel[iter];
798 unsigned int canKAtomType = (*mmffDef)(kAtomType)->eqLevel[iter];
799 if (canIAtomType > canKAtomType) {
800 unsigned int temp = canKAtomType;
801 canKAtomType = canIAtomType;
804 res1 = d_params.find(angleType);
805 if (res1 != d_params.end()) {
806 res2 = ((*res1).second).find(canIAtomType);
807 if (res2 != ((*res1).second).end()) {
808 res3 = ((*res2).second).find(jAtomType);
809 if (res3 != ((*res2).second).end()) {
810 res4 = ((*res3).second).find(canKAtomType);
811 if (res4 != ((*res3).second).end()) {
812 mmffAngleParams = &((*res4).second);
820 std::pair<std::vector<std::uint8_t>::const_iterator,
821 std::vector<std::uint8_t>::const_iterator> jBounds =
822 std::equal_range(d_jAtomType.begin(), d_jAtomType.end(), jAtomType);
823 std::pair<std::vector<std::uint8_t>::const_iterator,
824 std::vector<std::uint8_t>::const_iterator> bounds;
825 if (jBounds.first != jBounds.second) {
826 while ((iter < 4) && (!mmffAngleParams)) {
827 unsigned int canIAtomType = (*mmffDef)(iAtomType)->eqLevel[iter];
828 unsigned int canKAtomType = (*mmffDef)(kAtomType)->eqLevel[iter];
829 if (canIAtomType > canKAtomType) {
830 unsigned int temp = canKAtomType;
831 canKAtomType = canIAtomType;
834 bounds = std::equal_range(
835 d_iAtomType.begin() + (jBounds.first - d_jAtomType.begin()),
836 d_iAtomType.begin() + (jBounds.second - d_jAtomType.begin()),
838 if (bounds.first != bounds.second) {
839 bounds = std::equal_range(
840 d_kAtomType.begin() + (bounds.first - d_iAtomType.begin()),
841 d_kAtomType.begin() + (bounds.second - d_iAtomType.begin()),
843 if (bounds.first != bounds.second) {
844 bounds = std::equal_range(
845 d_angleType.begin() + (bounds.first - d_kAtomType.begin()),
846 d_angleType.begin() + (bounds.second - d_kAtomType.begin()),
848 if (bounds.first != bounds.second) {
849 mmffAngleParams = &d_params[bounds.first - d_angleType.begin()];
858 return mmffAngleParams;
864 static class std::unique_ptr<MMFFAngleCollection> ds_instance;
865 #ifdef RDKIT_MMFF_PARAMS_USE_STD_MAP 866 std::map<
const unsigned int,
867 std::map<
const unsigned int,
868 std::map<
const unsigned int,
869 std::map<const unsigned int, MMFFAngle> > > >
872 std::vector<MMFFAngle> d_params;
873 std::vector<std::uint8_t> d_iAtomType;
874 std::vector<std::uint8_t> d_jAtomType;
875 std::vector<std::uint8_t> d_kAtomType;
876 std::vector<std::uint8_t>
906 const unsigned int stretchBendType,
const unsigned int bondType1,
907 const unsigned int bondType2,
const unsigned int iAtomType,
908 const unsigned int jAtomType,
const unsigned int kAtomType) {
909 const MMFFStbn *mmffStbnParams = NULL;
911 unsigned int canIAtomType = iAtomType;
912 unsigned int canKAtomType = kAtomType;
913 unsigned int canStretchBendType = stretchBendType;
914 if (iAtomType > kAtomType) {
915 canIAtomType = kAtomType;
916 canKAtomType = iAtomType;
918 }
else if (iAtomType == kAtomType) {
919 swap = (bondType1 < bondType2);
921 #ifdef RDKIT_MMFF_PARAMS_USE_STD_MAP 922 std::map<
const unsigned int,
923 std::map<
const unsigned int,
924 std::map<
const unsigned int,
925 std::map<const unsigned int, MMFFStbn> > > >::
927 std::map<
const unsigned int,
928 std::map<
const unsigned int,
929 std::map<const unsigned int, MMFFStbn> > >::const_iterator
931 std::map<
const unsigned int,
932 std::map<const unsigned int, MMFFStbn> >::const_iterator res3;
933 std::map<const unsigned int, MMFFStbn>::const_iterator res4;
934 res1 = d_params.find(canStretchBendType);
935 if (res1 != d_params.end()) {
936 res2 = ((*res1).second).find(canIAtomType);
937 if (res2 != ((*res1).second).end()) {
938 res3 = ((*res2).second).find(jAtomType);
939 if (res3 != ((*res2).second).end()) {
940 res4 = ((*res3).second).find(canKAtomType);
941 if (res4 != ((*res3).second).end()) {
942 mmffStbnParams = &((*res4).second);
948 std::pair<std::vector<std::uint8_t>::const_iterator,
949 std::vector<std::uint8_t>::const_iterator> jBounds =
950 std::equal_range(d_jAtomType.begin(), d_jAtomType.end(), jAtomType);
951 std::pair<std::vector<std::uint8_t>::const_iterator,
952 std::vector<std::uint8_t>::const_iterator> bounds;
953 if (jBounds.first != jBounds.second) {
954 bounds = std::equal_range(
955 d_iAtomType.begin() + (jBounds.first - d_jAtomType.begin()),
956 d_iAtomType.begin() + (jBounds.second - d_jAtomType.begin()),
958 if (bounds.first != bounds.second) {
959 bounds = std::equal_range(
960 d_kAtomType.begin() + (bounds.first - d_iAtomType.begin()),
961 d_kAtomType.begin() + (bounds.second - d_iAtomType.begin()),
963 if (bounds.first != bounds.second) {
964 bounds = std::equal_range(
965 d_stretchBendType.begin() + (bounds.first - d_kAtomType.begin()),
966 d_stretchBendType.begin() + (bounds.second - d_kAtomType.begin()),
968 if (bounds.first != bounds.second) {
970 &d_params[bounds.first - d_stretchBendType.begin()];
977 return std::make_pair(swap, mmffStbnParams);
983 static class std::unique_ptr<MMFFStbnCollection> ds_instance;
984 #ifdef RDKIT_MMFF_PARAMS_USE_STD_MAP 985 std::map<
const unsigned int,
986 std::map<
const unsigned int,
987 std::map<
const unsigned int,
988 std::map<const unsigned int, MMFFStbn> > > >
991 std::vector<MMFFStbn> d_params;
992 std::vector<std::uint8_t> d_iAtomType;
993 std::vector<std::uint8_t> d_jAtomType;
994 std::vector<std::uint8_t> d_kAtomType;
995 std::vector<std::uint8_t>
1025 const unsigned int periodicTableRow1,
1026 const unsigned int periodicTableRow2,
1027 const unsigned int periodicTableRow3) {
1028 std::map<
const unsigned int,
1029 std::map<
const unsigned int,
1030 std::map<const unsigned int, MMFFStbn> > >::const_iterator
1032 std::map<
const unsigned int,
1033 std::map<const unsigned int, MMFFStbn> >::const_iterator res2;
1034 std::map<const unsigned int, MMFFStbn>::const_iterator res3;
1035 const MMFFStbn *mmffDfsbParams = NULL;
1037 unsigned int canPeriodicTableRow1 = periodicTableRow1;
1038 unsigned int canPeriodicTableRow3 = periodicTableRow3;
1039 if (periodicTableRow1 > periodicTableRow3) {
1040 canPeriodicTableRow1 = periodicTableRow3;
1041 canPeriodicTableRow3 = periodicTableRow1;
1044 res1 = d_params.find(canPeriodicTableRow1);
1045 if (res1 != d_params.end()) {
1046 res2 = ((*res1).second).find(periodicTableRow2);
1047 if (res2 != ((*res1).second).end()) {
1048 res3 = ((*res2).second).find(canPeriodicTableRow3);
1049 if (res3 != ((*res2).second).end()) {
1050 mmffDfsbParams = &((*res3).second);
1055 return std::make_pair(swap, mmffDfsbParams);
1061 static class std::unique_ptr<MMFFDfsbCollection> ds_instance;
1064 std::map<const unsigned int, std::map<const unsigned int, MMFFStbn> > >
1088 const std::string &mmffOop =
"");
1094 const unsigned int jAtomType,
1095 const unsigned int kAtomType,
1096 const unsigned int lAtomType) {
1098 const MMFFOop *mmffOopParams = NULL;
1099 unsigned int iter = 0;
1100 std::vector<unsigned int> canIKLAtomType(3);
1105 #ifdef RDKIT_MMFF_PARAMS_USE_STD_MAP 1106 std::map<
const unsigned int,
1107 std::map<
const unsigned int,
1108 std::map<
const unsigned int,
1109 std::map<const unsigned int, MMFFOop> > > >::
1110 const_iterator res1;
1111 std::map<
const unsigned int,
1112 std::map<
const unsigned int,
1113 std::map<const unsigned int, MMFFOop> > >::const_iterator
1115 std::map<
const unsigned int,
1116 std::map<const unsigned int, MMFFOop> >::const_iterator res3;
1117 std::map<const unsigned int, MMFFOop>::const_iterator res4;
1118 while ((iter < 4) && (!mmffOopParams)) {
1119 canIKLAtomType[0] = (*mmffDef)(iAtomType)->eqLevel[iter];
1120 unsigned int canJAtomType = jAtomType;
1121 canIKLAtomType[1] = (*mmffDef)(kAtomType)->eqLevel[iter];
1122 canIKLAtomType[2] = (*mmffDef)(lAtomType)->eqLevel[iter];
1123 std::sort(canIKLAtomType.begin(), canIKLAtomType.end());
1124 res1 = d_params.find(canIKLAtomType[0]);
1125 if (res1 != d_params.end()) {
1126 res2 = ((*res1).second).find(canJAtomType);
1127 if (res2 != ((*res1).second).end()) {
1128 res3 = ((*res2).second).find(canIKLAtomType[1]);
1129 if (res3 != ((*res2).second).end()) {
1130 res4 = ((*res3).second).find(canIKLAtomType[2]);
1131 if (res4 != ((*res3).second).end()) {
1132 mmffOopParams = &((*res4).second);
1140 std::pair<std::vector<std::uint8_t>::const_iterator,
1141 std::vector<std::uint8_t>::const_iterator> jBounds =
1142 std::equal_range(d_jAtomType.begin(), d_jAtomType.end(), jAtomType);
1143 std::pair<std::vector<std::uint8_t>::const_iterator,
1144 std::vector<std::uint8_t>::const_iterator> bounds;
1145 if (jBounds.first != jBounds.second) {
1146 while ((iter < 4) && (!mmffOopParams)) {
1147 canIKLAtomType[0] = (*mmffDef)(iAtomType)->eqLevel[iter];
1148 canIKLAtomType[1] = (*mmffDef)(kAtomType)->eqLevel[iter];
1149 canIKLAtomType[2] = (*mmffDef)(lAtomType)->eqLevel[iter];
1150 std::sort(canIKLAtomType.begin(), canIKLAtomType.end());
1151 bounds = std::equal_range(
1152 d_iAtomType.begin() + (jBounds.first - d_jAtomType.begin()),
1153 d_iAtomType.begin() + (jBounds.second - d_jAtomType.begin()),
1155 if (bounds.first != bounds.second) {
1156 bounds = std::equal_range(
1157 d_kAtomType.begin() + (bounds.first - d_iAtomType.begin()),
1158 d_kAtomType.begin() + (bounds.second - d_iAtomType.begin()),
1160 if (bounds.first != bounds.second) {
1161 bounds = std::equal_range(
1162 d_lAtomType.begin() + (bounds.first - d_kAtomType.begin()),
1163 d_lAtomType.begin() + (bounds.second - d_kAtomType.begin()),
1165 if (bounds.first != bounds.second) {
1166 mmffOopParams = &d_params[bounds.first - d_lAtomType.begin()];
1175 return mmffOopParams;
1181 static class std::unique_ptr<MMFFOopCollection> ds_instance[2];
1182 #ifdef RDKIT_MMFF_PARAMS_USE_STD_MAP 1183 std::map<
const unsigned int,
1184 std::map<
const unsigned int,
1185 std::map<
const unsigned int,
1186 std::map<const unsigned int, MMFFOop> > > >
1189 std::vector<MMFFOop> d_params;
1190 std::vector<std::uint8_t> d_iAtomType;
1191 std::vector<std::uint8_t> d_jAtomType;
1192 std::vector<std::uint8_t> d_kAtomType;
1193 std::vector<std::uint8_t> d_lAtomType;
1217 const std::string &mmffTor =
"");
1223 const std::pair<unsigned int, unsigned int> torType,
1224 const unsigned int iAtomType,
const unsigned int jAtomType,
1225 const unsigned int kAtomType,
const unsigned int lAtomType) {
1227 const MMFFTor *mmffTorParams = NULL;
1228 unsigned int iter = 0;
1229 unsigned int iWildCard = 0;
1230 unsigned int lWildCard = 0;
1231 unsigned int canTorType = torType.first;
1232 unsigned int maxIter = 5;
1237 #ifdef RDKIT_MMFF_PARAMS_USE_STD_MAP 1242 std::map<
const unsigned int,
1243 std::map<
const unsigned int,
1244 std::map<const unsigned int, MMFFTor> > > > >::
1245 const_iterator res1;
1246 std::map<
const unsigned int,
1247 std::map<
const unsigned int,
1248 std::map<
const unsigned int,
1249 std::map<const unsigned int, MMFFTor> > > >::
1250 const_iterator res2;
1251 std::map<
const unsigned int,
1252 std::map<
const unsigned int,
1253 std::map<const unsigned int, MMFFTor> > >::const_iterator
1255 std::map<
const unsigned int,
1256 std::map<const unsigned int, MMFFTor> >::const_iterator res4;
1257 std::map<const unsigned int, MMFFTor>::const_iterator res5;
1259 std::pair<std::vector<std::uint8_t>::const_iterator,
1260 std::vector<std::uint8_t>::const_iterator> jBounds;
1261 std::pair<std::vector<std::uint8_t>::const_iterator,
1262 std::vector<std::uint8_t>::const_iterator> bounds;
1265 while (((iter < maxIter) && ((!mmffTorParams) || (maxIter == 4))) ||
1266 ((iter == 4) && (torType.first == 5) && torType.second)) {
1272 if ((maxIter == 5) && (iter == 4)) {
1275 canTorType = torType.second;
1282 }
else if (iter == 2) {
1286 unsigned int canIAtomType = (*mmffDef)(iAtomType)->eqLevel[iWildCard];
1287 unsigned int canJAtomType = jAtomType;
1288 unsigned int canKAtomType = kAtomType;
1289 unsigned int canLAtomType = (*mmffDef)(lAtomType)->eqLevel[lWildCard];
1290 if (canJAtomType > canKAtomType) {
1291 unsigned int temp = canKAtomType;
1292 canKAtomType = canJAtomType;
1293 canJAtomType = temp;
1294 temp = canLAtomType;
1295 canLAtomType = canIAtomType;
1296 canIAtomType = temp;
1297 }
else if ((canJAtomType == canKAtomType) &&
1298 (canIAtomType > canLAtomType)) {
1299 unsigned int temp = canLAtomType;
1300 canLAtomType = canIAtomType;
1301 canIAtomType = temp;
1303 #ifdef RDKIT_MMFF_PARAMS_USE_STD_MAP 1304 res1 = d_params.find(canTorType);
1305 if (res1 != d_params.end()) {
1306 res2 = ((*res1).second).find(canIAtomType);
1307 if (res2 != ((*res1).second).end()) {
1308 res3 = ((*res2).second).find(canJAtomType);
1309 if (res3 != ((*res2).second).end()) {
1310 res4 = ((*res3).second).find(canKAtomType);
1311 if (res4 != ((*res3).second).end()) {
1312 res5 = ((*res4).second).find(canLAtomType);
1313 if (res5 != ((*res4).second).end()) {
1314 mmffTorParams = &((*res5).second);
1324 jBounds = std::equal_range(d_jAtomType.begin(), d_jAtomType.end(),
1326 if (jBounds.first != jBounds.second) {
1327 bounds = std::equal_range(
1328 d_kAtomType.begin() + (jBounds.first - d_jAtomType.begin()),
1329 d_kAtomType.begin() + (jBounds.second - d_jAtomType.begin()),
1331 if (bounds.first != bounds.second) {
1332 bounds = std::equal_range(
1333 d_iAtomType.begin() + (bounds.first - d_kAtomType.begin()),
1334 d_iAtomType.begin() + (bounds.second - d_kAtomType.begin()),
1336 if (bounds.first != bounds.second) {
1337 bounds = std::equal_range(
1338 d_lAtomType.begin() + (bounds.first - d_iAtomType.begin()),
1339 d_lAtomType.begin() + (bounds.second - d_iAtomType.begin()),
1341 if (bounds.first != bounds.second) {
1342 bounds = std::equal_range(
1343 d_torType.begin() + (bounds.first - d_lAtomType.begin()),
1344 d_torType.begin() + (bounds.second - d_lAtomType.begin()),
1346 if (bounds.first != bounds.second) {
1347 mmffTorParams = &d_params[bounds.first - d_torType.begin()];
1360 return std::make_pair(canTorType, mmffTorParams);
1366 static class std::unique_ptr<MMFFTorCollection> ds_instance[2];
1367 #ifdef RDKIT_MMFF_PARAMS_USE_STD_MAP 1368 std::map<
const unsigned int,
1369 std::map<
const unsigned int,
1370 std::map<
const unsigned int,
1371 std::map<
const unsigned int,
1372 std::map<
const unsigned int,
1376 std::vector<MMFFTor> d_params;
1377 std::vector<std::uint8_t> d_iAtomType;
1378 std::vector<std::uint8_t> d_jAtomType;
1379 std::vector<std::uint8_t> d_kAtomType;
1380 std::vector<std::uint8_t> d_lAtomType;
1381 std::vector<std::uint8_t>
1416 #ifdef RDKIT_MMFF_PARAMS_USE_STD_MAP 1417 std::map<const unsigned int, MMFFVdW>::const_iterator res;
1418 res = d_params.find(atomType);
1420 return (res != d_params.end() ? &((*res).second) : NULL);
1422 std::pair<std::vector<std::uint8_t>::const_iterator,
1423 std::vector<std::uint8_t>::const_iterator> bounds =
1424 std::equal_range(d_atomType.begin(), d_atomType.end(), atomType);
1426 return ((bounds.first != bounds.second)
1427 ? &d_params[bounds.first - d_atomType.begin()]
1435 static class std::unique_ptr<MMFFVdWCollection> ds_instance;
1436 #ifdef RDKIT_MMFF_PARAMS_USE_STD_MAP 1437 std::map<const unsigned int, MMFFVdW> d_params;
1439 std::vector<MMFFVdW> d_params;
1440 std::vector<std::uint8_t> d_atomType;
class to store MMFF parameters for angle bending
const MMFFCovRadPauEle * operator()(const unsigned int atomicNum) const
Looks up the parameters for a particular key and returns them.
static MMFFDefCollection * getMMFFDef(const std::string &mmffDef="")
gets a pointer to the singleton MMFFDefCollection
bool isDoubleZero(const double x)
const MMFFVdW * operator()(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 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 double MDYNE_A_TO_KCAL_MOL
#define RDKIT_FORCEFIELD_EXPORT
bool isMMFFAromatic(const unsigned int atomType) const
Looks up the parameters for a particular key and returns them.
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
const MMFFPBCI * operator()(const unsigned int atomType) const
Looks up the parameters for a particular key and returns them.
const std::pair< const unsigned int, const MMFFTor * > getMMFFTorParams(const std::pair< unsigned int, unsigned int > torType, 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 MMFFProp * operator()(const unsigned int atomType) const
Looks up the parameters for a particular key and returns them.
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 MMFFDef * operator()(const unsigned int atomType) const
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.
const std::pair< bool, const MMFFStbn * > getMMFFStbnParams(const unsigned int stretchBendType, const unsigned int bondType1, const unsigned int bondType2, 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 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