Chemical Data Processing Library C++ API - Version 1.0.0
MMFF94EnergyFunctions.hpp
Go to the documentation of this file.
1 /*
2  * MMFF94EnergyFunctions.hpp
3  *
4  * This file is part of the Chemical Data Processing Toolkit
5  *
6  * Copyright (C) 2003 Thomas Seidel <thomas.seidel@univie.ac.at>
7  *
8  * This library is free software; you can redistribute it and/or
9  * modify it under the terms of the GNU Lesser General Public
10  * License as published by the Free Software Foundation; either
11  * version 2 of the License, or (at your option) any later version.
12  *
13  * This library is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16  * Lesser General Public License for more details.
17  *
18  * You should have received a copy of the GNU Lesser General Public License
19  * along with this library; see the file COPYING. If not, write to
20  * the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
21  * Boston, MA 02111-1307, USA.
22  */
23 
29 #ifndef CDPL_FORCEFIELD_MMFF94ENERGYFUNCTIONS_HPP
30 #define CDPL_FORCEFIELD_MMFF94ENERGYFUNCTIONS_HPP
31 
40 
41 
42 namespace CDPL
43 {
44 
45  namespace ForceField
46  {
47 
48  template <typename ValueType, typename Iter, typename CoordsArray>
49  ValueType calcMMFF94BondStretchingEnergy(Iter beg, const Iter& end, const CoordsArray& coords);
50 
51  template <typename ValueType, typename CoordsArray>
52  ValueType calcMMFF94BondStretchingEnergy(const MMFF94BondStretchingInteraction& iaction, const CoordsArray& coords);
53 
77  template <typename ValueType, typename CoordsVec>
78  ValueType calcMMFF94BondStretchingEnergy(const CoordsVec& atom1_pos, const CoordsVec& atom2_pos,
79  const ValueType& force_const, const ValueType& ref_length);
80 
103  template <typename ValueType>
104  ValueType calcMMFF94BondStretchingEnergy(const ValueType& r_ij, const ValueType& force_const, const ValueType& ref_length);
105 
106 
107  template <typename ValueType, typename Iter, typename CoordsArray>
108  ValueType calcMMFF94AngleBendingEnergy(Iter beg, const Iter& end, const CoordsArray& coords);
109 
110  template <typename ValueType, typename CoordsArray>
111  ValueType calcMMFF94AngleBendingEnergy(const MMFF94AngleBendingInteraction& iaction, const CoordsArray& coords);
112 
141  template <typename ValueType, typename CoordsVec>
142  ValueType calcMMFF94AngleBendingEnergy(const CoordsVec& term_atom1_pos, const CoordsVec& ctr_atom_pos, const CoordsVec& term_atom2_pos,
143  bool linear, const ValueType& force_const, const ValueType& ref_angle);
144 
175  template <typename ValueType, typename CoordsVec>
176  ValueType calcMMFF94AngleBendingEnergy(const CoordsVec& term_atom1_pos, const CoordsVec& ctr_atom_pos, const CoordsVec& term_atom2_pos,
177  const ValueType& r_ij, const ValueType& r_jk,
178  bool linear, const ValueType& force_const, const ValueType& ref_angle);
179 
180 
181  template <typename ValueType, typename Iter, typename CoordsArray>
182  ValueType calcMMFF94StretchBendEnergy(Iter beg, const Iter& end, const CoordsArray& coords);
183 
184  template <typename ValueType, typename CoordsArray>
185  ValueType calcMMFF94StretchBendEnergy(const MMFF94StretchBendInteraction& iaction, const CoordsArray& coords);
186 
217  template <typename ValueType, typename CoordsVec>
218  ValueType calcMMFF94StretchBendEnergy(const CoordsVec& term_atom1_pos, const CoordsVec& ctr_atom_pos, const CoordsVec& term_atom2_pos,
219  const ValueType& ijk_force_const, const ValueType& kji_force_const, const ValueType& ref_angle,
220  const ValueType& ref_length1, const ValueType& ref_length2);
221 
254  template <typename ValueType, typename CoordsVec>
255  ValueType calcMMFF94StretchBendEnergy(const CoordsVec& term_atom1_pos, const CoordsVec& ctr_atom_pos, const CoordsVec& term_atom2_pos,
256  const ValueType& r_ij, const ValueType& r_jk,
257  const ValueType& ijk_force_const, const ValueType& kji_force_const, const ValueType& ref_angle,
258  const ValueType& ref_length1, const ValueType& ref_length2);
259 
260 
261  template <typename ValueType, typename Iter, typename CoordsArray>
262  ValueType calcMMFF94OutOfPlaneBendingEnergy(Iter beg, const Iter& end, const CoordsArray& coords);
263 
264  template <typename ValueType, typename CoordsArray>
265  ValueType calcMMFF94OutOfPlaneBendingEnergy(const MMFF94OutOfPlaneBendingInteraction& iaction, const CoordsArray& coords);
266 
284  template <typename ValueType, typename CoordsVec>
285  ValueType calcMMFF94OutOfPlaneBendingEnergy(const CoordsVec& term_atom1_pos, const CoordsVec& ctr_atom_pos, const CoordsVec& term_atom2_pos,
286  const CoordsVec& oop_atom_pos, const ValueType& force_const);
287 
306  template <typename ValueType, typename CoordsVec>
307  ValueType calcMMFF94OutOfPlaneBendingEnergy(const CoordsVec& term_atom1_pos, const CoordsVec& ctr_atom_pos, const CoordsVec& term_atom2_pos,
308  const CoordsVec& oop_atom_pos, const ValueType& r_jl, const ValueType& force_const);
309 
310 
311  template <typename ValueType, typename Iter, typename CoordsArray>
312  ValueType calcMMFF94TorsionEnergy(Iter beg, const Iter& end, const CoordsArray& coords);
313 
314  template <typename ValueType, typename CoordsArray>
315  ValueType calcMMFF94TorsionEnergy(const MMFF94TorsionInteraction& iaction, const CoordsArray& coords);
316 
338  template <typename ValueType, typename CoordsVec>
339  ValueType calcMMFF94TorsionEnergy(const CoordsVec& term_atom1_pos, const CoordsVec& ctr_atom1_pos, const CoordsVec& ctr_atom2_pos,
340  const CoordsVec& term_atom2_pos, const ValueType& tor_param1, const ValueType& tor_param2,
341  const ValueType& tor_param3);
342 
343 
344  template <typename ValueType, typename Iter, typename CoordsArray>
345  ValueType calcMMFF94ElectrostaticEnergy(Iter beg, const Iter& end, const CoordsArray& coords);
346 
347  template <typename ValueType, typename CoordsArray>
348  ValueType calcMMFF94ElectrostaticEnergy(const MMFF94ElectrostaticInteraction& iaction, const CoordsArray& coords);
349 
376  template <typename ValueType, typename CoordsVec>
377  ValueType calcMMFF94ElectrostaticEnergy(const CoordsVec& atom1_pos, const CoordsVec& atom2_pos, const ValueType& atom1_chg,
378  const ValueType& atom2_chg, const ValueType& scale_fact, const ValueType& de_const,
379  const ValueType& dist_expo);
380 
406  template <typename ValueType>
407  ValueType calcMMFF94ElectrostaticEnergy(const ValueType& r_ij, const ValueType& atom1_chg, const ValueType& atom2_chg,
408  const ValueType& scale_fact, const ValueType& de_const, const ValueType& dist_expo);
409 
410 
411  template <typename ValueType, typename Iter, typename CoordsArray>
412  ValueType calcMMFF94VanDerWaalsEnergy(Iter beg, const Iter& end, const CoordsArray& coords);
413 
414  template <typename ValueType, typename CoordsArray>
415  ValueType calcMMFF94VanDerWaalsEnergy(const MMFF94VanDerWaalsInteraction& iaction, const CoordsArray& coords);
416 
452  template <typename ValueType, typename CoordsVec>
453  ValueType calcMMFF94VanDerWaalsEnergy(const CoordsVec& atom1_pos, const CoordsVec& atom2_pos, const ValueType& e_IJ,
454  const ValueType& r_IJ, const ValueType& r_IJ_7);
455 
490  template <typename ValueType>
491  ValueType calcMMFF94VanDerWaalsEnergy(const ValueType& r_ij, const ValueType& e_IJ,
492  const ValueType& r_IJ, const ValueType& r_IJ_7);
493  } // namespace ForceField
494 } // namespace CDPL
495 
496 
497 // Implementation
498 // \cond DOC_IMPL_DETAILS
499 
500 namespace CDPL
501 {
502 
503  namespace ForceField
504  {
505 
506  namespace Detail
507  {
508 
509  template <typename ValueType, typename Iter, typename CoordsArray, typename FuncType>
510  ValueType accumMMFF94InteractionEnergies(Iter& beg, const Iter& end, const CoordsArray& coords, const FuncType& func)
511  {
512  ValueType e = ValueType();
513 
514  for (; beg != end; ++beg)
515  e += func(*beg, coords);
516 
517  return e;
518  }
519  } // namespace Detail
520  } // namespace ForceField
521 } // namespace CDPL
522 
523 
524 template <typename ValueType, typename Iter, typename CoordsArray>
525 ValueType CDPL::ForceField::calcMMFF94BondStretchingEnergy(Iter beg, const Iter& end, const CoordsArray& coords)
526 {
527  return Detail::accumMMFF94InteractionEnergies<ValueType>(beg, end, coords,
528  static_cast<ValueType (*)(const MMFF94BondStretchingInteraction&, const CoordsArray&)>(
529  &calcMMFF94BondStretchingEnergy<ValueType, CoordsArray>));
530 }
531 
532 template <typename ValueType, typename CoordsArray>
533 ValueType CDPL::ForceField::calcMMFF94BondStretchingEnergy(const MMFF94BondStretchingInteraction& iaction, const CoordsArray& coords)
534 {
535  return calcMMFF94BondStretchingEnergy<ValueType>(coords[iaction.getAtom1Index()], coords[iaction.getAtom2Index()],
536  iaction.getForceConstant(), iaction.getReferenceLength());
537 }
538 
539 template <typename ValueType, typename CoordsVec>
540 ValueType CDPL::ForceField::calcMMFF94BondStretchingEnergy(const CoordsVec& atom1_pos, const CoordsVec& atom2_pos,
541  const ValueType& force_const, const ValueType& ref_length)
542 {
543  ValueType dr_ij = calcDistance<ValueType>(atom1_pos, atom2_pos) - ref_length;
544  ValueType dr_ij_2 = dr_ij * dr_ij;
545  ValueType e_b = ValueType(143.9325 * 0.5) * force_const * dr_ij_2 * (1 - 2 * dr_ij + 28 * dr_ij_2 / 12);
546 
547  return e_b;
548 }
549 
550 template <typename ValueType>
551 ValueType CDPL::ForceField::calcMMFF94BondStretchingEnergy(const ValueType& r_ij, const ValueType& force_const, const ValueType& ref_length)
552 {
553  ValueType dr_ij = r_ij - ref_length;
554  ValueType dr_ij_2 = dr_ij * dr_ij;
555  ValueType e_b = ValueType(143.9325 * 0.5) * force_const * dr_ij_2 * (1 - 2 * dr_ij + 28 * dr_ij_2 / 12);
556 
557  return e_b;
558 }
559 
560 
561 template <typename ValueType, typename Iter, typename CoordsArray>
562 ValueType CDPL::ForceField::calcMMFF94AngleBendingEnergy(Iter beg, const Iter& end, const CoordsArray& coords)
563 {
564  return Detail::accumMMFF94InteractionEnergies<ValueType>(beg, end, coords,
565  static_cast<ValueType (*)(const MMFF94AngleBendingInteraction&, const CoordsArray&)>(
566  &calcMMFF94AngleBendingEnergy<ValueType, CoordsArray>));
567 }
568 
569 template <typename ValueType, typename CoordsArray>
570 ValueType CDPL::ForceField::calcMMFF94AngleBendingEnergy(const MMFF94AngleBendingInteraction& iaction, const CoordsArray& coords)
571 {
572  return calcMMFF94AngleBendingEnergy<ValueType>(coords[iaction.getTerminalAtom1Index()], coords[iaction.getCenterAtomIndex()],
573  coords[iaction.getTerminalAtom2Index()], iaction.isLinearAngle(), iaction.getForceConstant(),
574  iaction.getReferenceAngle());
575 }
576 
577 template <typename ValueType, typename CoordsVec>
578 ValueType CDPL::ForceField::calcMMFF94AngleBendingEnergy(const CoordsVec& term_atom1_pos, const CoordsVec& ctr_atom_pos, const CoordsVec& term_atom2_pos,
579  bool linear, const ValueType& force_const, const ValueType& ref_angle)
580 {
581  if (linear)
582  return (ValueType(143.9325) * force_const * (1 + calcBondAngleCos<ValueType>(term_atom1_pos, ctr_atom_pos, term_atom2_pos)));
583 
584  ValueType a_ijk = calcBondAngle<ValueType>(term_atom1_pos, ctr_atom_pos, term_atom2_pos) * ValueType(180 / M_PI);
585  ValueType da_ijk = a_ijk - ref_angle;
586  ValueType e_a = ValueType(0.043844 * 0.5) * force_const * da_ijk * da_ijk * (1 - ValueType(0.007) * da_ijk);
587 
588  return e_a;
589 }
590 
591 template <typename ValueType, typename CoordsVec>
592 ValueType CDPL::ForceField::calcMMFF94AngleBendingEnergy(const CoordsVec& term_atom1_pos, const CoordsVec& ctr_atom_pos, const CoordsVec& term_atom2_pos,
593  const ValueType& r_ij, const ValueType& r_jk,
594  bool linear, const ValueType& force_const, const ValueType& ref_angle)
595 {
596  if (linear)
597  return (ValueType(143.9325) * force_const * (1 + calcBondAngleCos<ValueType>(term_atom1_pos, ctr_atom_pos, term_atom2_pos, r_ij, r_jk)));
598 
599  ValueType a_ijk = calcBondAngle<ValueType>(term_atom1_pos, ctr_atom_pos, term_atom2_pos, r_ij, r_jk) * ValueType(180 / M_PI);
600  ValueType da_ijk = a_ijk - ref_angle;
601  ValueType e_a = ValueType(0.043844 * 0.5) * force_const * da_ijk * da_ijk * (1 - ValueType(0.007) * da_ijk);
602 
603  return e_a;
604 }
605 
606 
607 template <typename ValueType, typename Iter, typename CoordsArray>
608 ValueType CDPL::ForceField::calcMMFF94StretchBendEnergy(Iter beg, const Iter& end, const CoordsArray& coords)
609 {
610  return Detail::accumMMFF94InteractionEnergies<ValueType>(beg, end, coords,
611  static_cast<ValueType (*)(const MMFF94StretchBendInteraction&, const CoordsArray&)>(
612  &calcMMFF94StretchBendEnergy<ValueType, CoordsArray>));
613 }
614 
615 template <typename ValueType, typename CoordsArray>
616 ValueType CDPL::ForceField::calcMMFF94StretchBendEnergy(const MMFF94StretchBendInteraction& iaction, const CoordsArray& coords)
617 {
618  return calcMMFF94StretchBendEnergy<ValueType>(coords[iaction.getTerminalAtom1Index()], coords[iaction.getCenterAtomIndex()],
619  coords[iaction.getTerminalAtom2Index()], iaction.getIJKForceConstant(),
620  iaction.getKJIForceConstant(), iaction.getReferenceAngle(), iaction.getReferenceLength1(),
621  iaction.getReferenceLength2());
622 }
623 
624 template <typename ValueType, typename CoordsVec>
625 ValueType CDPL::ForceField::calcMMFF94StretchBendEnergy(const CoordsVec& term_atom1_pos, const CoordsVec& ctr_atom_pos, const CoordsVec& term_atom2_pos,
626  const ValueType& ijk_force_const, const ValueType& kji_force_const, const ValueType& ref_angle,
627  const ValueType& ref_length1, const ValueType& ref_length2)
628 {
629  ValueType r_ij = ValueType();
630  ValueType r_kj = ValueType();
631  ValueType a_ijk = calcBondLengthsAndAngle(term_atom1_pos, ctr_atom_pos, term_atom2_pos, r_ij, r_kj) * ValueType(180 / M_PI);
632 
633  ValueType dr_ij = r_ij - ref_length1;
634  ValueType dr_kj = r_kj - ref_length2;
635  ValueType da_ijk = a_ijk - ref_angle;
636 
637  ValueType e_ab = ValueType(2.51210) * (ijk_force_const * dr_ij + kji_force_const * dr_kj) * da_ijk;
638 
639  return e_ab;
640 }
641 
642 template <typename ValueType, typename CoordsVec>
643 ValueType CDPL::ForceField::calcMMFF94StretchBendEnergy(const CoordsVec& term_atom1_pos, const CoordsVec& ctr_atom_pos, const CoordsVec& term_atom2_pos,
644  const ValueType& r_ij, const ValueType& r_jk,
645  const ValueType& ijk_force_const, const ValueType& kji_force_const, const ValueType& ref_angle,
646  const ValueType& ref_length1, const ValueType& ref_length2)
647 {
648  ValueType a_ijk = calcBondAngle(term_atom1_pos, ctr_atom_pos, term_atom2_pos, r_ij, r_jk) * ValueType(180 / M_PI);
649 
650  ValueType dr_ij = r_ij - ref_length1;
651  ValueType dr_kj = r_jk - ref_length2;
652  ValueType da_ijk = a_ijk - ref_angle;
653 
654  ValueType e_ab = ValueType(2.51210) * (ijk_force_const * dr_ij + kji_force_const * dr_kj) * da_ijk;
655 
656  return e_ab;
657 }
658 
659 
660 template <typename ValueType, typename Iter, typename CoordsArray>
661 ValueType CDPL::ForceField::calcMMFF94OutOfPlaneBendingEnergy(Iter beg, const Iter& end, const CoordsArray& coords)
662 {
663  return Detail::accumMMFF94InteractionEnergies<ValueType>(beg, end, coords,
664  static_cast<ValueType (*)(const MMFF94OutOfPlaneBendingInteraction&, const CoordsArray&)>(
665  &calcMMFF94OutOfPlaneBendingEnergy<ValueType, CoordsArray>));
666 }
667 
668 template <typename ValueType, typename CoordsArray>
669 ValueType CDPL::ForceField::calcMMFF94OutOfPlaneBendingEnergy(const MMFF94OutOfPlaneBendingInteraction& iaction, const CoordsArray& coords)
670 {
671  return calcMMFF94OutOfPlaneBendingEnergy<ValueType>(coords[iaction.getTerminalAtom1Index()], coords[iaction.getCenterAtomIndex()],
672  coords[iaction.getTerminalAtom2Index()], coords[iaction.getOutOfPlaneAtomIndex()],
673  iaction.getForceConstant());
674 }
675 
676 template <typename ValueType, typename CoordsVec>
677 ValueType CDPL::ForceField::calcMMFF94OutOfPlaneBendingEnergy(const CoordsVec& term_atom1_pos, const CoordsVec& ctr_atom_pos, const CoordsVec& term_atom2_pos,
678  const CoordsVec& oop_atom_pos, const ValueType& force_const)
679 {
680  ValueType chi_ijkl = calcOutOfPlaneAngle<ValueType>(term_atom1_pos, ctr_atom_pos, term_atom2_pos, oop_atom_pos) * ValueType(180 / M_PI);
681  ValueType e_oop = ValueType(0.5 * 0.043844) * force_const * chi_ijkl * chi_ijkl;
682 
683  return e_oop;
684 }
685 
686 template <typename ValueType, typename CoordsVec>
687 ValueType CDPL::ForceField::calcMMFF94OutOfPlaneBendingEnergy(const CoordsVec& term_atom1_pos, const CoordsVec& ctr_atom_pos, const CoordsVec& term_atom2_pos,
688  const CoordsVec& oop_atom_pos, const ValueType& r_jl, const ValueType& force_const)
689 {
690  ValueType chi_ijkl = calcOutOfPlaneAngle<ValueType>(term_atom1_pos, ctr_atom_pos, term_atom2_pos, oop_atom_pos, r_jl) * ValueType(180 / M_PI);
691  ValueType e_oop = ValueType(0.5 * 0.043844) * force_const * chi_ijkl * chi_ijkl;
692 
693  return e_oop;
694 }
695 
696 
697 template <typename ValueType, typename Iter, typename CoordsArray>
698 ValueType CDPL::ForceField::calcMMFF94TorsionEnergy(Iter beg, const Iter& end, const CoordsArray& coords)
699 {
700  return Detail::accumMMFF94InteractionEnergies<ValueType>(beg, end, coords,
701  static_cast<ValueType (*)(const MMFF94TorsionInteraction&, const CoordsArray&)>(
702  &calcMMFF94TorsionEnergy<ValueType, CoordsArray>));
703 }
704 
705 template <typename ValueType, typename CoordsArray>
706 ValueType CDPL::ForceField::calcMMFF94TorsionEnergy(const MMFF94TorsionInteraction& iaction, const CoordsArray& coords)
707 {
708  return calcMMFF94TorsionEnergy<ValueType>(coords[iaction.getTerminalAtom1Index()], coords[iaction.getCenterAtom1Index()],
709  coords[iaction.getCenterAtom2Index()], coords[iaction.getTerminalAtom2Index()],
710  iaction.getTorsionParameter1(), iaction.getTorsionParameter2(), iaction.getTorsionParameter3());
711 }
712 
713 template <typename ValueType, typename CoordsVec>
714 ValueType CDPL::ForceField::calcMMFF94TorsionEnergy(const CoordsVec& term_atom1_pos, const CoordsVec& ctr_atom1_pos, const CoordsVec& ctr_atom2_pos,
715  const CoordsVec& term_atom2_pos, const ValueType& tor_param1, const ValueType& tor_param2,
716  const ValueType& tor_param3)
717 {
718  ValueType phi_cos = calcDihedralAngleCos<ValueType>(term_atom1_pos, ctr_atom1_pos, ctr_atom2_pos, term_atom2_pos);
719  ValueType phi = std::acos(phi_cos);
720  ValueType e_t = ValueType(0.5) * (tor_param1 * (1 + phi_cos) + tor_param2 * (1 - std::cos(2 * phi)) + tor_param3 * (1 + std::cos(3 * phi)));
721 
722  return e_t;
723 }
724 
725 
726 template <typename ValueType, typename Iter, typename CoordsArray>
727 ValueType CDPL::ForceField::calcMMFF94ElectrostaticEnergy(Iter beg, const Iter& end, const CoordsArray& coords)
728 {
729  return Detail::accumMMFF94InteractionEnergies<ValueType>(beg, end, coords,
730  static_cast<ValueType (*)(const MMFF94ElectrostaticInteraction&, const CoordsArray&)>(
731  &calcMMFF94ElectrostaticEnergy<ValueType, CoordsArray>));
732 }
733 
734 template <typename ValueType, typename CoordsArray>
735 ValueType CDPL::ForceField::calcMMFF94ElectrostaticEnergy(const MMFF94ElectrostaticInteraction& iaction, const CoordsArray& coords)
736 {
737  return calcMMFF94ElectrostaticEnergy<ValueType>(coords[iaction.getAtom1Index()], coords[iaction.getAtom2Index()],
738  iaction.getAtom1Charge(), iaction.getAtom2Charge(), iaction.getScalingFactor(),
739  iaction.getDielectricConstant(), iaction.getDistanceExponent());
740 }
741 
742 template <typename ValueType, typename CoordsVec>
743 ValueType CDPL::ForceField::calcMMFF94ElectrostaticEnergy(const CoordsVec& atom1_pos, const CoordsVec& atom2_pos, const ValueType& atom1_chg,
744  const ValueType& atom2_chg, const ValueType& scale_fact, const ValueType& de_const,
745  const ValueType& dist_expo)
746 {
747  ValueType tmp = std::pow(calcDistance<ValueType>(atom1_pos, atom2_pos) + ValueType(0.05), dist_expo);
748  ValueType e_q = scale_fact * ValueType(332.0716) * atom1_chg * atom2_chg / (de_const * tmp);
749 
750  return e_q;
751 }
752 
753 template <typename ValueType>
754 ValueType CDPL::ForceField::calcMMFF94ElectrostaticEnergy(const ValueType& r_ij, const ValueType& atom1_chg, const ValueType& atom2_chg,
755  const ValueType& scale_fact, const ValueType& de_const, const ValueType& dist_expo)
756 {
757  ValueType tmp = std::pow(r_ij + ValueType(0.05), dist_expo);
758  ValueType e_q = scale_fact * ValueType(332.0716) * atom1_chg * atom2_chg / (de_const * tmp);
759 
760  return e_q;
761 }
762 
763 
764 template <typename ValueType, typename Iter, typename CoordsArray>
765 ValueType CDPL::ForceField::calcMMFF94VanDerWaalsEnergy(Iter beg, const Iter& end, const CoordsArray& coords)
766 {
767  return Detail::accumMMFF94InteractionEnergies<ValueType>(beg, end, coords,
768  static_cast<ValueType (*)(const MMFF94VanDerWaalsInteraction&, const CoordsArray&)>(
769  &calcMMFF94VanDerWaalsEnergy<ValueType, CoordsArray>));
770 }
771 
772 template <typename ValueType, typename CoordsArray>
773 ValueType CDPL::ForceField::calcMMFF94VanDerWaalsEnergy(const MMFF94VanDerWaalsInteraction& iaction, const CoordsArray& coords)
774 {
775  return calcMMFF94VanDerWaalsEnergy<ValueType>(coords[iaction.getAtom1Index()], coords[iaction.getAtom2Index()],
776  iaction.getEIJ(), iaction.getRIJ(), iaction.getRIJPow7());
777 }
778 
779 template <typename ValueType, typename CoordsVec>
780 ValueType CDPL::ForceField::calcMMFF94VanDerWaalsEnergy(const CoordsVec& atom1_pos, const CoordsVec& atom2_pos, const ValueType& e_IJ,
781  const ValueType& r_IJ, const ValueType& r_IJ_7)
782 {
783  ValueType r_ij_2 = calcSquaredDistance<ValueType>(atom1_pos, atom2_pos);
784  ValueType r_ij = std::sqrt(r_ij_2);
785  ValueType r_ij_7 = r_ij_2 * r_ij_2 * r_ij_2 * r_ij;
786 
787  ValueType tmp = ValueType(1.07) * r_IJ / (r_ij + ValueType(0.07) * r_IJ);
788  ValueType tmp_2 = tmp * tmp;
789  ValueType tmp_7 = tmp_2 * tmp_2 * tmp_2 * tmp;
790 
791  ValueType e_vdw = e_IJ * tmp_7 * (ValueType(1.12) * r_IJ_7 / (r_ij_7 + ValueType(0.12) * r_IJ_7) - 2);
792 
793  return e_vdw;
794 }
795 
796 template <typename ValueType>
797 ValueType CDPL::ForceField::calcMMFF94VanDerWaalsEnergy(const ValueType& r_ij, const ValueType& e_IJ,
798  const ValueType& r_IJ, const ValueType& r_IJ_7)
799 {
800  ValueType r_ij_2 = r_ij * r_ij;
801  ValueType r_ij_7 = r_ij_2 * r_ij_2 * r_ij_2 * r_ij;
802 
803  ValueType tmp = ValueType(1.07) * r_IJ / (r_ij + ValueType(0.07) * r_IJ);
804  ValueType tmp_2 = tmp * tmp;
805  ValueType tmp_7 = tmp_2 * tmp_2 * tmp_2 * tmp;
806 
807  ValueType e_vdw = e_IJ * tmp_7 * (ValueType(1.12) * r_IJ_7 / (r_ij_7 + ValueType(0.12) * r_IJ_7) - 2);
808 
809  return e_vdw;
810 }
811 
812 // \endcond
813 
814 #endif // CDPL_FORCEFIELD_MMFF94ENERGYFUNCTIONS_HPP
MMFF94OutOfPlaneBendingInteraction.hpp
Definition of the class CDPL::ForceField::MMFF94OutOfPlaneBendingInteraction.
MMFF94ElectrostaticInteraction.hpp
Definition of the class CDPL::ForceField::MMFF94ElectrostaticInteraction.
CDPL::ForceField::calcMMFF94BondStretchingEnergy
ValueType calcMMFF94BondStretchingEnergy(Iter beg, const Iter &end, const CoordsArray &coords)
CDPL::ForceField::calcMMFF94AngleBendingEnergy
ValueType calcMMFF94AngleBendingEnergy(Iter beg, const Iter &end, const CoordsArray &coords)
CDPL::ForceField::MMFF94BondStretchingInteraction
Definition: MMFF94BondStretchingInteraction.hpp:44
CDPL::ForceField::calcMMFF94TorsionEnergy
ValueType calcMMFF94TorsionEnergy(Iter beg, const Iter &end, const CoordsArray &coords)
UtilityFunctions.hpp
Utility functions used in the calculation of force field energies and gradients.
MMFF94VanDerWaalsInteraction.hpp
Definition of the class CDPL::ForceField::MMFF94VanDerWaalsInteraction.
MMFF94BondStretchingInteraction.hpp
Definition of the class CDPL::ForceField::MMFF94BondStretchingInteraction.
CDPL::ForceField::calcMMFF94OutOfPlaneBendingEnergy
ValueType calcMMFF94OutOfPlaneBendingEnergy(Iter beg, const Iter &end, const CoordsArray &coords)
CDPL::ForceField::calcMMFF94StretchBendEnergy
ValueType calcMMFF94StretchBendEnergy(Iter beg, const Iter &end, const CoordsArray &coords)
CDPL::ForceField::MMFF94StretchBendInteraction
Definition: MMFF94StretchBendInteraction.hpp:44
MMFF94StretchBendInteraction.hpp
Definition of the class CDPL::ForceField::MMFF94StretchBendInteraction.
MMFF94TorsionInteraction.hpp
Definition of the class CDPL::ForceField::MMFF94TorsionInteraction.
CDPL::ForceField::MMFF94OutOfPlaneBendingInteraction
Definition: MMFF94OutOfPlaneBendingInteraction.hpp:44
CDPL::ForceField::MMFF94VanDerWaalsInteraction
Definition: MMFF94VanDerWaalsInteraction.hpp:45
CDPL::ForceField::MMFF94TorsionInteraction
Definition: MMFF94TorsionInteraction.hpp:44
CDPL::ForceField::calcBondAngle
ValueType calcBondAngle(const CoordsVec &term_atom1_pos, const CoordsVec &ctr_atom_pos, const CoordsVec &term_atom2_pos)
Calculates the bond angle between the two bonds i-j and j-k.
CDPL
The namespace of the Chemical Data Processing Library.
CDPL::ForceField::calcMMFF94VanDerWaalsEnergy
ValueType calcMMFF94VanDerWaalsEnergy(Iter beg, const Iter &end, const CoordsArray &coords)
CDPL::ForceField::MMFF94AngleBendingInteraction
Definition: MMFF94AngleBendingInteraction.hpp:44
MMFF94AngleBendingInteraction.hpp
Definition of the class CDPL::ForceField::MMFF94AngleBendingInteraction.
CDPL::ForceField::MMFF94ElectrostaticInteraction
Definition: MMFF94ElectrostaticInteraction.hpp:44
CDPL::ForceField::calcMMFF94ElectrostaticEnergy
ValueType calcMMFF94ElectrostaticEnergy(Iter beg, const Iter &end, const CoordsArray &coords)
CDPL::ForceField::calcBondLengthsAndAngle
ValueType calcBondLengthsAndAngle(const CoordsVec &term_atom1_pos, const CoordsVec &ctr_atom_pos, const CoordsVec &term_atom2_pos, ValueType &bond_length1, ValueType &bond_length2)
Calculates bond lengths and and the bond angle between the two bonds i-j and j-k.