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
fe8244c1
Commit
fe8244c1
authored
7 years ago
by
Ulf R. Pedersen
Browse files
Options
Downloads
Patches
Plain Diff
Rename fix
parent
3381a433
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/USER-PINNING/fix_rhok.cpp
+17
-18
17 additions, 18 deletions
src/USER-PINNING/fix_rhok.cpp
src/USER-PINNING/fix_rhok.h
+8
-8
8 additions, 8 deletions
src/USER-PINNING/fix_rhok.h
with
25 additions
and
26 deletions
src/USER-PINNING/fix_rho
KUmbrella
.cpp
→
src/USER-PINNING/fix_rho
k
.cpp
+
17
−
18
View file @
fe8244c1
...
@@ -5,16 +5,17 @@
...
@@ -5,16 +5,17 @@
The usage is as follows:
The usage is as follows:
fix [name] [groupID] rhoK
Umbrella
[nx] [ny] [nz] [kappa = spring constant] [rhoK0]
fix [name] [groupID] rhoK [nx] [ny] [nz] [kappa = spring constant] [rhoK0]
where k_i = (2 pi / L_i) * n_i
where k_i = (2 pi / L_i) * n_i
Written by Ulf Pedersen and Patrick Varilly, 4 Feb 2010
Written by Ulf Pedersen and Patrick Varilly, 4 Feb 2010
Tweaked for LAMMPS 15 Jan 2010 version by Ulf Pedersen, 19 Aug 2010
Tweaked for LAMMPS 15 Jan 2010 version by Ulf Pedersen, 19 Aug 2010
Tweaked again March 4th 2012 by Ulf Pedersen.
Tweaked again March 4th 2012 by Ulf R. Pedersen,
September 2016 by Ulf R. Pedersen
*/
*/
#include
"fix_rho
KUmbrella
.h"
#include
"fix_rho
k
.h"
#include
"error.h"
#include
"error.h"
#include
"update.h"
#include
"update.h"
#include
"respa.h"
#include
"respa.h"
...
@@ -32,7 +33,7 @@ using namespace FixConst;
...
@@ -32,7 +33,7 @@ using namespace FixConst;
// Constructor: all the parameters to this fix specified in
// Constructor: all the parameters to this fix specified in
// the LAMMPS input get passed in
// the LAMMPS input get passed in
FixRho
KUmbrella
::
FixRhoKUmbrella
(
LAMMPS
*
inLMP
,
int
inArgc
,
char
**
inArgv
)
FixRho
k
::
FixRhok
(
LAMMPS
*
inLMP
,
int
inArgc
,
char
**
inArgv
)
:
Fix
(
inLMP
,
inArgc
,
inArgv
)
:
Fix
(
inLMP
,
inArgc
,
inArgv
)
{
{
// Check arguments
// Check arguments
...
@@ -64,7 +65,7 @@ FixRhoKUmbrella::FixRhoKUmbrella( LAMMPS* inLMP, int inArgc, char** inArgv )
...
@@ -64,7 +65,7 @@ FixRhoKUmbrella::FixRhoKUmbrella( LAMMPS* inLMP, int inArgc, char** inArgv )
mRhoK0
=
atof
(
inArgv
[
7
]
);
mRhoK0
=
atof
(
inArgv
[
7
]
);
}
}
FixRho
KUmbrella
::~
FixRhoKUmbrella
()
FixRho
k
::~
FixRhok
()
{
{
}
}
...
@@ -73,7 +74,7 @@ FixRhoKUmbrella::~FixRhoKUmbrella()
...
@@ -73,7 +74,7 @@ FixRhoKUmbrella::~FixRhoKUmbrella()
// Tells LAMMPS where this fix should act
// Tells LAMMPS where this fix should act
int
int
FixRho
KUmbrella
::
setmask
()
FixRho
k
::
setmask
()
{
{
int
mask
=
0
;
int
mask
=
0
;
...
@@ -88,7 +89,7 @@ FixRhoKUmbrella::setmask()
...
@@ -88,7 +89,7 @@ FixRhoKUmbrella::setmask()
return
mask
;
return
mask
;
}
}
/*int FixRho
KUmbrella
::setmask()
/*int FixRho
k
::setmask()
{
{
int mask = 0;
int mask = 0;
mask |= POST_FORCE;
mask |= POST_FORCE;
...
@@ -100,7 +101,7 @@ FixRhoKUmbrella::setmask()
...
@@ -100,7 +101,7 @@ FixRhoKUmbrella::setmask()
// Initializes the fix at the beginning of a run
// Initializes the fix at the beginning of a run
void
void
FixRho
KUmbrella
::
init
()
FixRho
k
::
init
()
{
{
// RESPA boilerplate
// RESPA boilerplate
if
(
strcmp
(
update
->
integrate_style
,
"respa"
)
==
0
)
if
(
strcmp
(
update
->
integrate_style
,
"respa"
)
==
0
)
...
@@ -122,7 +123,7 @@ FixRhoKUmbrella::init()
...
@@ -122,7 +123,7 @@ FixRhoKUmbrella::init()
// Initial application of the fix to a system (when doing MD)
// Initial application of the fix to a system (when doing MD)
void
void
FixRho
KUmbrella
::
setup
(
int
inVFlag
)
FixRho
k
::
setup
(
int
inVFlag
)
{
{
if
(
strcmp
(
update
->
integrate_style
,
"verlet"
)
==
0
)
if
(
strcmp
(
update
->
integrate_style
,
"verlet"
)
==
0
)
post_force
(
inVFlag
);
post_force
(
inVFlag
);
...
@@ -136,14 +137,14 @@ FixRhoKUmbrella::setup( int inVFlag )
...
@@ -136,14 +137,14 @@ FixRhoKUmbrella::setup( int inVFlag )
// Initial application of the fix to a system (when doing minimization)
// Initial application of the fix to a system (when doing minimization)
void
void
FixRho
KUmbrella
::
min_setup
(
int
inVFlag
)
FixRho
k
::
min_setup
(
int
inVFlag
)
{
{
post_force
(
inVFlag
);
post_force
(
inVFlag
);
}
}
// Modify the forces calculated in the main force loop of ordinary MD
// Modify the forces calculated in the main force loop of ordinary MD
void
void
FixRho
KUmbrella
::
post_force
(
int
inVFlag
)
FixRho
k
::
post_force
(
int
inVFlag
)
{
{
double
**
x
=
atom
->
x
;
double
**
x
=
atom
->
x
;
double
**
f
=
atom
->
f
;
double
**
f
=
atom
->
f
;
...
@@ -168,11 +169,9 @@ FixRhoKUmbrella::post_force( int inVFlag )
...
@@ -168,11 +169,9 @@ FixRhoKUmbrella::post_force( int inVFlag )
MPI_Allreduce
(
mRhoKLocal
,
mRhoKGlobal
,
MPI_Allreduce
(
mRhoKLocal
,
mRhoKGlobal
,
2
,
MPI_DOUBLE
,
MPI_SUM
,
world
);
2
,
MPI_DOUBLE
,
MPI_SUM
,
world
);
//
WARNING!!!!!
< \sum_{i,j} e^{-ik.(r_i - r_j)} > ~ N, so
//
Info:
< \sum_{i,j} e^{-ik.(r_i - r_j)} > ~ N, so
// we define rho_k as (1 / sqrt(N)) \sum_i e^{-i k.r_i}, so that
// we define rho_k as (1 / sqrt(N)) \sum_i e^{-i k.r_i}, so that
// <rho_k^2> is intensive.
// <rho_k^2> is intensive.
//
// Don't forget this two years from now when you change the system size!!!
mRhoKGlobal
[
0
]
/=
mSqrtNThis
;
mRhoKGlobal
[
0
]
/=
mSqrtNThis
;
mRhoKGlobal
[
1
]
/=
mSqrtNThis
;
mRhoKGlobal
[
1
]
/=
mSqrtNThis
;
...
@@ -207,7 +206,7 @@ FixRhoKUmbrella::post_force( int inVFlag )
...
@@ -207,7 +206,7 @@ FixRhoKUmbrella::post_force( int inVFlag )
// Forces in RESPA loop
// Forces in RESPA loop
void
void
FixRho
KUmbrella
::
post_force_respa
(
int
inVFlag
,
int
inILevel
,
int
inILoop
)
FixRho
k
::
post_force_respa
(
int
inVFlag
,
int
inILevel
,
int
inILoop
)
{
{
if
(
inILevel
==
mNLevelsRESPA
-
1
)
if
(
inILevel
==
mNLevelsRESPA
-
1
)
post_force
(
inVFlag
);
post_force
(
inVFlag
);
...
@@ -215,14 +214,14 @@ FixRhoKUmbrella::post_force_respa( int inVFlag, int inILevel, int inILoop )
...
@@ -215,14 +214,14 @@ FixRhoKUmbrella::post_force_respa( int inVFlag, int inILevel, int inILoop )
// Forces in minimization loop
// Forces in minimization loop
void
void
FixRho
KUmbrella
::
min_post_force
(
int
inVFlag
)
FixRho
k
::
min_post_force
(
int
inVFlag
)
{
{
post_force
(
inVFlag
);
post_force
(
inVFlag
);
}
}
// Compute the change in the potential energy induced by this fix
// Compute the change in the potential energy induced by this fix
double
double
FixRho
KUmbrella
::
compute_scalar
()
FixRho
k
::
compute_scalar
()
{
{
double
rhoK
=
sqrt
(
mRhoKGlobal
[
0
]
*
mRhoKGlobal
[
0
]
double
rhoK
=
sqrt
(
mRhoKGlobal
[
0
]
*
mRhoKGlobal
[
0
]
+
mRhoKGlobal
[
1
]
*
mRhoKGlobal
[
1
]
);
+
mRhoKGlobal
[
1
]
*
mRhoKGlobal
[
1
]
);
...
@@ -232,7 +231,7 @@ FixRhoKUmbrella::compute_scalar()
...
@@ -232,7 +231,7 @@ FixRhoKUmbrella::compute_scalar()
// Compute the ith component of the vector
// Compute the ith component of the vector
double
double
FixRho
KUmbrella
::
compute_vector
(
int
inI
)
FixRho
k
::
compute_vector
(
int
inI
)
{
{
if
(
inI
==
0
)
if
(
inI
==
0
)
return
mRhoKGlobal
[
0
];
// Real part
return
mRhoKGlobal
[
0
];
// Real part
...
...
This diff is collapsed.
Click to expand it.
src/USER-PINNING/fix_rho
KUmbrella
.h
→
src/USER-PINNING/fix_rho
k
.h
+
8
−
8
View file @
fe8244c1
/*
/*
fix_rho
K_umbrella
.h
fix_rho
k
.h
A fix to do umbrella sampling on rho(k).
A fix to do umbrella sampling on rho(k).
...
@@ -15,24 +15,24 @@
...
@@ -15,24 +15,24 @@
#ifdef FIX_CLASS
#ifdef FIX_CLASS
FixStyle
(
rho
KUmbrella
,
FixRhoKUmbrella
)
FixStyle
(
rho
k
,
FixRhok
)
#else
#else
#ifndef __FIX_RHOK
UMBRELLA
__
#ifndef __FIX_RHOK__
#define __FIX_RHOK
UMBRELLA
__
#define __FIX_RHOK__
#include
"fix.h"
#include
"fix.h"
namespace
LAMMPS_NS
{
namespace
LAMMPS_NS
{
class
FixRho
KUmbrella
:
public
Fix
class
FixRho
k
:
public
Fix
{
{
public:
public:
// Constructor: all the parameters to this fix specified in
// Constructor: all the parameters to this fix specified in
// the LAMMPS input get passed in
// the LAMMPS input get passed in
FixRho
KUmbrella
(
LAMMPS
*
inLMP
,
int
inArgc
,
char
**
inArgv
);
FixRho
k
(
LAMMPS
*
inLMP
,
int
inArgc
,
char
**
inArgv
);
virtual
~
FixRho
KUmbrella
();
virtual
~
FixRho
k
();
// Methods that this fix implements
// Methods that this fix implements
// --------------------------------
// --------------------------------
...
@@ -76,6 +76,6 @@ private:
...
@@ -76,6 +76,6 @@ private:
}
// namespace LAMMPS_NS
}
// namespace LAMMPS_NS
#endif // __FIX_RHOK
UMBRELLA
__
#endif // __FIX_RHOK__
#endif // FIX_CLASS
#endif // FIX_CLASS
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