git-svn-id: svn://svn.icms.temple.edu/lammps-ro/trunk@8629 f3b2605a-c512-4ea7-a41b-209d697bcdaa

This commit is contained in:
sjplimp
2012-08-13 21:44:23 +00:00
parent 6618a2a19d
commit c98a5d4149
3 changed files with 7 additions and 6 deletions

View File

@ -99,10 +99,10 @@ int main(int narg, char **arg)
int natoms = lammps_get_natoms(ptr);
double *x = (double *) malloc(3*natoms*sizeof(double));
lammps_get_coords(ptr,x);
lammps_gather_atoms(lmp,"x",1,3,x);
double epsilon = 0.1;
x[0] += epsilon;
lammps_put_coords(ptr,x);
lammps_scatter_atoms(lmp,"x",1,3,x);
free(x);
lammps_command(ptr,"run 1");

View File

@ -23,6 +23,7 @@
#include "stdlib.h"
#include "string.h"
#include "mpi.h"
#include "lammps.h" // these are LAMMPS include files
#include "input.h"
#include "atom.h"
@ -104,10 +105,10 @@ int main(int narg, char **arg)
int natoms = static_cast<int> (lmp->atom->natoms);
double *x = new double[3*natoms];
lammps_get_coords(lmp,x); // no LAMMPS class function for this
lammps_gather_atoms(lmp,"x",1,3,x);
double epsilon = 0.1;
x[0] += epsilon;
lammps_put_coords(lmp,x); // no LAMMPS class function for this
lammps_scatter_atoms(lmp,"x",1,3,x);
delete [] x;
lmp->input->one("run 1");

View File

@ -115,9 +115,9 @@ PROGRAM f_driver
CALL lammps_get_natoms(ptr,natoms)
ALLOCATE(x(3*natoms))
CALL lammps_get_coords(ptr,x)
CALL lammps_gather_atoms(ptr,'x',1,3,x);
x(1) = x(1) + epsilon
CALL lammps_put_coords(ptr,x)
CALL lammps_scatter_atoms(ptr,'x',1,3,x);
DEALLOCATE(x)