Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F66951312
fix_nvt_sllod_intel.cpp
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Subscribers
None
File Metadata
Details
File Info
Storage
Attached
Created
Wed, Jun 19, 01:41
Size
3 KB
Mime Type
text/x-c
Expires
Fri, Jun 21, 01:41 (1 d, 23 h)
Engine
blob
Format
Raw Data
Handle
18321085
Attached To
rLAMMPS lammps
fix_nvt_sllod_intel.cpp
View Options
/* ----------------------------------------------------------------------
LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator
http://lammps.sandia.gov, Sandia National Laboratories
Steve Plimpton, sjplimp@sandia.gov
Copyright (2003) Sandia Corporation. Under the terms of Contract
DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains
certain rights in this software. This software is distributed under
the GNU General Public License.
See the README file in the top-level LAMMPS directory.
------------------------------------------------------------------------- */
#include <math.h>
#include <string.h>
#include "fix_nvt_sllod_intel.h"
#include "math_extra.h"
#include "atom.h"
#include "domain.h"
#include "group.h"
#include "modify.h"
#include "fix.h"
#include "fix_deform.h"
#include "compute.h"
#include "error.h"
using
namespace
LAMMPS_NS
;
using
namespace
FixConst
;
enum
{
NO_REMAP
,
X_REMAP
,
V_REMAP
};
// same as fix_deform.cpp
/* ---------------------------------------------------------------------- */
FixNVTSllodIntel
::
FixNVTSllodIntel
(
LAMMPS
*
lmp
,
int
narg
,
char
**
arg
)
:
FixNHIntel
(
lmp
,
narg
,
arg
)
{
if
(
!
tstat_flag
)
error
->
all
(
FLERR
,
"Temperature control must be used with fix nvt/sllod"
);
if
(
pstat_flag
)
error
->
all
(
FLERR
,
"Pressure control can not be used with fix nvt/sllod"
);
// default values
if
(
mtchain_default_flag
)
mtchain
=
1
;
// create a new compute temp style
// id = fix-ID + temp
int
n
=
strlen
(
id
)
+
6
;
id_temp
=
new
char
[
n
];
strcpy
(
id_temp
,
id
);
strcat
(
id_temp
,
"_temp"
);
char
**
newarg
=
new
char
*
[
3
];
newarg
[
0
]
=
id_temp
;
newarg
[
1
]
=
group
->
names
[
igroup
];
newarg
[
2
]
=
(
char
*
)
"temp/deform"
;
modify
->
add_compute
(
3
,
newarg
);
delete
[]
newarg
;
tcomputeflag
=
1
;
}
/* ---------------------------------------------------------------------- */
void
FixNVTSllodIntel
::
init
()
{
FixNHIntel
::
init
();
if
(
!
temperature
->
tempbias
)
error
->
all
(
FLERR
,
"Temperature for fix nvt/sllod does not have a bias"
);
nondeformbias
=
0
;
if
(
strcmp
(
temperature
->
style
,
"temp/deform"
)
!=
0
)
nondeformbias
=
1
;
// check fix deform remap settings
int
i
;
for
(
i
=
0
;
i
<
modify
->
nfix
;
i
++
)
if
(
strcmp
(
modify
->
fix
[
i
]
->
style
,
"deform"
)
==
0
)
{
if
(((
FixDeform
*
)
modify
->
fix
[
i
])
->
remapflag
!=
V_REMAP
)
error
->
all
(
FLERR
,
"Using fix nvt/sllod with inconsistent fix deform "
"remap option"
);
break
;
}
if
(
i
==
modify
->
nfix
)
error
->
all
(
FLERR
,
"Using fix nvt/sllod with no fix deform defined"
);
}
/* ----------------------------------------------------------------------
perform half-step scaling of velocities
-----------------------------------------------------------------------*/
void
FixNVTSllodIntel
::
nh_v_temp
()
{
// remove and restore bias = streaming velocity = Hrate*lamda + Hratelo
// thermostat thermal velocity only
// vdelu = SLLOD correction = Hrate*Hinv*vthermal
// for non temp/deform BIAS:
// calculate temperature since some computes require temp
// computed on current nlocal atoms to remove bias
if
(
nondeformbias
)
temperature
->
compute_scalar
();
double
**
v
=
atom
->
v
;
int
*
mask
=
atom
->
mask
;
int
nlocal
=
atom
->
nlocal
;
if
(
igroup
==
atom
->
firstgroup
)
nlocal
=
atom
->
nfirst
;
double
h_two
[
6
],
vdelu
[
3
];
MathExtra
::
multiply_shape_shape
(
domain
->
h_rate
,
domain
->
h_inv
,
h_two
);
for
(
int
i
=
0
;
i
<
nlocal
;
i
++
)
{
if
(
mask
[
i
]
&
groupbit
)
{
vdelu
[
0
]
=
h_two
[
0
]
*
v
[
i
][
0
]
+
h_two
[
5
]
*
v
[
i
][
1
]
+
h_two
[
4
]
*
v
[
i
][
2
];
vdelu
[
1
]
=
h_two
[
1
]
*
v
[
i
][
1
]
+
h_two
[
3
]
*
v
[
i
][
2
];
vdelu
[
2
]
=
h_two
[
2
]
*
v
[
i
][
2
];
temperature
->
remove_bias
(
i
,
v
[
i
]);
v
[
i
][
0
]
=
v
[
i
][
0
]
*
factor_eta
-
dthalf
*
vdelu
[
0
];
v
[
i
][
1
]
=
v
[
i
][
1
]
*
factor_eta
-
dthalf
*
vdelu
[
1
];
v
[
i
][
2
]
=
v
[
i
][
2
]
*
factor_eta
-
dthalf
*
vdelu
[
2
];
temperature
->
restore_bias
(
i
,
v
[
i
]);
}
}
}
Event Timeline
Log In to Comment