My favorites | Sign in
Project Home Issues Source
Checkout   Browse   Changes    
 
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
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
/********************************************\
*
* Sire - Molecular Simulation Framework
*
* Copyright (C) 2009 Christopher Woods
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* For full details of the license please see the COPYING file
* that should have come with this distribution.
*
* You can contact the authors via the developer's mailing list
* at http://siremol.org
*
\*********************************************/

#ifndef SIRESYSTEM_IDENTITYCONSTRAINT_H
#define SIRESYSTEM_IDENTITYCONSTRAINT_H

#include <QVector>

#include "moleculeconstraint.h"

#include "SireBase/propertymap.h"

#include "SireMaths/vector.h"

#include "SireMol/moleculegroup.h"

#include "SireFF/point.h"

SIRE_BEGIN_HEADER

namespace SireSystem
{
class IdentityConstraint;
}

QDataStream& operator<<(QDataStream&, const SireSystem::IdentityConstraint&);
QDataStream& operator>>(QDataStream&, SireSystem::IdentityConstraint&);

namespace SireSystem
{

using SireBase::PropertyMap;

using SireMaths::Vector;

using SireMol::MoleculeGroup;
using SireMol::Molecules;
using SireMol::MolID;
using SireMol::MolNum;

namespace detail
{
class IdentityConstraintPvt;
}

/** An identity constraint provides a method of constraining
the identity of molecules based on *where* they are located.

For example, it can be useful to be able to identify a
water in a binding pocket. However, in a normal simulation,
we don't identify waters by location, but by their index
(e.g. this is the first water, this is the second etc.).

This means that the identity of the water in the binding
pocket can change, e.g. it can start with the fifth water
in the pocket, but during the simulation the fifth water
may diffuse out of the pocket, and the twentieth water
would diffuse in its place. The identity of the water
in the binding pocket will thus have changed from the
fifth water to the twentieth water.

An identity constraint works by constantly monitoring
the locations of the waters, and so it can detect when
the fifth water is displaced by the twentieth water. When
it detects that this has occured, the constraint swaps
the coordinates of the fifth and twentieth waters,
thereby ensuring that the fifth water *stays* in the pocket.
This doesn't affect the energy or the statistics of the
system, as waters are indistinguishable (there are N!
equivalent configurations of N waters - we only see them
as N! different configurations as we identify each water,
when really they are indistinguishable).

The idea of constraining the identity of molecules
was first presented by M. Tyka, R. Sessions and A. Clarke in

"Absolute Free-Energy Calculations of Liquids Using
a Harmonic Reference State"

J. Chem. Phys. B, 2007, 111, 9571-9580

doi://10.1021/jp072357w

They used the method to constrain the identity of *all*
molecules, so that harmonic restraints can be applied
to them all.

This identity constraint is more general, and allows
the identification of a subset of molecules to be
constrained (e.g. just the waters in a binding pocket).

@author Christopher Woods
*/
class SIRESYSTEM_EXPORT IdentityConstraint
: public SireBase::ConcreteProperty<IdentityConstraint,MoleculeConstraint>
{

friend QDataStream& ::operator<<(QDataStream&, const IdentityConstraint&);
friend QDataStream& ::operator>>(QDataStream&, IdentityConstraint&);

public:
IdentityConstraint();

IdentityConstraint(const MoleculeGroup &molgroup,
const PropertyMap &map = PropertyMap());

IdentityConstraint(const SireFF::PointRef &point,
const MoleculeGroup &molgroup,
const PropertyMap &map = PropertyMap());

IdentityConstraint(const QList<SireFF::PointPtr> &points,
const MoleculeGroup &molgroup,
const PropertyMap &map = PropertyMap());

IdentityConstraint(const QVector<SireFF::PointPtr> &points,
const MoleculeGroup &molgroup,
const PropertyMap &map = PropertyMap());

IdentityConstraint(const IdentityConstraint &other);

~IdentityConstraint();

IdentityConstraint& operator=(const IdentityConstraint &other);

bool operator==(const IdentityConstraint &other) const;
bool operator!=(const IdentityConstraint &other) const;

static const char* typeName();

QString toString() const;

const MoleculeGroup& moleculeGroup() const;

QVector<SireFF::PointPtr> points() const;

const PropertyMap& propertyMap() const;

bool involvesMolecule(MolNum molnum) const;
bool involvesMoleculesFrom(const Molecules &molecules) const;

void useManyPointsAlgorithm();
void useFewPointsAlgorithm();
void useSinglePointAlgorithm();

Molecules update(const System &system);
Molecules update(const System &system, MolNum changed_mol);
Molecules update(const System &system, const Molecules &molecules);

bool isSatisfied(const System &system) const;

static SireMol::MolGroupPtr constrain(const MoleculeGroup &molgroup,
const SireFF::PointRef &point,
const PropertyMap &map = PropertyMap());

static SireMol::MolGroupPtr constrain(const MoleculeGroup &molgroup,
const QVector<SireFF::PointPtr> &points,
const PropertyMap &map = PropertyMap());

static SireMol::MolGroupPtr constrain(const MoleculeGroup &molgroup,
const QList<SireFF::PointPtr> &points,
const PropertyMap &map = PropertyMap());

private:
/** The helper class that is used to implement the constraint */
SireBase::SharedPolyPointer<detail::IdentityConstraintPvt> d;
};

}

Q_DECLARE_METATYPE( SireSystem::IdentityConstraint )

SIRE_EXPOSE_CLASS( SireSystem::IdentityConstraint )

SIRE_END_HEADER

#endif

Change log

r1054 by chryswoods on Sep 3, 2009   Diff
I'm working on the absolute binding free
energy code, and in so doing have fixed
bugs in the output of ProtoMS
parameterisation errors, lack of implicit
conversion
of QString and Property to PropertyName,
and have added code to IdentityConstraint
to allow it to perform one-off
constraints.

Go to: 
Sign in to write a code review

Older revisions

r1029 by chryswoods on Aug 5, 2009   Diff
I've updated the Constraints class to
work with MoleculeConstraint objects,
and have
also updated System so that it applies
the molecule constraints every time a
...
r1026 by chryswoods on Aug 4, 2009   Diff
I've finished writing the identity
constraints (which necessitated adding
a CloseMols class). The
constraint in tests (in
test/SireSystem/identityconstraint.py)
...
r1025 by chryswoods on Jul 17, 2009   Diff
I've simplified the implementation of
the IdentityConstraint by using a
polymorphic
hidden class to provide different
implementations depending on the ratio
...
All revisions of this file

File info

Size: 7014 bytes, 201 lines
Powered by Google Project Hosting