git-svn-id: svn://svn.icms.temple.edu/lammps-ro/trunk@14426 f3b2605a-c512-4ea7-a41b-209d697bcdaa
This commit is contained in:
@ -15,6 +15,7 @@
|
|||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include "fix_store.h"
|
#include "fix_store.h"
|
||||||
#include "atom.h"
|
#include "atom.h"
|
||||||
|
#include "comm.h"
|
||||||
#include "force.h"
|
#include "force.h"
|
||||||
#include "memory.h"
|
#include "memory.h"
|
||||||
#include "error.h"
|
#include "error.h"
|
||||||
@ -123,6 +124,35 @@ int FixStore::setmask()
|
|||||||
return mask;
|
return mask;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* ----------------------------------------------------------------------
|
||||||
|
write global array to restart file
|
||||||
|
------------------------------------------------------------------------- */
|
||||||
|
|
||||||
|
void FixStore::write_restart(FILE *fp)
|
||||||
|
{
|
||||||
|
int n = nrow*ncol;
|
||||||
|
if (comm->me == 0) {
|
||||||
|
int size = n * sizeof(double);
|
||||||
|
fwrite(&size,sizeof(int),1,fp);
|
||||||
|
if (vecflag) fwrite(vstore,sizeof(double),n,fp);
|
||||||
|
else fwrite(&astore[0][0],sizeof(double),n,fp);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ----------------------------------------------------------------------
|
||||||
|
use global array from restart file to restart the Fix
|
||||||
|
------------------------------------------------------------------------- */
|
||||||
|
|
||||||
|
void FixStore::restart(char *buf)
|
||||||
|
{
|
||||||
|
// HOWTO insure size of buf is the same
|
||||||
|
|
||||||
|
int n = nrow*ncol;
|
||||||
|
double *dbuf = (double *) buf;
|
||||||
|
if (vecflag) memcpy(vstore,dbuf,n*sizeof(double));
|
||||||
|
else memcpy(&astore[0][0],dbuf,n*sizeof(double));
|
||||||
|
}
|
||||||
|
|
||||||
/* ----------------------------------------------------------------------
|
/* ----------------------------------------------------------------------
|
||||||
allocate atom-based array
|
allocate atom-based array
|
||||||
------------------------------------------------------------------------- */
|
------------------------------------------------------------------------- */
|
||||||
|
|||||||
@ -20,6 +20,7 @@ FixStyle(STORE,FixStore)
|
|||||||
#ifndef LMP_FIX_STORE_H
|
#ifndef LMP_FIX_STORE_H
|
||||||
#define LMP_FIX_STORE_H
|
#define LMP_FIX_STORE_H
|
||||||
|
|
||||||
|
#include <stdio.h>
|
||||||
#include "fix.h"
|
#include "fix.h"
|
||||||
|
|
||||||
namespace LAMMPS_NS {
|
namespace LAMMPS_NS {
|
||||||
@ -35,6 +36,9 @@ class FixStore : public Fix {
|
|||||||
~FixStore();
|
~FixStore();
|
||||||
int setmask();
|
int setmask();
|
||||||
|
|
||||||
|
void write_restart(FILE *);
|
||||||
|
void restart(char *);
|
||||||
|
|
||||||
void grow_arrays(int);
|
void grow_arrays(int);
|
||||||
void copy_arrays(int, int, int);
|
void copy_arrays(int, int, int);
|
||||||
int pack_exchange(int, double *);
|
int pack_exchange(int, double *);
|
||||||
|
|||||||
Reference in New Issue
Block a user