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
a37f4b76
Commit
a37f4b76
authored
Feb 06, 2010
by
Peter Eastman
Browse files
Throw an exception if the cutoff distance is greater than half the box size (bug 1023)
parent
82554f15
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
37 additions
and
0 deletions
+37
-0
openmmapi/src/CustomGBForceImpl.cpp
openmmapi/src/CustomGBForceImpl.cpp
+7
-0
openmmapi/src/CustomNonbondedForceImpl.cpp
openmmapi/src/CustomNonbondedForceImpl.cpp
+7
-0
openmmapi/src/GBSAOBCForceImpl.cpp
openmmapi/src/GBSAOBCForceImpl.cpp
+7
-0
openmmapi/src/GBVIForceImpl.cpp
openmmapi/src/GBVIForceImpl.cpp
+7
-0
openmmapi/src/NonbondedForceImpl.cpp
openmmapi/src/NonbondedForceImpl.cpp
+9
-0
No files found.
openmmapi/src/CustomGBForceImpl.cpp
View file @
a37f4b76
...
...
@@ -95,6 +95,13 @@ void CustomGBForceImpl::initialize(ContextImpl& context) {
exclusions
[
particle1
].
insert
(
particle2
);
exclusions
[
particle2
].
insert
(
particle1
);
}
if
(
owner
.
getNonbondedMethod
()
==
CustomGBForce
::
CutoffPeriodic
)
{
Vec3
boxVectors
[
3
];
system
.
getPeriodicBoxVectors
(
boxVectors
[
0
],
boxVectors
[
1
],
boxVectors
[
2
]);
double
cutoff
=
owner
.
getCutoffDistance
();
if
(
cutoff
>
0.5
*
boxVectors
[
0
][
0
]
||
cutoff
>
0.5
*
boxVectors
[
1
][
1
]
||
cutoff
>
0.5
*
boxVectors
[
2
][
2
])
throw
OpenMMException
(
"CustomGBForce: The cutoff distance cannot be greater than half the periodic box size."
);
}
dynamic_cast
<
CalcCustomGBForceKernel
&>
(
kernel
.
getImpl
()).
initialize
(
context
.
getSystem
(),
owner
);
}
...
...
openmmapi/src/CustomNonbondedForceImpl.cpp
View file @
a37f4b76
...
...
@@ -95,6 +95,13 @@ void CustomNonbondedForceImpl::initialize(ContextImpl& context) {
exclusions
[
particle1
].
insert
(
particle2
);
exclusions
[
particle2
].
insert
(
particle1
);
}
if
(
owner
.
getNonbondedMethod
()
==
CustomNonbondedForce
::
CutoffPeriodic
)
{
Vec3
boxVectors
[
3
];
system
.
getPeriodicBoxVectors
(
boxVectors
[
0
],
boxVectors
[
1
],
boxVectors
[
2
]);
double
cutoff
=
owner
.
getCutoffDistance
();
if
(
cutoff
>
0.5
*
boxVectors
[
0
][
0
]
||
cutoff
>
0.5
*
boxVectors
[
1
][
1
]
||
cutoff
>
0.5
*
boxVectors
[
2
][
2
])
throw
OpenMMException
(
"CustomNonbondedForce: The cutoff distance cannot be greater than half the periodic box size."
);
}
dynamic_cast
<
CalcCustomNonbondedForceKernel
&>
(
kernel
.
getImpl
()).
initialize
(
context
.
getSystem
(),
owner
);
}
...
...
openmmapi/src/GBSAOBCForceImpl.cpp
View file @
a37f4b76
...
...
@@ -45,6 +45,13 @@ void GBSAOBCForceImpl::initialize(ContextImpl& context) {
kernel
=
context
.
getPlatform
().
createKernel
(
CalcGBSAOBCForceKernel
::
Name
(),
context
);
if
(
owner
.
getNumParticles
()
!=
context
.
getSystem
().
getNumParticles
())
throw
OpenMMException
(
"GBSAOBCForce must have exactly as many particles as the System it belongs to."
);
if
(
owner
.
getNonbondedMethod
()
==
GBSAOBCForce
::
CutoffPeriodic
)
{
Vec3
boxVectors
[
3
];
context
.
getSystem
().
getPeriodicBoxVectors
(
boxVectors
[
0
],
boxVectors
[
1
],
boxVectors
[
2
]);
double
cutoff
=
owner
.
getCutoffDistance
();
if
(
cutoff
>
0.5
*
boxVectors
[
0
][
0
]
||
cutoff
>
0.5
*
boxVectors
[
1
][
1
]
||
cutoff
>
0.5
*
boxVectors
[
2
][
2
])
throw
OpenMMException
(
"GBSAOBCForce: The cutoff distance cannot be greater than half the periodic box size."
);
}
dynamic_cast
<
CalcGBSAOBCForceKernel
&>
(
kernel
.
getImpl
()).
initialize
(
context
.
getSystem
(),
owner
);
}
...
...
openmmapi/src/GBVIForceImpl.cpp
View file @
a37f4b76
...
...
@@ -94,6 +94,13 @@ void GBVIForceImpl::initialize(ContextImpl& context) {
bondIndices
[
i
].
push_back
(
particle2
);
bondLengths
[
i
]
=
bondLength
;
}
if
(
owner
.
getNonbondedMethod
()
==
GBVIForce
::
CutoffPeriodic
)
{
Vec3
boxVectors
[
3
];
system
.
getPeriodicBoxVectors
(
boxVectors
[
0
],
boxVectors
[
1
],
boxVectors
[
2
]);
double
cutoff
=
owner
.
getCutoffDistance
();
if
(
cutoff
>
0.5
*
boxVectors
[
0
][
0
]
||
cutoff
>
0.5
*
boxVectors
[
1
][
1
]
||
cutoff
>
0.5
*
boxVectors
[
2
][
2
])
throw
OpenMMException
(
"GBVIForce: The cutoff distance cannot be greater than half the periodic box size."
);
}
vector
<
double
>
scaledRadii
;
scaledRadii
.
resize
(
numberOfParticles
);
...
...
openmmapi/src/NonbondedForceImpl.cpp
View file @
a37f4b76
...
...
@@ -85,6 +85,15 @@ void NonbondedForceImpl::initialize(ContextImpl& context) {
exceptions
[
particle1
].
insert
(
particle2
);
exceptions
[
particle2
].
insert
(
particle1
);
}
if
(
owner
.
getNonbondedMethod
()
==
NonbondedForce
::
CutoffPeriodic
||
owner
.
getNonbondedMethod
()
==
NonbondedForce
::
Ewald
||
owner
.
getNonbondedMethod
()
==
NonbondedForce
::
PME
)
{
Vec3
boxVectors
[
3
];
system
.
getPeriodicBoxVectors
(
boxVectors
[
0
],
boxVectors
[
1
],
boxVectors
[
2
]);
double
cutoff
=
owner
.
getCutoffDistance
();
if
(
cutoff
>
0.5
*
boxVectors
[
0
][
0
]
||
cutoff
>
0.5
*
boxVectors
[
1
][
1
]
||
cutoff
>
0.5
*
boxVectors
[
2
][
2
])
throw
OpenMMException
(
"NonbondedForce: The cutoff distance cannot be greater than half the periodic box size."
);
}
dynamic_cast
<
CalcNonbondedForceKernel
&>
(
kernel
.
getImpl
()).
initialize
(
context
.
getSystem
(),
owner
);
}
...
...
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