~ubuntu-branches/debian/sid/lammps/sid

« back to all changes in this revision

Viewing changes to src/USER-SPH/atom_vec_meso.cpp

  • Committer: Package Import Robot
  • Author(s): Anton Gladky
  • Date: 2015-04-29 23:44:49 UTC
  • mfrom: (5.1.3 experimental)
  • Revision ID: package-import@ubuntu.com-20150429234449-mbhy9utku6hp6oq8
Tags: 0~20150313.gitfa668e1-1
Upload into unstable.

Show diffs side-by-side

added added

removed removed

Lines of Context:
11
11
 See the README file in the top-level LAMMPS directory.
12
12
 ------------------------------------------------------------------------- */
13
13
 
 
14
#include "string.h"
14
15
#include "stdlib.h"
15
16
#include "atom_vec_meso.h"
16
17
#include "atom.h"
29
30
{
30
31
  molecular = 0;
31
32
  mass_type = 1;
 
33
  forceclearflag = 1;
32
34
 
33
35
  comm_x_only = 0; // we communicate not only x forward but also vest ...
34
36
  comm_f_only = 0; // we also communicate de and drho in reverse direction
131
133
 
132
134
/* ---------------------------------------------------------------------- */
133
135
 
 
136
void AtomVecMeso::force_clear(int n, size_t nbytes)
 
137
{
 
138
  memset(&de[n],0,nbytes);
 
139
  memset(&drho[n],0,nbytes);
 
140
}
 
141
 
 
142
/* ---------------------------------------------------------------------- */
 
143
 
134
144
int AtomVecMeso::pack_comm_hybrid(int n, int *list, double *buf) {
135
145
  //printf("in AtomVecMeso::pack_comm_hybrid\n");
136
146
  int i, j, m;
934
944
}
935
945
 
936
946
/* ----------------------------------------------------------------------
 
947
   assign an index to named atom property and return index
 
948
   return -1 if name is unknown to this atom style
 
949
------------------------------------------------------------------------- */
 
950
 
 
951
int AtomVecMeso::property_atom(char *name)
 
952
{
 
953
  if (strcmp(name,"rho") == 0) return 0;
 
954
  if (strcmp(name,"drho") == 0) return 1;
 
955
  if (strcmp(name,"e") == 0) return 2;
 
956
  if (strcmp(name,"de") == 0) return 3;
 
957
  if (strcmp(name,"cv") == 0) return 4;
 
958
  return -1;
 
959
}
 
960
 
 
961
/* ----------------------------------------------------------------------
 
962
   pack per-atom data into buf for ComputePropertyAtom
 
963
   index maps to data specific to this atom style
 
964
------------------------------------------------------------------------- */
 
965
 
 
966
void AtomVecMeso::pack_property_atom(int index, double *buf, 
 
967
                                     int nvalues, int groupbit)
 
968
{
 
969
  int *mask = atom->mask;
 
970
  int nlocal = atom->nlocal;
 
971
  int n = 0;
 
972
 
 
973
  if (index == 0) {
 
974
    for (int i = 0; i < nlocal; i++) {
 
975
      if (mask[i] & groupbit) buf[n] = rho[i];
 
976
      else buf[n] = 0.0;
 
977
      n += nvalues;
 
978
    }
 
979
  } else if (index == 1) {
 
980
    for (int i = 0; i < nlocal; i++) {
 
981
      if (mask[i] & groupbit) buf[n] = drho[i];
 
982
      else buf[n] = 0.0;
 
983
      n += nvalues;
 
984
    }
 
985
  } else if (index == 2) {
 
986
    for (int i = 0; i < nlocal; i++) {
 
987
      if (mask[i] & groupbit) buf[n] = e[i];
 
988
      else buf[n] = 0.0;
 
989
      n += nvalues;
 
990
    }
 
991
  } else if (index == 3) {
 
992
    for (int i = 0; i < nlocal; i++) {
 
993
      if (mask[i] & groupbit) buf[n] = de[i];
 
994
      else buf[n] = 0.0;
 
995
      n += nvalues;
 
996
    }
 
997
  } else if (index == 4) {
 
998
    for (int i = 0; i < nlocal; i++) {
 
999
      if (mask[i] & groupbit) buf[n] = cv[i];
 
1000
      else buf[n] = 0.0;
 
1001
      n += nvalues;
 
1002
    }
 
1003
  }
 
1004
}
 
1005
 
 
1006
/* ----------------------------------------------------------------------
937
1007
   return # of bytes of allocated memory
938
1008
   ------------------------------------------------------------------------- */
939
1009