Chemical Data Processing Library C++ API - Version 1.2.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 template <typename ValueType, typename Iter, typename CoordsArray>
501 ValueType CDPL::ForceField::calcMMFF94BondStretchingEnergy(Iter beg, const Iter& end, const CoordsArray& coords)
502 {
503  return Detail::accumInteractionEnergies<ValueType>(beg, end, coords,
504  static_cast<ValueType (*)(const MMFF94BondStretchingInteraction&, const CoordsArray&)>(
505  &calcMMFF94BondStretchingEnergy<ValueType, CoordsArray>));
506 }
507 
508 template <typename ValueType, typename CoordsArray>
509 ValueType CDPL::ForceField::calcMMFF94BondStretchingEnergy(const MMFF94BondStretchingInteraction& iaction, const CoordsArray& coords)
510 {
511  return calcMMFF94BondStretchingEnergy<ValueType>(coords[iaction.getAtom1Index()], coords[iaction.getAtom2Index()],
512  iaction.getForceConstant(), iaction.getReferenceLength());
513 }
514 
515 template <typename ValueType, typename CoordsVec>
516 ValueType CDPL::ForceField::calcMMFF94BondStretchingEnergy(const CoordsVec& atom1_pos, const CoordsVec& atom2_pos,
517  const ValueType& force_const, const ValueType& ref_length)
518 {
519  ValueType dr_ij = calcDistance<ValueType>(atom1_pos, atom2_pos) - ref_length;
520  ValueType dr_ij_2 = dr_ij * dr_ij;
521  ValueType e_b = ValueType(143.9325 * 0.5) * force_const * dr_ij_2 * (1 - 2 * dr_ij + 28 * dr_ij_2 / 12);
522 
523  return e_b;
524 }
525 
526 template <typename ValueType>
527 ValueType CDPL::ForceField::calcMMFF94BondStretchingEnergy(const ValueType& r_ij, const ValueType& force_const, const ValueType& ref_length)
528 {
529  ValueType dr_ij = r_ij - ref_length;
530  ValueType dr_ij_2 = dr_ij * dr_ij;
531  ValueType e_b = ValueType(143.9325 * 0.5) * force_const * dr_ij_2 * (1 - 2 * dr_ij + 28 * dr_ij_2 / 12);
532 
533  return e_b;
534 }
535 
536 
537 template <typename ValueType, typename Iter, typename CoordsArray>
538 ValueType CDPL::ForceField::calcMMFF94AngleBendingEnergy(Iter beg, const Iter& end, const CoordsArray& coords)
539 {
540  return Detail::accumInteractionEnergies<ValueType>(beg, end, coords,
541  static_cast<ValueType (*)(const MMFF94AngleBendingInteraction&, const CoordsArray&)>(
542  &calcMMFF94AngleBendingEnergy<ValueType, CoordsArray>));
543 }
544 
545 template <typename ValueType, typename CoordsArray>
546 ValueType CDPL::ForceField::calcMMFF94AngleBendingEnergy(const MMFF94AngleBendingInteraction& iaction, const CoordsArray& coords)
547 {
548  return calcMMFF94AngleBendingEnergy<ValueType>(coords[iaction.getTerminalAtom1Index()], coords[iaction.getCenterAtomIndex()],
549  coords[iaction.getTerminalAtom2Index()], iaction.isLinearAngle(), iaction.getForceConstant(),
550  iaction.getReferenceAngle());
551 }
552 
553 template <typename ValueType, typename CoordsVec>
554 ValueType CDPL::ForceField::calcMMFF94AngleBendingEnergy(const CoordsVec& term_atom1_pos, const CoordsVec& ctr_atom_pos, const CoordsVec& term_atom2_pos,
555  bool linear, const ValueType& force_const, const ValueType& ref_angle)
556 {
557  if (linear)
558  return (ValueType(143.9325) * force_const * (1 + calcBondAngleCos<ValueType>(term_atom1_pos, ctr_atom_pos, term_atom2_pos)));
559 
560  ValueType a_ijk = calcBondAngle<ValueType>(term_atom1_pos, ctr_atom_pos, term_atom2_pos) * ValueType(180 / M_PI);
561  ValueType da_ijk = a_ijk - ref_angle;
562  ValueType e_a = ValueType(0.043844 * 0.5) * force_const * da_ijk * da_ijk * (1 - ValueType(0.007) * da_ijk);
563 
564  return e_a;
565 }
566 
567 template <typename ValueType, typename CoordsVec>
568 ValueType CDPL::ForceField::calcMMFF94AngleBendingEnergy(const CoordsVec& term_atom1_pos, const CoordsVec& ctr_atom_pos, const CoordsVec& term_atom2_pos,
569  const ValueType& r_ij, const ValueType& r_jk,
570  bool linear, const ValueType& force_const, const ValueType& ref_angle)
571 {
572  if (linear)
573  return (ValueType(143.9325) * force_const * (1 + calcBondAngleCos<ValueType>(term_atom1_pos, ctr_atom_pos, term_atom2_pos, r_ij, r_jk)));
574 
575  ValueType a_ijk = calcBondAngle<ValueType>(term_atom1_pos, ctr_atom_pos, term_atom2_pos, r_ij, r_jk) * ValueType(180 / M_PI);
576  ValueType da_ijk = a_ijk - ref_angle;
577  ValueType e_a = ValueType(0.043844 * 0.5) * force_const * da_ijk * da_ijk * (1 - ValueType(0.007) * da_ijk);
578 
579  return e_a;
580 }
581 
582 
583 template <typename ValueType, typename Iter, typename CoordsArray>
584 ValueType CDPL::ForceField::calcMMFF94StretchBendEnergy(Iter beg, const Iter& end, const CoordsArray& coords)
585 {
586  return Detail::accumInteractionEnergies<ValueType>(beg, end, coords,
587  static_cast<ValueType (*)(const MMFF94StretchBendInteraction&, const CoordsArray&)>(
588  &calcMMFF94StretchBendEnergy<ValueType, CoordsArray>));
589 }
590 
591 template <typename ValueType, typename CoordsArray>
592 ValueType CDPL::ForceField::calcMMFF94StretchBendEnergy(const MMFF94StretchBendInteraction& iaction, const CoordsArray& coords)
593 {
594  return calcMMFF94StretchBendEnergy<ValueType>(coords[iaction.getTerminalAtom1Index()], coords[iaction.getCenterAtomIndex()],
595  coords[iaction.getTerminalAtom2Index()], iaction.getIJKForceConstant(),
596  iaction.getKJIForceConstant(), iaction.getReferenceAngle(), iaction.getReferenceLength1(),
597  iaction.getReferenceLength2());
598 }
599 
600 template <typename ValueType, typename CoordsVec>
601 ValueType CDPL::ForceField::calcMMFF94StretchBendEnergy(const CoordsVec& term_atom1_pos, const CoordsVec& ctr_atom_pos, const CoordsVec& term_atom2_pos,
602  const ValueType& ijk_force_const, const ValueType& kji_force_const, const ValueType& ref_angle,
603  const ValueType& ref_length1, const ValueType& ref_length2)
604 {
605  ValueType r_ij = ValueType();
606  ValueType r_kj = ValueType();
607  ValueType a_ijk = calcBondLengthsAndAngle(term_atom1_pos, ctr_atom_pos, term_atom2_pos, r_ij, r_kj) * ValueType(180 / M_PI);
608 
609  ValueType dr_ij = r_ij - ref_length1;
610  ValueType dr_kj = r_kj - ref_length2;
611  ValueType da_ijk = a_ijk - ref_angle;
612 
613  ValueType e_ab = ValueType(2.51210) * (ijk_force_const * dr_ij + kji_force_const * dr_kj) * da_ijk;
614 
615  return e_ab;
616 }
617 
618 template <typename ValueType, typename CoordsVec>
619 ValueType CDPL::ForceField::calcMMFF94StretchBendEnergy(const CoordsVec& term_atom1_pos, const CoordsVec& ctr_atom_pos, const CoordsVec& term_atom2_pos,
620  const ValueType& r_ij, const ValueType& r_jk,
621  const ValueType& ijk_force_const, const ValueType& kji_force_const, const ValueType& ref_angle,
622  const ValueType& ref_length1, const ValueType& ref_length2)
623 {
624  ValueType a_ijk = calcBondAngle(term_atom1_pos, ctr_atom_pos, term_atom2_pos, r_ij, r_jk) * ValueType(180 / M_PI);
625 
626  ValueType dr_ij = r_ij - ref_length1;
627  ValueType dr_kj = r_jk - ref_length2;
628  ValueType da_ijk = a_ijk - ref_angle;
629 
630  ValueType e_ab = ValueType(2.51210) * (ijk_force_const * dr_ij + kji_force_const * dr_kj) * da_ijk;
631 
632  return e_ab;
633 }
634 
635 
636 template <typename ValueType, typename Iter, typename CoordsArray>
637 ValueType CDPL::ForceField::calcMMFF94OutOfPlaneBendingEnergy(Iter beg, const Iter& end, const CoordsArray& coords)
638 {
639  return Detail::accumInteractionEnergies<ValueType>(beg, end, coords,
640  static_cast<ValueType (*)(const MMFF94OutOfPlaneBendingInteraction&, const CoordsArray&)>(
641  &calcMMFF94OutOfPlaneBendingEnergy<ValueType, CoordsArray>));
642 }
643 
644 template <typename ValueType, typename CoordsArray>
645 ValueType CDPL::ForceField::calcMMFF94OutOfPlaneBendingEnergy(const MMFF94OutOfPlaneBendingInteraction& iaction, const CoordsArray& coords)
646 {
647  return calcMMFF94OutOfPlaneBendingEnergy<ValueType>(coords[iaction.getTerminalAtom1Index()], coords[iaction.getCenterAtomIndex()],
648  coords[iaction.getTerminalAtom2Index()], coords[iaction.getOutOfPlaneAtomIndex()],
649  iaction.getForceConstant());
650 }
651 
652 template <typename ValueType, typename CoordsVec>
653 ValueType CDPL::ForceField::calcMMFF94OutOfPlaneBendingEnergy(const CoordsVec& term_atom1_pos, const CoordsVec& ctr_atom_pos, const CoordsVec& term_atom2_pos,
654  const CoordsVec& oop_atom_pos, const ValueType& force_const)
655 {
656  ValueType chi_ijkl = calcOutOfPlaneAngle<ValueType>(term_atom1_pos, ctr_atom_pos, term_atom2_pos, oop_atom_pos) * ValueType(180 / M_PI);
657  ValueType e_oop = ValueType(0.5 * 0.043844) * force_const * chi_ijkl * chi_ijkl;
658 
659  return e_oop;
660 }
661 
662 template <typename ValueType, typename CoordsVec>
663 ValueType CDPL::ForceField::calcMMFF94OutOfPlaneBendingEnergy(const CoordsVec& term_atom1_pos, const CoordsVec& ctr_atom_pos, const CoordsVec& term_atom2_pos,
664  const CoordsVec& oop_atom_pos, const ValueType& r_jl, const ValueType& force_const)
665 {
666  ValueType chi_ijkl = calcOutOfPlaneAngle<ValueType>(term_atom1_pos, ctr_atom_pos, term_atom2_pos, oop_atom_pos, r_jl) * ValueType(180 / M_PI);
667  ValueType e_oop = ValueType(0.5 * 0.043844) * force_const * chi_ijkl * chi_ijkl;
668 
669  return e_oop;
670 }
671 
672 
673 template <typename ValueType, typename Iter, typename CoordsArray>
674 ValueType CDPL::ForceField::calcMMFF94TorsionEnergy(Iter beg, const Iter& end, const CoordsArray& coords)
675 {
676  return Detail::accumInteractionEnergies<ValueType>(beg, end, coords,
677  static_cast<ValueType (*)(const MMFF94TorsionInteraction&, const CoordsArray&)>(
678  &calcMMFF94TorsionEnergy<ValueType, CoordsArray>));
679 }
680 
681 template <typename ValueType, typename CoordsArray>
682 ValueType CDPL::ForceField::calcMMFF94TorsionEnergy(const MMFF94TorsionInteraction& iaction, const CoordsArray& coords)
683 {
684  return calcMMFF94TorsionEnergy<ValueType>(coords[iaction.getTerminalAtom1Index()], coords[iaction.getCenterAtom1Index()],
685  coords[iaction.getCenterAtom2Index()], coords[iaction.getTerminalAtom2Index()],
686  iaction.getTorsionParameter1(), iaction.getTorsionParameter2(), iaction.getTorsionParameter3());
687 }
688 
689 template <typename ValueType, typename CoordsVec>
690 ValueType CDPL::ForceField::calcMMFF94TorsionEnergy(const CoordsVec& term_atom1_pos, const CoordsVec& ctr_atom1_pos, const CoordsVec& ctr_atom2_pos,
691  const CoordsVec& term_atom2_pos, const ValueType& tor_param1, const ValueType& tor_param2,
692  const ValueType& tor_param3)
693 {
694  ValueType phi_cos = calcDihedralAngleCos<ValueType>(term_atom1_pos, ctr_atom1_pos, ctr_atom2_pos, term_atom2_pos);
695  ValueType phi = std::acos(phi_cos);
696  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)));
697 
698  return e_t;
699 }
700 
701 
702 template <typename ValueType, typename Iter, typename CoordsArray>
703 ValueType CDPL::ForceField::calcMMFF94ElectrostaticEnergy(Iter beg, const Iter& end, const CoordsArray& coords)
704 {
705  return Detail::accumInteractionEnergies<ValueType>(beg, end, coords,
706  static_cast<ValueType (*)(const MMFF94ElectrostaticInteraction&, const CoordsArray&)>(
707  &calcMMFF94ElectrostaticEnergy<ValueType, CoordsArray>));
708 }
709 
710 template <typename ValueType, typename CoordsArray>
711 ValueType CDPL::ForceField::calcMMFF94ElectrostaticEnergy(const MMFF94ElectrostaticInteraction& iaction, const CoordsArray& coords)
712 {
713  return calcMMFF94ElectrostaticEnergy<ValueType>(coords[iaction.getAtom1Index()], coords[iaction.getAtom2Index()],
714  iaction.getAtom1Charge(), iaction.getAtom2Charge(), iaction.getScalingFactor(),
715  iaction.getDielectricConstant(), iaction.getDistanceExponent());
716 }
717 
718 template <typename ValueType, typename CoordsVec>
719 ValueType CDPL::ForceField::calcMMFF94ElectrostaticEnergy(const CoordsVec& atom1_pos, const CoordsVec& atom2_pos, const ValueType& atom1_chg,
720  const ValueType& atom2_chg, const ValueType& scale_fact, const ValueType& de_const,
721  const ValueType& dist_expo)
722 {
723  ValueType tmp = std::pow(calcDistance<ValueType>(atom1_pos, atom2_pos) + ValueType(0.05), dist_expo);
724  ValueType e_q = scale_fact * ValueType(332.0716) * atom1_chg * atom2_chg / (de_const * tmp);
725 
726  return e_q;
727 }
728 
729 template <typename ValueType>
730 ValueType CDPL::ForceField::calcMMFF94ElectrostaticEnergy(const ValueType& r_ij, const ValueType& atom1_chg, const ValueType& atom2_chg,
731  const ValueType& scale_fact, const ValueType& de_const, const ValueType& dist_expo)
732 {
733  ValueType tmp = std::pow(r_ij + ValueType(0.05), dist_expo);
734  ValueType e_q = scale_fact * ValueType(332.0716) * atom1_chg * atom2_chg / (de_const * tmp);
735 
736  return e_q;
737 }
738 
739 
740 template <typename ValueType, typename Iter, typename CoordsArray>
741 ValueType CDPL::ForceField::calcMMFF94VanDerWaalsEnergy(Iter beg, const Iter& end, const CoordsArray& coords)
742 {
743  return Detail::accumInteractionEnergies<ValueType>(beg, end, coords,
744  static_cast<ValueType (*)(const MMFF94VanDerWaalsInteraction&, const CoordsArray&)>(
745  &calcMMFF94VanDerWaalsEnergy<ValueType, CoordsArray>));
746 }
747 
748 template <typename ValueType, typename CoordsArray>
749 ValueType CDPL::ForceField::calcMMFF94VanDerWaalsEnergy(const MMFF94VanDerWaalsInteraction& iaction, const CoordsArray& coords)
750 {
751  return calcMMFF94VanDerWaalsEnergy<ValueType>(coords[iaction.getAtom1Index()], coords[iaction.getAtom2Index()],
752  iaction.getEIJ(), iaction.getRIJ(), iaction.getRIJPow7());
753 }
754 
755 template <typename ValueType, typename CoordsVec>
756 ValueType CDPL::ForceField::calcMMFF94VanDerWaalsEnergy(const CoordsVec& atom1_pos, const CoordsVec& atom2_pos, const ValueType& e_IJ,
757  const ValueType& r_IJ, const ValueType& r_IJ_7)
758 {
759  ValueType r_ij_2 = calcSquaredDistance<ValueType>(atom1_pos, atom2_pos);
760  ValueType r_ij = std::sqrt(r_ij_2);
761  ValueType r_ij_7 = r_ij_2 * r_ij_2 * r_ij_2 * r_ij;
762 
763  ValueType tmp = ValueType(1.07) * r_IJ / (r_ij + ValueType(0.07) * r_IJ);
764  ValueType tmp_2 = tmp * tmp;
765  ValueType tmp_7 = tmp_2 * tmp_2 * tmp_2 * tmp;
766 
767  ValueType e_vdw = e_IJ * tmp_7 * (ValueType(1.12) * r_IJ_7 / (r_ij_7 + ValueType(0.12) * r_IJ_7) - 2);
768 
769  return e_vdw;
770 }
771 
772 template <typename ValueType>
773 ValueType CDPL::ForceField::calcMMFF94VanDerWaalsEnergy(const ValueType& r_ij, const ValueType& e_IJ,
774  const ValueType& r_IJ, const ValueType& r_IJ_7)
775 {
776  ValueType r_ij_2 = r_ij * r_ij;
777  ValueType r_ij_7 = r_ij_2 * r_ij_2 * r_ij_2 * r_ij;
778 
779  ValueType tmp = ValueType(1.07) * r_IJ / (r_ij + ValueType(0.07) * r_IJ);
780  ValueType tmp_2 = tmp * tmp;
781  ValueType tmp_7 = tmp_2 * tmp_2 * tmp_2 * tmp;
782 
783  ValueType e_vdw = e_IJ * tmp_7 * (ValueType(1.12) * r_IJ_7 / (r_ij_7 + ValueType(0.12) * r_IJ_7) - 2);
784 
785  return e_vdw;
786 }
787 
788 // \endcond
789 
790 #endif // CDPL_FORCEFIELD_MMFF94ENERGYFUNCTIONS_HPP
Utility functions used in the calculation of force field energies and gradients.
Definition of the class CDPL::ForceField::MMFF94AngleBendingInteraction.
Definition of the class CDPL::ForceField::MMFF94BondStretchingInteraction.
Definition of the class CDPL::ForceField::MMFF94ElectrostaticInteraction.
Definition of the class CDPL::ForceField::MMFF94OutOfPlaneBendingInteraction.
Definition of the class CDPL::ForceField::MMFF94StretchBendInteraction.
Definition of the class CDPL::ForceField::MMFF94TorsionInteraction.
Definition of the class CDPL::ForceField::MMFF94VanDerWaalsInteraction.
Definition: MMFF94AngleBendingInteraction.hpp:42
Definition: MMFF94BondStretchingInteraction.hpp:42
Definition: MMFF94ElectrostaticInteraction.hpp:42
Definition: MMFF94OutOfPlaneBendingInteraction.hpp:42
Definition: MMFF94StretchBendInteraction.hpp:42
Definition: MMFF94TorsionInteraction.hpp:42
Definition: MMFF94VanDerWaalsInteraction.hpp:43
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.
ValueType calcMMFF94OutOfPlaneBendingEnergy(Iter beg, const Iter &end, const CoordsArray &coords)
ValueType calcMMFF94VanDerWaalsEnergy(Iter beg, const Iter &end, const CoordsArray &coords)
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.
ValueType calcMMFF94BondStretchingEnergy(Iter beg, const Iter &end, const CoordsArray &coords)
ValueType calcMMFF94StretchBendEnergy(Iter beg, const Iter &end, const CoordsArray &coords)
ValueType calcMMFF94ElectrostaticEnergy(Iter beg, const Iter &end, const CoordsArray &coords)
ValueType calcMMFF94TorsionEnergy(Iter beg, const Iter &end, const CoordsArray &coords)
ValueType calcMMFF94AngleBendingEnergy(Iter beg, const Iter &end, const CoordsArray &coords)
The namespace of the Chemical Data Processing Library.