Loading...
Searching...
No Matches
support.h
Go to the documentation of this file.
// -*- Mode: C++; tab-width: 2; -*-
// vi: set ts=2:
//
// $Id: support.h,v 1.28 2005/12/23 17:01:52 amoll Exp $
//
#ifndef BALL_MOLMEC_COMMON_SUPPORT_H
#define BALL_MOLMEC_COMMON_SUPPORT_H
#ifndef BALL_COMMON_H
# include <BALL/common.h>
#endif
#ifndef BALL_MATHS_SIMPLEBOX3_H
# include <BALL/MATHS/simpleBox3.h>
#endif
#ifndef BALL_MOLMEC_COMMON_FORCEFIELD_H
# include <BALL/MOLMEC/COMMON/forceField.h>
#endif
#ifndef BALL_MOLMEC_COMMON_ATOMVECTOR_H
# include <BALL/MOLMEC/COMMON/atomVector.h>
#endif
#ifndef BALL_DATATYPE_HASHGRID_H
# include <BALL/DATATYPE/hashGrid.h>
#endif
#ifndef BALL_KERNEL_BOND_H
# include <BALL/KERNEL/bond.h>
#endif
#include <vector>
namespace BALL
{
class Atom;
class System;
namespace MolmecSupport
{
using std::pair;
enum PairListAlgorithmType
{
HASH_GRID,
BRUTE_FORCE
};
BALL_EXPORT BALL::Size calculateNonBondedAtomPairs
(ForceField::PairVector& pair_vector,
const AtomVector& atom_vector, const SimpleBox3& box,
double distance, bool periodic_boundary_enabled,
PairListAlgorithmType type);
BALL_EXPORT Size sortNonBondedAtomPairsAfterSelection(ForceField::PairVector& pair_vector);
BALL_EXPORT BALL::Size addNonOverlappingMolecules
(System& system, const HashGrid3<const Atom*>& solute_grid,
const System& solvent, const SimpleBox3& box, double distance);
BALL_EXPORT void adaptWaterBox(System& system, const SimpleBox3& box);
// ?????
BALL_EXPORT void calculateMinimumImage
(Vector3& distance, const Vector3& period);
template <typename TorsionType, typename AtomIteratorType>
Size computeTorsions
(const AtomIteratorType& start, const AtomIteratorType& end,
std::vector<TorsionType>& torsions, bool use_selection = false);
//
template <typename TorsionType, typename AtomIteratorType>
Size computeTorsions
(const AtomIteratorType& start, const AtomIteratorType& end,
std::vector<TorsionType>& torsions, bool use_selection)
{
// pointers to the four atoms
Atom* a1;
Atom* a2;
Atom* a3;
Atom* a4;
Size number_of_added_torsions = 0;
// Iterate over all atoms...
//
AtomIteratorType atom_it = start;
for (; atom_it != end; ++atom_it)
{
// ...and check each bond whether it is part of
// a torsion.
Atom::BondIterator it1 = (*atom_it)->beginBond();
for (; +it1 ; ++ it1)
{
// Consider each bond just once by making sure that
// our start atom is the *first* atom of the bond.
if (*atom_it == it1->getFirstAtom())
{
// We know have the two central atoms of a potential
// torsion and store them in a2 and a3.
a2 = *atom_it;
a3 = const_cast<Atom*>(it1->getSecondAtom());
// Now, find all other atoms (atoms 1 and 4)
Atom::BondIterator it2;
Atom::BondIterator it3;
for (it2 = (*atom_it)->beginBond(); +it2 ; ++it2)
{
if (it2->getSecondAtom() != it1->getSecondAtom())
{
// determine the first atom
if (it2->getFirstAtom() == *atom_it)
{
a1 = const_cast<Atom*>(it2->getSecondAtom());
}
else
{
a1 = const_cast<Atom*>(it2->getFirstAtom());
}
for (it3 = const_cast<Atom*>(it1->getSecondAtom())->beginBond(); +it3 ; ++it3)
{
if (it3->getFirstAtom() != a2 )
{
// determine the fourth atom a4
if (it3->getFirstAtom() == a3)
{
a4 = const_cast<Atom*>(it3->getSecondAtom());
}
else
{
a4 = const_cast<Atom*>(it3->getFirstAtom());
}
if (use_selection == false
|| (use_selection == true
&& (a1->isSelected() || a2->isSelected() || a3->isSelected() || a4->isSelected())))
{
// Push the torsion onto the torsion vector.
TorsionType tmp;
tmp.atom1 = a1;
tmp.atom2 = a2;
tmp.atom3 = a3;
tmp.atom4 = a4;
torsions.push_back(tmp);
number_of_added_torsions++;
}
}
}
}
}
}
}
}
// return the number of torsions computed
return number_of_added_torsions;
}
} // namespace MolmecSupport
} // namespace BALL
#endif // BALL_MOLMEC_COMMON_SUPPORT_H
BALL_EXPORT
#define BALL_EXPORT
Definition COMMON/global.h:50
atomVector.h
bond.h
BALL::AtomVector
Definition atomVector.h:31
BALL::Atom
Definition atom.h:90
BALL::Atom::beginBond
BondIterator beginBond()
Return a bond iterator pointing to the first bond of the atom.
Definition atom.h:890
BALL::Atom::BondIterator
RandomAccessIterator< Atom, Bond, BondIteratorPosition, BondIteratorTraits > BondIterator
Definition atom.h:887
BALL::Bond::getFirstAtom
const Atom * getFirstAtom() const
Return a pointer to the first atom.
BALL::Bond::getSecondAtom
const Atom * getSecondAtom() const
Return a pointer to the second atom.
BALL::ForceField::PairVector
std::vector< std::pair< Atom *, Atom * > > PairVector
Definition forceField.h:99
BALL::HashGrid3
Three-dimensional Hash Grid Class.
Definition hashGrid.h:755
BALL::Selectable::isSelected
bool isSelected() const
BALL::System
Definition KERNEL/system.h:40
common.h
forceField.h
BALL::SimpleBox3
TSimpleBox3< float > SimpleBox3
Definition simpleBox3.h:615
hashGrid.h
BALL::MolmecSupport
Definition support.h:46
BALL::MolmecSupport::computeTorsions
Size computeTorsions(const AtomIteratorType &start, const AtomIteratorType &end, std::vector< TorsionType > &torsions, bool use_selection=false)
Definition support.h:154
BALL::MolmecSupport::calculateNonBondedAtomPairs
BALL_EXPORT BALL::Size calculateNonBondedAtomPairs(ForceField::PairVector &pair_vector, const AtomVector &atom_vector, const SimpleBox3 &box, double distance, bool periodic_boundary_enabled, PairListAlgorithmType type)
BALL::MolmecSupport::addNonOverlappingMolecules
BALL_EXPORT BALL::Size addNonOverlappingMolecules(System &system, const HashGrid3< const Atom * > &solute_grid, const System &solvent, const SimpleBox3 &box, double distance)
BALL::MolmecSupport::calculateMinimumImage
BALL_EXPORT void calculateMinimumImage(Vector3 &distance, const Vector3 &period)
BALL::MolmecSupport::sortNonBondedAtomPairsAfterSelection
BALL_EXPORT Size sortNonBondedAtomPairsAfterSelection(ForceField::PairVector &pair_vector)
BALL::MolmecSupport::PairListAlgorithmType
PairListAlgorithmType
Definition support.h:61
BALL::MolmecSupport::HASH_GRID
@ HASH_GRID
Definition support.h:64
BALL::MolmecSupport::BRUTE_FORCE
@ BRUTE_FORCE
Definition support.h:68
BALL::MolmecSupport::adaptWaterBox
BALL_EXPORT void adaptWaterBox(System &system, const SimpleBox3 &box)
BALL
Definition constants.h:13
BALL::Size
BALL_SIZE_TYPE Size
Definition COMMON/global.h:114
BALL::Vector3
TVector3< float > Vector3
Definition vector3.h:1084
simpleBox3.h