Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
tsoc
openmm
Commits
1342158e
Commit
1342158e
authored
Aug 20, 2015
by
peastman
Browse files
Fixed an unnecessary exception in SETTLE code
parent
300566f3
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
40 additions
and
36 deletions
+40
-36
platforms/cuda/src/CudaIntegrationUtilities.cpp
platforms/cuda/src/CudaIntegrationUtilities.cpp
+7
-5
platforms/opencl/src/OpenCLIntegrationUtilities.cpp
platforms/opencl/src/OpenCLIntegrationUtilities.cpp
+7
-5
platforms/reference/src/SimTKReference/ReferenceConstraints.cpp
...rms/reference/src/SimTKReference/ReferenceConstraints.cpp
+26
-26
No files found.
platforms/cuda/src/CudaIntegrationUtilities.cpp
View file @
1342158e
...
@@ -201,15 +201,17 @@ CudaIntegrationUtilities::CudaIntegrationUtilities(CudaContext& context, const S
...
@@ -201,15 +201,17 @@ CudaIntegrationUtilities::CudaIntegrationUtilities(CudaContext& context, const S
params
.
push_back
(
make_float2
(
dist13
,
dist12
));
params
.
push_back
(
make_float2
(
dist13
,
dist12
));
}
}
else
else
throw
OpenMMException
(
"Two of the three distances constrained with SETTLE must be the same."
);
continue
;
// We can't handle this with SETTLE
isShakeAtom
[
atom1
]
=
true
;
isShakeAtom
[
atom1
]
=
true
;
isShakeAtom
[
atom2
]
=
true
;
isShakeAtom
[
atom2
]
=
true
;
isShakeAtom
[
atom3
]
=
true
;
isShakeAtom
[
atom3
]
=
true
;
}
}
settleAtoms
=
CudaArray
::
create
<
int4
>
(
context
,
atoms
.
size
(),
"settleAtoms"
);
if
(
atoms
.
size
()
>
0
)
{
settleParams
=
CudaArray
::
create
<
float2
>
(
context
,
params
.
size
(),
"settleParams"
);
settleAtoms
=
CudaArray
::
create
<
int4
>
(
context
,
atoms
.
size
(),
"settleAtoms"
);
settleAtoms
->
upload
(
atoms
);
settleParams
=
CudaArray
::
create
<
float2
>
(
context
,
params
.
size
(),
"settleParams"
);
settleParams
->
upload
(
params
);
settleAtoms
->
upload
(
atoms
);
settleParams
->
upload
(
params
);
}
}
}
// Find clusters consisting of a central atom with up to three peripheral atoms.
// Find clusters consisting of a central atom with up to three peripheral atoms.
...
...
platforms/opencl/src/OpenCLIntegrationUtilities.cpp
View file @
1342158e
...
@@ -220,15 +220,17 @@ OpenCLIntegrationUtilities::OpenCLIntegrationUtilities(OpenCLContext& context, c
...
@@ -220,15 +220,17 @@ OpenCLIntegrationUtilities::OpenCLIntegrationUtilities(OpenCLContext& context, c
params
.
push_back
(
mm_float2
(
dist13
,
dist12
));
params
.
push_back
(
mm_float2
(
dist13
,
dist12
));
}
}
else
else
throw
OpenMMException
(
"Two of the three distances constrained with SETTLE must be the same."
);
continue
;
// We can't handle this with SETTLE
isShakeAtom
[
atom1
]
=
true
;
isShakeAtom
[
atom1
]
=
true
;
isShakeAtom
[
atom2
]
=
true
;
isShakeAtom
[
atom2
]
=
true
;
isShakeAtom
[
atom3
]
=
true
;
isShakeAtom
[
atom3
]
=
true
;
}
}
settleAtoms
=
OpenCLArray
::
create
<
mm_int4
>
(
context
,
atoms
.
size
(),
"settleAtoms"
);
if
(
atoms
.
size
()
>
0
)
{
settleParams
=
OpenCLArray
::
create
<
mm_float2
>
(
context
,
params
.
size
(),
"settleParams"
);
settleAtoms
=
OpenCLArray
::
create
<
mm_int4
>
(
context
,
atoms
.
size
(),
"settleAtoms"
);
settleAtoms
->
upload
(
atoms
);
settleParams
=
OpenCLArray
::
create
<
mm_float2
>
(
context
,
params
.
size
(),
"settleParams"
);
settleParams
->
upload
(
params
);
settleAtoms
->
upload
(
atoms
);
settleParams
->
upload
(
params
);
}
}
}
// Find clusters consisting of a central atom with up to three peripheral atoms.
// Find clusters consisting of a central atom with up to three peripheral atoms.
...
...
platforms/reference/src/SimTKReference/ReferenceConstraints.cpp
View file @
1342158e
...
@@ -6,7 +6,7 @@
...
@@ -6,7 +6,7 @@
* Biological Structures at Stanford, funded under the NIH Roadmap for *
* Biological Structures at Stanford, funded under the NIH Roadmap for *
* Medical Research, grant U54 GM072970. See https://simtk.org. *
* Medical Research, grant U54 GM072970. See https://simtk.org. *
* *
* *
* Portions copyright (c) 2013 Stanford University and the Authors.
*
* Portions copyright (c) 2013
-2015
Stanford University and the Authors. *
* Authors: Peter Eastman *
* Authors: Peter Eastman *
* Contributors: *
* Contributors: *
* *
* *
...
@@ -98,14 +98,13 @@ ReferenceConstraints::ReferenceConstraints(const System& system) : ccma(NULL), s
...
@@ -98,14 +98,13 @@ ReferenceConstraints::ReferenceConstraints(const System& system) : ccma(NULL), s
// Record the SETTLE clusters.
// Record the SETTLE clusters.
vector
<
bool
>
isSettleAtom
(
numParticles
,
false
);
vector
<
bool
>
isSettleAtom
(
numParticles
,
false
);
int
numSETTLE
=
settleClusters
.
size
();
if
(
settleClusters
.
size
()
>
0
)
{
if
(
numSETTLE
>
0
)
{
vector
<
int
>
atom1
;
vector
<
int
>
atom1
(
numSETTLE
);
vector
<
int
>
atom2
;
vector
<
int
>
atom2
(
numSETTLE
);
vector
<
int
>
atom3
;
vector
<
int
>
atom3
(
numSETTLE
);
vector
<
RealOpenMM
>
distance1
;
vector
<
RealOpenMM
>
distance1
(
numSETTLE
);
vector
<
RealOpenMM
>
distance2
;
vector
<
RealOpenMM
>
distance2
(
numSETTLE
);
for
(
int
i
=
0
;
i
<
settleClusters
.
size
();
i
++
)
{
for
(
int
i
=
0
;
i
<
numSETTLE
;
i
++
)
{
int
p1
=
settleClusters
[
i
];
int
p1
=
settleClusters
[
i
];
int
p2
=
settleConstraints
[
p1
].
begin
()
->
first
;
int
p2
=
settleConstraints
[
p1
].
begin
()
->
first
;
int
p3
=
(
++
settleConstraints
[
p1
].
begin
())
->
first
;
int
p3
=
(
++
settleConstraints
[
p1
].
begin
())
->
first
;
...
@@ -114,35 +113,36 @@ ReferenceConstraints::ReferenceConstraints(const System& system) : ccma(NULL), s
...
@@ -114,35 +113,36 @@ ReferenceConstraints::ReferenceConstraints(const System& system) : ccma(NULL), s
float
dist23
=
settleConstraints
[
p2
].
find
(
p3
)
->
second
;
float
dist23
=
settleConstraints
[
p2
].
find
(
p3
)
->
second
;
if
(
dist12
==
dist13
)
{
if
(
dist12
==
dist13
)
{
// p1 is the central atom
// p1 is the central atom
atom1
[
i
]
=
p1
;
atom1
.
push_back
(
p1
)
;
atom2
[
i
]
=
p2
;
atom2
.
push_back
(
p2
)
;
atom3
[
i
]
=
p3
;
atom3
.
push_back
(
p3
)
;
distance1
[
i
]
=
dist12
;
distance1
.
push_back
(
dist12
)
;
distance2
[
i
]
=
dist23
;
distance2
.
push_back
(
dist23
)
;
}
}
else
if
(
dist12
==
dist23
)
{
else
if
(
dist12
==
dist23
)
{
// p2 is the central atom
// p2 is the central atom
atom1
[
i
]
=
p2
;
atom1
.
push_back
(
p2
)
;
atom2
[
i
]
=
p1
;
atom2
.
push_back
(
p1
)
;
atom3
[
i
]
=
p3
;
atom3
.
push_back
(
p3
)
;
distance1
[
i
]
=
dist12
;
distance1
.
push_back
(
dist12
)
;
distance2
[
i
]
=
dist13
;
distance2
.
push_back
(
dist13
)
;
}
}
else
if
(
dist13
==
dist23
)
{
else
if
(
dist13
==
dist23
)
{
// p3 is the central atom
// p3 is the central atom
atom1
[
i
]
=
p3
;
atom1
.
push_back
(
p3
)
;
atom2
[
i
]
=
p1
;
atom2
.
push_back
(
p1
)
;
atom3
[
i
]
=
p2
;
atom3
.
push_back
(
p2
)
;
distance1
[
i
]
=
dist13
;
distance1
.
push_back
(
dist13
)
;
distance2
[
i
]
=
dist12
;
distance2
.
push_back
(
dist12
)
;
}
}
else
else
throw
OpenMMException
(
"Two of the three distances constrained with SETTLE must be the same."
);
continue
;
// We can't handle this with SETTLE
isSettleAtom
[
p1
]
=
true
;
isSettleAtom
[
p1
]
=
true
;
isSettleAtom
[
p2
]
=
true
;
isSettleAtom
[
p2
]
=
true
;
isSettleAtom
[
p3
]
=
true
;
isSettleAtom
[
p3
]
=
true
;
}
}
settle
=
new
ReferenceSETTLEAlgorithm
(
atom1
,
atom2
,
atom3
,
distance1
,
distance2
,
masses
);
if
(
atom1
.
size
()
>
0
)
settle
=
new
ReferenceSETTLEAlgorithm
(
atom1
,
atom2
,
atom3
,
distance1
,
distance2
,
masses
);
}
}
// All other constraints are handled with CCMA.
// All other constraints are handled with CCMA.
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment