Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
A
arbd
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
tbgl
tools
arbd
Commits
38fd85ff
Commit
38fd85ff
authored
7 years ago
by
cmaffeo2
Browse files
Options
Downloads
Patches
Plain Diff
Fixed dihedrals potential wrapping and singularity handling
parent
193b2737
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/TabulatedDihedral.cu
+7
-6
7 additions, 6 deletions
src/TabulatedDihedral.cu
src/TabulatedMethods.cuh
+9
-9
9 additions, 9 deletions
src/TabulatedMethods.cuh
with
16 additions
and
15 deletions
src/TabulatedDihedral.cu
+
7
−
6
View file @
38fd85ff
...
...
@@ -60,13 +60,14 @@ TabulatedDihedralPotential::TabulatedDihedralPotential(String fileName) : fileNa
assert
(
size
*
deltaAngle
>=
360
);
float
tmp
[
size
];
for
(
int
i
=
0
;
i
<
size
;
++
i
)
{
//
j=0 corresponsds to angle[i] in
[-Pi,
-
Pi+delta)
float
a
=
(
angle
[
i
]
+
180.0
f
)
;
for
(
int
j
=
0
;
j
<
size
;
++
j
)
{
//
reorganize data so that the angle goes from
[-Pi,Pi+delta)
float
a
=
-
180.0
f
-
angle
[
0
]
+
j
*
deltaAngle
;
while
(
a
<
0
)
a
+=
360.0
f
;
while
(
a
>=
360
)
a
-=
360.0
f
;
int
j
=
floor
(
a
/
deltaAngle
);
if
(
j
>=
size
)
continue
;
while
(
a
>=
size
*
deltaAngle
)
a
-=
360.0
f
;
int
i
=
round
(
a
/
deltaAngle
);
assert
(
i
>=
0
);
assert
(
i
<
size
);
tmp
[
j
]
=
pot
[
i
];
}
for
(
int
i
=
0
;
i
<
size
;
++
i
)
pot
[
i
]
=
tmp
[
i
];
...
...
This diff is collapsed.
Click to expand it.
src/TabulatedMethods.cuh
+
9
−
9
View file @
38fd85ff
...
...
@@ -117,6 +117,9 @@ __device__ inline void computeDihedral(const TabulatedDihedralPotential* __restr
// home = home % size;
int
home1
=
(
home
+
1
)
>=
d
->
size
?
(
home
+
1
-
d
->
size
)
:
home
+
1
;
assert
(
home1
>
0
);
assert
(
home1
<
d
->
size
);
//================================================
// Linear interpolation
float
U0
=
d
->
pot
[
home
];
// Potential
...
...
@@ -126,15 +129,12 @@ __device__ inline void computeDihedral(const TabulatedDihedralPotential* __restr
force
=
-
dU
*
d
->
angle_step_inv
;
// avoid singularity when one angle is straight
force
=
(
ab
.
length2
()
*
bc
.
length2
()
*
crossABC
.
rLength2
()
>
100.0
f
||
(
ab
.
length2
()
*
bc
.
length2
()
*
crossABC
.
rLength2
())
*
crossBCD
.
rLength2
()
>
100.0
f
)
?
0.0
f
:
force
;
// if (force >= 10000.0f)
// printf("pot[%d] = %f; pot[%d] = %f\n", home,U0, home1, U0+dU);
if
(
force
>
1000.0
f
)
force
=
1000.0
f
;
if
(
force
<
-
1000.0
f
)
force
=
-
1000.0
f
;
assert
(
force
<
10000.0
f
);
// force = (distbc*distbc*crossABC.rLength2() > 1000.0f || distbc*distbc*crossBCD.rLength2() > 1000.0f) ? 0.0f : force;
force
=
(
ab
.
length2
()
*
bc
.
length2
()
*
crossABC
.
rLength2
()
>
100.0
f
||
bc
.
length2
()
*
cd
.
length2
()
*
crossBCD
.
rLength2
()
>
100.0
f
)
?
0.0
f
:
force
;
// if ( force > 1000.0f )
// printf("%f %d %d (%.4f %.4f) %.2f %f\n",force,home,home1, d->pot[home], d->pot[home1], dU, d->angle_step_inv);
//assert( force < 10000.0f )
f1
*=
force
;
f2
*=
force
;
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment