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
69605295
Commit
69605295
authored
6 years ago
by
robeme
Browse files
Options
Downloads
Patches
Plain Diff
set appropriate flags for computing a vector in constructor of fix restrain
parent
808eb2a2
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/fix_restrain.cpp
+25
-3
25 additions, 3 deletions
src/fix_restrain.cpp
src/fix_restrain.h
+2
-0
2 additions, 0 deletions
src/fix_restrain.h
with
27 additions
and
3 deletions
src/fix_restrain.cpp
+
25
−
3
View file @
69605295
...
...
@@ -53,6 +53,9 @@ FixRestrain::FixRestrain(LAMMPS *lmp, int narg, char **arg) :
scalar_flag
=
1
;
global_freq
=
1
;
extscalar
=
1
;
vector_flag
=
1
;
size_vector
=
3
;
extvector
=
1
;
respa_level_support
=
1
;
ilevel_respa
=
0
;
...
...
@@ -188,6 +191,10 @@ void FixRestrain::min_setup(int vflag)
void
FixRestrain
::
post_force
(
int
vflag
)
{
energy
=
0.0
;
ebond
=
0.0
;
eangle
=
0.0
;
edihed
=
0.0
;
for
(
int
m
=
0
;
m
<
nrestrain
;
m
++
)
if
(
rstyle
[
m
]
==
BOND
)
restrain_bond
(
m
);
...
...
@@ -271,7 +278,8 @@ void FixRestrain::restrain_bond(int m)
if
(
r
>
0.0
)
fbond
=
-
2.0
*
rk
/
r
;
else
fbond
=
0.0
;
energy
+=
rk
*
dr
;
ebond
+=
rk
*
dr
;
energy
+=
ebond
;
// apply force to each of 2 atoms
...
...
@@ -378,7 +386,8 @@ void FixRestrain::restrain_angle(int m)
dtheta
=
acos
(
c
)
-
target
[
m
];
tk
=
k
*
dtheta
;
energy
+=
tk
*
dtheta
;
eangle
+=
tk
*
dtheta
;
energy
+=
eangle
;
a
=
-
2.0
*
tk
*
s
;
a11
=
a
*
c
/
rsq1
;
...
...
@@ -558,7 +567,8 @@ void FixRestrain::restrain_dihedral(int m)
df1
*=
-
mult
[
m
];
p
+=
1.0
;
energy
+=
k
*
p
;
edihed
+=
k
*
p
;
energy
+=
edihed
;
fg
=
vb1x
*
vb2xm
+
vb1y
*
vb2ym
+
vb1z
*
vb2zm
;
hg
=
vb3x
*
vb2xm
+
vb3y
*
vb2ym
+
vb3z
*
vb2zm
;
...
...
@@ -635,3 +645,15 @@ double FixRestrain::compute_scalar()
MPI_Allreduce
(
&
energy
,
&
energy_all
,
1
,
MPI_DOUBLE
,
MPI_SUM
,
world
);
return
energy_all
;
}
/* ----------------------------------------------------------------------
return individual energy contributions
------------------------------------------------------------------------- */
double
FixRestrain
::
compute_vector
(
int
n
)
{
if
(
n
==
0
)
return
ebond
;
if
(
n
==
1
)
return
eangle
;
if
(
n
==
2
)
return
edihed
;
return
0.0
;
}
This diff is collapsed.
Click to expand it.
src/fix_restrain.h
+
2
−
0
View file @
69605295
...
...
@@ -36,6 +36,7 @@ class FixRestrain : public Fix {
void
post_force_respa
(
int
,
int
,
int
);
void
min_post_force
(
int
);
double
compute_scalar
();
double
compute_vector
(
int
);
private:
int
ilevel_respa
;
...
...
@@ -46,6 +47,7 @@ class FixRestrain : public Fix {
double
*
kstart
,
*
kstop
,
*
target
;
double
*
cos_target
,
*
sin_target
;
double
energy
,
energy_all
;
double
ebond
,
eangle
,
edihed
;
void
restrain_bond
(
int
);
void
restrain_angle
(
int
);
...
...
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