BALL 1.5.0
Loading...
Searching...
No Matches
kekulizer.h
Go to the documentation of this file.
1// -*- Mode: C++; tab-width: 2; -*-
2// vi: set ts=2:
3//
4
5#ifndef BALL_STRUCTURE_KEKULIZER_H
6#define BALL_STRUCTURE_KEKULIZER_H
7
8#ifndef BALL_COMMON_H
9# include <BALL/common.h>
10#endif
11
12#ifndef BALL_DATATYPE_HASHMAP_H
14#endif
15
16#include <set>
17
18namespace BALL
19{
20 class Atom;
21 class Molecule;
22 class Bond;
23
38 {
40 struct BALL_EXPORT AtomInfo
41 {
42 // needed for sorting:
43 bool operator < (const AtomInfo& info) const;
44 AtomInfo& operator = (const AtomInfo& ai) ;
45
46 // THE atom
47 Atom* atom;
48
49 // bond to be set to a double bond
50 Bond* double_bond;
51
52 // aromatic bonds
53 std::vector<Bond*> abonds;
54
55 // position of the partner atoms in the vector of AtomInfos
56 std::vector<Position> partner_id;
57
58 // current number of double bonds for this atom
59 Index curr_double;
60
61 // minumum possible number of double bonds for this atom
62 Index min_double;
63
64 // maximum possible number of double bonds for this atom
65 Index max_double;
66
67 // number of double bonds for this atom to be uncharged
68 Index uncharged_double;
69 };
70
71 public:
72
74
75
77
79 virtual ~Kekuliser() {}
80
82 bool setup(Molecule& ac);
83
85 void setAromaticRings(const std::vector<std::set<Atom*> >& rings) { aromatic_rings_ = rings;}
86
88 void setRings(const std::vector<std::set<Atom*> >& rings) { rings_ = rings;}
89
91 const std::vector<Bond*>& getUnassignedBonds() const { return unassigned_bonds_; }
92
94 void clear();
95
97 void dump();
98
100 void setUseFormalCharges(bool state) { use_formal_charges_ = state;}
101
103 bool useFormalCharges() const { return use_formal_charges_;}
104
105 protected:
106
109 virtual Size getPenalty_(Atom& atom, Index charge);
110
112
113 // merge aromatic rings:
120
122
123 std::vector<std::set<Atom*> > aromatic_systems_;
124 std::vector<std::set<Atom*> > aromatic_rings_;
125 std::vector<std::set<Atom*> > rings_;
126 std::vector<Bond*> unassigned_bonds_;
127
128 // atoms that take part in an aromatic bond:
129 std::set<const Atom*> aromatic_atoms_;
130 std::set<const Atom*> all_aromatic_atoms_;
132
134
135 // current aromatic system:
136 std::vector<AtomInfo> atom_infos_;
140
141 std::vector<std::vector<AtomInfo> > solutions_;
142 };
143
144} // namespace BALL
145
146#endif // BALL_STRUCTURE_KEKULIZER_H
#define BALL_CREATE(name)
Definition create.h:62
char Atom[5]
Definition PDBdefs.h:257
HashMap class based on the STL map (containing serveral convenience functions)
Definition hashMap.h:74
HashMap< Atom *, Index > max_valence_
Definition kekulizer.h:131
std::vector< std::set< Atom * > > aromatic_systems_
Definition kekulizer.h:123
bool fixAromaticRings_()
void fixAromaticSystem_(Position it)
Molecule * molecule_
Definition kekulizer.h:137
std::vector< std::set< Atom * > > rings_
Definition kekulizer.h:125
void calculateAromaticSystems_()
virtual Size getPenalty_(Atom &atom, Index charge)
bool hasAromaticBonds_(Atom &atom)
void applySolution_(Position pos)
Position calculateDistanceScores_()
Size current_penalty_
Definition kekulizer.h:139
void setRings(const std::vector< std::set< Atom * > > &rings)
Definition kekulizer.h:88
std::vector< Bond * > unassigned_bonds_
Definition kekulizer.h:126
bool use_formal_charges_
Definition kekulizer.h:121
void setUseFormalCharges(bool state)
Definition kekulizer.h:100
bool setup(Molecule &ac)
bool useFormalCharges() const
Definition kekulizer.h:103
const std::vector< Bond * > & getUnassignedBonds() const
Definition kekulizer.h:91
void getMaximumValence_()
std::vector< std::set< Atom * > > aromatic_rings_
Definition kekulizer.h:124
void collectSystems_(Atom &atom)
std::vector< std::vector< AtomInfo > > solutions_
Definition kekulizer.h:141
std::set< const Atom * > all_aromatic_atoms_
Definition kekulizer.h:130
void setAromaticRings(const std::vector< std::set< Atom * > > &rings)
Definition kekulizer.h:85
std::set< const Atom * > aromatic_atoms_
Definition kekulizer.h:129
void collectAromaticAtoms_()
std::vector< AtomInfo > atom_infos_
Definition kekulizer.h:136
std::set< Atom * > current_aromatic_system_
Definition kekulizer.h:133
#define BALL_EXPORT