void Compute_Forces( reax_system *system, control_params *control, simulation_data *data, storage *workspace, reax_list **lists, output_controls *out_control, mpi_datatypes *mpi_data ) { MPI_Comm comm; int qeq_flag; comm = mpi_data->world; qeq_flag = 0; if( qeq_flag ) Init_Forces( system, control, data, workspace, lists, out_control, comm ); else Init_Forces_noQEq( system, control, data, workspace, lists, out_control, comm ); /********* bonded interactions ************/ Compute_Bonded_Forces( system, control, data, workspace, lists, out_control, mpi_data->world ); /********* nonbonded interactions ************/ Compute_NonBonded_Forces( system, control, data, workspace, lists, out_control, mpi_data->world ); /*********** total force ***************/ Compute_Total_Force( system, control, data, workspace, lists, mpi_data ); }
void Compute_Forces(reax_system *system, control_params *control, simulation_data *data, static_storage *workspace, list** lists, output_controls *out_control) { real t_start, t_elapsed; t_start = Get_Time(); if (!control->tabulate) Init_Forces(system, control, data, workspace, lists, out_control); else Init_Forces_Tab(system, control, data, workspace, lists, out_control); t_elapsed = Get_Timing_Info(t_start); data->timing.init_forces += t_elapsed; #if defined(DEBUG_FOCUS) fprintf( stderr, "init_forces - "); #endif t_start = Get_Time(); Compute_Bonded_Forces(system, control, data, workspace, lists, out_control); t_elapsed = Get_Timing_Info(t_start); data->timing.bonded += t_elapsed; #if defined(DEBUG_FOCUS) fprintf( stderr, "bonded_forces - "); #endif t_start = Get_Time(); Compute_NonBonded_Forces(system, control, data, workspace, lists, out_control); t_elapsed = Get_Timing_Info(t_start); data->timing.nonb += t_elapsed; #if defined(DEBUG_FOCUS) fprintf( stderr, "nonbondeds - "); #endif Compute_Total_Force(system, control, data, workspace, lists); // implement amd simulation if (control->amd) { Compute_AMD_Force(system, control, data, workspace, lists); } if (control->bboost == 1) Compute_Bond_Boost_Force(system, control, data, workspace, lists, out_control); else if (control->bboost == 2) Compute_Bond_Boost_Force_All(system, control, data, workspace, lists, out_control); else if (control->bboost == 3) Compute_Bond_Boost_Force_All_Couple(system, control, data, workspace, lists, out_control); //Print_Total_Force( system, control, data, workspace, lists, out_control ); //Bias Potential //Bias_Spring(system, control, data, workspace, lists, out_control); if (control->bias_con_de) Bias_COn_Decompose(system, control, data, workspace, lists, out_control); else if (control->bias_con_com) Bias_COn_Combine(system, control, data, workspace, lists, out_control); if (control->bias_lj126 == 1) Bias_LJ_126(system, control, data, workspace, lists, out_control); if (control->bias_charge == 1) Bias_Charge(system, control, data, workspace, lists, out_control); #if defined(DEBUG_FOCUS) fprintf( stderr, "totalforces - "); //Print_Total_Force( system, control, data, workspace, lists, out_control ); #endif #ifdef TEST_FORCES Print_Total_Force( system, control, data, workspace, lists, out_control ); Compare_Total_Forces( system, control, data, workspace, lists, out_control ); #endif #if defined(DEBUG_FOCUS) fprintf( stderr, "forces - "); #endif }
void Compute_Forces( reax_system *system, control_params *control, simulation_data *data, storage *workspace, reax_list **lists, output_controls *out_control, mpi_datatypes *mpi_data ) { MPI_Comm comm; int qeq_flag; #if defined(LOG_PERFORMANCE) real t_start = 0; //MPI_Barrier( mpi_data->world ); if( system->my_rank == MASTER_NODE ) t_start = Get_Time( ); #endif comm = mpi_data->world; /********* init forces ************/ #if defined(PURE_REAX) if( control->qeq_freq && (data->step-data->prev_steps)%control->qeq_freq==0 ) qeq_flag = 1; else qeq_flag = 0; #elif defined(LAMMPS_REAX) qeq_flag = 0; #endif if( qeq_flag ) Init_Forces( system, control, data, workspace, lists, out_control, comm ); else Init_Forces_noQEq( system, control, data, workspace, lists, out_control, comm ); #if defined(LOG_PERFORMANCE) //MPI_Barrier( mpi_data->world ); if( system->my_rank == MASTER_NODE ) Update_Timing_Info( &t_start, &(data->timing.init_forces) ); #endif /********* bonded interactions ************/ Compute_Bonded_Forces( system, control, data, workspace, lists, out_control, mpi_data->world ); #if defined(LOG_PERFORMANCE) //MPI_Barrier( mpi_data->world ); if( system->my_rank == MASTER_NODE ) Update_Timing_Info( &t_start, &(data->timing.bonded) ); #endif #if defined(DEBUG_FOCUS) fprintf( stderr, "p%d @ step%d: completed bonded\n", system->my_rank, data->step ); MPI_Barrier( mpi_data->world ); #endif /**************** qeq ************************/ #if defined(PURE_REAX) if( qeq_flag ) QEq( system, control, data, workspace, out_control, mpi_data ); #if defined(LOG_PERFORMANCE) //MPI_Barrier( mpi_data->world ); if( system->my_rank == MASTER_NODE ) Update_Timing_Info( &t_start, &(data->timing.qEq) ); #endif #if defined(DEBUG_FOCUS) fprintf(stderr, "p%d @ step%d: qeq completed\n", system->my_rank, data->step); MPI_Barrier( mpi_data->world ); #endif #endif //PURE_REAX /********* nonbonded interactions ************/ Compute_NonBonded_Forces( system, control, data, workspace, lists, out_control, mpi_data->world ); #if defined(LOG_PERFORMANCE) //MPI_Barrier( mpi_data->world ); if( system->my_rank == MASTER_NODE ) Update_Timing_Info( &t_start, &(data->timing.nonb) ); #endif #if defined(DEBUG_FOCUS) fprintf( stderr, "p%d @ step%d: nonbonded forces completed\n", system->my_rank, data->step ); MPI_Barrier( mpi_data->world ); #endif /*********** total force ***************/ Compute_Total_Force( system, control, data, workspace, lists, mpi_data ); #if defined(LOG_PERFORMANCE) //MPI_Barrier( mpi_data->world ); if( system->my_rank == MASTER_NODE ) Update_Timing_Info( &t_start, &(data->timing.bonded) ); #endif #if defined(DEBUG_FOCUS) fprintf( stderr, "p%d @ step%d: total forces computed\n", system->my_rank, data->step ); //Print_Total_Force( system, data, workspace ); MPI_Barrier( mpi_data->world ); #endif #if defined(TEST_FORCES) Print_Force_Files( system, control, data, workspace, lists, out_control, mpi_data ); #endif }