Commit 111ff447 authored by mkanski's avatar mkanski
Browse files

Pointer moved to reax lists

parent 3a4bb6f9
Loading
Loading
Loading
Loading
+12 −9
Original line number Diff line number Diff line
@@ -108,6 +108,8 @@ PairReaxC::PairReaxC(LAMMPS *lmp) : Pair(lmp)
  system->bndry_cuts.ghost_cutoff = 0;
  system->my_atoms = NULL;
  system->pair_ptr = this;
  system->error_ptr = this->lmp->error;
  control->error_ptr = this->lmp->error;

  system->omp_active = 0;

@@ -139,13 +141,13 @@ PairReaxC::~PairReaxC()

    if (control->tabulate ) Deallocate_Lookup_Tables( lmp, system);

    if (control->hbond_cut > 0 )  Delete_List( lmp, lists+HBONDS, world);
    Delete_List( lmp, lists+BONDS, world );
    Delete_List( lmp, lists+THREE_BODIES, world );
    Delete_List( lmp, lists+FAR_NBRS, world );
    if (control->hbond_cut > 0 )  Delete_List( lists+HBONDS, world);
    Delete_List( lists+BONDS, world );
    Delete_List( lists+THREE_BODIES, world );
    Delete_List( lists+FAR_NBRS, world );

    DeAllocate_Workspace( lmp, control, workspace );
    DeAllocate_System( lmp, system );
    DeAllocate_Workspace( control, workspace );
    DeAllocate_System( system );
  }

  memory->destroy( system );
