Unverified Commit 95433356 authored by Axel Kohlmeyer's avatar Axel Kohlmeyer
Browse files

Merge branch 'master' into collected-small-changes

parents f4159ff5 605524ab
Loading
Loading
Loading
Loading
+33 −41
Original line number Diff line number Diff line
@@ -447,23 +447,23 @@ int PairReaxCKokkos<DeviceType>::Init_Lookup_Tables()
  num_atom_types = atom->ntypes;
  dr = control->nonb_cut / control->tabulate;
  h = (double*)
    smalloc( (control->tabulate+2) * sizeof(double), "lookup:h", world );
    smalloc( control->error_ptr, (control->tabulate+2) * sizeof(double), "lookup:h");
  fh = (double*)
    smalloc( (control->tabulate+2) * sizeof(double), "lookup:fh", world );
    smalloc( control->error_ptr, (control->tabulate+2) * sizeof(double), "lookup:fh");
  fvdw = (double*)
    smalloc( (control->tabulate+2) * sizeof(double), "lookup:fvdw", world );
    smalloc( control->error_ptr, (control->tabulate+2) * sizeof(double), "lookup:fvdw");
  fCEvd = (double*)
    smalloc( (control->tabulate+2) * sizeof(double), "lookup:fCEvd", world );
    smalloc( control->error_ptr, (control->tabulate+2) * sizeof(double), "lookup:fCEvd");
  fele = (double*)
    smalloc( (control->tabulate+2) * sizeof(double), "lookup:fele", world );
    smalloc( control->error_ptr, (control->tabulate+2) * sizeof(double), "lookup:fele");
  fCEclmb = (double*)
    smalloc( (control->tabulate+2) * sizeof(double), "lookup:fCEclmb", world );
    smalloc( control->error_ptr, (control->tabulate+2) * sizeof(double), "lookup:fCEclmb");

  LR = (LR_lookup_table**)
    scalloc( num_atom_types+1, sizeof(LR_lookup_table*), "lookup:LR", world );
    scalloc( control->error_ptr, num_atom_types+1, sizeof(LR_lookup_table*), "lookup:LR");
  for( i = 0; i < num_atom_types+1; ++i )
    LR[i] = (LR_lookup_table*)
      scalloc( num_atom_types+1, sizeof(LR_lookup_table), "lookup:LR[i]", world );
      scalloc( control->error_ptr, num_atom_types+1, sizeof(LR_lookup_table), "lookup:LR[i]");

  for( i = 1; i <= num_atom_types; ++i ) {
    for( j = i; j <= num_atom_types; ++j ) {
@@ -473,22 +473,18 @@ int PairReaxCKokkos<DeviceType>::Init_Lookup_Tables()
      LR[i][j].dx = dr;
      LR[i][j].inv_dx = control->tabulate / control->nonb_cut;
      LR[i][j].y = (LR_data*)
        smalloc( LR[i][j].n * sizeof(LR_data), "lookup:LR[i,j].y", world );
        smalloc( control->error_ptr, LR[i][j].n * sizeof(LR_data), "lookup:LR[i,j].y");
      LR[i][j].H = (cubic_spline_coef*)
        smalloc( LR[i][j].n*sizeof(cubic_spline_coef),"lookup:LR[i,j].H" ,
                 world );
        smalloc( control->error_ptr, LR[i][j].n*sizeof(cubic_spline_coef),"lookup:LR[i,j].H");
      LR[i][j].vdW = (cubic_spline_coef*)
        smalloc( LR[i][j].n*sizeof(cubic_spline_coef),"lookup:LR[i,j].vdW",
                 world);
        smalloc( control->error_ptr, LR[i][j].n*sizeof(cubic_spline_coef),"lookup:LR[i,j].vdW");
      LR[i][j].CEvd = (cubic_spline_coef*)
        smalloc( LR[i][j].n*sizeof(cubic_spline_coef),"lookup:LR[i,j].CEvd",
                 world);
        smalloc( control->error_ptr, LR[i][j].n*sizeof(cubic_spline_coef),"lookup:LR[i,j].CEvd");
      LR[i][j].ele = (cubic_spline_coef*)
        smalloc( LR[i][j].n*sizeof(cubic_spline_coef),"lookup:LR[i,j].ele",
                 world );
        smalloc( control->error_ptr, LR[i][j].n*sizeof(cubic_spline_coef),"lookup:LR[i,j].ele");
      LR[i][j].CEclmb = (cubic_spline_coef*)
        smalloc( LR[i][j].n*sizeof(cubic_spline_coef),
                 "lookup:LR[i,j].CEclmb", world );
        smalloc( control->error_ptr, LR[i][j].n*sizeof(cubic_spline_coef),
                 "lookup:LR[i,j].CEclmb");

      for( r = 1; r <= control->tabulate; ++r ) {
        LR_vdW_Coulomb(i, j, r * dr, &(LR[i][j].y[r]) );
@@ -512,24 +508,20 @@ int PairReaxCKokkos<DeviceType>::Init_Lookup_Tables()
      vlast_vdw = fCEvd[r-1];
      vlast_ele = fele[r-1];

      Natural_Cubic_Spline( &h[1], &fh[1],
                            &(LR[i][j].H[1]), control->tabulate+1, world );
      Natural_Cubic_Spline( control->error_ptr, &h[1], &fh[1],
                            &(LR[i][j].H[1]), control->tabulate+1 );

      Complete_Cubic_Spline( &h[1], &fvdw[1], v0_vdw, vlast_vdw,
                             &(LR[i][j].vdW[1]), control->tabulate+1,
                             world );
      Complete_Cubic_Spline( control->error_ptr, &h[1], &fvdw[1], v0_vdw, vlast_vdw,
                             &(LR[i][j].vdW[1]), control->tabulate+1 );

      Natural_Cubic_Spline( &h[1], &fCEvd[1],
                            &(LR[i][j].CEvd[1]), control->tabulate+1,
                            world );
      Natural_Cubic_Spline( control->error_ptr, &h[1], &fCEvd[1],
                            &(LR[i][j].CEvd[1]), control->tabulate+1 );

      Complete_Cubic_Spline( &h[1], &fele[1], v0_ele, vlast_ele,
                             &(LR[i][j].ele[1]), control->tabulate+1,
                             world );
      Complete_Cubic_Spline( control->error_ptr, &h[1], &fele[1], v0_ele, vlast_ele,
                             &(LR[i][j].ele[1]), control->tabulate+1 );

      Natural_Cubic_Spline( &h[1], &fCEclmb[1],
                            &(LR[i][j].CEclmb[1]), control->tabulate+1,
                            world );
      Natural_Cubic_Spline( control->error_ptr, &h[1], &fCEclmb[1],
                            &(LR[i][j].CEclmb[1]), control->tabulate+1 );
    }
  }
  free(h);
@@ -555,16 +547,16 @@ void PairReaxCKokkos<DeviceType>::Deallocate_Lookup_Tables()
  for( i = 0; i <= ntypes; ++i ) {
    for( j = i; j <= ntypes; ++j )
      if (LR[i][j].n) {
        sfree( LR[i][j].y, "LR[i,j].y" );
        sfree( LR[i][j].H, "LR[i,j].H" );
        sfree( LR[i][j].vdW, "LR[i,j].vdW" );
        sfree( LR[i][j].CEvd, "LR[i,j].CEvd" );
        sfree( LR[i][j].ele, "LR[i,j].ele" );
        sfree( LR[i][j].CEclmb, "LR[i,j].CEclmb" );
        sfree( control->error_ptr, LR[i][j].y, "LR[i,j].y" );
        sfree( control->error_ptr, LR[i][j].H, "LR[i,j].H" );
        sfree( control->error_ptr, LR[i][j].vdW, "LR[i,j].vdW" );
        sfree( control->error_ptr, LR[i][j].CEvd, "LR[i,j].CEvd" );
        sfree( control->error_ptr, LR[i][j].ele, "LR[i,j].ele" );
        sfree( control->error_ptr, LR[i][j].CEclmb, "LR[i,j].CEclmb" );
      }
    sfree( LR[i], "LR[i]" );
    sfree( control->error_ptr, LR[i], "LR[i]" );
  }
  sfree( LR, "LR" );
  sfree( control->error_ptr, LR, "LR" );
}

