FOX/ObjCryst++  1.10.X (development)
wxMolecule.h
1 /* ObjCryst++ Object-Oriented Crystallographic Library
2  (c) 2000-2007 Vincent Favre-Nicolin vincefn@users.sourceforge.net
3  2000-2001 University of Geneva (Switzerland)
4 
5  This program is free software; you can redistribute it and/or modify
6  it under the terms of the GNU General Public License as published by
7  the Free Software Foundation; either version 2 of the License, or
8  (at your option) any later version.
9 
10  This program is distributed in the hope that it will be useful,
11  but WITHOUT ANY WARRANTY; without even the implied warranty of
12  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  GNU General Public License for more details.
14 
15  You should have received a copy of the GNU General Public License
16  along with this program; if not, write to the Free Software
17  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 */
19 
20 #ifndef _VFN_WX_MOLECULE_H_
21 #define _VFN_WX_MOLECULE_H_
22 
23 #include "wx/grid.h"
24 #include "ObjCryst/wxCryst/wxScatterer.h"
25 #include "ObjCryst/ObjCryst/Molecule.h"
26 
27 namespace ObjCryst
28 {
29 class WXMolecule;
30 // Scrolled window for bonds, bond angles and dihedral angles
31 class WXMolScrolledWindow:public wxGrid
32 {
33  public:
34  WXMolScrolledWindow(wxWindow* parent, WXMolecule* pWXMol,long id=-1);
35  virtual ~WXMolScrolledWindow();
36  private:
40 };
41 
44 {
45  public:
46  WXMolAtom(wxWindow *parent, MolAtom*);
47  virtual ~WXMolAtom();
48  virtual void CrystUpdate(const bool updateUI=false,const bool mutexlock=false);
49  virtual void UpdateUI(const bool mutexlock=false);
50  void OnChangeScattPow(wxCommandEvent &);
51  private:
52  MolAtom *mpMolAtom;
53  wxBoxSizer *mpSizer;
54  WXCrystObjBasicList mList;
55  WXFieldString *mpFieldName;
56  WXFieldChoice* mpFieldScattPower;
57  DECLARE_EVENT_TABLE()
58 };
59 
62 {
63  public:
64  WXMolBond(wxWindow *parent, MolBond*);
65  virtual ~WXMolBond();
66  virtual void CrystUpdate(const bool updateUI=false,const bool mutexlock=false);
67  virtual void UpdateUI(const bool mutexlock=false);
68  void OnChangeAtom(wxCommandEvent &);
70  void OnToggleFree(wxCommandEvent & WXUNUSED(event));
71  private:
72  MolBond *mpMolBond;
73  wxBoxSizer *mpSizer;
74  WXCrystObjBasicList mList;
75  WXFieldChoice* mpFieldAtom1;
76  WXFieldChoice* mpFieldAtom2;
77  wxCheckBox *mpButtonFree;
79  REAL mValue;
80  DECLARE_EVENT_TABLE()
81 };
82 
85 {
86  public:
87  WXMolBondAngle(wxWindow *parent, MolBondAngle*);
88  virtual ~WXMolBondAngle();
89  virtual void CrystUpdate(const bool updateUI=false,const bool mutexlock=false);
90  virtual void UpdateUI(const bool mutexlock=false);
91  void OnChangeAtom(wxCommandEvent &);
92  private:
93  MolBondAngle *mpMolBondAngle;
94  wxBoxSizer *mpSizer;
95  WXCrystObjBasicList mList;
96  WXFieldChoice* mpFieldAtom1;
97  WXFieldChoice* mpFieldAtom2;
98  WXFieldChoice* mpFieldAtom3;
100  REAL mValue;
101  DECLARE_EVENT_TABLE()
102 };
103 
106 {
107  public:
108  WXMolDihedralAngle(wxWindow *parent, MolDihedralAngle*);
109  virtual ~WXMolDihedralAngle();
110  virtual void CrystUpdate(const bool updateUI=false,const bool mutexlock=false);
111  virtual void UpdateUI(const bool mutexlock=false);
112  void OnChangeAtom(wxCommandEvent &);
113  private:
114  MolDihedralAngle *mpMolDihedralAngle;
115  wxBoxSizer *mpSizer;
116  WXCrystObjBasicList mList;
117  WXFieldChoice* mpFieldAtom1;
118  WXFieldChoice* mpFieldAtom2;
119  WXFieldChoice* mpFieldAtom3;
120  WXFieldChoice* mpFieldAtom4;
122  REAL mValue;
123  DECLARE_EVENT_TABLE()
124 };
125 
127 class WXMolecule: public WXScatterer
128 {
129  public:
130  WXMolecule(wxWindow *parent, Molecule*);
131  virtual ~WXMolecule();
132  void OnMenuOptimizeConformation(wxCommandEvent & WXUNUSED(event));
133  void OnMenuPrintRestraintStatus(wxCommandEvent & WXUNUSED(event));
134  void OnMenuExportRestraints(wxCommandEvent & WXUNUSED(event));
135  void OnMenuAddAtom(wxCommandEvent & WXUNUSED(event));
136  void OnMenuAddBond(wxCommandEvent & WXUNUSED(event));
137  void OnMenuAddAngle(wxCommandEvent & WXUNUSED(event));
138  void OnMenuAddDihedralAngle(wxCommandEvent & WXUNUSED(event));
139  void OnMenuAddRigidGroup(wxCommandEvent & WXUNUSED(event));
140  void OnMenuAddNonFlipAtom(wxCommandEvent & WXUNUSED(event));
141  void OnMenuRigidfyWithDihedralAngles(wxCommandEvent & WXUNUSED(event));
142  void OnMenuRemoveAtom(wxCommandEvent & WXUNUSED(event));
143  void OnMenuRemoveBond(wxCommandEvent & WXUNUSED(event));
144  void OnMenuRemoveAngle(wxCommandEvent & WXUNUSED(event));
145  void OnMenuRemoveDihedralAngle(wxCommandEvent & WXUNUSED(event));
146  void OnMenuRemoveNonFlipAtom(wxCommandEvent & WXUNUSED(event));
147  void OnMenuRemoveRigidGroup(wxCommandEvent & WXUNUSED(event));
148  void OnMenuSetLimits(wxCommandEvent &event);
149  void OnMenuShowRestraintWindow(wxCommandEvent &event);
150  void OnMenuSetDeltaSigma(wxCommandEvent &event);
151  void OnChangeCenterAtom(wxCommandEvent &event);
152  void OnEditGridAtom(wxGridEvent &e);
153  void OnEditGridBondLength(wxGridEvent &e);
154  void OnEditGridBondAngle(wxGridEvent &e);
155  void OnEditGridDihedralAngle(wxGridEvent &e);
156  void OnEditGridRigidGroup(wxGridEvent &e);
157  void OnMenuExport2ZMatrix(wxCommandEvent &event);
158  void OnMenuTest(wxCommandEvent &event);
159  void OnMenuMDTest(wxCommandEvent &event);
160  void OnMenuRotate(wxCommandEvent &event);
164  virtual void CrystUpdate(const bool updateUI=false,const bool mutexlock=false);
165  virtual void UpdateUI(const bool mutexlock=false);
166  virtual bool Enable(bool enable=true);
167  private:
168  Molecule* mpMolecule;
169  WXMolScrolledWindow* mpAtomWin;
170  WXMolScrolledWindow* mpBondWin;
171  WXMolScrolledWindow* mpAngleWin;
172  WXMolScrolledWindow* mpDihedralAngleWin;
173  WXMolScrolledWindow* mpRigidGroupWin;
174  WXMolScrolledWindow* mpNonFlipAtomWin;
176  struct CellAtom
177  {
178  CellAtom();
179  MolAtom* mpAtom;
180  std::string mName;
181  const ScatteringPower* mpScatteringPower;
182  REAL mX,mY,mZ,mOcc;
185  };
188  std::list<CellAtom> mvpAtom;
189 
191  struct CellBond
192  {
193  CellBond();
194  MolBond* mpBond;
195  std::string mAtom1;
196  std::string mAtom2;
197  REAL mLength;
198  REAL mLength0;
199  REAL mSigma;
200  REAL mDelta;
203  };
206  std::list<CellBond> mvpBond;
209  {
210  CellBondAngle();
211  MolBondAngle* mpBondAngle;
212  std::string mAtom1;
213  std::string mAtom2;
214  std::string mAtom3;
215  REAL mAngle;
216  REAL mAngle0;
217  REAL mSigma;
218  REAL mDelta;
221  };
224  std::list<CellBondAngle> mvpBondAngle;
227  {
229  MolDihedralAngle* mpDihedralAngle;
230  std::string mAtom1;
231  std::string mAtom2;
232  std::string mAtom3;
233  std::string mAtom4;
234  REAL mAngle;
235  REAL mAngle0;
236  REAL mSigma;
237  REAL mDelta;
240  };
243  std::list<CellDihedralAngle> mvpDihedralAngle;
245  {
246  CellRigidGroup();
253  };
256  std::list<CellRigidGroup> mvpRigidGroup;
262  DECLARE_EVENT_TABLE()
263 };
264 
265 } //namespace
266 
267 #endif //_VFN_WX_MOLECULE_H_
bool mNeedUpdateUI
True if we need to update the displayed values.
Definition: wxMolecule.h:252
virtual void CrystUpdate(const bool updateUI=false, const bool mutexlock=false)
Get new values to be displayed from the underlying object, and raise flag if an UI update is necessar...
Definition: wxMolecule.cpp:446
REAL mValue
The current value.
Definition: wxMolecule.h:100
A List of WXCrystObjBasic.
Definition: wxCryst.h:196
Bond angle restraint between 3 atoms.
Definition: Molecule.h:256
bool mNeedUpdateUI
True if we need to update the displayed values.
Definition: wxMolecule.h:220
virtual void CrystUpdate(const bool updateUI=false, const bool mutexlock=false)
Get new values to be displayed from the underlying object, and raise flag if an UI update is necessar...
Definition: wxMolecule.cpp:209
RigidGroup mGroupCopy
Copy of the set of atoms, as it was last displayed.
Definition: wxMolecule.h:250
Class to pick one choice...
Definition: wxCryst.h:482
REAL mValue
The current value.
Definition: wxMolecule.h:79
std::list< CellDihedralAngle > mvpDihedralAngle
Displayed list of Dihedral angles.
Definition: wxMolecule.h:243
bool mNeedUpdateUI
True if we need to update the displayed values.
Definition: wxMolecule.h:239
virtual void UpdateUI(const bool mutexlock=false)
Update the User Interface, if necessary.
Bond between two atoms, also a restraint on the associated bond length.
Definition: Molecule.h:152
wxCryst class for Molecule objects
Definition: wxMolecule.h:127
Structure to store the bond current values.
Definition: wxMolecule.h:191
Rigid groups of atoms inside a molecule.
Definition: Molecule.h:500
std::list< CellAtom > mvpAtom
Displayed list of atoms.
Definition: wxMolecule.h:188
void OnToggleFree(wxCommandEvent &WXUNUSED(event))
Toggle the 'free' status of the bond.
Definition: wxMolecule.cpp:369
Abstract base class for all objects in wxCryst.
Definition: wxCryst.h:127
virtual void CrystUpdate(const bool updateUI=false, const bool mutexlock=false)
Get new values to be displayed from the underlying object, and raise flag if an UI update is necessar...
Definition: wxMolecule.cpp:311
std::list< CellBondAngle > mvpBondAngle
Displayed list of bond angle.
Definition: wxMolecule.h:224
Molecule : class for complex scatterer descriptions using cartesian coordinates with bond length/angl...
Definition: Molecule.h:731
RigidGroup * mpGroup
Rigid group in the Molecule.
Definition: wxMolecule.h:248
bool mNeedUpdateUI
True if we need to update the displayed values.
Definition: wxMolecule.h:202
Structure to store the Atom parameters.
Definition: wxMolecule.h:176
bool mNeedUpdateUI
True if we need to update the displayed values.
Definition: wxMolecule.h:184
Structure to store the dihedral angles current values.
Definition: wxMolecule.h:226
virtual void CrystUpdate(const bool updateUI=false, const bool mutexlock=false)
Get new values to be displayed from the underlying object, and raise flag if an UI update is necessar...
MolAtom : atom inside a Molecule.
Definition: Molecule.h:58
wx class for MolDihedralAngle objects
Definition: wxMolecule.h:105
REAL mValue
The current value.
Definition: wxMolecule.h:122
wx class for MolBond objects
Definition: wxMolecule.h:61
WXMolecule * mpWXMolecule
The WXMolecule window which created this window, and who should be told if it is destroyed.
Definition: wxMolecule.h:39
Dihedral angle restraint between 4 atoms.
Definition: Molecule.h:346
The namespace which includes all objects (crystallographic and algorithmic) in ObjCryst++.
Definition: Atom.cpp:47
std::list< CellBond > mvpBond
Displayed list of bonds, in the order they appear.
Definition: wxMolecule.h:206
virtual void UpdateUI(const bool mutexlock=false)
Update the User Interface, if necessary.
Definition: wxMolecule.cpp:321
bool mIsSelfUpdating
Flag to indicate whether we are updating values in the wxGrid data.
Definition: wxMolecule.h:259
virtual void CrystUpdate(const bool updateUI=false, const bool mutexlock=false)
Get new values to be displayed from the underlying object, and raise flag if an UI update is necessar...
Definition: wxMolecule.cpp:592
wx class for MolBondAngle objects
Definition: wxMolecule.h:84
void NotifyDeleteListWin(WXMolScrolledWindow *win)
Notify that either the bond, bond angle or dihedral angle list window has been destroyed.
std::list< CellRigidGroup > mvpRigidGroup
Displayed list of Dihedral angles.
Definition: wxMolecule.h:256
wx class for MolAtom objects
Definition: wxMolecule.h:43
virtual void UpdateUI(const bool mutexlock=false)
Update the User Interface, if necessary.
Definition: wxMolecule.cpp:456
virtual void UpdateUI(const bool mutexlock=false)
Update the User Interface, if necessary.
Definition: wxMolecule.cpp:218
WXFieldChoice * mpFieldCenterAtom
Center atom.
Definition: wxMolecule.h:261
Structure to store the bond angles current values.
Definition: wxMolecule.h:208
A field which directly links to a string.
Definition: wxCryst.h:328
virtual void UpdateUI(const bool mutexlock=false)
Update the User Interface, if necessary.
Definition: wxMolecule.cpp:602
base wxCryst class for Scatterers
Definition: wxScatterer.h:35
Abstract Base Class to describe the scattering power of any Scatterer component in a crystal...