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
a3cd6000
Unverified
Commit
a3cd6000
authored
7 years ago
by
Steve Plimpton
Committed by
GitHub
7 years ago
Browse files
Options
Downloads
Plain Diff
Merge pull request #786 from jrgissing/per_atom_prop_group
per-atom property dynamic group
parents
53fb7f40
13c08225
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/group.txt
+6
-1
6 additions, 1 deletion
doc/src/group.txt
src/fix_group.cpp
+31
-2
31 additions, 2 deletions
src/fix_group.cpp
src/fix_group.h
+3
-3
3 additions, 3 deletions
src/fix_group.h
with
40 additions
and
6 deletions
doc/src/group.txt
+
6
−
1
View file @
a3cd6000
...
@@ -43,6 +43,7 @@ style = {delete} or {clear} or {empty} or {region} or \
...
@@ -43,6 +43,7 @@ style = {delete} or {clear} or {empty} or {region} or \
keyword = {region} or {var} or {every}
keyword = {region} or {var} or {every}
{region} value = region-ID
{region} value = region-ID
{var} value = name of variable
{var} value = name of variable
{property} value = name of per-atom property
{every} value = N = update group every this many timesteps
{every} value = N = update group every this many timesteps
{static} = no args :pre
{static} = no args :pre
:ule
:ule
...
@@ -221,7 +222,11 @@ conditions are applied. If the {region} keyword is used, atoms not in
...
@@ -221,7 +222,11 @@ conditions are applied. If the {region} keyword is used, atoms not in
the specified region are removed from the dynamic group. If the {var}
the specified region are removed from the dynamic group. If the {var}
keyword is used, the variable name must be an atom-style or
keyword is used, the variable name must be an atom-style or
atomfile-style variable. The variable is evaluated and atoms whose
atomfile-style variable. The variable is evaluated and atoms whose
per-atom values are 0.0, are removed from the dynamic group.
per-atom values are 0.0, are removed from the dynamic group. If the {property}
keyword is used, the per-atom property name must be a previously defined
per-atom property. The per-atom property is evaluated and atoms whose
values are 0.0 are removed from the dynamic group, otherwise they
are added to the group.
The assignment of atoms to a dynamic group is done at the beginning of
The assignment of atoms to a dynamic group is done at the beginning of
each run and on every timestep that is a multiple of {N}, which is the
each run and on every timestep that is a multiple of {N}, which is the
...
...
This diff is collapsed.
Click to expand it.
src/fix_group.cpp
+
31
−
2
View file @
a3cd6000
...
@@ -33,7 +33,7 @@ using namespace FixConst;
...
@@ -33,7 +33,7 @@ using namespace FixConst;
/* ---------------------------------------------------------------------- */
/* ---------------------------------------------------------------------- */
FixGroup
::
FixGroup
(
LAMMPS
*
lmp
,
int
narg
,
char
**
arg
)
:
Fix
(
lmp
,
narg
,
arg
),
FixGroup
::
FixGroup
(
LAMMPS
*
lmp
,
int
narg
,
char
**
arg
)
:
Fix
(
lmp
,
narg
,
arg
),
idregion
(
NULL
),
idvar
(
NULL
)
idregion
(
NULL
),
idvar
(
NULL
)
,
idprop
(
NULL
)
{
{
// dgroupbit = bitmask of dynamic group
// dgroupbit = bitmask of dynamic group
// group ID is last part of fix ID
// group ID is last part of fix ID
...
@@ -49,6 +49,7 @@ idregion(NULL), idvar(NULL)
...
@@ -49,6 +49,7 @@ idregion(NULL), idvar(NULL)
regionflag
=
0
;
regionflag
=
0
;
varflag
=
0
;
varflag
=
0
;
propflag
=
0
;
nevery
=
1
;
nevery
=
1
;
int
iarg
=
3
;
int
iarg
=
3
;
...
@@ -73,7 +74,17 @@ idregion(NULL), idvar(NULL)
...
@@ -73,7 +74,17 @@ idregion(NULL), idvar(NULL)
idvar
=
new
char
[
n
];
idvar
=
new
char
[
n
];
strcpy
(
idvar
,
arg
[
iarg
+
1
]);
strcpy
(
idvar
,
arg
[
iarg
+
1
]);
iarg
+=
2
;
iarg
+=
2
;
}
else
if
(
strcmp
(
arg
[
iarg
],
"every"
)
==
0
)
{
}
else
if
(
strcmp
(
arg
[
iarg
],
"property"
)
==
0
)
{
if
(
iarg
+
2
>
narg
)
error
->
all
(
FLERR
,
"Illegal group command"
);
if
(
atom
->
find_custom
(
arg
[
iarg
+
1
],
typeflag
)
<
0
)
error
->
all
(
FLERR
,
"Per atom property for group dynamic does not exist"
);
propflag
=
1
;
delete
[]
idprop
;
int
n
=
strlen
(
arg
[
iarg
+
1
])
+
1
;
idprop
=
new
char
[
n
];
strcpy
(
idprop
,
arg
[
iarg
+
1
]);
iarg
+=
2
;
}
else
if
(
strcmp
(
arg
[
iarg
],
"every"
)
==
0
)
{
if
(
iarg
+
2
>
narg
)
error
->
all
(
FLERR
,
"Illegal group command"
);
if
(
iarg
+
2
>
narg
)
error
->
all
(
FLERR
,
"Illegal group command"
);
nevery
=
force
->
inumeric
(
FLERR
,
arg
[
iarg
+
1
]);
nevery
=
force
->
inumeric
(
FLERR
,
arg
[
iarg
+
1
]);
if
(
nevery
<=
0
)
error
->
all
(
FLERR
,
"Illegal group command"
);
if
(
nevery
<=
0
)
error
->
all
(
FLERR
,
"Illegal group command"
);
...
@@ -88,6 +99,7 @@ FixGroup::~FixGroup()
...
@@ -88,6 +99,7 @@ FixGroup::~FixGroup()
{
{
delete
[]
idregion
;
delete
[]
idregion
;
delete
[]
idvar
;
delete
[]
idvar
;
delete
[]
idprop
;
}
}
/* ---------------------------------------------------------------------- */
/* ---------------------------------------------------------------------- */
...
@@ -130,6 +142,12 @@ void FixGroup::init()
...
@@ -130,6 +142,12 @@ void FixGroup::init()
error
->
all
(
FLERR
,
"Variable for group dynamic is invalid style"
);
error
->
all
(
FLERR
,
"Variable for group dynamic is invalid style"
);
}
}
if
(
propflag
)
{
iprop
=
atom
->
find_custom
(
idprop
,
typeflag
);
if
(
iprop
<
0
)
error
->
all
(
FLERR
,
"Per-atom property for group dynamic does not exist"
);
}
// warn if any FixGroup is not at tail end of all post_integrate fixes
// warn if any FixGroup is not at tail end of all post_integrate fixes
Fix
**
fix
=
modify
->
fix
;
Fix
**
fix
=
modify
->
fix
;
...
@@ -188,6 +206,9 @@ void FixGroup::set_group()
...
@@ -188,6 +206,9 @@ void FixGroup::set_group()
// invoke atom-style variable if defined
// invoke atom-style variable if defined
double
*
var
=
NULL
;
double
*
var
=
NULL
;
int
*
ivector
=
NULL
;
double
*
dvector
=
NULL
;
if
(
varflag
)
{
if
(
varflag
)
{
modify
->
clearstep_compute
();
modify
->
clearstep_compute
();
...
@@ -196,6 +217,12 @@ void FixGroup::set_group()
...
@@ -196,6 +217,12 @@ void FixGroup::set_group()
modify
->
addstep_compute
(
update
->
ntimestep
+
nevery
);
modify
->
addstep_compute
(
update
->
ntimestep
+
nevery
);
}
}
// invoke per-atom property if defined
if
(
propflag
&&
!
typeflag
)
ivector
=
atom
->
ivector
[
iprop
];
//check nlocal > 0?
if
(
propflag
&&
typeflag
)
dvector
=
atom
->
dvector
[
iprop
];
//check nlocal > 0?
// update region in case it has a variable dependence or is dynamic
// update region in case it has a variable dependence or is dynamic
if
(
regionflag
)
region
->
prematch
();
if
(
regionflag
)
region
->
prematch
();
...
@@ -214,6 +241,8 @@ void FixGroup::set_group()
...
@@ -214,6 +241,8 @@ void FixGroup::set_group()
inflag
=
1
;
inflag
=
1
;
if
(
regionflag
&&
!
region
->
match
(
x
[
i
][
0
],
x
[
i
][
1
],
x
[
i
][
2
]))
inflag
=
0
;
if
(
regionflag
&&
!
region
->
match
(
x
[
i
][
0
],
x
[
i
][
1
],
x
[
i
][
2
]))
inflag
=
0
;
if
(
varflag
&&
var
[
i
]
==
0.0
)
inflag
=
0
;
if
(
varflag
&&
var
[
i
]
==
0.0
)
inflag
=
0
;
if
(
propflag
&&
!
typeflag
&&
ivector
[
i
]
==
0
)
inflag
=
0
;
if
(
propflag
&&
typeflag
&&
dvector
[
i
]
==
0
)
inflag
=
0
;
}
else
inflag
=
0
;
}
else
inflag
=
0
;
if
(
inflag
)
mask
[
i
]
|=
gbit
;
if
(
inflag
)
mask
[
i
]
|=
gbit
;
...
...
This diff is collapsed.
Click to expand it.
src/fix_group.h
+
3
−
3
View file @
a3cd6000
...
@@ -36,9 +36,9 @@ class FixGroup : public Fix {
...
@@ -36,9 +36,9 @@ class FixGroup : public Fix {
private:
private:
int
gbit
,
gbitinverse
;
int
gbit
,
gbitinverse
;
int
regionflag
,
varflag
;
int
regionflag
,
varflag
,
propflag
,
typeflag
;
int
iregion
,
ivar
;
int
iregion
,
ivar
,
iprop
;
char
*
idregion
,
*
idvar
;
char
*
idregion
,
*
idvar
,
*
idprop
;
class
Region
*
region
;
class
Region
*
region
;
int
nlevels_respa
;
int
nlevels_respa
;
...
...
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