Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F82304095
atom_vec_dpd.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
Tue, Sep 10, 16:17
Size
4 KB
Mime Type
text/x-c
Expires
Thu, Sep 12, 16:17 (1 d, 22 h)
Engine
blob
Format
Raw Data
Handle
20677007
Attached To
rLAMMPS lammps
atom_vec_dpd.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 "stdlib.h"
#include "atom_vec_dpd.h"
#include "atom.h"
#include "domain.h"
#include "modify.h"
#include "fix.h"
#include "memory.h"
#include "error.h"
using
namespace
LAMMPS_NS
;
#define DELTA 10000
/* ---------------------------------------------------------------------- */
AtomVecDPD
::
AtomVecDPD
(
LAMMPS
*
lmp
,
int
narg
,
char
**
arg
)
:
AtomVecAtomic
(
lmp
,
narg
,
arg
)
{
mass_type
=
1
;
comm_x_only
=
0
;
size_comm
=
6
;
size_reverse
=
3
;
size_border
=
9
;
size_data_atom
=
5
;
size_data_vel
=
4
;
xcol_data
=
3
;
}
/* ---------------------------------------------------------------------- */
int
AtomVecDPD
::
pack_comm
(
int
n
,
int
*
list
,
double
*
buf
,
int
pbc_flag
,
int
*
pbc
)
{
int
i
,
j
,
m
;
double
dx
,
dy
,
dz
;
m
=
0
;
if
(
pbc_flag
==
0
)
{
for
(
i
=
0
;
i
<
n
;
i
++
)
{
j
=
list
[
i
];
buf
[
m
++
]
=
x
[
j
][
0
];
buf
[
m
++
]
=
x
[
j
][
1
];
buf
[
m
++
]
=
x
[
j
][
2
];
buf
[
m
++
]
=
v
[
j
][
0
];
buf
[
m
++
]
=
v
[
j
][
1
];
buf
[
m
++
]
=
v
[
j
][
2
];
}
}
else
{
if
(
domain
->
triclinic
==
0
)
{
dx
=
pbc
[
0
]
*
domain
->
xprd
;
dy
=
pbc
[
1
]
*
domain
->
yprd
;
dz
=
pbc
[
2
]
*
domain
->
zprd
;
}
else
{
dx
=
pbc
[
0
]
*
domain
->
xprd
+
pbc
[
5
]
*
domain
->
xy
+
pbc
[
4
]
*
domain
->
xz
;
dy
=
pbc
[
1
]
*
domain
->
yprd
+
pbc
[
3
]
*
domain
->
yz
;
dz
=
pbc
[
2
]
*
domain
->
zprd
;
}
for
(
i
=
0
;
i
<
n
;
i
++
)
{
j
=
list
[
i
];
buf
[
m
++
]
=
x
[
j
][
0
]
+
dx
;
buf
[
m
++
]
=
x
[
j
][
1
]
+
dy
;
buf
[
m
++
]
=
x
[
j
][
2
]
+
dz
;
buf
[
m
++
]
=
v
[
j
][
0
];
buf
[
m
++
]
=
v
[
j
][
1
];
buf
[
m
++
]
=
v
[
j
][
2
];
}
}
return
m
;
}
/* ---------------------------------------------------------------------- */
int
AtomVecDPD
::
pack_comm_one
(
int
i
,
double
*
buf
)
{
buf
[
0
]
=
v
[
i
][
0
];
buf
[
1
]
=
v
[
i
][
1
];
buf
[
2
]
=
v
[
i
][
2
];
return
3
;
}
/* ---------------------------------------------------------------------- */
void
AtomVecDPD
::
unpack_comm
(
int
n
,
int
first
,
double
*
buf
)
{
int
i
,
m
,
last
;
m
=
0
;
last
=
first
+
n
;
for
(
i
=
first
;
i
<
last
;
i
++
)
{
x
[
i
][
0
]
=
buf
[
m
++
];
x
[
i
][
1
]
=
buf
[
m
++
];
x
[
i
][
2
]
=
buf
[
m
++
];
v
[
i
][
0
]
=
buf
[
m
++
];
v
[
i
][
1
]
=
buf
[
m
++
];
v
[
i
][
2
]
=
buf
[
m
++
];
}
}
/* ---------------------------------------------------------------------- */
int
AtomVecDPD
::
unpack_comm_one
(
int
i
,
double
*
buf
)
{
v
[
i
][
0
]
=
buf
[
0
];
v
[
i
][
1
]
=
buf
[
1
];
v
[
i
][
2
]
=
buf
[
2
];
return
3
;
}
/* ---------------------------------------------------------------------- */
int
AtomVecDPD
::
pack_border
(
int
n
,
int
*
list
,
double
*
buf
,
int
pbc_flag
,
int
*
pbc
)
{
int
i
,
j
,
m
;
double
dx
,
dy
,
dz
;
m
=
0
;
if
(
pbc_flag
==
0
)
{
for
(
i
=
0
;
i
<
n
;
i
++
)
{
j
=
list
[
i
];
buf
[
m
++
]
=
x
[
j
][
0
];
buf
[
m
++
]
=
x
[
j
][
1
];
buf
[
m
++
]
=
x
[
j
][
2
];
buf
[
m
++
]
=
tag
[
j
];
buf
[
m
++
]
=
type
[
j
];
buf
[
m
++
]
=
mask
[
j
];
buf
[
m
++
]
=
v
[
j
][
0
];
buf
[
m
++
]
=
v
[
j
][
1
];
buf
[
m
++
]
=
v
[
j
][
2
];
}
}
else
{
if
(
domain
->
triclinic
==
0
)
{
dx
=
pbc
[
0
]
*
domain
->
xprd
;
dy
=
pbc
[
1
]
*
domain
->
yprd
;
dz
=
pbc
[
2
]
*
domain
->
zprd
;
}
else
{
dx
=
pbc
[
0
];
dy
=
pbc
[
1
];
dz
=
pbc
[
2
];
}
for
(
i
=
0
;
i
<
n
;
i
++
)
{
j
=
list
[
i
];
buf
[
m
++
]
=
x
[
j
][
0
]
+
dx
;
buf
[
m
++
]
=
x
[
j
][
1
]
+
dy
;
buf
[
m
++
]
=
x
[
j
][
2
]
+
dz
;
buf
[
m
++
]
=
tag
[
j
];
buf
[
m
++
]
=
type
[
j
];
buf
[
m
++
]
=
mask
[
j
];
buf
[
m
++
]
=
v
[
j
][
0
];
buf
[
m
++
]
=
v
[
j
][
1
];
buf
[
m
++
]
=
v
[
j
][
2
];
}
}
return
m
;
}
/* ---------------------------------------------------------------------- */
int
AtomVecDPD
::
pack_border_one
(
int
i
,
double
*
buf
)
{
buf
[
0
]
=
v
[
i
][
0
];
buf
[
1
]
=
v
[
i
][
1
];
buf
[
2
]
=
v
[
i
][
2
];
return
3
;
}
/* ---------------------------------------------------------------------- */
void
AtomVecDPD
::
unpack_border
(
int
n
,
int
first
,
double
*
buf
)
{
int
i
,
m
,
last
;
m
=
0
;
last
=
first
+
n
;
for
(
i
=
first
;
i
<
last
;
i
++
)
{
if
(
i
==
nmax
)
grow
(
0
);
x
[
i
][
0
]
=
buf
[
m
++
];
x
[
i
][
1
]
=
buf
[
m
++
];
x
[
i
][
2
]
=
buf
[
m
++
];
tag
[
i
]
=
static_cast
<
int
>
(
buf
[
m
++
]);
type
[
i
]
=
static_cast
<
int
>
(
buf
[
m
++
]);
mask
[
i
]
=
static_cast
<
int
>
(
buf
[
m
++
]);
v
[
i
][
0
]
=
buf
[
m
++
];
v
[
i
][
1
]
=
buf
[
m
++
];
v
[
i
][
2
]
=
buf
[
m
++
];
}
}
/* ---------------------------------------------------------------------- */
int
AtomVecDPD
::
unpack_border_one
(
int
i
,
double
*
buf
)
{
v
[
i
][
0
]
=
buf
[
0
];
v
[
i
][
1
]
=
buf
[
1
];
v
[
i
][
2
]
=
buf
[
2
];
return
3
;
}
Event Timeline
Log In to Comment