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
Commit
3f248310
authored
Dec 11, 2009
by
Peter Eastman
Browse files
Hopefully improved the accuracy of torsion calculations
parent
15a92011
Changes
1
Hide 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
* Contributors: Pande Group
*
*
* Permission is hereby granted, free of charge, to any person obtaining
* Permission is hereby granted, free of charge, to any person obtaining
...
@@ -239,10 +239,15 @@ RealOpenMM ReferenceBondIxn::getAngleBetweenTwoVectors( RealOpenMM* vector1, Rea
...
@@ -239,10 +239,15 @@ RealOpenMM ReferenceBondIxn::getAngleBetweenTwoVectors( RealOpenMM* vector1, Rea
RealOpenMM
dotProduct
=
getNormedDotProduct
(
vector1
,
vector2
,
hasREntry
);
RealOpenMM
dotProduct
=
getNormedDotProduct
(
vector1
,
vector2
,
hasREntry
);
RealOpenMM
angle
;
RealOpenMM
angle
;
if
(
dotProduct
>=
one
){
if
(
dotProduct
>
(
RealOpenMM
)
0.99
||
dotProduct
<
(
RealOpenMM
)
-
0.99
)
{
angle
=
zero
;
// We're close to the singularity in acos(), so take the cross product and use asin() instead.
}
else
if
(
dotProduct
<=
-
one
){
angle
=
PI_M
;
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
{
}
else
{
angle
=
ACOS
(
dotProduct
);
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