-
Notifications
You must be signed in to change notification settings - Fork 28
/
sketcherMinimizerMolecule.h
114 lines (91 loc) · 3.76 KB
/
sketcherMinimizerMolecule.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
/*
* sketcherMinimizerMolecule.h
*
* Created by Nicola Zonta on 03/05/2010.
* Copyright Schrodinger, LLC. All rights reserved.
*
*/
#include "CoordgenConfig.hpp"
#include <iostream>
#include <utility>
#include <vector>
#ifndef sketcherMINIMIZERMOLECULE_H
#define sketcherMINIMIZERMOLECULE_H
class sketcherMinimizerAtom;
class sketcherMinimizerBond;
class sketcherMinimizerRing;
class sketcherMinimizerPointF;
class sketcherMinimizerFragment;
/* class to define a molecule */
class EXPORT_COORDGEN sketcherMinimizerMolecule
{
public:
sketcherMinimizerMolecule();
~sketcherMinimizerMolecule();
// create a new atom and add it to the molecule
sketcherMinimizerAtom* addNewAtom();
// create a new bond and add it to the molecule
sketcherMinimizerBond* addNewBond(sketcherMinimizerAtom* at1,
sketcherMinimizerAtom* at2);
// void fromChmMol(ChmMol& mol);
std::vector<sketcherMinimizerAtom*>& getAtoms() { return _atoms; }
std::vector<sketcherMinimizerBond*>& getBonds() { return _bonds; }
std::vector<sketcherMinimizerRing*>& getRings() { return _rings; }
std::vector<sketcherMinimizerFragment*>& getFragments()
{
return _fragments;
}
void setFragments(std::vector<sketcherMinimizerFragment*> fragments)
{
_fragments = std::move(fragments);
}
/* set this molecule to require force-field minimization */
void requireMinimization();
/* return true if this molecule requires a force field-based minimization
(i.e. has clashes that cannot be solved otherwise) */
bool minimizationIsRequired();
std::vector<sketcherMinimizerAtom*> _atoms;
std::vector<sketcherMinimizerBond*> _bonds;
std::vector<sketcherMinimizerRing*> _rings;
std::vector<sketcherMinimizerBond*> m_proximityRelations;
std::vector<sketcherMinimizerFragment*> _fragments;
/* set the given fragment as the main fragment of the kinematic chain */
void setMainFragment(sketcherMinimizerFragment* fragment)
{
m_mainFragment = fragment;
}
sketcherMinimizerFragment* getMainFragment() { return m_mainFragment; }
bool fixed;
bool hasFixedFragments, hasConstrainedFragments;
bool needToAlignNonRingAtoms;
bool needToAlignWholeMolecule;
bool isPlaced; // used by arrangeMultipleMolecules
/* return the total charge of the molecule */
int totalCharge();
/* set the top left and bottom right points of the molecule's bounding
* rectangle */
void boundingBox(sketcherMinimizerPointF& min,
sketcherMinimizerPointF& max);
/* return the coordinates of the center of the molecule */
sketcherMinimizerPointF center();
/* recalculate structure elements (e.g. rings) */
static void forceUpdateStruct(std::vector<sketcherMinimizerAtom*>& atoms,
std::vector<sketcherMinimizerBond*>& bonds,
std::vector<sketcherMinimizerRing*>& rings);
/* calculate neighbor info of each atom */
static void
assignBondsAndNeighbors(std::vector<sketcherMinimizerAtom*>& atoms,
std::vector<sketcherMinimizerBond*>& bonds);
/* run a SSSR algorithm */
static void findRings(std::vector<sketcherMinimizerBond*>& bonds,
std::vector<sketcherMinimizerRing*>& rings);
/* convenience function for the SSSR algorithm */
static sketcherMinimizerRing* closeRing(sketcherMinimizerBond* bond);
/* convenience function for the SSSR algorithm */
static void addRing(sketcherMinimizerRing* ring,
std::vector<sketcherMinimizerRing*>& rings);
private:
sketcherMinimizerFragment* m_mainFragment;
bool m_requireMinimization;
};
#endif // sketcherMINIMIZERMOLECULE_H