/* ---------------------------------------------------------------------- */
+4 −4
Original line number Diff line number Diff line
@@ -637,14 +637,14 @@ void FixPIMD::comm_exec(double **ptr)
    if(nsend > max_nsend)
    {
      max_nsend = nsend+200;
      tag_send = (int*) memory->srealloc(tag_send, sizeof(int)*max_nsend, "FixPIMD:tag_send");
      tag_send = (tagint*) memory->srealloc(tag_send, sizeof(tagint)*max_nsend, "FixPIMD:tag_send");
      buf_send = (double*) memory->srealloc(buf_send, sizeof(double)*max_nsend*3, "FixPIMD:x_send");
    }

    // send tags

    MPI_Sendrecv( atom->tag, nlocal, MPI_INT, plan_send[iplan], 0,
                  tag_send,  nsend,  MPI_INT, plan_recv[iplan], 0, universe->uworld, MPI_STATUS_IGNORE);
    MPI_Sendrecv( atom->tag, nlocal, MPI_LMP_TAGINT, plan_send[iplan], 0,
                  tag_send,  nsend,  MPI_LMP_TAGINT, plan_recv[iplan], 0, universe->uworld, MPI_STATUS_IGNORE);

    // wrap positions

+1 −1
Original line number Diff line number Diff line
@@ -68,7 +68,7 @@ class FixPIMD : public Fix {
  /* inter-partition communication */

  int max_nsend;
  int* tag_send;
  tagint* tag_send;
  double *buf_send;

  int max_nlocal;
+5 −5
Original line number Diff line number Diff line
@@ -113,7 +113,7 @@ PairReaxCOMP::~PairReaxCOMP()
  if (setup_flag) {
    reax_list * bonds = lists+BONDS;
    for (int i=0; i<bonds->num_intrs; ++i)
      sfree(bonds->select.bond_list[i].bo_data.CdboReduction, "CdboReduction");
      sfree(error, bonds->select.bond_list[i].bo_data.CdboReduction, "CdboReduction");
  }
  memory->destroy(num_nbrs_offset);

@@ -209,7 +209,7 @@ void PairReaxCOMP::compute(int eflag, int vflag)

  setup();

  Reset( system, control, data, workspace, &lists, world );
  Reset( system, control, data, workspace, &lists );

  // Why not update workspace like in MPI-only code?
  // Using the MPI-only way messes up the hb energy
@@ -410,12 +410,12 @@ void PairReaxCOMP::setup( )

    // initialize my data structures

    PreAllocate_Space( system, control, workspace, world );
    PreAllocate_Space( system, control, workspace );
    write_reax_atoms();

    int num_nbrs = estimate_reax_lists();
    if(!Make_List(system->total_cap, num_nbrs, TYP_FAR_NEIGHBOR,
                  lists+FAR_NBRS, world))
                  lists+FAR_NBRS))
      error->all(FLERR,"Pair reax/c problem in far neighbor list");

    write_reax_lists();
