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
3f248310
"vscode:/vscode.git/clone" did not exist on "cc65c54e1cf35d0425808b0eecb5fe6afe6896c2"
Commit
3f248310
authored
Dec 11, 2009
by
Peter Eastman
Browse files
Hopefully improved the accuracy of torsion calculations
parent
15a92011
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
5 deletions
+10
-5
platforms/reference/src/SimTKReference/ReferenceBondIxn.cpp
platforms/reference/src/SimTKReference/ReferenceBondIxn.cpp
+10
-5
No files found.
platforms/reference/src/SimTKReference/ReferenceBondIxn.cpp
View file @
3f248310
/* Portions copyright (c) 2006 Stanford University and Simbios.
/* Portions copyright (c) 2006
-2009
Stanford University and Simbios.
* Contributors: Pande Group
*
* Permission is hereby granted, free of charge, to any person obtaining
...
...
@@ -239,10 +239,15 @@ RealOpenMM ReferenceBondIxn::getAngleBetweenTwoVectors( RealOpenMM* vector1, Rea
RealOpenMM
dotProduct
=
getNormedDotProduct
(
vector1
,
vector2
,
hasREntry
);
RealOpenMM
angle
;
if
(
dotProduct
>=
one
){
angle
=
zero
;
}
else
if
(
dotProduct
<=
-
one
){
angle
=
PI_M
;
if
(
dotProduct
>
(
RealOpenMM
)
0.99
||
dotProduct
<
(
RealOpenMM
)
-
0.99
)
{
// We're close to the singularity in acos(), so take the cross product and use asin() instead.
RealOpenMM
cross
[
3
];
SimTKOpenMMUtilities
::
crossProductVector3
(
vector1
,
vector2
,
cross
);
RealOpenMM
scale
=
DOT3
(
vector1
,
vector1
)
*
DOT3
(
vector2
,
vector2
);
angle
=
ASIN
(
SQRT
(
DOT3
(
cross
,
cross
)
/
scale
));
if
(
dotProduct
<
zero
)
angle
=
M_PI
-
angle
;
}
else
{
angle
=
ACOS
(
dotProduct
);
}
...
...
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