Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F85847927
fix_print.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, Oct 2, 12:38
Size
1 KB
Mime Type
text/x-c
Expires
Fri, Oct 4, 12:38 (2 d)
Engine
blob
Format
Raw Data
Handle
21282469
Attached To
rLAMMPS lammps
fix_print.cpp
View Options
/* ----------------------------------------------------------------------
LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator
www.cs.sandia.gov/~sjplimp/lammps.html
Steve Plimpton, sjplimp@sandia.gov, Sandia National Laboratories
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 "string.h"
#include "fix_print.h"
#include "update.h"
#include "input.h"
#include "variable.h"
#include "error.h"
#define MAXLINE 1024
/* ---------------------------------------------------------------------- */
FixPrint
::
FixPrint
(
int
narg
,
char
**
arg
)
:
Fix
(
narg
,
arg
)
{
if
(
narg
!=
5
)
error
->
all
(
"Illegal fix print command"
);
nevery
=
atoi
(
arg
[
3
]);
if
(
nevery
<=
0
)
error
->
all
(
"Illegal fix print command"
);
MPI_Comm_rank
(
world
,
&
me
);
int
n
=
strlen
(
arg
[
4
])
+
1
;
line
=
new
char
[
n
];
strcpy
(
line
,
arg
[
4
]);
copy
=
new
char
[
MAXLINE
];
work
=
new
char
[
MAXLINE
];
}
/* ---------------------------------------------------------------------- */
FixPrint
::~
FixPrint
()
{
delete
[]
line
;
delete
[]
copy
;
delete
[]
work
;
}
/* ---------------------------------------------------------------------- */
int
FixPrint
::
setmask
()
{
int
mask
=
0
;
mask
|=
END_OF_STEP
;
return
mask
;
}
/* ---------------------------------------------------------------------- */
void
FixPrint
::
end_of_step
()
{
// make a copy of line to work on
// substitute for $ variables (no printing)
// append a newline and print final copy
strcpy
(
copy
,
line
);
input
->
substitute
(
copy
,
0
);
strcat
(
copy
,
"
\n
"
);
if
(
me
==
0
)
{
if
(
screen
)
fprintf
(
screen
,
copy
);
if
(
logfile
)
fprintf
(
logfile
,
copy
);
}
}
Event Timeline
Log In to Comment