RxDock 0.1.0
A fast, versatile, and open-source program for docking ligands to proteins and nucleic acids
Loading...
Searching...
No Matches
Atom.h
1/***********************************************************************
2 * The rDock program was developed from 1998 - 2006 by the software team
3 * at RiboTargets (subsequently Vernalis (R&D) Ltd).
4 * In 2006, the software was licensed to the University of York for
5 * maintenance and distribution.
6 * In 2012, Vernalis and the University of York agreed to release the
7 * program as Open Source software.
8 * This version is licensed under GNU-LGPL version 3.0 with support from
9 * the University of Barcelona.
10 * http://rdock.sourceforge.net/
11 ***********************************************************************/
12
13// Handles all the properties for a single atom
14
15#ifndef _RBTATOM_H_
16#define _RBTATOM_H_
17
18#include "rxdock/Config.h"
19#include "rxdock/Coord.h"
20#include "rxdock/PMF.h"
21#include "rxdock/Quat.h"
22#include "rxdock/TriposAtomType.h"
23
24#include <list>
25
26#include <nlohmann/json.hpp>
27
28using json = nlohmann::json;
29
30namespace rxdock {
31
32class Model; // Forward declaration
33class Bond; // Forward declaration
34
35// DM 23 Apr 1999 - provide custom comparison function
36// to bond map, so that map is sorted by bond ID, not by pointer
38public:
39 bool operator()(Bond *pBond1, Bond *pBond2) const;
40};
41
42// Map of bonds the atom is bonded to
43// Key is regular Bond*, value is Bool
44// Bool is true if this atom is atom1 in the bond, false if atom2
45typedef std::map<Bond *, bool, BondPCmp_BondId> BondMap;
46typedef BondMap::iterator BondMapIter;
47typedef BondMap::const_iterator BondMapConstIter;
48
49class Atom {
50public:
52 // Enums
54
55 // Hybridisation state
56 enum eHybridState {
57 UNDEFINED = 0,
58 SP = 1, // SP hybridised (linear geom)
59 SP2 = 2, // SP2 hybridised (planar geom)
60 SP3 = 3, // SP3 hybridised (tetrahedral geom)
61 AROM = 4, // Aromatic SP2 (planar geom)
62 TRI = 5, // Trigonal nitrogen (planar geom)
63 };
64
66 // Constructors / destructors
68
69 // Default constructor
70 RBTDLL_EXPORT Atom();
71
72 // Constructor supplying all 2-D parameters
73 RBTDLL_EXPORT
74 explicit Atom(int nAtomId, int nAtomicNo = 6, std::string strAtomName = "C",
75 std::string strSubunitId = "1",
76 std::string strSubunitName = "RES",
77 std::string strSegmentName = "SEG1",
78 eHybridState eState =
79 UNDEFINED, // DM 8 Dec 1998 Changed from SP3 to UNDEFINED
80 unsigned int nHydrogens = 0, int nFormalCharge = 0);
81 Atom(json j);
82
83 // Default destructor
84 virtual ~Atom();
85
86 // Copy constructor
87 Atom(const Atom &atom);
88
89 // Copy assignment
90 Atom &operator=(const Atom &atom);
91
93 // Stream functions
95
96 // Insertion operator (primarily for debugging)
97 // Note: needs to be friend so can access atom private data
98 // without using the accessor functions
99 RBTDLL_EXPORT friend std::ostream &operator<<(std::ostream &s,
100 const Atom &atom);
101 friend void to_json(json &j, const Atom &atom);
102 friend void from_json(const json &j, Atom &atom);
103
104 // Virtual function for dumping atom details to an output stream
105 // Derived classes (e.g. pseudoatom) can override if required
106 virtual std::ostream &Print(std::ostream &s) const;
107
109 // Public accessor functions
110 // 2-D attributes
112
113 // DM 7 June 2006
114 // atom enabled state is controlled by the parent Model
115 // enabled state
116 RBTDLL_EXPORT bool GetEnabled() const;
117
118 // AtomId
119 int GetAtomId() const { return m_nAtomId; }
120 void SetAtomId(const int nAtomId) { m_nAtomId = nAtomId; }
121
122 // AtomicNo
123 int GetAtomicNo() const { return m_nAtomicNo; }
124 void SetAtomicNo(const int nAtomicNo) { m_nAtomicNo = nAtomicNo; }
125
126 // AtomName
127 std::string GetName() const { return m_strAtomName; }
128 void SetAtomName(const std::string &strAtomName) {
129 m_strAtomName = strAtomName;
130 }
131 RBTDLL_EXPORT std::string
132 GetFullAtomName() const; // Returns composite of segment name,
133 // subunit id and name, and atom name
134
135 // SubunitId
136 std::string GetSubunitId() const { return m_strSubunitId; }
137 void SetSubunitId(const std::string &strSubunitId) {
138 m_strSubunitId = strSubunitId;
139 }
140
141 // SubunitName
142 std::string GetSubunitName() const { return m_strSubunitName; }
143 void SetSubunitName(const std::string &strSubunitName) {
144 m_strSubunitName = strSubunitName;
145 }
146
147 // SegmentName
148 std::string GetSegmentName() const { return m_strSegmentName; }
149 void SetSegmentName(const std::string &strSegmentName) {
150 m_strSegmentName = strSegmentName;
151 }
152
153 // Hybridisation state
154 eHybridState GetHybridState() const { return m_eState; }
155 void SetHybridState(const eHybridState eState) { m_eState = eState; }
156
157 // Attached hydrogens
158 unsigned int GetNumImplicitHydrogens() const { return m_nHydrogens; }
159 void SetNumImplicitHydrogens(const unsigned int nHydrogens) {
160 m_nHydrogens = nHydrogens;
161 }
162
163 // FormalCharge (DM 24 Mar 1999 - changed from double to int)
164 int GetFormalCharge() const { return m_nFormalCharge; }
165 void SetFormalCharge(const int nFormalCharge) {
166 m_nFormalCharge = nFormalCharge;
167 }
168
169 // CyclicFlag - flag to indicate atom is in a ring (set by Model::FindRing)
170 bool GetCyclicFlag() const { return m_bCyclic; }
171 void SetCyclicFlag(bool bCyclic = true) { m_bCyclic = bCyclic; }
172
173 // SelectionFlag - general purpose flag can be set/cleared by various search
174 // algorithms (e.g. FindRings)
175 bool GetSelectionFlag() const { return m_bSelected; }
176 void SetSelectionFlag(bool bSelected = true) { m_bSelected = bSelected; }
177 void InvertSelectionFlag() { m_bSelected = !m_bSelected; }
178
179 // DM 21 Jul 1999 - user-defined flag
180 bool GetUser1Flag() const { return m_bUser1; }
181 void SetUser1Flag(bool bUser1 = true) { m_bUser1 = bUser1; }
182
183 // DM 29 Jan 2000 - user-defined double
184 double GetUser1Value() const { return m_dUser1; }
185 void SetUser1Value(double dUser1 = 0.0) { m_dUser1 = dUser1; }
186
187 // DM 27 Jul 2000 - user-defined double#2
188 double GetUser2Value() const { return m_dUser2; }
189 void SetUser2Value(double dUser2 = 0.0) { m_dUser2 = dUser2; }
190
191 // ModelPtr - pointer to the parent model
192 Model *GetModelPtr() const { return m_pModel; }
193 void SetModelPtr(Model *pModel = nullptr) { m_pModel = pModel; }
194
195 // DM 04 Dec 1998 Add functions to handle bond map
196 // Returns number of bonds in map
197 unsigned int GetNumBonds() const { return m_bondMap.size(); }
198 // Returns the bond map
199 // DM 26 Oct 2000 - return by reference
200 // BondMap GetBondMap() const {return m_bondMap;}
201 const BondMap &GetBondMap() const { return m_bondMap; }
202 // Add a bond to the bond map - returns true if OK, false if this atom is not
203 // a member of the bond or if bond already added
204 bool AddBond(Bond *pBond);
205 // Remove a bond from the bond map - returns true if OK, false if bond not
206 // present in map
207 bool RemoveBond(Bond *pBond);
208 // Returns number of cyclic bonds in map
209 unsigned int GetNumCyclicBonds() const;
210 // Returns bond map with only cyclic bonds included
211 BondMap GetCyclicBondMap() const;
212 // Returns total formal bond order around atom
213 int GetTotalFormalBondOrder() const;
214 // Returns max formal bond order for all bonds to atom
215 int GetMaxFormalBondOrder() const;
216
218 // Public accessor functions
219 // 3-D attributes
221
222 // Coords
223 // DM 8 Dec 1998 - make virtual so we can override in the pseudoatom class
224 // DM 11 Jul 2000 - remove overhead of virtual methods
225 // Pseudo atoms must now refresh their coords each time the constituent atoms
226 // move DM 27 Oct 2000 - return by reference
227 const Coord &GetCoords() const { return m_coord; }
228 double GetX() const { return m_coord.xyz(0); }
229 double GetY() const { return m_coord.xyz(1); }
230 double GetZ() const { return m_coord.xyz(2); }
231
232 void SetCoords(const Coord &coord) { m_coord = coord; }
233 void SetCoords(const double x, const double y, const double z) {
234 m_coord.xyz(0) = x;
235 m_coord.xyz(1) = y;
236 m_coord.xyz(2) = z;
237 }
238 void SetX(const double x) { m_coord.xyz(0) = x; }
239 void SetY(const double y) { m_coord.xyz(1) = y; }
240 void SetZ(const double z) { m_coord.xyz(2) = z; }
241
242 // PartialCharge
243 double GetPartialCharge() const { return m_dPartialCharge; }
244 void SetPartialCharge(const double dPartialCharge) {
245 m_dPartialCharge = dPartialCharge;
246 }
247
248 // GroupCharge (added DM 24 Mar 1999, for ionic interaction group charges)
249 double GetGroupCharge() const { return m_dGroupCharge; }
250 void SetGroupCharge(const double dGroupCharge) {
251 m_dGroupCharge = dGroupCharge;
252 }
253
254 // AtomicMass
255 double GetAtomicMass() const { return m_dAtomicMass; }
256 void SetAtomicMass(const double dAtomicMass) { m_dAtomicMass = dAtomicMass; }
257
258 // VdwRadius
259 double GetVdwRadius() const { return m_dVdwRadius; }
260 void SetVdwRadius(const double dVdwRadius) { m_dVdwRadius = dVdwRadius; }
261
262 // AtomType
263 std::string GetFFType() const { return m_strFFType; }
264 void SetFFType(const std::string &strFFType) { m_strFFType = strFFType; }
265 PMFType GetPMFType() const { return m_nPMFType; }
266 void SetPMFType(PMFType aType) { m_nPMFType = aType; }
267 TriposAtomType::eType GetTriposType() const { return m_triposType; }
268 void SetTriposType(TriposAtomType::eType aType) { m_triposType = aType; }
269
270 // XB
271 // reweighting factor
272 // double GetReweight() const { return m_dReweight; }
273 // void SetReweight(const double dReweight) { m_dReweight = dReweight; }
274 // XB END MODIFICATIONS
275
277 // Other public methods
279 // DM 11 Jan 1999 - give atoms the ability to save their current coords
280 // and revert to the saved coords. Useful for Monte Carlo simulations.
281 // DM 08 Feb 1999 - all saved coords are now saved in a
282 // std::map<UInt,Coord> map key=0 is reserved for the default SaveCoords
283 // and RevertCoords
284 void SaveCoords(unsigned int coordNum = 0);
285 void RevertCoords(unsigned int coordNum = 0);
286
287 // Translate - translate coordinates by the supplied vector
288 void Translate(const Vector &vector) { m_coord += vector; }
289
290 void Translate(const double vx, const double vy, const double vz) {
291 m_coord += Coord(vx, vy, vz);
292 }
293
294 // DM 07 Jan 1999 - rotate coordinates using the supplied quaternion
295 void RotateUsingQuat(const Quat &q) { m_coord = q.Rotate(m_coord); }
296
297 // DM 04 Dec 1998 Now we have the bond map, we can easily provide
298 // coordination numbers This version returns the total number of coordinated
299 // atoms (includes implicit hydrogens) Equivalent to
300 // GetNumBonds()+GetNumImplicitHydrogens()
301 unsigned int GetCoordinationNumber() const;
302 // This version returns the number of coordinated atoms of a given element
303 // Note: for hydrogens, the implicit atoms are excluded
304 // so GetCoordinationNumber(1) will return the number of explicit hydrogens
305 unsigned int GetCoordinationNumber(int nAtomicNo) const;
306 // This version returns the number of coordinated atoms of a given force field
307 // type
308 unsigned int GetCoordinationNumber(const std::string &strFFType) const;
309 // This version returns the number of coordinated atoms of a given
310 // hybridisation state
311 unsigned int GetCoordinationNumber(eHybridState e) const;
312
313protected:
314private:
315 // Private methods
316 // Clears the bond map - should only need to be called by the copy
317 // constructors, hence private
318 void ClearBondMap();
319
320private:
321 // Private data
322
323 // These can be considered as 2-D params (i.e. define the chemistry and
324 // topology)
325 int m_nAtomicNo; // Atomic number
326 int m_nAtomId; // Atom ID
327 std::string m_strAtomName; // Atom name
328 std::string m_strSubunitId; // Subunit(residue) ID (note: string not int)
329 std::string m_strSubunitName; // Subunit(residue) name
330 std::string m_strSegmentName; // Segment(molecule) name
331 eHybridState m_eState; // Hybridisation state
332 unsigned int m_nHydrogens; // Number of attached (implicit) hydrogens
333 int m_nFormalCharge; // Formal charge (DM 24 Mar 1999 - changed from double
334 // to int)
335 Model *m_pModel; // Regular pointer to parent model
336 BondMap m_bondMap; // Map of bonds this atom is bonded to
337 bool m_bCyclic; // Is the atom in a ring ?
338 bool m_bSelected; // Can be set/cleared by various search algorithms (e.g.
339 // FindRings)
340 bool m_bUser1; // User flag 1
341 double m_dUser1; // User value 1
342 double m_dUser2; // User value 2
343 PMFType m_nPMFType; // PMF atom type: default
344 TriposAtomType::eType m_triposType; // DM 14 May 2002: Tripos 5.2 atom type
345
346 // These can be considered as 3-D params (i.e. the extra info required for 3-D
347 // calculations)
348 Coord m_coord; // cartesian coords
349 double m_dPartialCharge; // partial charge
350 double m_dGroupCharge; // interaction group charge (added DM 24 Mar 1999)
351 double m_dAtomicMass; // atomic mass
352 double m_dVdwRadius; // atomic mass
353 std::string m_strFFType; // force field atom type
354 // double m_dReweight; // XB reweighting factor
355
356 UIntCoordMap m_savedCoords; // DM 08 Feb 1999 - now store all saved coords
357 // in a std::map<UInt,Coord>
358};
359
360// Useful typedefs
361typedef SmartPtr<Atom> AtomPtr; // Smart pointer
362typedef std::vector<AtomPtr> AtomList; // Vector of smart pointers
363typedef AtomList::iterator AtomListIter;
364typedef AtomList::const_iterator AtomListConstIter;
365
366typedef std::vector<Atom *> AtomRList; // Vector of regular pointers
367typedef AtomRList::iterator AtomRListIter;
368typedef AtomRList::const_iterator AtomRListConstIter;
369
370typedef std::vector<AtomList>
371 AtomListList; // A vector of atom vectors (e.g. for storing ring systems)
372typedef AtomListList::iterator AtomListListIter;
373typedef AtomListList::const_iterator AtomListListConstIter;
374
375typedef std::vector<AtomRList>
376 AtomRListList; // A vector of atom vectors (regular pointer version)
377typedef AtomRListList::iterator AtomRListListIter;
378typedef AtomRListList::const_iterator AtomRListListConstIter;
379
380typedef std::list<AtomPtr> AtomTrueList; // A real list of smart pointers
381typedef AtomTrueList::iterator AtomTrueListIter;
382typedef AtomTrueList::const_iterator AtomTrueListConstIter;
383
385// Non-member functions (in rxdock namespace)
387
388std::ostream &operator<<(std::ostream &s, const Atom &atom);
389
390void to_json(json &j, const Atom &atom);
391void from_json(const json &j, Atom &site);
392
394// Calculation functions
396
397// DM 07 Jul 2000 - converted to regular Atom* versions
398// Returns the "bond" length in Angstroms between 2 atoms
399// Note: atoms do not have to be bonded
400inline double BondLength(Atom *pAtom1, Atom *pAtom2) {
401 return Length(pAtom1->GetCoords(), pAtom2->GetCoords());
402}
403
404// Returns the "bond" angle in degrees between 3 atoms
405// Note: atoms do not have to be bonded
406inline double BondAngle(Atom *pAtom1, Atom *pAtom2, Atom *pAtom3) {
407 return Angle(pAtom1->GetCoords(), pAtom2->GetCoords(), pAtom3->GetCoords());
408}
409
410// Returns the "bond" dihedral in degrees between 4 atoms
411// Note: atoms do not have to be bonded
412inline double BondDihedral(Atom *pAtom1, Atom *pAtom2, Atom *pAtom3,
413 Atom *pAtom4) {
414 return Dihedral(pAtom1->GetCoords(), pAtom2->GetCoords(), pAtom3->GetCoords(),
415 pAtom4->GetCoords());
416}
417
419// Conversion functions
421
422// Converts hybridisation state enum to a string
423std::string ConvertHybridStateToString(Atom::eHybridState eState);
424// Convert formal charge to a string (e.g. +, -, +2, -2 etc)
425std::string ConvertFormalChargeToString(int nCharge);
426
428// Predicates (for use by STL algorithms)
430// DM 30 Apr 2002 - convert to regular Atom* functions
431// More universal as AtomPtr parameters will be automatically degraded to
432// regular pointers
433
434// Is atom enabled ?
435class isAtomEnabled : public std::function<bool(Atom *)> {
436public:
437 explicit isAtomEnabled() = default;
438 bool operator()(Atom *pAtom) const { return pAtom->GetEnabled(); }
439};
440
441// Is atom selected ?
442class isAtomSelected : public std::function<bool(Atom *)> {
443public:
444 explicit isAtomSelected() = default;
445 bool operator()(Atom *pAtom) const { return pAtom->GetSelectionFlag(); }
446};
447
448// Is atom cyclic ?
449class isAtomCyclic : public std::function<bool(Atom *)> {
450public:
451 explicit isAtomCyclic() = default;
452 bool operator()(const Atom *pAtom) const { return pAtom->GetCyclicFlag(); }
453};
454
455// DM 9 Feb 2000 - is atom bridgehead? Checks for >2 cyclic bonds
456class isAtomBridgehead : public std::function<bool(Atom *)> {
457public:
458 explicit isAtomBridgehead() = default;
459 bool operator()(const Atom *pAtom) const {
460 return (pAtom->GetNumCyclicBonds() > 2);
461 }
462};
463
464// Is atom a H-Bond Acceptor ?
465// Checks atomic number for O(8), N(7) or S(16)
466class isAtomHBondAcceptor : public std::function<bool(Atom *)> {
467public:
468 explicit isAtomHBondAcceptor() = default;
469 RBTDLL_EXPORT bool operator()(const Atom *) const;
470};
471
472// Is atom a H-Bond Donor ?
473// Checks 1) is it a hydrogen, 2) does it make exactly one bond, 3) is the bond
474// to O, N or S ?
475class isAtomHBondDonor : public std::function<bool(Atom *)> {
476public:
477 explicit isAtomHBondDonor() = default;
478 RBTDLL_EXPORT bool operator()(const Atom *) const;
479};
480
481// Is atom formally charged ?
482// Checks if formal charge is != zero
483class isAtomCharged : public std::function<bool(Atom *)> {
484public:
485 explicit isAtomCharged() = default;
486 bool operator()(const Atom *pAtom) const {
487 return (pAtom->GetFormalCharge() != 0);
488 }
489};
490
491// Is atom formally positively charged ?
492// Checks if formal charge is > zero
493class isAtomPosCharged : public std::function<bool(Atom *)> {
494public:
495 explicit isAtomPosCharged() = default;
496 bool operator()(const Atom *pAtom) const {
497 return (pAtom->GetFormalCharge() > 0);
498 }
499};
500
501// Is atom formally negatively charged ?
502// Checks if formal charge is < zero
503class isAtomNegCharged : public std::function<bool(Atom *)> {
504public:
505 explicit isAtomNegCharged() = default;
506 bool operator()(const Atom *pAtom) const {
507 return (pAtom->GetFormalCharge() < 0);
508 }
509};
510
511// Does atom have implicit hydrogens
512class isAtomExtended : public std::function<bool(Atom *)> {
513public:
514 explicit isAtomExtended() = default;
515 bool operator()(const Atom *pAtom) const {
516 return (pAtom->GetNumImplicitHydrogens() > 0);
517 }
518};
519
520// Is atom planar ?
521// Checks if 1) atom makes 2 bonds (in which case must be planar) or
522// 2) hybridisation state is SP2, AROM or TRI
523class isAtomPlanar : public std::function<bool(Atom *)> {
524public:
525 explicit isAtomPlanar() = default;
526 bool operator()(const Atom *) const;
527};
528
529// Is atom a pi-atom ?
530// SP2,TRI or AROM, or special case of OSP3
531class isPiAtom : public std::function<bool(Atom *)> {
532public:
533 explicit isPiAtom() = default;
534 RBTDLL_EXPORT bool operator()(const Atom *) const;
535};
536
537// Is atomic number equal to n ?
538class isAtomicNo_eq : public std::function<bool(Atom *)> {
539 int n;
540
541public:
542 explicit isAtomicNo_eq(int nn) : n(nn) {}
543 bool operator()(const Atom *pAtom) const { return pAtom->GetAtomicNo() == n; }
544};
545
546// Is Force field type equal to s ?
547class isFFType_eq : public std::function<bool(Atom *)> {
548 std::string s;
549
550public:
551 explicit isFFType_eq(std::string ss) : s(std::move(ss)) {}
552 bool operator()(const Atom *pAtom) const { return pAtom->GetFFType() == s; }
553};
554
555// Is Atom name equal to s ?
556class isAtomName_eq : public std::function<bool(Atom *)> {
557 std::string s;
558
559public:
560 explicit isAtomName_eq(std::string ss) : s(std::move(ss)) {}
561 bool operator()(const Atom *pAtom) const { return pAtom->GetName() == s; }
562};
563
564// Is Subunit name equal to s ?
565class isSubunitName_eq : public std::function<bool(Atom *)> {
566 std::string s;
567
568public:
569 explicit isSubunitName_eq(std::string ss) : s(std::move(ss)) {}
570 bool operator()(const Atom *pAtom) const {
571 return pAtom->GetSubunitName() == s;
572 }
573};
574
575// Is Subunit ID equal to s ?
576class isSubunitId_eq : public std::function<bool(Atom *)> {
577 std::string s;
578
579public:
580 explicit isSubunitId_eq(std::string ss) : s(std::move(ss)) {}
581 bool operator()(const Atom *pAtom) const {
582 return pAtom->GetSubunitId() == s;
583 }
584};
585
586// Is Segment name equal to s ?
587class isSegmentName_eq : public std::function<bool(Atom *)> {
588 std::string s;
589
590public:
591 explicit isSegmentName_eq(std::string ss) : s(std::move(ss)) {}
592 bool operator()(const Atom *pAtom) const {
593 return pAtom->GetSegmentName() == s;
594 }
595};
596
597// Is hybridisation state equal to e ? (DM 26 Mar 1999)
598class isHybridState_eq : public std::function<bool(Atom *)> {
599 Atom::eHybridState e;
600
601public:
602 explicit isHybridState_eq(Atom::eHybridState ee) : e(ee) {}
603 bool operator()(const Atom *pAtom) const {
604 return pAtom->GetHybridState() == e;
605 }
606};
607
608// DM 6 Jan 1999
609// Is atom2 equal to atom1 (checks if underlying regular pointers match)
610// Note: this is a binary rather than unary predicate
611// DM 1 Feb 1999 - renamed from isAtom_eq to isAtomPtr_eq
612class isAtomPtr_eq : public std::function<bool(Atom *, Atom *)> {
613public:
614 explicit isAtomPtr_eq() = default;
615 bool operator()(const Atom *pAtom1, const Atom *pAtom2) const {
616 return pAtom1 == pAtom2;
617 }
618};
619
620// DM 1 Feb 1999
621// Is atom2 equal to atom1 (checks if subunit name, subunit ID and atom name
622// match) Note: this is a binary rather than unary predicate
623class isAtom_eq : public std::function<bool(Atom *, Atom *)> {
624public:
625 explicit isAtom_eq() = default;
626 bool operator()(const Atom *pAtom1, const Atom *pAtom2) const {
627 return ((pAtom1->GetSubunitId() == pAtom2->GetSubunitId()) &&
628 (pAtom1->GetSubunitName() == pAtom2->GetSubunitName()) &&
629 (pAtom1->GetName() == pAtom2->GetName()));
630 }
631};
632
633// DM 22 Apr 2002
634// Is atom2 ID equal to atom1 ID
635// Note: this is a binary rather than unary predicate
636class isAtomId_eq : public std::function<bool(Atom *, Atom *)> {
637public:
638 explicit isAtomId_eq() = default;
639 bool operator()(const Atom *pAtom1, const Atom *pAtom2) const {
640 return (pAtom1->GetAtomId() == pAtom2->GetAtomId());
641 }
642};
643
644// DM 12 Apr 1999
645// Is atom inside a sphere defined by radius=r, center=c
646class isAtomInsideSphere : public std::function<bool(Atom *)> {
647 const Coord &c; // center of sphere
648 double r2; // radius squared (to avoid taking square roots)
649public:
650 explicit isAtomInsideSphere(const Coord &cc, double rr)
651 : c(cc), r2(rr * rr) {}
652 bool operator()(const Atom *pAtom) const {
653 return Length2(pAtom->GetCoords() - c) <= r2;
654 }
655};
656
657// DM 12 Apr 1999
658// Is atom within a cuboid defined by cmin,cmax coords?
659class isAtomInsideCuboid : public std::function<bool(Atom *)> {
660 const Coord &cmin;
661 const Coord &cmax;
662
663public:
664 explicit isAtomInsideCuboid(const Coord &ccmin, const Coord &ccmax)
665 : cmin(ccmin), cmax(ccmax) {}
666 bool operator()(const Atom *pAtom) const {
667 // DM 27 Oct 2000 - GetCoords now returns by reference
668 const Coord &c = pAtom->GetCoords();
669 return (c >= cmin) && (c <= cmax);
670 }
671};
672
673// DM 29 Jul 1999
674// Is atom within a given distance of any coord in the coord list
675class isAtomNearCoordList : public std::function<bool(Atom *)> {
676 const CoordList &cl;
677 double r2; // radius squared (to avoid taking square roots)
678public:
679 explicit isAtomNearCoordList(const CoordList &ccl, double rr)
680 : cl(ccl), r2(rr * rr) {}
681 bool operator()(const Atom *pAtom) const;
682};
683
684// Is atom2 1-2 connected (i.e. bonded) to atom1 ?
685class isAtom_12Connected : public std::function<bool(Atom *)> {
686 Atom *pAtom1;
687 AtomList bondedAtomList1;
688
689public:
690 explicit isAtom_12Connected(Atom *spAtom);
691 bool operator()(Atom *spAtom2) const;
692};
693
694// Is atom2 1-3 connected (i.e. via a bond angle) to atom1 ?
695class isAtom_13Connected : public std::function<bool(Atom *)> {
696 Atom *pAtom1;
697 AtomList bondedAtomList1;
698
699public:
700 explicit isAtom_13Connected(Atom *pAtom);
701 bool operator()(Atom *pAtom2) const;
702};
703
704// Is atom's subunit an RNA-type (i.e. A,G,C or U)
705class isAtomRNA : public std::function<bool(Atom *)> {
706public:
707 explicit isAtomRNA() = default;
708 bool operator()(const Atom *) const;
709};
710
711// Is atom classified as an RNA receptor "anionic" atom
712// For our purposes, these are N7,O2,O4,O6,O1P and O2P
713// DM 22 Dec 1998 - center phosphate interactions on the P atom, not on O1P and
714// O2P to avoid double counting of favourable interactions class
715// isAtomRNAAnionic : public std::function<bool(Atom *)> {
716// isAtomRNA bIsAtomRNA;
717// public:
718// explicit isAtomRNAAnionic() {}
719// Bool operator() (AtomPtr) const;
720//};
721
722// DM 22 Dec 1998 - need ligand anionic atoms so we can include repulsive
723// interactions with the RNA
724//
725// Is atom classified as a ligand "anionic" atom
726// Includes COO-, PO3-
727// class isAtomLigandAnionic : public std::function<bool(Atom *)> {
728// public:
729// explicit isAtomLigandAnionic() {}
730// Bool operator() (AtomPtr) const;
731//};
732
733// DM 22 Dec 1998 - renamed from isAtomRNACationic
734//
735// Is atom classified as a ligand "cationic" atom
736// The most important category is charged Nitrogens
737// class isAtomLigandCationic : public std::function<bool(Atom *)> {
738// public:
739// explicit isAtomLigandCationic() {}
740// Bool operator() (AtomPtr) const;
741//};
742
744// DM 30 Mar 1999
745// Now that the MolecularFileSources define the GroupCharge attribute in a
746// file-format independent manner, we don't need separate predicates for
747// isRNAAnionic, isLigandAnionic etc We just need isIonic, isCationic, isAnionic
748
749// Is atom defined as an ionic interaction center ?
750// Checks if group charge is != zero
751class isAtomIonic : public std::function<bool(Atom *)> {
752public:
753 explicit isAtomIonic() = default;
754 bool operator()(const Atom *pAtom) const {
755 return (std::fabs(pAtom->GetGroupCharge()) > 0.001);
756 }
757};
758
759// Is atom defined as a cationic interaction center ?
760// Checks if group charge is > zero
761class isAtomCationic : public std::function<bool(Atom *)> {
762public:
763 explicit isAtomCationic() = default;
764 bool operator()(const Atom *pAtom) const {
765 return (pAtom->GetGroupCharge() > 0.001);
766 }
767};
768
769// Is atom defined as an anionic interaction center ?
770// Checks if group charge is < zero
771class isAtomAnionic : public std::function<bool(Atom *)> {
772public:
773 explicit isAtomAnionic() = default;
774 bool operator()(const Atom *pAtom) const {
775 return (pAtom->GetGroupCharge() < -0.001);
776 }
777};
778
779// Is atom the central carbon in a guanidinium group ?
780// Checks for cationic sp2/arom carbon
781// DM 27 Jan 2000 - also check is acyclic
782class isAtomGuanidiniumCarbon : public std::function<bool(Atom *)> {
783 isAtomicNo_eq bIsCarbon;
784 isAtomCationic bIsCationic;
785 isPiAtom bIsPi;
786 isAtomCyclic bIsCyclic;
787
788public:
789 explicit isAtomGuanidiniumCarbon() : bIsCarbon(6) {}
790 bool operator()(const Atom *pAtom) const {
791 return bIsCationic(pAtom) && bIsCarbon(pAtom) && bIsPi(pAtom) &&
792 !bIsCyclic(pAtom);
793 }
794};
795
796// DM 24 Jan 2001
797// Checks for common metal ions by atomic number
798// DM 19 Oct 2001 - extend to all common metals (Na,Mg,K->Zn)
799class isAtomMetal : public std::function<bool(Atom *)> {
800public:
801 RBTDLL_EXPORT explicit isAtomMetal();
802 RBTDLL_EXPORT bool operator()(const Atom *pAtom) const;
803};
804
805// DM 21 Jul 1999 Is atom lipophilic ?
806// DM 16 May 2003 Total rewrite to be much more comprehensive
807class isAtomLipophilic : public std::function<bool(Atom *)> {
808 isAtomIonic isIonic;
809 isAtomHBondDonor isHBD;
811 isAtomMetal isMetal;
812 isHybridState_eq isSP3;
813 isHybridState_eq isSP2;
814 isAtomicNo_eq isO;
815 isAtomicNo_eq isN;
816
817public:
818 explicit isAtomLipophilic()
819 : isSP3(Atom::SP3), isSP2(Atom::SP2), isO(8), isN(7) {}
820 RBTDLL_EXPORT bool operator()(Atom *pAtom) const;
821};
822
824
825// DM 6 April 1999
826// Is coordination number of atom equal to n
827// First constructor checks total coordination number
828// Other constructors check atomic number, force field type and hybridisation
829// state coordination numbers
830class isCoordinationNumber_eq : public std::function<bool(Atom *)> {
831 enum {
832 TOTAL,
833 ATNO,
834 FFTYPE,
835 HYBRID
836 } eCNType; // Type of coordination number to check
837 unsigned int n; // Coordination number value to check
838 int atNo;
839 std::string ffType;
840 Atom::eHybridState hybrid;
841
842public:
843 // Total coordination number
844 explicit isCoordinationNumber_eq(unsigned int nn)
845 : eCNType(TOTAL), n(nn), atNo(0), ffType(""), hybrid(Atom::UNDEFINED) {}
846 // Atomic number coordination number
847 explicit isCoordinationNumber_eq(unsigned int nn, int nAt)
848 : eCNType(ATNO), n(nn), atNo(nAt), ffType(""), hybrid(Atom::UNDEFINED) {}
849 // Force field type coordination number
850 explicit isCoordinationNumber_eq(unsigned int nn, std::string strType)
851 : eCNType(FFTYPE), n(nn), atNo(0), ffType(std::move(strType)),
852 hybrid(Atom::UNDEFINED) {}
853 // Hybridisation state coordination number
854 explicit isCoordinationNumber_eq(unsigned int nn, Atom::eHybridState eState)
855 : eCNType(HYBRID), n(nn), atNo(0), ffType(""), hybrid(eState) {}
856 bool operator()(Atom *pAtom) const {
857 switch (eCNType) {
858 case TOTAL:
859 return pAtom->GetCoordinationNumber() == n;
860 case ATNO:
861 return pAtom->GetCoordinationNumber(atNo) == n;
862 case FFTYPE:
863 return pAtom->GetCoordinationNumber(ffType) == n;
864 case HYBRID:
865 return pAtom->GetCoordinationNumber(hybrid) == n;
866 default:
867 return false;
868 }
869 }
870};
871
873// Comparison functions for sorting Atom* containers
874// For use by STL sort algorithms
876
877// Less than operator for sorting Atom*s by atom ID
879public:
880 bool operator()(Atom *pAtom1, Atom *pAtom2) const {
881 return pAtom1->GetAtomId() < pAtom2->GetAtomId();
882 }
883};
884
885// Less than operator for sorting Atom*s by atomic number
887public:
888 bool operator()(Atom *pAtom1, Atom *pAtom2) const {
889 return pAtom1->GetAtomicNo() < pAtom2->GetAtomicNo();
890 }
891};
892
893// Less than operator for sorting Atom*s by atom name
895public:
896 bool operator()(Atom *pAtom1, Atom *pAtom2) const {
897 return pAtom1->GetName() < pAtom2->GetName();
898 }
899};
900
901// Less than operator for sorting AtomPtrs by pointer value
903public:
904 bool operator()(Atom *pAtom1, Atom *pAtom2) const { return pAtom1 < pAtom2; }
905};
906
908// Functions objects for performing actions on atoms
909// For use by STL algorithms
911
912// DM 28 Jul 1999 - extract atom coord (for use by std::transform)
913// DM 27 Oct 2000 - return by reference
914inline const Coord &ExtractAtomCoord(Atom *pAtom) { return pAtom->GetCoords(); }
915
916// DM 09 Nov 1999 - Accumulate atomic mass (for use by std::accumulate)
917inline double AccumAtomicMass(double val, Atom *pAtom) {
918 return val + pAtom->GetAtomicMass();
919}
920
921// DM 11 Nov 1999 - Accumulate mass weighted coords (for use by std::accumulate)
922inline Coord AccumMassWeightedCoords(const Coord &val, Atom *pAtom) {
923 return val + pAtom->GetAtomicMass() * pAtom->GetCoords();
924}
925
926// Translate an atom by the supplied vector
928 const Vector v;
929
930public:
931 explicit TranslateAtom(const Vector &vv) : v(vv) {}
932 void operator()(Atom *pAtom) { pAtom->Translate(v); }
933};
934
935// Translate an atom by the supplied vector, but only if the selection flag is
936// true
938 const Vector v;
939
940public:
941 explicit TranslateAtomIfSelected(const Vector &vv) : v(vv) {}
942 void operator()(Atom *pAtom) {
943 if (pAtom->GetSelectionFlag())
944 pAtom->Translate(v);
945 }
946};
947
948// Rotate an atom by the supplied quaternion
950 const Quat q;
951
952public:
953 explicit RotateAtomUsingQuat(const Quat &qq) : q(qq) {}
954 void operator()(Atom *pAtom) { pAtom->RotateUsingQuat(q); }
955};
956
957// Rotate an atom by the supplied quaternion, but only if the selection flag is
958// true
960 const Quat q;
961
962public:
963 explicit RotateAtomUsingQuatIfSelected(const Quat &qq) : q(qq) {}
964 void operator()(Atom *pAtom) {
965 if (pAtom->GetSelectionFlag())
966 pAtom->RotateUsingQuat(q);
967 }
968};
969
970// Select/deselect the atom
972 bool b;
973
974public:
975 explicit SelectAtom(bool bb) : b(bb) {}
976 void operator()(Atom *pAtom) { pAtom->SetSelectionFlag(b); }
977};
978
979// Invert the atom selection flag
981public:
982 explicit InvertSelectAtom() = default;
983 void operator()(Atom *pAtom) { pAtom->InvertSelectionFlag(); }
984};
985
986// Select the intramolecular flexible interactions to this atom (sets
987// SelectionFlag = true)
989public:
990 explicit SelectFlexAtoms() = default;
991 void operator()(Atom *pAtom);
992};
993
994// Set/unset the cyclic flag
996 bool b;
997
998public:
999 explicit CyclicAtom(bool bb) : b(bb) {}
1000 void operator()(Atom *pAtom) { pAtom->SetCyclicFlag(b); }
1001};
1002
1004// Atom list functions (implemented as STL algorithms)
1006
1007// Unary
1008
1009// Generic template version of GetNumAtoms, passing in your own predicate
1010template <class Predicate>
1011unsigned int GetNumAtomsWithPredicate(const AtomList &atomList,
1012 const Predicate &pred) {
1013 return std::count_if(atomList.begin(), atomList.end(), pred);
1014}
1015
1016// Generic template version of GetAtomList, passing in your own predicate
1017template <class Predicate>
1018AtomList GetAtomListWithPredicate(const AtomList &atomList,
1019 const Predicate &pred) {
1020 AtomList newAtomList;
1021 std::copy_if(atomList.begin(), atomList.end(),
1022 std::back_inserter(newAtomList), pred);
1023 return newAtomList;
1024}
1025
1026// Generic template version of FindAtomInList, passing in your own predicate
1027template <class Predicate>
1028AtomListIter FindAtomInList(AtomList &atomList, const Predicate &pred) {
1029 return std::find_if(atomList.begin(), atomList.end(), pred);
1030}
1031
1032// Selected atoms
1033void SetAtomSelectionFlagsInList(AtomList &atomList, bool bSelected = true);
1034void InvertAtomSelectionFlags(AtomList &atomList); // DM 08 Jan 1999
1035
1036inline unsigned int GetNumSelectedAtomsInList(const AtomList &atomList) {
1037 return GetNumAtomsWithPredicate(atomList, isAtomSelected());
1038}
1039
1040inline AtomList GetSelectedAtomsFromList(const AtomList &atomList) {
1041 return GetAtomListWithPredicate(atomList, isAtomSelected());
1042}
1043
1044// Cyclic atoms
1045void SetAtomCyclicFlagsInList(AtomList &atomList, bool bCyclic = true);
1046
1047inline unsigned int GetNumCyclicAtomsInList(const AtomList &atomList) {
1048 return GetNumAtomsWithPredicate(atomList, isAtomCyclic());
1049}
1050inline AtomList GetCyclicAtomsFromList(const AtomList &atomList) {
1051 return GetAtomListWithPredicate(atomList, isAtomCyclic());
1052}
1053
1054// Hydrogen bond acceptor atoms
1055inline unsigned int GetNumHBondAcceptorAtomsInList(const AtomList &atomList) {
1056 return GetNumAtomsWithPredicate(atomList, isAtomHBondAcceptor());
1057}
1058inline AtomList GetHBondAcceptorAtomsFromList(const AtomList &atomList) {
1059 return GetAtomListWithPredicate(atomList, isAtomHBondAcceptor());
1060}
1061
1062// Hydrogen bond donor atoms
1063inline unsigned int GetNumHBondDonorAtomsInList(const AtomList &atomList) {
1064 return GetNumAtomsWithPredicate(atomList, isAtomHBondDonor());
1065}
1066inline AtomList GetHBondDonorAtomsFromList(const AtomList &atomList) {
1067 return GetAtomListWithPredicate(atomList, isAtomHBondDonor());
1068}
1069
1070//(Formally) charged atoms
1071inline unsigned int GetNumChargedAtomsInList(const AtomList &atomList) {
1072 return GetNumAtomsWithPredicate(atomList, isAtomCharged());
1073}
1074inline AtomList GetChargedAtomsFromList(const AtomList &atomList) {
1075 return GetAtomListWithPredicate(atomList, isAtomCharged());
1076}
1077
1078// Planar atoms
1079inline unsigned int GetNumPlanarAtomsInList(const AtomList &atomList) {
1080 return GetNumAtomsWithPredicate(atomList, isAtomPlanar());
1081}
1082inline AtomList GetPlanarAtomsFromList(const AtomList &atomList) {
1083 return GetAtomListWithPredicate(atomList, isAtomPlanar());
1084}
1085
1086// RNA anionic atoms
1087// inline UInt GetNumRNAAnionicAtoms(const AtomList& atomList) {
1088// return
1089// GetNumAtomsWithPredicate(atomList,isAtomRNAAnionic());
1090//}
1091// inline AtomList GetRNAAnionicAtomList(const AtomList& atomList) {
1092// return
1093// GetAtomListWithPredicate(atomList,isAtomRNAAnionic());
1094//}
1095
1096// Ligand anionic atoms
1097// DM 22 Dec 1998
1098// inline UInt GetNumLigandAnionicAtoms(const AtomList& atomList) {
1099// return
1100// GetNumAtomsWithPredicate(atomList,isAtomLigandAnionic());
1101//}
1102// inline AtomList GetLigandAnionicAtomList(const AtomList& atomList) {
1103// return
1104// GetAtomListWithPredicate(atomList,isAtomLigandAnionic());
1105//}
1106
1107// Ligand cationic atoms
1108// DM 22 Dec 1998 -renamed from Get..RNACationic..
1109// inline UInt GetNumLigandCationicAtoms(const AtomList& atomList) {
1110// return
1111// GetNumAtomsWithPredicate(atomList,isAtomLigandCationic());
1112//}
1113// inline AtomList GetLigandCationicAtomList(const AtomList& atomList) {
1114// return
1115// GetAtomListWithPredicate(atomList,isAtomLigandCationic());
1116//}
1117
1118// Guanidinium carbons
1119// inline UInt GetNumGuanidiniumCarbonAtoms(const AtomList& atomList) {
1120// return
1121// GetNumAtomsWithPredicate(atomList,isAtomGuanidiniumCarbon());
1122//}
1123// inline AtomList GetGuanidiniumCarbonAtomList(const AtomList& atomList)
1124// {
1125// return
1126// GetAtomListWithPredicate(atomList,isAtomGuanidiniumCarbon());
1127//}
1128
1129// BondedAtoms
1130// Helper function to return the atom pointer for the "other" atom in the bond
1131// i.e. return (bondPair.second) ? bondPair.first->GetAtom2Ptr() :
1132// bondPair.first->GetAtom1Ptr();
1133AtomPtr GetBondedAtomPtr(std::pair<Bond *, bool> bondBoolPair);
1134
1135// This pair of functions is a little different to the above
1136// They convert a BondMap to an AtomList. The BondMap is assumed to
1137// contain all bonds to a particular atom GetBondedAtomPtr is used to get the
1138// "other" atom in the pair.
1139unsigned int GetNumBondedAtoms(const BondMap &bondMap);
1140AtomList GetBondedAtomList(const BondMap &bondMap);
1141
1142// If spAtom is a regular Atom, these two functions just behave like the two
1143// above If spAtom can be dynamically_casted to an PseudoAtom, these return
1144// the constituent atom list for the pseudoatom
1145unsigned int GetNumBondedAtoms(const Atom *pAtom);
1146RBTDLL_EXPORT AtomList GetBondedAtomList(const Atom *pAtom);
1147
1148// Binary
1149
1150// Atoms with atomic no = nAtomicNo
1151inline unsigned int GetNumAtomsWithAtomicNo_eq(const AtomList &atomList,
1152 int nAtomicNo) {
1153 return GetNumAtomsWithPredicate(atomList, isAtomicNo_eq(nAtomicNo));
1154}
1155inline AtomList GetAtomListWithAtomicNo_eq(const AtomList &atomList,
1156 int nAtomicNo) {
1157 return GetAtomListWithPredicate(atomList, isAtomicNo_eq(nAtomicNo));
1158}
1159
1160// Atoms with FFType = strFFType
1161inline unsigned int GetNumAtomsWithFFType_eq(const AtomList &atomList,
1162 std::string strFFType) {
1163 return GetNumAtomsWithPredicate(atomList, isFFType_eq(std::move(strFFType)));
1164}
1165inline AtomList GetAtomListWithFFType_eq(const AtomList &atomList,
1166 std::string strFFType) {
1167 return GetAtomListWithPredicate(atomList, isFFType_eq(std::move(strFFType)));
1168}
1169
1170// Atoms with AtomName = strAtomName
1171inline unsigned int GetNumAtomsWithAtomName_eq(const AtomList &atomList,
1172 std::string strAtomName) {
1173 return GetNumAtomsWithPredicate(atomList,
1174 isAtomName_eq(std::move(strAtomName)));
1175}
1176inline AtomList GetAtomListWithAtomName_eq(const AtomList &atomList,
1177 std::string strAtomName) {
1178 return GetAtomListWithPredicate(atomList,
1179 isAtomName_eq(std::move(strAtomName)));
1180}
1181
1182// DM 1 Feb 1999
1183// Attempts to match atoms in atomList2 with those in atomList1, where the match
1184// is performed using isAtom_eq (tests subunit ID, subunit name and atom name
1185// for equality) and NOT isAtomPtr_eq (which tests the Atom* pointers
1186// themselves
1187// for equality, i.e. same objects) Returns list of Atom smart pointers to
1188// atoms in atomList1 for which a match is found.
1189unsigned int GetNumMatchingAtoms(const AtomList &atomList1,
1190 const AtomList &atomList2);
1191AtomList GetMatchingAtomList(const AtomList &atomList1,
1192 const AtomList &atomList2);
1193
1194// DM 30 Mar 1999
1195// These versions match atoms against a full atom name specifier of the form
1196// given by GetFullAtomName(): <segment name>:<subunit name>_<subunit id>:<atom
1197// name> e.g. A:U_23:O4 All fields are optional, and if missing, will match all
1198// atoms So, for example, these are all valid full names: N7 (equiv. to
1199// ::N7)
1200// - matches N7's in all subunits, all segments A::O4 -
1201// matches O4's in all subunits in segment A U:O4 (equiv. to :U:O4) - matches
1202// O4's in subunits named U in all segments U_23:O4 - matches
1203// O4's in subunit U23 in all segments _23: - matches all
1204// atoms in
1205// subunit ID=23 in all segments
1206unsigned int GetNumMatchingAtoms(const AtomList &atomList,
1207 const std::string &strFullName);
1208AtomList GetMatchingAtomList(const AtomList &atomList,
1209 const std::string &strFullName);
1210
1211// DM 15 Apr 1999 - as above, but match against a list of full atom name
1212// specifiers Returns total list (i.e. all matches OR'd). Does not remove
1213// duplicates.
1214unsigned int GetNumMatchingAtoms(const AtomList &atomList,
1215 const std::vector<std::string> &fullNameList);
1216AtomList GetMatchingAtomList(const AtomList &atomList,
1217 const std::vector<std::string> &fullNameList);
1218
1220// DM 07 Jan 1999
1221// Actions on atom lists
1223// Translate all atoms in the list by the supplied vector
1224inline void TranslateAtoms(const AtomList &atomList, const Vector &v) {
1225 std::for_each(atomList.begin(), atomList.end(), TranslateAtom(v));
1226}
1227
1228// Translate all selected atoms in the list by the supplied vector
1229inline void TranslateSelectedAtoms(const AtomList &atomList, const Vector &v) {
1230 std::for_each(atomList.begin(), atomList.end(), TranslateAtomIfSelected(v));
1231}
1232
1233// Rotate all atoms in the list by the supplied quaternion
1234inline void RotateAtomsUsingQuat(const AtomList &atomList, const Quat &q) {
1235 std::for_each(atomList.begin(), atomList.end(), RotateAtomUsingQuat(q));
1236}
1237
1238// Rotate all selected atoms in the list by the supplied quaternion
1239inline void RotateSelectedAtomsUsingQuat(const AtomList &atomList,
1240 const Quat &q) {
1241 std::for_each(atomList.begin(), atomList.end(),
1242 RotateAtomUsingQuatIfSelected(q));
1243}
1244
1245// Save coords by number for all atoms in the list
1246void SaveAtomCoords(const AtomList &atomList, unsigned int coordNum = 0);
1247// Revert to numbered coords for all atoms in the list
1248void RevertAtomCoords(const AtomList &atomList, unsigned int coordNum = 0);
1249
1250// DM 9 Nov 1999
1251// Returns total atomic mass (molecular weight) for all atoms in the list
1252double GetTotalAtomicMass(const AtomList &atomList);
1253
1254// Returns center of mass of atoms in the list
1255Coord GetCenterOfAtomicMass(const AtomList &atomList);
1256
1257// DM 20 May 1999 - returns the coords of all atoms in the list
1258CoordList GetCoordList(const AtomList &atomList);
1259// DM 09 Aug 2001 - returns coordList via argument
1260RBTDLL_EXPORT void GetCoordList(const AtomList &atomList, CoordList &coordList);
1261
1262// Streams an atom list in Quanta CSD file format (for easy color coding of
1263// selected atoms in Quanta) nFormat = 0 => Receptor atom format: "zone 1 #
1264// pick O5T = col 2" nFormat != 0 => Ligand atom format "pick N1 .and. segm H =
1265// col 2" std::ostream should have been opened before calling
1266// PrintQuantaCSDFormat
1267void PrintQuantaCSDFormat(const AtomList &atomList, std::ostream &s,
1268 int nColor = 2, int nFormat = 0);
1269
1270// DM 25 Feb 1999
1271// Modified DM 6 Apr 1999 to operate using the GroupCharge attribute
1272// Scans an atom list and sets the group charge to zero on any
1273// cationic-ionic pairs which are 1-2 or 1-3 connected
1274//(e.g. on -OOC.CR.NH3+ would zero the C and N)
1275void RemoveZwitterions(AtomList &atomList);
1276
1277} // namespace rxdock
1278
1279#endif //_RBTATOM_H_
Definition Atom.h:878
Definition Atom.h:894
Definition Atom.h:886
Definition Atom.h:902
Definition Atom.h:49
Definition Atom.h:37
Definition Bond.h:27
Definition Coord.h:45
Definition Atom.h:995
Definition Atom.h:980
Definition Model.h:34
Definition Quat.h:24
Definition Atom.h:949
Definition Atom.h:971
Definition Atom.h:988
Definition SmartPointer.h:48
Definition Atom.h:937
Definition Atom.h:927
Definition Atom.h:771
Definition Atom.h:456
Definition Atom.h:761
Definition Atom.h:483
Definition Atom.h:449
Definition Atom.h:435
Definition Atom.h:512
Definition Atom.h:782
Definition Atom.h:466
Definition Atom.h:475
Definition Atom.h:636
Definition Atom.h:659
Definition Atom.h:646
Definition Atom.h:751
Definition Atom.h:807
Definition Atom.h:799
Definition Atom.h:556
Definition Atom.h:675
Definition Atom.h:503
Definition Atom.h:523
Definition Atom.h:493
Definition Atom.h:612
Definition Atom.h:705
Definition Atom.h:442
Definition Atom.h:685
Definition Atom.h:695
Definition Atom.h:623
Definition Atom.h:538
Definition Atom.h:830
Definition Atom.h:547
Definition Atom.h:598
Definition Atom.h:531
Definition Atom.h:587
Definition Atom.h:576
Definition Atom.h:565