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
0ca6b16a
Commit
0ca6b16a
authored
4 years ago
by
cmaffeo2
Browse files
Options
Downloads
Patches
Plain Diff
Fixed revert
parent
29535488
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/TabulatedPotential.cu
+0
-77
0 additions, 77 deletions
src/TabulatedPotential.cu
src/TabulatedPotential.h
+10
-0
10 additions, 0 deletions
src/TabulatedPotential.h
with
10 additions
and
77 deletions
src/TabulatedPotential.cu
+
0
−
77
View file @
0ca6b16a
...
...
@@ -180,80 +180,3 @@ int FullTabulatedPotential::countValueLines(const char* fileName) {
return
count
;
}
void
TabulatedPotential
::
truncate
(
float
cutoff
)
{
int
home
=
int
(
floor
((
cutoff
-
r0
)
/
dr
));
if
(
home
>
n
)
return
;
float
v
=
v0
[
home
];
for
(
int
i
=
home
;
i
<
n
;
i
++
)
v0
[
i
]
=
v
;
interpolate
();
}
bool
TabulatedPotential
::
truncate
(
float
switchDist
,
float
cutoff
,
float
value
)
{
int
indOff
=
int
(
floor
((
cutoff
-
r0
)
/
dr
));
int
indSwitch
=
int
(
floor
((
switchDist
-
r0
)
/
dr
));
if
(
indSwitch
>
n
)
return
false
;
// Set everything after the cutoff to "value".
for
(
int
i
=
indOff
;
i
<
n
;
i
++
)
v0
[
i
]
=
value
;
// Apply a linear switch.
float
v
=
v0
[
indSwitch
];
float
m
=
(
value
-
v
)
/
(
indOff
-
indSwitch
);
for
(
int
i
=
indSwitch
;
i
<
indOff
;
i
++
)
v0
[
i
]
=
m
*
(
i
-
indSwitch
)
+
v
;
interpolate
();
return
true
;
}
Vector3
TabulatedPotential
::
computeForce
(
Vector3
r
)
{
float
d
=
r
.
length
();
Vector3
rUnit
=
-
r
/
d
;
int
home
=
int
(
floor
((
d
-
r0
)
/
dr
));
if
(
home
<
0
)
return
Vector3
(
0.0
f
);
if
(
home
>=
n
)
return
Vector3
(
0.0
f
);
float
homeR
=
home
*
dr
+
r0
;
float
w
=
(
d
-
homeR
)
/
dr
;
// Interpolate.
Vector3
force
=
-
(
3.0
f
*
v3
[
home
]
*
w
*
w
+
2.0
f
*
v2
[
home
]
*
w
+
v1
[
home
])
*
rUnit
/
dr
;
return
force
;
}
void
TabulatedPotential
::
init
(
const
float
*
dist
,
const
float
*
pot
,
int
n0
)
{
n
=
abs
(
n0
);
dr
=
dist
[
1
]
-
dist
[
0
];
r0
=
dist
[
0
];
r1
=
r0
+
n
*
dr
;
v0
=
new
float
[
n
];
for
(
int
i
=
0
;
i
<
n
;
i
++
)
v0
[
i
]
=
pot
[
i
];
}
void
TabulatedPotential
::
interpolate
()
{
v1
=
new
float
[
n
];
v2
=
new
float
[
n
];
v3
=
new
float
[
n
];
for
(
int
i
=
0
;
i
<
n
;
i
++
)
{
int
i0
=
i
-
1
;
int
i1
=
i
;
int
i2
=
i
+
1
;
int
i3
=
i
+
2
;
if
(
i0
<
0
)
i0
=
0
;
if
(
i2
>=
n
)
i2
=
n
-
1
;
if
(
i3
>=
n
)
i3
=
n
-
1
;
v3
[
i
]
=
0.5
f
*
(
-
v0
[
i0
]
+
3.0
f
*
v0
[
i1
]
-
3.0
f
*
v0
[
i2
]
+
v0
[
i3
]);
v2
[
i
]
=
0.5
f
*
(
2.0
f
*
v0
[
i0
]
-
5.0
f
*
v0
[
i1
]
+
4.0
f
*
v0
[
i2
]
-
v0
[
i3
]);
v1
[
i
]
=
0.5
f
*
(
-
v0
[
i0
]
+
v0
[
i2
]);
}
e0
=
v3
[
n
-
1
]
+
v2
[
n
-
1
]
+
v1
[
n
-
1
]
+
v0
[
n
-
1
];
}
>>>>>>>
parent
of
7
b4247c
...
Merge
branch
'
feat
/
bondangle
'
into
release
This diff is collapsed.
Click to expand it.
src/TabulatedPotential.h
+
10
−
0
View file @
0ca6b16a
...
...
@@ -14,6 +14,12 @@
#include
"useful.h"
#include
<cuda.h>
#ifndef gpuErrchk
#define delgpuErrchk
#define gpuErrchk(code) { if ((code) != cudaSuccess) { \
fprintf(stderr,"CUDA Error: %s %s %d\n", cudaGetErrorString(code), __FILE__, __LINE__); \
}}
#endif
class
EnergyForce
{
public:
...
...
@@ -171,4 +177,8 @@ private:
float
drInv
;
//TODO replace with drInv
float
r0
;
};
#ifndef delgpuErrchk
#undef delgpuErrchk
#undef gpuErrchk
#endif
#endif
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