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
1e9778b8
Commit
1e9778b8
authored
6 years ago
by
mkanski
Browse files
Options
Downloads
Patches
Plain Diff
Extend compute pair to handle multiple instances of a given pair style
parent
cdea8968
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
doc/src/compute_pair.txt
+23
-10
23 additions, 10 deletions
doc/src/compute_pair.txt
src/compute_pair.cpp
+23
-9
23 additions, 9 deletions
src/compute_pair.cpp
src/compute_pair.h
+1
-1
1 addition, 1 deletion
src/compute_pair.h
with
47 additions
and
20 deletions
doc/src/compute_pair.txt
+
23
−
10
View file @
1e9778b8
...
@@ -10,17 +10,22 @@ compute pair command :h3
...
@@ -10,17 +10,22 @@ compute pair command :h3
[Syntax:]
[Syntax:]
compute ID group-ID pair pstyle
e
value :pre
compute ID group-ID pair pstyle
keyword
value :pre
ID, group-ID are documented in "compute"_compute.html command
ID, group-ID are documented in "compute"_compute.html command :ulb,l
pair = style name of this compute command
pair = style name of this compute command :l
pstyle = style name of a pair style that calculates additional values
pstyle = style name of a pair style that calculates additional values :l
evalue = {epair} or {evdwl} or {ecoul} or blank (optional setting) :ul
zero or more keyword/value pairs may be appended :l
keyword = {evalue} or {nsub}
{evalue} arg = {epair} or {evdwl} or {ecoul}
{nsub} n = use {n}-th instance of a sub-style in a pair_style hybrid or hybrid/overlay command :pre
:ule
[Examples:]
[Examples:]
compute 1 all pair gauss
compute 1 all pair gauss
compute 1 all pair lj/cut/coul/cut ecoul
compute 1 all pair lj/cut/coul/cut evalue ecoul
compute 1 all pair tersoff nsub 2
compute 1 all pair reax :pre
compute 1 all pair reax :pre
[Description:]
[Description:]
...
@@ -33,15 +38,23 @@ NOTE: The group specified for this command is [ignored].
...
@@ -33,15 +38,23 @@ NOTE: The group specified for this command is [ignored].
The specified {pstyle} must be a pair style used in your simulation
The specified {pstyle} must be a pair style used in your simulation
either by itself or as a sub-style in a "pair_style hybrid or
either by itself or as a sub-style in a "pair_style hybrid or
hybrid/overlay"_pair_hybrid.html command.
hybrid/overlay"_pair_hybrid.html command. If the sub-style is
used more than once, additional keyword {nsub} has to be specified in
order to choose a single instance.
The {evalue} setting is optional; it may be left off the command. All
NOTE: The {nsub} keyword should be used only if the sub-style occurs
multiple times. Its value must be an integer from 1 to M, where M is
the number of times the sub-style is listed in the "pair_style hybrid
or hybrid/overlay"_pair_hybrid.html" command. If the pair style is
used once, {nsub} must remain zero.
The {evalue} setting is optional. All
pair styles tally a potential energy {epair} which may be broken into
pair styles tally a potential energy {epair} which may be broken into
two parts: {evdwl} and {ecoul} such that {epair} = {evdwl} + {ecoul}.
two parts: {evdwl} and {ecoul} such that {epair} = {evdwl} + {ecoul}.
If the pair style calculates Coulombic interactions, their energy will
If the pair style calculates Coulombic interactions, their energy will
be tallied in {ecoul}. Everything else (whether it is a Lennard-Jones
be tallied in {ecoul}. Everything else (whether it is a Lennard-Jones
style van der Waals interaction or not) is tallied in {evdwl}. If
style van der Waals interaction or not) is tallied in {evdwl}. If
{evalue} is specified as {epair}
or left out
, then {epair} is stored
{evalue} is specified as {epair}, then {epair} is stored
as a global scalar by this compute. This is useful when using
as a global scalar by this compute. This is useful when using
"pair_style hybrid"_pair_hybrid.html if you want to know the portion
"pair_style hybrid"_pair_hybrid.html if you want to know the portion
of the total energy contributed by one sub-style. If {evalue} is
of the total energy contributed by one sub-style. If {evalue} is
...
@@ -82,4 +95,4 @@ the doc page for the pair style for details.
...
@@ -82,4 +95,4 @@ the doc page for the pair style for details.
[Default:]
[Default:]
The default
for
{evalue}
is
{epair}.
The
keyword
default
s are
{evalue}
=
{epair}
, nsub = 0
.
This diff is collapsed.
Click to expand it.
src/compute_pair.cpp
+
23
−
9
View file @
1e9778b8
...
@@ -29,7 +29,7 @@ ComputePair::ComputePair(LAMMPS *lmp, int narg, char **arg) :
...
@@ -29,7 +29,7 @@ ComputePair::ComputePair(LAMMPS *lmp, int narg, char **arg) :
Compute
(
lmp
,
narg
,
arg
),
Compute
(
lmp
,
narg
,
arg
),
pstyle
(
NULL
),
pair
(
NULL
),
one
(
NULL
)
pstyle
(
NULL
),
pair
(
NULL
),
one
(
NULL
)
{
{
if
(
narg
<
4
||
narg
>
5
)
error
->
all
(
FLERR
,
"Illegal compute pair command"
);
if
(
narg
<
4
)
error
->
all
(
FLERR
,
"Illegal compute pair command"
);
scalar_flag
=
1
;
scalar_flag
=
1
;
extscalar
=
1
;
extscalar
=
1
;
...
@@ -41,19 +41,33 @@ ComputePair::ComputePair(LAMMPS *lmp, int narg, char **arg) :
...
@@ -41,19 +41,33 @@ ComputePair::ComputePair(LAMMPS *lmp, int narg, char **arg) :
pstyle
=
new
char
[
n
];
pstyle
=
new
char
[
n
];
strcpy
(
pstyle
,
arg
[
3
]);
strcpy
(
pstyle
,
arg
[
3
]);
if
(
narg
==
5
)
{
int
iarg
=
4
;
if
(
strcmp
(
arg
[
4
],
"epair"
)
==
0
)
evalue
=
EPAIR
;
nsub
=
0
;
if
(
strcmp
(
arg
[
4
],
"evdwl"
)
==
0
)
evalue
=
EVDWL
;
if
(
strcmp
(
arg
[
4
],
"ecoul"
)
==
0
)
evalue
=
ECOUL
;
while
(
iarg
<
narg
)
{
}
else
evalue
=
EPAIR
;
if
(
strcmp
(
arg
[
iarg
],
"evalue"
)
==
0
)
{
if
(
iarg
+
2
>
narg
)
error
->
all
(
FLERR
,
"Illegal compute pair command"
);
if
(
strcmp
(
arg
[
iarg
+
1
],
"epair"
)
==
0
)
evalue
=
EPAIR
;
else
if
(
strcmp
(
arg
[
iarg
+
1
],
"evdwl"
)
==
0
)
evalue
=
EVDWL
;
else
if
(
strcmp
(
arg
[
iarg
+
1
],
"ecoul"
)
==
0
)
evalue
=
ECOUL
;
else
error
->
all
(
FLERR
,
"Unrecognized energy type"
);
iarg
+=
2
;
}
else
if
(
strcmp
(
arg
[
iarg
],
"nsub"
)
==
0
)
{
if
(
iarg
+
2
>
narg
)
error
->
all
(
FLERR
,
"Illegal compute pair command"
);
nsub
=
force
->
inumeric
(
FLERR
,
arg
[
iarg
+
1
]);
iarg
+=
2
;
}
else
error
->
all
(
FLERR
,
"Illegal compute pair command"
);
}
// check if pair style with and without suffix exists
// check if pair style with and without suffix exists
pair
=
force
->
pair_match
(
pstyle
,
1
);
pair
=
force
->
pair_match
(
pstyle
,
1
,
nsub
);
if
(
!
pair
&&
lmp
->
suffix
)
{
if
(
!
pair
&&
lmp
->
suffix
)
{
strcat
(
pstyle
,
"/"
);
strcat
(
pstyle
,
"/"
);
strcat
(
pstyle
,
lmp
->
suffix
);
strcat
(
pstyle
,
lmp
->
suffix
);
pair
=
force
->
pair_match
(
pstyle
,
1
);
pair
=
force
->
pair_match
(
pstyle
,
1
,
nsub
);
}
}
if
(
!
pair
)
if
(
!
pair
)
...
@@ -84,7 +98,7 @@ void ComputePair::init()
...
@@ -84,7 +98,7 @@ void ComputePair::init()
{
{
// recheck for pair style in case it has been deleted
// recheck for pair style in case it has been deleted
pair
=
force
->
pair_match
(
pstyle
,
1
);
pair
=
force
->
pair_match
(
pstyle
,
1
,
nsub
);
if
(
!
pair
)
if
(
!
pair
)
error
->
all
(
FLERR
,
"Unrecognized pair style in compute pair command"
);
error
->
all
(
FLERR
,
"Unrecognized pair style in compute pair command"
);
}
}
...
...
This diff is collapsed.
Click to expand it.
src/compute_pair.h
+
1
−
1
View file @
1e9778b8
...
@@ -33,7 +33,7 @@ class ComputePair : public Compute {
...
@@ -33,7 +33,7 @@ class ComputePair : public Compute {
void
compute_vector
();
void
compute_vector
();
private:
private:
int
evalue
,
npair
;
int
evalue
,
npair
,
nsub
;
char
*
pstyle
;
char
*
pstyle
;
class
Pair
*
pair
;
class
Pair
*
pair
;
double
*
one
;
double
*
one
;
...
...
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