BALL 1.5.0
support.h
Go to the documentation of this file.
1// -*- Mode: C++; tab-width: 2; -*-
2// vi: set ts=2:
3//
4// $Id: support.h,v 1.28 2005/12/23 17:01:52 amoll Exp $
5//
6
7
8#ifndef BALL_MOLMEC_COMMON_SUPPORT_H
9#define BALL_MOLMEC_COMMON_SUPPORT_H
10
11#ifndef BALL_COMMON_H
12# include <BALL/common.h>
13#endif
14
15#ifndef BALL_MATHS_SIMPLEBOX3_H
17#endif
18
19#ifndef BALL_MOLMEC_COMMON_FORCEFIELD_H
21#endif
22
23#ifndef BALL_MOLMEC_COMMON_ATOMVECTOR_H
25#endif
26
27#ifndef BALL_DATATYPE_HASHGRID_H
29#endif
30
31#ifndef BALL_KERNEL_BOND_H
32# include <BALL/KERNEL/bond.h>
33#endif
34
35#include <vector>
36
37namespace BALL
38{
39 class Atom;
40 class System;
41
45 namespace MolmecSupport
46 {
47
48 using std::pair;
49
53
57
61 {
65
69 };
71
87 (ForceField::PairVector& pair_vector,
88 const AtomVector& atom_vector, const SimpleBox3& box,
89 double distance, bool periodic_boundary_enabled,
91
100
115 (System& system, const HashGrid3<const Atom*>& solute_grid,
116 const System& solvent, const SimpleBox3& box, double distance);
117
130 BALL_EXPORT void adaptWaterBox(System& system, const SimpleBox3& box);
131
134 // ?????
136 (Vector3& distance, const Vector3& period);
137
145 template <typename TorsionType, typename AtomIteratorType>
147 (const AtomIteratorType& start, const AtomIteratorType& end,
148 std::vector<TorsionType>& torsions, bool use_selection = false);
149
150
151 //
152 template <typename TorsionType, typename AtomIteratorType>
154 (const AtomIteratorType& start, const AtomIteratorType& end,
155 std::vector<TorsionType>& torsions, bool use_selection)
156 {
157 // pointers to the four atoms
158 Atom* a1;
159 Atom* a2;
160 Atom* a3;
161 Atom* a4;
162
163 Size number_of_added_torsions = 0;
164
165 // Iterate over all atoms...
166 //
167 AtomIteratorType atom_it = start;
168 for (; atom_it != end; ++atom_it)
169 {
170 // ...and check each bond whether it is part of
171 // a torsion.
172 Atom::BondIterator it1 = (*atom_it)->beginBond();
173 for (; +it1 ; ++ it1)
174 {
175 // Consider each bond just once by making sure that
176 // our start atom is the *first* atom of the bond.
177 if (*atom_it == it1->getFirstAtom())
178 {
179 // We know have the two central atoms of a potential
180 // torsion and store them in a2 and a3.
181 a2 = *atom_it;
182 a3 = const_cast<Atom*>(it1->getSecondAtom());
183
184 // Now, find all other atoms (atoms 1 and 4)
187 for (it2 = (*atom_it)->beginBond(); +it2 ; ++it2)
188 {
189 if (it2->getSecondAtom() != it1->getSecondAtom())
190 {
191 // determine the first atom
192 if (it2->getFirstAtom() == *atom_it)
193 {
194 a1 = const_cast<Atom*>(it2->getSecondAtom());
195 }
196 else
197 {
198 a1 = const_cast<Atom*>(it2->getFirstAtom());
199 }
200
201 for (it3 = const_cast<Atom*>(it1->getSecondAtom())->beginBond(); +it3 ; ++it3)
202 {
203 if (it3->getFirstAtom() != a2 )
204 {
205 // determine the fourth atom a4
206 if (it3->getFirstAtom() == a3)
207 {
208 a4 = const_cast<Atom*>(it3->getSecondAtom());
209 }
210 else
211 {
212 a4 = const_cast<Atom*>(it3->getFirstAtom());
213 }
214
215 if (use_selection == false
216 || (use_selection == true
217 && (a1->isSelected() || a2->isSelected() || a3->isSelected() || a4->isSelected())))
218 {
219 // Push the torsion onto the torsion vector.
220 TorsionType tmp;
221 tmp.atom1 = a1;
222 tmp.atom2 = a2;
223 tmp.atom3 = a3;
224 tmp.atom4 = a4;
225
226 torsions.push_back(tmp);
227 number_of_added_torsions++;
228 }
229 }
230 }
231 }
232 }
233 }
234 }
235 }
236
237 // return the number of torsions computed
238 return number_of_added_torsions;
239 }
240
241 } // namespace MolmecSupport
242} // namespace BALL
243
244#endif // BALL_MOLMEC_COMMON_SUPPORT_H
Definition: constants.h:13
char Atom[5]
Definition: PDBdefs.h:257
Size computeTorsions(const AtomIteratorType &start, const AtomIteratorType &end, std::vector< TorsionType > &torsions, bool use_selection=false)
Definition: support.h:154
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 BALL::Size addNonOverlappingMolecules(System &system, const HashGrid3< const Atom * > &solute_grid, const System &solvent, const SimpleBox3 &box, double distance)
BALL_EXPORT void calculateMinimumImage(Vector3 &distance, const Vector3 &period)
BALL_EXPORT Size sortNonBondedAtomPairsAfterSelection(ForceField::PairVector &pair_vector)
BALL_EXPORT void adaptWaterBox(System &system, const SimpleBox3 &box)
bool isSelected() const
std::vector< std::pair< Atom *, Atom * > > PairVector
Definition: forceField.h:99
#define BALL_EXPORT
Definition: COMMON/global.h:50