@@ -437,13 +439,14 @@ void PairReaxC::setup( )

    // initialize my data structures

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

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

    write_reax_lists();
    Initialize( lmp, system, control, data, workspace, &lists, out_control,
@@ -466,7 +469,7 @@ void PairReaxC::setup( )

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

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

  bigint local_ngroup = list->inum;
+158 −158

File changed.

Preview size limit exceeded, changes collapsed.

+5 −5
Original line number Diff line number Diff line
@@ -33,15 +33,15 @@
#include "error.h"
using namespace LAMMPS_NS;

int  PreAllocate_Space( LAMMPS_NS::LAMMPS*, reax_system*, control_params*, storage*, MPI_Comm );
int  PreAllocate_Space( reax_system*, control_params*, storage*, MPI_Comm );

int  Allocate_System( reax_system*, int, int, char* );
void DeAllocate_System( LAMMPS_NS::LAMMPS*, reax_system* );
void DeAllocate_System( reax_system* );

int  Allocate_Workspace( LAMMPS_NS::LAMMPS*, reax_system*, control_params*, storage*,
int  Allocate_Workspace( reax_system*, control_params*, storage*,
                         int, int, MPI_Comm, char* );
void DeAllocate_Workspace( LAMMPS_NS::LAMMPS*, control_params*, storage* );
void DeAllocate_Workspace( control_params*, storage* );

void ReAllocate( LAMMPS *lmp, reax_system*, control_params*, simulation_data*, storage*,
void ReAllocate( reax_system*, control_params*, simulation_data*, storage*,
                 reax_list**, mpi_datatypes* );
#endif
+17 −17
Original line number Diff line number Diff line
@@ -99,54 +99,54 @@ char Read_Force_Field( LAMMPS_NS::LAMMPS* lmp, FILE *fp, reax_interaction *reax,

  /* Allocating structures in reax_interaction */
  reax->sbp = (single_body_parameters*)
    scalloc(lmp,  reax->num_atom_types, sizeof(single_body_parameters), "sbp",
    scalloc(lmp->error,  reax->num_atom_types, sizeof(single_body_parameters), "sbp",
             comm );
  reax->tbp = (two_body_parameters**)
    scalloc(lmp,  reax->num_atom_types, sizeof(two_body_parameters*), "tbp", comm );
    scalloc(lmp->error,  reax->num_atom_types, sizeof(two_body_parameters*), "tbp", comm );
  reax->thbp= (three_body_header***)
    scalloc(lmp,  reax->num_atom_types, sizeof(three_body_header**), "thbp", comm );
    scalloc(lmp->error,  reax->num_atom_types, sizeof(three_body_header**), "thbp", comm );
  reax->hbp = (hbond_parameters***)
    scalloc(lmp,  reax->num_atom_types, sizeof(hbond_parameters**), "hbp", comm );
    scalloc(lmp->error,  reax->num_atom_types, sizeof(hbond_parameters**), "hbp", comm );
  reax->fbp = (four_body_header****)
    scalloc(lmp,  reax->num_atom_types, sizeof(four_body_header***), "fbp", comm );
    scalloc(lmp->error,  reax->num_atom_types, sizeof(four_body_header***), "fbp", comm );
  tor_flag  = (char****)
    scalloc(lmp,  reax->num_atom_types, sizeof(char***), "tor_flag", comm );
    scalloc(lmp->error,  reax->num_atom_types, sizeof(char***), "tor_flag", comm );

  for( i = 0; i < reax->num_atom_types; i++ ) {
    reax->tbp[i] = (two_body_parameters*)
      scalloc(lmp,  reax->num_atom_types, sizeof(two_body_parameters), "tbp[i]",
      scalloc(lmp->error,  reax->num_atom_types, sizeof(two_body_parameters), "tbp[i]",
               comm );
    reax->thbp[i]= (three_body_header**)
      scalloc(lmp,  reax->num_atom_types, sizeof(three_body_header*), "thbp[i]",
      scalloc(lmp->error,  reax->num_atom_types, sizeof(three_body_header*), "thbp[i]",
               comm );
    reax->hbp[i] = (hbond_parameters**)
      scalloc(lmp,  reax->num_atom_types, sizeof(hbond_parameters*), "hbp[i]",
      scalloc(lmp->error,  reax->num_atom_types, sizeof(hbond_parameters*), "hbp[i]",
               comm );
    reax->fbp[i] = (four_body_header***)
      scalloc(lmp,  reax->num_atom_types, sizeof(four_body_header**), "fbp[i]",
      scalloc(lmp->error,  reax->num_atom_types, sizeof(four_body_header**), "fbp[i]",
               comm );
    tor_flag[i]  = (char***)
      scalloc(lmp,  reax->num_atom_types, sizeof(char**), "tor_flag[i]", comm );
      scalloc(lmp->error,  reax->num_atom_types, sizeof(char**), "tor_flag[i]", comm );

    for( j = 0; j < reax->num_atom_types; j++ ) {
      reax->thbp[i][j]= (three_body_header*)
        scalloc(lmp,  reax->num_atom_types, sizeof(three_body_header), "thbp[i,j]",
        scalloc(lmp->error,  reax->num_atom_types, sizeof(three_body_header), "thbp[i,j]",
                 comm );
      reax->hbp[i][j] = (hbond_parameters*)
        scalloc(lmp,  reax->num_atom_types, sizeof(hbond_parameters), "hbp[i,j]",
        scalloc(lmp->error,  reax->num_atom_types, sizeof(hbond_parameters), "hbp[i,j]",
                 comm );
      reax->fbp[i][j] = (four_body_header**)
        scalloc(lmp,  reax->num_atom_types, sizeof(four_body_header*), "fbp[i,j]",
        scalloc(lmp->error,  reax->num_atom_types, sizeof(four_body_header*), "fbp[i,j]",
                 comm );
      tor_flag[i][j]  = (char**)
        scalloc(lmp,  reax->num_atom_types, sizeof(char*), "tor_flag[i,j]", comm );
        scalloc(lmp->error,  reax->num_atom_types, sizeof(char*), "tor_flag[i,j]", comm );

      for (k=0; k < reax->num_atom_types; k++) {
        reax->fbp[i][j][k] = (four_body_header*)
          scalloc(lmp,  reax->num_atom_types, sizeof(four_body_header), "fbp[i,j,k]",
          scalloc(lmp->error,  reax->num_atom_types, sizeof(four_body_header), "fbp[i,j,k]",
                   comm );
        tor_flag[i][j][k]  = (char*)
          scalloc(lmp,  reax->num_atom_types, sizeof(char), "tor_flag[i,j,k]",
          scalloc(lmp->error,  reax->num_atom_types, sizeof(char), "tor_flag[i,j,k]",
                   comm );
      }
    }
+7 −4
Original line number Diff line number Diff line
@@ -127,7 +127,7 @@ int Init_Workspace( LAMMPS_NS::LAMMPS* lmp, reax_system *system, control_params
{
  int ret;

  ret = Allocate_Workspace( lmp, system, control, workspace,
  ret = Allocate_Workspace( system, control, workspace,
                            system->local_cap, system->total_cap, comm, msg );
  if (ret != SUCCESS)
    return ret;
@@ -181,10 +181,11 @@ int Init_Lists( LAMMPS *lmp, reax_system *system, control_params *control,
    }
    total_hbonds = (int)(MAX( total_hbonds*saferzone, mincap*MIN_HBONDS ));

    if( !Make_List( lmp, system->Hcap, total_hbonds, TYP_HBOND,
    if( !Make_List( system->Hcap, total_hbonds, TYP_HBOND,
                    *lists+HBONDS, comm ) ) {
      lmp->error->one(FLERR, "Not enough space for hbonds list.");
    }
    (*lists+HBONDS)->error_ptr = system->error_ptr;
  }

  total_bonds = 0;
@@ -194,17 +195,19 @@ int Init_Lists( LAMMPS *lmp, reax_system *system, control_params *control,
  }
  bond_cap = (int)(MAX( total_bonds*safezone, mincap*MIN_BONDS ));

  if( !Make_List( lmp, system->total_cap, bond_cap, TYP_BOND,
  if( !Make_List( system->total_cap, bond_cap, TYP_BOND,
                  *lists+BONDS, comm ) ) {
    lmp->error->one(FLERR, "Not enough space for bonds list.");
  }
  (*lists+BONDS)->error_ptr = system->error_ptr;

  /* 3bodies list */
  cap_3body = (int)(MAX( num_3body*safezone, MIN_3BODIES ));
  if( !Make_List( lmp, bond_cap, cap_3body, TYP_THREE_BODY,
  if( !Make_List( bond_cap, cap_3body, TYP_THREE_BODY,
                  *lists+THREE_BODIES, comm ) ){
    lmp->error->one(FLERR,"Problem in initializing angles list.");
  }
  (*lists+THREE_BODIES)->error_ptr = system->error_ptr;

  free( hb_top );
  free( bond_top );
Loading