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

« back to all changes in this revision

Viewing changes to src/GRANULAR/pair_gran_hooke_history.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:
45
45
  no_virial_fdotr_compute = 1;
46
46
  history = 1;
47
47
  fix_history = NULL;
48
 
  suffix = NULL;
49
48
 
50
49
  single_extra = 4;
51
50
  svector = new double[4];
52
51
 
53
 
  computeflag = 0;
54
52
  neighprev = 0;
55
53
 
56
54
  nmax = 0;
67
65
{
68
66
  delete [] svector;
69
67
  if (fix_history) modify->delete_fix("SHEAR_HISTORY");
70
 
  if (suffix) delete[] suffix;
71
68
 
72
69
  if (allocated) {
73
70
    memory->destroy(setflag);
102
99
  if (eflag || vflag) ev_setup(eflag,vflag);
103
100
  else evflag = vflag_fdotr = 0;
104
101
 
105
 
  computeflag = 1;
106
102
  int shearupdate = 1;
107
103
  if (update->setupflag) shearupdate = 0;
108
104
 
410
406
 
411
407
  // need a granular neigh list and optionally a granular history neigh list
412
408
 
413
 
  int irequest = neighbor->request(this);
 
409
  int irequest = neighbor->request(this,instance_me);
414
410
  neighbor->requests[irequest]->half = 0;
415
411
  neighbor->requests[irequest]->gran = 1;
416
412
  if (history) {
417
 
    irequest = neighbor->request(this);
 
413
    irequest = neighbor->request(this,instance_me);
418
414
    neighbor->requests[irequest]->id = 1;
419
415
    neighbor->requests[irequest]->half = 0;
420
416
    neighbor->requests[irequest]->granhistory = 1;
436
432
    fixarg[0] = (char *) "SHEAR_HISTORY";
437
433
    fixarg[1] = (char *) "all";
438
434
    fixarg[2] = (char *) "SHEAR_HISTORY";
439
 
    modify->add_fix(3,fixarg,suffix);
 
435
    modify->add_fix(3,fixarg,1);
440
436
    delete [] fixarg;
441
437
    fix_history = (FixShearHistory *) modify->fix[modify->nfix-1];
442
438
    fix_history->pair = this;
713
709
  // reset neighprev to 0 as necessary
714
710
 
715
711
  int jnum = list->numneigh[i];
716
 
  int *touch = list->listgranhistory->firstneigh[i];
 
712
  int *jlist = list->firstneigh[i];
717
713
  double *allshear = list->listgranhistory->firstdouble[i];
718
714
 
719
715
  for (int jj = 0; jj < jnum; jj++) {
720
716
    neighprev++;
721
717
    if (neighprev >= jnum) neighprev = 0;
722
 
    if (touch[neighprev] == j) break;
 
718
    if (jlist[neighprev] == j) break;
723
719
  }
724
720
 
725
721
  double *shear = &allshear[3*neighprev];
763
759
 
764
760
/* ---------------------------------------------------------------------- */
765
761
 
766
 
int PairGranHookeHistory::pack_comm(int n, int *list,
767
 
                                    double *buf, int pbc_flag, int *pbc)
 
762
int PairGranHookeHistory::pack_forward_comm(int n, int *list, double *buf, 
 
763
                                            int pbc_flag, int *pbc)
768
764
{
769
765
  int i,j,m;
770
766
 
773
769
    j = list[i];
774
770
    buf[m++] = mass_rigid[j];
775
771
  }
776
 
  return 1;
 
772
  return m;
777
773
}
778
774
 
779
775
/* ---------------------------------------------------------------------- */
780
776
 
781
 
void PairGranHookeHistory::unpack_comm(int n, int first, double *buf)
 
777
void PairGranHookeHistory::unpack_forward_comm(int n, int first, double *buf)
782
778
{
783
779
  int i,m,last;
784
780
 
788
784
    mass_rigid[i] = buf[m++];
789
785
}
790
786
 
791
 
/* ---------------------------------------------------------------------- */
792
 
 
793
 
void *PairGranHookeHistory::extract(const char *str, int &dim)
794
 
{
795
 
  dim = 0;
796
 
  if (strcmp(str,"computeflag") == 0) return (void *) &computeflag;
797
 
  return NULL;
798
 
}
799
 
 
800
787
/* ----------------------------------------------------------------------
801
788
   memory usage of local atom-based arrays
802
789
------------------------------------------------------------------------- */