@@ -445,7 +445,7 @@ void PairReaxCOMP::setup( )

    // check if I need to shrink/extend my data-structs

    ReAllocate( system, control, data, workspace, &lists, mpi_data );
    ReAllocate( system, control, data, workspace, &lists );
  }
}

+7 −5
Original line number Diff line number Diff line
@@ -289,9 +289,10 @@ void Validate_ListsOMP( reax_system *system, storage * /*workspace */, reax_list
      else comp = bonds->num_intrs;

      if (End_Index(i, bonds) > comp) {
        fprintf( stderr, "step%d-bondchk failed: i=%d end(i)=%d str(i+1)=%d\n",
        char errmsg[256];
        snprintf(errmsg, 256, "step%d-bondchk failed: i=%d end(i)=%d str(i+1)=%d\n",
                  step, i, End_Index(i,bonds), comp );
        MPI_Abort( comm, INSUFFICIENT_MEMORY );
        system->error_ptr->one(FLERR,errmsg);
      }
    }
  }
@@ -315,9 +316,10 @@ void Validate_ListsOMP( reax_system *system, storage * /*workspace */, reax_list
        else comp = hbonds->num_intrs;

        if (End_Index(Hindex, hbonds) > comp) {
          fprintf(stderr,"step%d-hbondchk failed: H=%d end(H)=%d str(H+1)=%d\n",
          char errmsg[256];
          snprintf(errmsg, 256, "step%d-hbondchk failed: H=%d end(H)=%d str(H+1)=%d\n",
                  step, Hindex, End_Index(Hindex,hbonds), comp );
          MPI_Abort( comm, INSUFFICIENT_MEMORY );
          system->error_ptr->one(FLERR, errmsg);
        }
      }
    }
Loading