Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
L
lammps
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
multiscale
lammps
Commits
0a417b40
Commit
0a417b40
authored
8 years ago
by
Axel Kohlmeyer
Browse files
Options
Downloads
Patches
Plain Diff
add short neighbor list support to pair style tersoff
parent
399c0af1
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/MANYBODY/pair_tersoff.cpp
+28
-17
28 additions, 17 deletions
src/MANYBODY/pair_tersoff.cpp
src/MANYBODY/pair_tersoff.h
+3
-0
3 additions, 0 deletions
src/MANYBODY/pair_tersoff.h
with
31 additions
and
17 deletions
src/MANYBODY/pair_tersoff.cpp
+
28
−
17
View file @
0a417b40
...
...
@@ -52,6 +52,10 @@ PairTersoff::PairTersoff(LAMMPS *lmp) : Pair(lmp)
params
=
NULL
;
elem2param
=
NULL
;
map
=
NULL
;
sizeshort
=
10
;
numshort
=
0
;
neighshort
=
NULL
;
}
/* ----------------------------------------------------------------------
...
...
@@ -71,6 +75,7 @@ PairTersoff::~PairTersoff()
if
(
allocated
)
{
memory
->
destroy
(
setflag
);
memory
->
destroy
(
cutsq
);
memory
->
destroy
(
neighshort
);
delete
[]
map
;
}
}
...
...
@@ -98,6 +103,7 @@ void PairTersoff::compute(int eflag, int vflag)
int
*
type
=
atom
->
type
;
int
nlocal
=
atom
->
nlocal
;
int
newton_pair
=
force
->
newton_pair
;
const
double
cutshortsq
=
cutmax
*
cutmax
;
inum
=
list
->
inum
;
ilist
=
list
->
ilist
;
...
...
@@ -118,12 +124,26 @@ void PairTersoff::compute(int eflag, int vflag)
jlist
=
firstneigh
[
i
];
jnum
=
numneigh
[
i
];
numshort
=
0
;
for
(
jj
=
0
;
jj
<
jnum
;
jj
++
)
{
j
=
jlist
[
jj
];
j
&=
NEIGHMASK
;
jtag
=
tag
[
j
];
delx
=
xtmp
-
x
[
j
][
0
];
dely
=
ytmp
-
x
[
j
][
1
];
delz
=
ztmp
-
x
[
j
][
2
];
rsq
=
delx
*
delx
+
dely
*
dely
+
delz
*
delz
;
if
(
rsq
<
cutshortsq
)
{
neighshort
[
numshort
++
]
=
j
;
if
(
numshort
>
sizeshort
)
{
sizeshort
+=
sizeshort
/
2
;
memory
->
grow
(
neighshort
,
sizeshort
,
"pair:neighshort"
);
}
}
jtag
=
tag
[
j
];
if
(
itag
>
jtag
)
{
if
((
itag
+
jtag
)
%
2
==
0
)
continue
;
}
else
if
(
itag
<
jtag
)
{
...
...
@@ -135,12 +155,6 @@ void PairTersoff::compute(int eflag, int vflag)
}
jtype
=
map
[
type
[
j
]];
delx
=
xtmp
-
x
[
j
][
0
];
dely
=
ytmp
-
x
[
j
][
1
];
delz
=
ztmp
-
x
[
j
][
2
];
rsq
=
delx
*
delx
+
dely
*
dely
+
delz
*
delz
;
iparam_ij
=
elem2param
[
itype
][
jtype
][
jtype
];
if
(
rsq
>
params
[
iparam_ij
].
cutsq
)
continue
;
...
...
@@ -160,9 +174,8 @@ void PairTersoff::compute(int eflag, int vflag)
// three-body interactions
// skip immediately if I-J is not within cutoff
for
(
jj
=
0
;
jj
<
jnum
;
jj
++
)
{
j
=
jlist
[
jj
];
j
&=
NEIGHMASK
;
for
(
jj
=
0
;
jj
<
numshort
;
jj
++
)
{
j
=
neighshort
[
jj
];
jtype
=
map
[
type
[
j
]];
iparam_ij
=
elem2param
[
itype
][
jtype
][
jtype
];
...
...
@@ -176,10 +189,9 @@ void PairTersoff::compute(int eflag, int vflag)
zeta_ij
=
0.0
;
for
(
kk
=
0
;
kk
<
j
num
;
kk
++
)
{
for
(
kk
=
0
;
kk
<
num
short
;
kk
++
)
{
if
(
jj
==
kk
)
continue
;
k
=
jlist
[
kk
];
k
&=
NEIGHMASK
;
k
=
neighshort
[
kk
];
ktype
=
map
[
type
[
k
]];
iparam_ijk
=
elem2param
[
itype
][
jtype
][
ktype
];
...
...
@@ -208,10 +220,9 @@ void PairTersoff::compute(int eflag, int vflag)
// attractive term via loop over k
for
(
kk
=
0
;
kk
<
j
num
;
kk
++
)
{
for
(
kk
=
0
;
kk
<
num
short
;
kk
++
)
{
if
(
jj
==
kk
)
continue
;
k
=
jlist
[
kk
];
k
&=
NEIGHMASK
;
k
=
neighshort
[
kk
];
ktype
=
map
[
type
[
k
]];
iparam_ijk
=
elem2param
[
itype
][
jtype
][
ktype
];
...
...
@@ -251,7 +262,7 @@ void PairTersoff::allocate()
memory
->
create
(
setflag
,
n
+
1
,
n
+
1
,
"pair:setflag"
);
memory
->
create
(
cutsq
,
n
+
1
,
n
+
1
,
"pair:cutsq"
);
memory
->
create
(
neighshort
,
sizeshort
,
"pair:neighshort"
);
map
=
new
int
[
n
+
1
];
}
...
...
This diff is collapsed.
Click to expand it.
src/MANYBODY/pair_tersoff.h
+
3
−
0
View file @
0a417b40
...
...
@@ -59,6 +59,9 @@ class PairTersoff : public Pair {
int
nelements
;
// # of unique elements
int
nparams
;
// # of stored parameter sets
int
maxparam
;
// max # of parameter sets
int
sizeshort
;
// size of short neighbor list array
int
numshort
;
// current count of neighbors in short list
int
*
neighshort
;
// short neighbor list array
virtual
void
allocate
();
virtual
void
read_file
(
char
*
);
...
...
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