repo: TuckermanGroup/PINY

original_code:
void coef_force_tau_fun_hybrid(CPEWALD *cpewald,int nstate,
                               double *creal,double *cimag,
                               double *fcreal,double *fcimag,
                               double *cre_scr,double *cim_scr,
                               double *zfft,double *zfft_tmp,
                               double *v_ks_tau,double *ak2_sm,
                               double *pvten_cp,
                               int cp_ptens_calc,double *hmati,
                               COMMUNICATE *communicate,
                               int icoef_form,int icoef_orth,int ifcoef_form,
                               PARA_FFT_PKG3D *cp_sclr_fft_pkg3d_sm)
{
  int MPI_INT = 1;
  int MPI_DOUBLE = 1;
  int MPI_CHAR = 1;
  int MPI_MAX = 1;
  int MPI_SUM = 1;
  int MPI_ANY_TAG = 1;
  int MPI_ANY_SOURCE = 1;
  int *MPI_BOTTOM = {0};
   int is,i,iupper,component;
   double tpi;
   double aka,akb,akc,gk,cfact;
   double eke;
   int ioff,ncoef1,ioff2;
   int iii,iis,iis2,nis;
   int nfft = cp_sclr_fft_pkg3d_sm->nfft;
   int ncoef = cp_sclr_fft_pkg3d_sm->ncoef;
   int myid_state = communicate->myid_state;
   int np_states = communicate->np_states;
   int *kastore_sm = cpewald->kastr_sm;
   int *kbstore_sm = cpewald->kbstr_sm;
   int *kcstore_sm = cpewald->kcstr_sm;
  if(icoef_orth!=1){
    printf("@@@@@@@@@@@@@@@@@@@@_ERROR_@@@@@@@@@@@@@@@@@@@@\n");
    printf("The coefficients must be in orthogonal form    \n");
    printf("on state processor %d in coef_force_calc_hybrid\n",myid_state);
    printf("@@@@@@@@@@@@@@@@@@@@_ERROR_@@@@@@@@@@@@@@@@@@@@\n");
    fflush(stdout);exit(1);
  }
  if(np_states>1)
   if( ifcoef_form==1 || icoef_form == 1){
    printf("@@@@@@@@@@@@@@@@@@@@_ERROR_@@@@@@@@@@@@@@@@@@@@\n");
    printf("The coefs/coef forces must be in normal (not transposed) \n");
    printf("form on state processor %d in coef_force_calc_hybrid  \n",
           myid_state);
    printf("@@@@@@@@@@@@@@@@@@@@_ERROR_@@@@@@@@@@@@@@@@@@@@\n");
    fflush(stdout);exit(1);
  }
  tpi = 2.0*3.14159265358979323846;
  ncoef1 = ncoef - 1;
  iupper = nstate;
  if(nstate % 2 == 1){
     iupper = nstate - 1;
  }
 for(component = 1; component <= 3; component++){
  get_igcoef_hybrid(creal,cimag,cre_scr,cim_scr,cpewald,hmati,
                    nstate,ncoef,component);
  for(is = 1; is <= iupper; is = is + 2){
     ioff = (is-1)*ncoef;
     ioff2 = (is)*ncoef;
     dble_pack_coef(&cre_scr[ioff],&cim_scr[ioff],&cre_scr[ioff2],&cim_scr[ioff2],
                    zfft,cp_sclr_fft_pkg3d_sm);
     para_fft_gen3d_fwd_to_r(zfft,zfft_tmp,cp_sclr_fft_pkg3d_sm);
    cp_vpsi(zfft,v_ks_tau,nfft);
    para_fft_gen3d_bck_to_g(zfft,zfft_tmp,cp_sclr_fft_pkg3d_sm);
    dble_upack_coef(&cre_scr[ioff],&cim_scr[ioff],
                    &cre_scr[ioff2],&cim_scr[ioff2],
                    zfft,cp_sclr_fft_pkg3d_sm);
    for(i=1; i<= ncoef1; i++){
       aka = (double)kastore_sm[i];
       akb = (double)kbstore_sm[i];
       akc = (double)kcstore_sm[i];
       if(component==1) gk = (aka*hmati[1] +akb*hmati[2] +akc*hmati[3])*tpi;
       if(component==2) gk = (aka*hmati[4] +akb*hmati[5] +akc*hmati[6])*tpi;
       if(component==3) gk = (aka*hmati[7] +akb*hmati[8] +akc*hmati[9])*tpi;
       iis = ioff + i;
       iis2 = ioff2 + i;
       fcreal[iis] += 4.0*gk*cim_scr[iis];
       fcimag[iis] -= 4.0*gk*cre_scr[iis];
       fcreal[iis2] += 4.0*gk*cim_scr[iis2];
       fcimag[iis2] -= 4.0*gk*cre_scr[iis2];
    }
  }
  if((nstate % 2 ) != 0) {
     ioff = (nstate-1)*ncoef;
     sngl_pack_coef(&cre_scr[ioff],&cim_scr[ioff],zfft,cp_sclr_fft_pkg3d_sm);
     para_fft_gen3d_fwd_to_r(zfft,zfft_tmp,cp_sclr_fft_pkg3d_sm);
    cp_vpsi(zfft,v_ks_tau,nfft);
      para_fft_gen3d_bck_to_g(zfft,zfft_tmp,cp_sclr_fft_pkg3d_sm);
      sngl_upack_coef(&cre_scr[ioff],&cim_scr[ioff],zfft,cp_sclr_fft_pkg3d_sm);
    for(i=1; i<= ncoef1; i++){
       aka = (double)kastore_sm[i];
       akb = (double)kbstore_sm[i];
       akc = (double)kcstore_sm[i];
       if(component==1) gk = (aka*hmati[1] +akb*hmati[2] +akc*hmati[3])*tpi;
       if(component==2) gk = (aka*hmati[4] +akb*hmati[5] +akc*hmati[6])*tpi;
       if(component==3) gk = (aka*hmati[7] +akb*hmati[8] +akc*hmati[9])*tpi;
       iis = ioff+i;
       fcreal[iis] += 4.0*gk*cim_scr[iis];
       fcimag[iis] -= 4.0*gk*cre_scr[iis];
    }
   }
  }
 }

canonical_original_code:
void coef_force_tau_fun_hybrid(struct cpewald *cpewald, int nstate, double *creal, double *cimag, double *fcreal, double *fcimag, double *cre_scr, double *cim_scr, double *zfft, double *zfft_tmp, double *v_ks_tau, double *ak2_sm, double *pvten_cp, int cp_ptens_calc, double *hmati, struct communicate *communicate, int icoef_form, int icoef_orth, int ifcoef_form, struct para_fft_pkg3d *cp_sclr_fft_pkg3d_sm)
{
  int MPI_INT = 1;
  int MPI_DOUBLE = 1;
  int MPI_CHAR = 1;
  int MPI_MAX = 1;
  int MPI_SUM = 1;
  int MPI_ANY_TAG = 1;
  int MPI_ANY_SOURCE = 1;
  int *MPI_BOTTOM = {0};
   int is; int i; int iupper; int component;
   double tpi;
   double aka; double akb; double akc; double gk; double cfact;
   double eke;
   int ioff; int ncoef1; int ioff2;
   int iii; int iis; int iis2; int nis;
   int nfft = cp_sclr_fft_pkg3d_sm->nfft;
   int ncoef = cp_sclr_fft_pkg3d_sm->ncoef;
   int myid_state = communicate->myid_state;
   int np_states = communicate->np_states;
   int *kastore_sm = cpewald->kastr_sm;
   int *kbstore_sm = cpewald->kbstr_sm;
   int *kcstore_sm = cpewald->kcstr_sm;
  if(icoef_orth!=1){
    printf("@@@@@@@@@@@@@@@@@@@@_ERROR_@@@@@@@@@@@@@@@@@@@@\n");
    printf("The coefficients must be in orthogonal form    \n");
    printf("on state processor %d in coef_force_calc_hybrid\n",myid_state);
    printf("@@@@@@@@@@@@@@@@@@@@_ERROR_@@@@@@@@@@@@@@@@@@@@\n");
    fflush(stdout);exit(1);
  }
  if(np_states>1)
   if( ifcoef_form==1 || icoef_form == 1){
    printf("@@@@@@@@@@@@@@@@@@@@_ERROR_@@@@@@@@@@@@@@@@@@@@\n");
    printf("The coefs/coef forces must be in normal (not transposed) \n");
    printf("form on state processor %d in coef_force_calc_hybrid  \n",
           myid_state);
    printf("@@@@@@@@@@@@@@@@@@@@_ERROR_@@@@@@@@@@@@@@@@@@@@\n");
    fflush(stdout);exit(1);
  }
  tpi = 2.0*3.14159265358979323846;
  ncoef1 = ncoef - 1;
  iupper = nstate;
  if(nstate % 2 == 1){
     iupper = nstate - 1;
  }
 for(component = 1; component <= 3; component++){
  get_igcoef_hybrid(creal,cimag,cre_scr,cim_scr,cpewald,hmati,
                    nstate,ncoef,component);
  for(is = 1; is <= iupper; is = is + 2){
     ioff = (is-1)*ncoef;
     ioff2 = (is)*ncoef;
     dble_pack_coef(&cre_scr[ioff],&cim_scr[ioff],&cre_scr[ioff2],&cim_scr[ioff2],
                    zfft,cp_sclr_fft_pkg3d_sm);
     para_fft_gen3d_fwd_to_r(zfft,zfft_tmp,cp_sclr_fft_pkg3d_sm);
    cp_vpsi(zfft,v_ks_tau,nfft);
    para_fft_gen3d_bck_to_g(zfft,zfft_tmp,cp_sclr_fft_pkg3d_sm);
    dble_upack_coef(&cre_scr[ioff],&cim_scr[ioff],
                    &cre_scr[ioff2],&cim_scr[ioff2],
                    zfft,cp_sclr_fft_pkg3d_sm);
    for(i=1; i<= ncoef1; i++){
       aka = (double)kastore_sm[i];
       akb = (double)kbstore_sm[i];
       akc = (double)kcstore_sm[i];
       if(component==1) gk = (aka*hmati[1] +akb*hmati[2] +akc*hmati[3])*tpi;
       if(component==2) gk = (aka*hmati[4] +akb*hmati[5] +akc*hmati[6])*tpi;
       if(component==3) gk = (aka*hmati[7] +akb*hmati[8] +akc*hmati[9])*tpi;
       iis = ioff + i;
       iis2 = ioff2 + i;
       fcreal[iis] += 4.0*gk*cim_scr[iis];
       fcimag[iis] -= 4.0*gk*cre_scr[iis];
       fcreal[iis2] += 4.0*gk*cim_scr[iis2];
       fcimag[iis2] -= 4.0*gk*cre_scr[iis2];
    }
  }
  if((nstate % 2 ) != 0) {
     ioff = (nstate-1)*ncoef;
     sngl_pack_coef(&cre_scr[ioff],&cim_scr[ioff],zfft,cp_sclr_fft_pkg3d_sm);
     para_fft_gen3d_fwd_to_r(zfft,zfft_tmp,cp_sclr_fft_pkg3d_sm);
    cp_vpsi(zfft,v_ks_tau,nfft);
      para_fft_gen3d_bck_to_g(zfft,zfft_tmp,cp_sclr_fft_pkg3d_sm);
      sngl_upack_coef(&cre_scr[ioff],&cim_scr[ioff],zfft,cp_sclr_fft_pkg3d_sm);
    for(i=1; i<= ncoef1; i++){
       aka = (double)kastore_sm[i];
       akb = (double)kbstore_sm[i];
       akc = (double)kcstore_sm[i];
       if(component==1) gk = (aka*hmati[1] +akb*hmati[2] +akc*hmati[3])*tpi;
       if(component==2) gk = (aka*hmati[4] +akb*hmati[5] +akc*hmati[6])*tpi;
       if(component==3) gk = (aka*hmati[7] +akb*hmati[8] +akc*hmati[9])*tpi;
       iis = ioff+i;
       fcreal[iis] += 4.0*gk*cim_scr[iis];
       fcimag[iis] -= 4.0*gk*cre_scr[iis];
    }
   }
  }
 }

variable_types: struct cpewald { int nktot_sm; int nktot_dens_cp_box; int nktot_cp_mall; int nktot_cp_sm_mall; int nktot_dens_cp_box_mall; int box_rat; double dbox_rat; double gw_gmin; double gw_gmin_dens_cp_box; int *kmax_cp; int *kmax_cp_dens_cp_box; int *kastr_sm; int *kastr_dens_cp_box; int *ibrk1_sm; int *ibrk1_dens_cp_box; double *ak2; double *ak2_dens_cp_box; } *

variable_types: nstate int

variable_types:
creal
double *

variable_types:
cimag
double *

variable_types:
fcreal
double *

variable_types:
fcimag
double *

variable_types:
zfft
double *

variable_types:
hmati
double *

variable_types: struct communicate { int np_beads; int myid; int myid_bead_forc; int myid_bead; int myid_bead_prime; int myid_state; int myid_forc; int myid_forc_source; int myid_forc_target; int world; int comm_beads; int comm_beads_forc; int comm_states; int comm_forc; int comm_forc_source; int comm_forc_target; int comm_faux; } *

variable_types: struct para_fft_pkg3d { int nktot; int ncoef_use; int nfft_size; int nfft; int igeneric_opt; int scale_opt; int len_ifax; int nwork1; double ecut; int comm; int num_proc; int *map_proc; int *recv_counts_rho; int *recv_counts_coef; int *map_pme_dn; int *recvcounts_pme_dn; int *sendcounts_pme_dn; int *map_pme_up; int *recvcounts_pme_up; int *sendcounts_pme_up; int ndata_kc; int nkf3; int str_fft_kc_proc; int ska_fft_kc_proc; int skb_fft_kc_proc; int *sendcounts_fft_kc; int *recvcounts_fft_kc; int *sum_fft_kc_proc; int nka_fft_kc; int *ka_fft_kc; int *ifax_c_f; double *work_1c_f; double *work_1c_r; int ndata_kb; int nkf2; int str_fft_kb_proc; int ska_fft_kb_proc; int skc_fft_kb_proc; int *ska_fft_kb_proc_all; int *skc_fft_kb_proc_all; int *sendcounts_fft_kb; int *recvcounts_fft_kb; int *sum_fft_kb_proc; int *ifax_b_f; double *work_1b_f; double *work_1b_r; int ndata_ka; int nkf1; int str_fft_ka_proc; int skb_fft_ka_proc; int skc_fft_ka_proc; int *skb_fft_ka_proc_all; int *skc_fft_ka_proc_all; int *sendcounts_fft_ka; int *recvcounts_fft_ka; int *ifax_a_f; double *work_1a_f; double *work_1a_r; int *send_counts_row_big_small; int *recv_counts_row_big_small; int *sdispls_row_big_small; int *rdispls_row_big_small; int *send_counts_dual_map; int *recv_counts_dual_map; int *sdispls_dual_map; int *rdispls_dual_map; int *send_counts_row_big_small_upack; int *recv_counts_row_big_small_upack; int *sdispls_row_big_small_upack; int *rdispls_row_big_small_upack; int *send_counts_dual_map_upack; int *recv_counts_dual_map_upack; int *sdispls_dual_map_upack; int *rdispls_dual_map_upack; int *send_counts_ioff_big_small; int *recv_counts_ioff_big_small; int *sdispls_ioff_big_small; int *rdispls_ioff_big_small; } *

variable_types: is int

variable_types: i int

variable_types: iupper int

variable_types: component int

variable_types: tpi double

variable_types: aka double

variable_types: akb double

variable_types: akc double

variable_types: gk double

variable_types: cfact double

variable_types: eke double

variable_types: ioff int

variable_types: iii int

variable_types: iis int

variable_types: nis int

variable_types: nfft int

variable_types: ncoef int

return_type: void


original_code:
void coef_force_tau_fun_full_g(CPEWALD *cpewald,int nstate,
                               double *creal,double *cimag,
                               double *fcreal,double *fcimag,
                               double *cre_scr,double *cim_scr,
                               double *zfft,double *zfft_tmp,
                               double *v_ks_tau,double *ak2_sm,
                               double *pvten_cp,
                               int cp_ptens_calc,double *hmati,
                               COMMUNICATE *communicate,
                               int icoef_form,int icoef_orth,int ifcoef_form,
                               PARA_FFT_PKG3D *cp_para_fft_pkg3d_sm)
{
  int MPI_INT = 1;
  int MPI_DOUBLE = 1;
  int MPI_CHAR = 1;
  int MPI_MAX = 1;
  int MPI_SUM = 1;
  int MPI_ANY_TAG = 1;
  int MPI_ANY_SOURCE = 1;
  int *MPI_BOTTOM = {0};
   int is,i,iupper,component;
   double tpi;
   double aka,akb,akc,gk,cfact;
   double eke;
   int ioff,ioff2;
   int iii,iis,iis2,nis;
   int icoef_off = cp_para_fft_pkg3d_sm->icoef_off;
   int nfft = cp_para_fft_pkg3d_sm->nfft_proc;
   int ncoef = cp_para_fft_pkg3d_sm->ncoef_proc;
   int ncoef_use = cp_para_fft_pkg3d_sm->ncoef_use;
   int myid_state = communicate->myid_state;
   int np_states = communicate->np_states;
   int *kastore_sm = cpewald->kastr_sm;
   int *kbstore_sm = cpewald->kbstr_sm;
   int *kcstore_sm = cpewald->kcstr_sm;
  if(icoef_orth!=1){
    printf("@@@@@@@@@@@@@@@@@@@@_ERROR_@@@@@@@@@@@@@@@@@@@@\n");
    printf("The coefficients must be in orthogonal form    \n");
    printf("on state processor %d in coef_force_tau_calc_full_g\n",myid_state);
    printf("@@@@@@@@@@@@@@@@@@@@_ERROR_@@@@@@@@@@@@@@@@@@@@\n");
    fflush(stdout);exit(1);
  }
  if(np_states>1)
   if( ifcoef_form==0 || icoef_form == 0){
    printf("@@@@@@@@@@@@@@@@@@@@_ERROR_@@@@@@@@@@@@@@@@@@@@\n");
    printf("The coefs/coef forces must be in transposed (not normal) \n");
    printf("form on state processor %d in coef_force_tau_calc_full_g  \n",
           myid_state);
    printf("@@@@@@@@@@@@@@@@@@@@_ERROR_@@@@@@@@@@@@@@@@@@@@\n");
    fflush(stdout);exit(1);
  }
  tpi = 2.0*3.14159265358979323846;
  iupper = nstate;
  if(nstate % 2 == 1){
     iupper = nstate - 1;
  }
 for(component = 1; component <= 3; component++){
   get_igcoef_full_g(creal,cimag,cre_scr,cim_scr,cpewald,hmati,
                     icoef_off,nstate,ncoef,ncoef_use,component);
  for(is = 1; is <= iupper; is = is + 2){
     ioff = (is-1)*ncoef;
     ioff2 = (is)*ncoef;
     dble_pack_coef(&cre_scr[ioff],&cim_scr[ioff],&cre_scr[ioff2],&cim_scr[ioff2],
                    zfft,cp_para_fft_pkg3d_sm);
     para_fft_gen3d_fwd_to_r(zfft,zfft_tmp,cp_para_fft_pkg3d_sm);
    cp_vpsi(zfft,v_ks_tau,nfft);
    para_fft_gen3d_bck_to_g(zfft,zfft_tmp,cp_para_fft_pkg3d_sm);
    dble_upack_coef(&cre_scr[ioff],&cim_scr[ioff],
                    &cre_scr[ioff2],&cim_scr[ioff2],
                    zfft,cp_para_fft_pkg3d_sm);
    for(i=1; i<= ncoef_use; i++){
       aka = (double)kastore_sm[i];
       akb = (double)kbstore_sm[i];
       akc = (double)kcstore_sm[i];
       if(component==1) gk = (aka*hmati[1] +akb*hmati[2] +akc*hmati[3])*tpi;
       if(component==2) gk = (aka*hmati[4] +akb*hmati[5] +akc*hmati[6])*tpi;
       if(component==3) gk = (aka*hmati[7] +akb*hmati[8] +akc*hmati[9])*tpi;
       iis = ioff+i;
       iis2 = ioff2+i;
       fcreal[iis] += 4.0*gk*cim_scr[iis];
       fcimag[iis] -= 4.0*gk*cre_scr[iis];
       fcreal[iis2] += 4.0*gk*cim_scr[iis2];
       fcimag[iis2] -= 4.0*gk*cre_scr[iis2];
    }
  }
  if((nstate % 2 ) != 0) {
     ioff = (nstate-1)*ncoef;
     sngl_pack_coef(&cre_scr[ioff],&cim_scr[ioff],zfft,cp_para_fft_pkg3d_sm);
     para_fft_gen3d_fwd_to_r(zfft,zfft_tmp,cp_para_fft_pkg3d_sm);
    cp_vpsi(zfft,v_ks_tau,nfft);
      para_fft_gen3d_bck_to_g(zfft,zfft_tmp,cp_para_fft_pkg3d_sm);
      sngl_upack_coef(&cre_scr[ioff],&cim_scr[ioff],zfft,
                          cp_para_fft_pkg3d_sm);
    for(i=1; i<= ncoef_use; i++){
       aka = (double)kastore_sm[i];
       akb = (double)kbstore_sm[i];
       akc = (double)kcstore_sm[i];
       if(component==1) gk = (aka*hmati[1] +akb*hmati[2] +akc*hmati[3])*tpi;
       if(component==2) gk = (aka*hmati[4] +akb*hmati[5] +akc*hmati[6])*tpi;
       if(component==3) gk = (aka*hmati[7] +akb*hmati[8] +akc*hmati[9])*tpi;
       iis = ioff+i;
       fcreal[iis] += 4.0*gk*cim_scr[iis];
       fcimag[iis] -= 4.0*gk*cre_scr[iis];
    }
   }
  }
 }

canonical_original_code:
void coef_force_tau_fun_full_g(struct cpewald *cpewald, int nstate, double *creal, double *cimag, double *fcreal, double *fcimag, double *cre_scr, double *cim_scr, double *zfft, double *zfft_tmp, double *v_ks_tau, double *ak2_sm, double *pvten_cp, int cp_ptens_calc, double *hmati, struct communicate *communicate, int icoef_form, int icoef_orth, int ifcoef_form, struct para_fft_pkg3d *cp_para_fft_pkg3d_sm)
{
  int MPI_INT = 1;
  int MPI_DOUBLE = 1;
  int MPI_CHAR = 1;
  int MPI_MAX = 1;
  int MPI_SUM = 1;
  int MPI_ANY_TAG = 1;
  int MPI_ANY_SOURCE = 1;
  int *MPI_BOTTOM = {0};
   int is; int i; int iupper; int component;
   double tpi;
   double aka; double akb; double akc; double gk; double cfact;
   double eke;
   int ioff; int ioff2;
   int iii; int iis; int iis2; int nis;
   int icoef_off = cp_para_fft_pkg3d_sm->icoef_off;
   int nfft = cp_para_fft_pkg3d_sm->nfft_proc;
   int ncoef = cp_para_fft_pkg3d_sm->ncoef_proc;
   int ncoef_use = cp_para_fft_pkg3d_sm->ncoef_use;
   int myid_state = communicate->myid_state;
   int np_states = communicate->np_states;
   int *kastore_sm = cpewald->kastr_sm;
   int *kbstore_sm = cpewald->kbstr_sm;
   int *kcstore_sm = cpewald->kcstr_sm;
  if(icoef_orth!=1){
    printf("@@@@@@@@@@@@@@@@@@@@_ERROR_@@@@@@@@@@@@@@@@@@@@\n");
    printf("The coefficients must be in orthogonal form    \n");
    printf("on state processor %d in coef_force_tau_calc_full_g\n",myid_state);
    printf("@@@@@@@@@@@@@@@@@@@@_ERROR_@@@@@@@@@@@@@@@@@@@@\n");
    fflush(stdout);exit(1);
  }
  if(np_states>1)
   if( ifcoef_form==0 || icoef_form == 0){
    printf("@@@@@@@@@@@@@@@@@@@@_ERROR_@@@@@@@@@@@@@@@@@@@@\n");
    printf("The coefs/coef forces must be in transposed (not normal) \n");
    printf("form on state processor %d in coef_force_tau_calc_full_g  \n",
           myid_state);
    printf("@@@@@@@@@@@@@@@@@@@@_ERROR_@@@@@@@@@@@@@@@@@@@@\n");
    fflush(stdout);exit(1);
  }
  tpi = 2.0*3.14159265358979323846;
  iupper = nstate;
  if(nstate % 2 == 1){
     iupper = nstate - 1;
  }
 for(component = 1; component <= 3; component++){
   get_igcoef_full_g(creal,cimag,cre_scr,cim_scr,cpewald,hmati,
                     icoef_off,nstate,ncoef,ncoef_use,component);
  for(is = 1; is <= iupper; is = is + 2){
     ioff = (is-1)*ncoef;
     ioff2 = (is)*ncoef;
     dble_pack_coef(&cre_scr[ioff],&cim_scr[ioff],&cre_scr[ioff2],&cim_scr[ioff2],
                    zfft,cp_para_fft_pkg3d_sm);
     para_fft_gen3d_fwd_to_r(zfft,zfft_tmp,cp_para_fft_pkg3d_sm);
    cp_vpsi(zfft,v_ks_tau,nfft);
    para_fft_gen3d_bck_to_g(zfft,zfft_tmp,cp_para_fft_pkg3d_sm);
    dble_upack_coef(&cre_scr[ioff],&cim_scr[ioff],
                    &cre_scr[ioff2],&cim_scr[ioff2],
                    zfft,cp_para_fft_pkg3d_sm);
    for(i=1; i<= ncoef_use; i++){
       aka = (double)kastore_sm[i];
       akb = (double)kbstore_sm[i];
       akc = (double)kcstore_sm[i];
       if(component==1) gk = (aka*hmati[1] +akb*hmati[2] +akc*hmati[3])*tpi;
       if(component==2) gk = (aka*hmati[4] +akb*hmati[5] +akc*hmati[6])*tpi;
       if(component==3) gk = (aka*hmati[7] +akb*hmati[8] +akc*hmati[9])*tpi;
       iis = ioff+i;
       iis2 = ioff2+i;
       fcreal[iis] += 4.0*gk*cim_scr[iis];
       fcimag[iis] -= 4.0*gk*cre_scr[iis];
       fcreal[iis2] += 4.0*gk*cim_scr[iis2];
       fcimag[iis2] -= 4.0*gk*cre_scr[iis2];
    }
  }
  if((nstate % 2 ) != 0) {
     ioff = (nstate-1)*ncoef;
     sngl_pack_coef(&cre_scr[ioff],&cim_scr[ioff],zfft,cp_para_fft_pkg3d_sm);
     para_fft_gen3d_fwd_to_r(zfft,zfft_tmp,cp_para_fft_pkg3d_sm);
    cp_vpsi(zfft,v_ks_tau,nfft);
      para_fft_gen3d_bck_to_g(zfft,zfft_tmp,cp_para_fft_pkg3d_sm);
      sngl_upack_coef(&cre_scr[ioff],&cim_scr[ioff],zfft,
                          cp_para_fft_pkg3d_sm);
    for(i=1; i<= ncoef_use; i++){
       aka = (double)kastore_sm[i];
       akb = (double)kbstore_sm[i];
       akc = (double)kcstore_sm[i];
       if(component==1) gk = (aka*hmati[1] +akb*hmati[2] +akc*hmati[3])*tpi;
       if(component==2) gk = (aka*hmati[4] +akb*hmati[5] +akc*hmati[6])*tpi;
       if(component==3) gk = (aka*hmati[7] +akb*hmati[8] +akc*hmati[9])*tpi;
       iis = ioff+i;
       fcreal[iis] += 4.0*gk*cim_scr[iis];
       fcimag[iis] -= 4.0*gk*cre_scr[iis];
    }
   }
  }
 }

variable_types: struct cpewald { int nktot_sm; int nktot_dens_cp_box; int nktot_cp_mall; int nktot_cp_sm_mall; int nktot_dens_cp_box_mall; int box_rat; double dbox_rat; double gw_gmin; double gw_gmin_dens_cp_box; int *kmax_cp; int *kmax_cp_dens_cp_box; int *kastr_sm; int *kastr_dens_cp_box; int *ibrk1_sm; int *ibrk1_dens_cp_box; double *ak2; double *ak2_dens_cp_box; } *

variable_types: nstate int

variable_types:
creal
double *

variable_types:
cimag
double *

variable_types:
fcreal
double *

variable_types:
fcimag
double *

variable_types:
zfft
double *

variable_types:
hmati
double *

variable_types: struct communicate { int np_beads; int myid; int myid_bead_forc; int myid_bead; int myid_bead_prime; int myid_state; int myid_forc; int myid_forc_source; int myid_forc_target; int world; int comm_beads; int comm_beads_forc; int comm_states; int comm_forc; int comm_forc_source; int comm_forc_target; int comm_faux; } *

variable_types: struct para_fft_pkg3d { int nktot; int ncoef_use; int nfft_size; int nfft; int igeneric_opt; int scale_opt; int len_ifax; int nwork1; double ecut; int comm; int num_proc; int *map_proc; int *recv_counts_rho; int *recv_counts_coef; int *map_pme_dn; int *recvcounts_pme_dn; int *sendcounts_pme_dn; int *map_pme_up; int *recvcounts_pme_up; int *sendcounts_pme_up; int ndata_kc; int nkf3; int str_fft_kc_proc; int ska_fft_kc_proc; int skb_fft_kc_proc; int *sendcounts_fft_kc; int *recvcounts_fft_kc; int *sum_fft_kc_proc; int nka_fft_kc; int *ka_fft_kc; int *ifax_c_f; double *work_1c_f; double *work_1c_r; int ndata_kb; int nkf2; int str_fft_kb_proc; int ska_fft_kb_proc; int skc_fft_kb_proc; int *ska_fft_kb_proc_all; int *skc_fft_kb_proc_all; int *sendcounts_fft_kb; int *recvcounts_fft_kb; int *sum_fft_kb_proc; int *ifax_b_f; double *work_1b_f; double *work_1b_r; int ndata_ka; int nkf1; int str_fft_ka_proc; int skb_fft_ka_proc; int skc_fft_ka_proc; int *skb_fft_ka_proc_all; int *skc_fft_ka_proc_all; int *sendcounts_fft_ka; int *recvcounts_fft_ka; int *ifax_a_f; double *work_1a_f; double *work_1a_r; int *send_counts_row_big_small; int *recv_counts_row_big_small; int *sdispls_row_big_small; int *rdispls_row_big_small; int *send_counts_dual_map; int *recv_counts_dual_map; int *sdispls_dual_map; int *rdispls_dual_map; int *send_counts_row_big_small_upack; int *recv_counts_row_big_small_upack; int *sdispls_row_big_small_upack; int *rdispls_row_big_small_upack; int *send_counts_dual_map_upack; int *recv_counts_dual_map_upack; int *sdispls_dual_map_upack; int *rdispls_dual_map_upack; int *send_counts_ioff_big_small; int *recv_counts_ioff_big_small; int *sdispls_ioff_big_small; int *rdispls_ioff_big_small; } *

variable_types: is int


original_code:
void control_debug_cp_pimd(CLASS *class,BONDED *bonded,
                           GENERAL_DATA *general_data,CP *cp)
{
  int MPI_INT = 1;
  int MPI_DOUBLE = 1;
  int MPI_CHAR = 1;
  int MPI_MAX = 1;
  int MPI_SUM = 1;
  int MPI_ANY_TAG = 1;
  int MPI_ANY_SOURCE = 1;
  int *MPI_BOTTOM = {0};
  int iii;
  int i,j,ip,iflag,start,start_proc;
  int iflag_mass = 1;
  int npairs,np_tot;
  int pi_beads = class->clatoms_info.pi_beads;
  int pi_beads_proc = class->clatoms_info.pi_beads_proc;
  double cpu1,cpu2,cpu;
  double kinet_temp = 0.0;
  double kinet_nhc_temp = 0.0;
  double kinet_nhc_bead_temp = 0.0;
  double kinet_cp_temp = 0.0;
  double cp_ehart_temp = 0.0;
  double cp_exc_temp = 0.0;
  double cp_muxc_temp = 0.0;
  double cp_eext_temp = 0.0;
  double cp_enl_temp = 0.0;
  double cp_eke_temp = 0.0;
  int error_check_on = general_data->error_check_on;
  int rank = class->communicate.myid;
  int myid_bead = class->communicate.myid_bead;
  int np_beads = class->communicate.np_beads;
  int num_proc = class->communicate.np;
  int world = class->communicate.world;
  int comm_beads = class->communicate.comm_beads;
  int comm_states = class->communicate.comm_states;
  int pi_beads_proc_st = class->clatoms_info.pi_beads_proc_st;
           start_proc = (pi_beads_proc_st == 1 ? 2:1);
  if(error_check_on==1){
    printf("\n");{int i;for(i=0;i<=78;i++){printf("=");}printf("\n");};
    printf("Debugging CP portion of pi_md \n");
    {int i;for(i=0;i<=78;i++){printf("-");}printf("\n");};printf("\n");
  }
  if(num_proc>1){Barrier(world);}
  start = (rank == 0 ? 2:1);
  general_data->filenames.ifile_open = 1;
  general_data->timeinfo.itime = 0;
  class->energy_ctrl.itime = 0;
  if(error_check_on==1){
    output_cp_pimd(class,general_data,bonded,cp);
  }
  if(num_proc>1){Barrier(world);}
  general_data->stat_avg.updates = 0.0;
  general_data->stat_avg.acpu = 0.0;
  if(bonded->bond_free.num != 0){
    for(i=1;i<= (bonded->bond_free.num);i++){
      bonded->bond_free.hist[i] = 0.0;
    }
  }
  if(bonded->bend_free.num != 0){
    for(i=1;i<= (bonded->bend_free.num);i++){
      bonded->bend_free.hist[i] = 0.0;
    }
  }
  if(bonded->tors_free.num == 1){
    for(i=1;i<= bonded->tors_free.num;i++){
      bonded->tors_free.hist[i] = 0.0;
    }
  }
  if(bonded->tors_free.num == 2){
    for(i=1;i<= bonded->tors_free.nhist;i++){
    for(j=1;j<= bonded->tors_free.nhist;j++){
      bonded->tors_free.hist_2d[i][j] = 0.0;
    }
    }
  }
  if(bonded->constrnt.iconstrnt==1){
     init_constraint(bonded,&(general_data->ptens));
  }
    general_data->stat_avg.iter_shake = 0;
    general_data->stat_avg.iter_ratl = 0;
    general_data->stat_avg.iter_23 = 0;
    general_data->stat_avg.iter_33 = 0;
    general_data->stat_avg.iter_46 = 0;
  class->energy_ctrl.iget_full_inter = 1;
  class->energy_ctrl.iget_res_inter = 0;
  if(general_data->timeinfo.int_res_ter==1){
    class->energy_ctrl.iget_res_inter=1;
  }
  class->energy_ctrl.iget_full_intra = 1;
  class->energy_ctrl.iget_res_intra = 0;
  if((general_data->timeinfo.int_res_tra)==1){
    class->energy_ctrl.iget_res_intra=1;
  }
  if((class->nbr_list.iver)==1){
    if(error_check_on==1){
     printf("======================================\n");
     if((class->nbr_list.verlist.nolst_ver_update)==1){
        printf("Checking verlist update type: no_lst\n");
     }else{
        printf("Checking verlist update type: lnk_lst\n");
     }
     printf("--------------------------------------\n\n");
    }
    if(num_proc>1){Barrier(world);}
    cputime(&cpu1);
      verlist_control(&(class->clatoms_info),&(class->clatoms_pos[1]),
                  &(class->nbr_list),
                  &(bonded->excl),&(class->atommaps),&(general_data->cell),
                  &(bonded->intra_scr),&(class->for_scr),
                  &(general_data->timeinfo),&(class->interact),error_check_on,
                  &(class->class_comm_forc_pkg));
    cputime(&cpu2);
    cpu = cpu2-cpu1;
    npairs = class->nbr_list.verlist.nter[(class->clatoms_info.natm_tot)]
            + class->nbr_list.verlist.jver_off[(class->clatoms_info.natm_tot)];
    np_tot = (class->clatoms_info.natm_tot)*(class->clatoms_info.natm_tot-1)
             /2 - (bonded->excl.nlst);
    if(error_check_on==1){
     printf("Number of pairs = %d out of %d; cpu time %g\n",npairs,np_tot,cpu);
     printf("\n--------------------------------------\n");
     printf("Finished checking list update         \n");
     printf("======================================\n\n");
     printf("Enter an integer to continue:  ");
     scanf("%d",&iii); printf("\n");
    }
    if(num_proc>1){Barrier(world);}
  }
  test_energy_cp_pimd(class,bonded,general_data,cp);
  get_tvten_pimd(class,general_data);
  get_cpke_pimd(&(cp->cpcoeffs_info),(cp->cpcoeffs_pos),
                &(general_data->stat_avg),cp->cpopts.cp_lsda,
                class->clatoms_info.pi_beads_proc,
                class->communicate.np_states);
if(myid_bead<np_beads){
  if((general_data->ensopts.nvt)==1){
     iflag_mass = 1;
     if(class->clatoms_info.pi_beads_proc_st==1){
       init_NHC_par(&(class->clatoms_info),&(class->clatoms_pos[1]),
              &(class->therm_info_class),&(class->therm_class),
              &(class->int_scr),iflag_mass,&(class->class_comm_forc_pkg));
     }
     iflag_mass = 2;
     for(ip=start_proc;ip<=pi_beads_proc;ip++){
      init_NHC_par(&(class->clatoms_info),&(class->clatoms_pos[ip]),
                    &(class->therm_info_bead),&(class->therm_bead[ip]),
                    &(class->int_scr),iflag_mass,&(class->class_comm_forc_pkg));
     }
    iflag = 0;
    nhc_vol_potkin_pimd(class,general_data,iflag);
  }
  if((general_data->ensopts.npt_i)==1){
     if(class->clatoms_info.pi_beads_proc_st==1){
       init_NHCPI_par(&(class->clatoms_info),&(class->clatoms_pos[1]),
                &(class->therm_info_class),&(class->therm_class),
                &(general_data->baro),
                &(class->int_scr),&(class->class_comm_forc_pkg));
     }
     iflag_mass = 2;
     for(ip=start_proc;ip<=pi_beads_proc;ip++){
      init_NHC_par(&(class->clatoms_info),&(class->clatoms_pos[ip]),
                    &(class->therm_info_bead),&(class->therm_bead[ip]),
                    &(class->int_scr),iflag_mass,&(class->class_comm_forc_pkg));
     }
    iflag = 1;
    nhc_vol_potkin_pimd(class,general_data,iflag);
  }
  if((general_data->ensopts.npt_f)==1){
     if(class->clatoms_info.pi_beads_proc_st==1){
       init_NHCPF_par(&(class->clatoms_info),&(class->clatoms_pos[1]),
                &(class->therm_info_class),&(class->therm_class),
                &(general_data->baro),
                &(general_data->par_rahman),&(general_data->cell),
                &(class->int_scr),&(class->class_comm_forc_pkg));
     }
     iflag_mass = 2;
     for(ip=start_proc;ip<=pi_beads_proc;ip++){
      init_NHC_par(&(class->clatoms_info),&(class->clatoms_pos[ip]),
                    &(class->therm_info_bead),&(class->therm_bead[ip]),
                    &(class->int_scr),iflag_mass,&(class->class_comm_forc_pkg));
     }
    iflag = 2;
    nhc_vol_potkin_pimd(class,general_data,iflag);
  }
}
if(num_proc>1){Barrier(comm_beads);}
  if((general_data->ensopts.npt_i+general_data->ensopts.npt_f)==0){
    general_data->stat_avg.kinet_v = 0.0;
  }
  if((general_data->ensopts.npt_i+general_data->ensopts.npt_f+
                                  general_data->ensopts.nvt)==0){
    general_data->stat_avg.kinet_nhc = 0.0;
  }
  if(cp->cptherm_info.num_c_nhc > 0){
   for(ip=1;ip<=pi_beads_proc;ip++){
    init_cp_NHC(&(cp->cptherm_info),&(cp->cptherm_pos[ip]),
                &(cp->cpcoeffs_info),&(cp->cpcoeffs_pos[ip]),
                &(cp->cpscr),cp->cpopts.cp_lsda,comm_states,
                cp->communicate.np_states,cp->communicate.myid_state);
   }
    nhc_cp_potkin_pimd(&(cp->cptherm_info),(cp->cptherm_pos),
                       &(general_data->stat_avg),pi_beads);
  }
if(num_proc>1){
   Reduce(&(general_data->stat_avg.cp_ehart), &cp_ehart_temp,1,MPI_DOUBLE,
                   MPI_SUM,0,world);
   Reduce(&(general_data->stat_avg.cp_exc), &cp_exc_temp,1,MPI_DOUBLE,
                   MPI_SUM,0,world);
   Reduce(&(general_data->stat_avg.cp_muxc), &cp_muxc_temp,1,MPI_DOUBLE,
                   MPI_SUM,0,world);
   Reduce(&(general_data->stat_avg.cp_eext), &cp_eext_temp,1,MPI_DOUBLE,
                   MPI_SUM,0,world);
   Reduce(&(general_data->stat_avg.cp_enl), &cp_enl_temp,1,MPI_DOUBLE,
                   MPI_SUM,0,world);
   Reduce(&(general_data->stat_avg.cp_eke), &cp_eke_temp,1,MPI_DOUBLE,
                   MPI_SUM,0,world);
   Reduce(&(general_data->stat_avg.kinet_cp), &kinet_cp_temp,1,
                   MPI_DOUBLE,MPI_SUM,0,world);
   if(myid_bead<np_beads){
     Reduce(&(general_data->stat_avg.kinet), &kinet_temp,1,MPI_DOUBLE,
                   MPI_SUM,0,class->communicate.comm_beads);
     Reduce(&(general_data->stat_avg.kinet_nhc_bead), &kinet_nhc_bead_temp,1,
                   MPI_DOUBLE,MPI_SUM,0,class->communicate.comm_beads);
     Reduce(&(general_data->stat_avg.kinet_nhc), &kinet_nhc_temp,1,
                   MPI_DOUBLE,MPI_SUM,0,class->communicate.comm_beads);
     general_data->stat_avg.kinet = kinet_temp;
     general_data->stat_avg.kinet_nhc_bead = kinet_nhc_bead_temp;
     general_data->stat_avg.kinet_nhc = kinet_nhc_temp;
   }
   if(num_proc>1){Barrier(comm_beads);}
   general_data->stat_avg.kinet_cp = kinet_cp_temp;
   general_data->stat_avg.cp_ehart = cp_ehart_temp;
   general_data->stat_avg.cp_exc = cp_exc_temp;
   general_data->stat_avg.cp_muxc = cp_muxc_temp;
   general_data->stat_avg.cp_eext = cp_eext_temp;
   general_data->stat_avg.cp_enl = cp_enl_temp;
   general_data->stat_avg.cp_eke = cp_eke_temp;
 }
  if(error_check_on==1){
    initial_output_cp_pimd(class,general_data,bonded,cp);
  }
  if(num_proc>1){Barrier(world);}
  if(error_check_on==1){
    printf("\n");
    {int i;for(i=0;i<=78;i++){printf("-");}printf("\n");};
    printf("Completed debug\n");
    {int i;for(i=0;i<=78;i++){printf("=");}printf("\n");};printf("\n");
  }
  if(num_proc>1){Barrier(world);}
   }

canonical_original_code:
void control_debug_cp_pimd(struct class *class, struct bonded *bonded, struct general_data *general_data, struct cp *cp)
{
  int MPI_INT = 1;
  int MPI_DOUBLE = 1;
  int MPI_CHAR = 1;
  int MPI_MAX = 1;
  int MPI_SUM = 1;
  int MPI_ANY_TAG = 1;
  int MPI_ANY_SOURCE = 1;
  int *MPI_BOTTOM = {0};
  int iii;
  int i; int j; int ip; int iflag; int start; int start_proc;
  int iflag_mass = 1;
  int npairs; int np_tot;
  int pi_beads = class->clatoms_info.pi_beads;
  int pi_beads_proc = class->clatoms_info.pi_beads_proc;
  double cpu1; double cpu2; double cpu;
  double kinet_temp = 0.0;
  double kinet_nhc_temp = 0.0;
  double kinet_nhc_bead_temp = 0.0;
  double kinet_cp_temp = 0.0;
  double cp_ehart_temp = 0.0;
  double cp_exc_temp = 0.0;
  double cp_muxc_temp = 0.0;
  double cp_eext_temp = 0.0;
  double cp_enl_temp = 0.0;
  double cp_eke_temp = 0.0;
  int error_check_on = general_data->error_check_on;
  int rank = class->communicate.myid;
  int myid_bead = class->communicate.myid_bead;
  int np_beads = class->communicate.np_beads;
  int num_proc = class->communicate.np;
  int world = class->communicate.world;
  int comm_beads = class->communicate.comm_beads;
  int comm_states = class->communicate.comm_states;
  int pi_beads_proc_st = class->clatoms_info.pi_beads_proc_st;
           start_proc = (pi_beads_proc_st == 1 ? 2:1);
  if(error_check_on==1){
    printf("\n");{int i;for(i=0;i<=78;i++){printf("=");}printf("\n");};
    printf("Debugging CP portion of pi_md \n");
    {int i;for(i=0;i<=78;i++){printf("-");}printf("\n");};printf("\n");
  }
  if(num_proc>1){Barrier(world);}
  start = (rank == 0 ? 2:1);
  general_data->filenames.ifile_open = 1;
  general_data->timeinfo.itime = 0;
  class->energy_ctrl.itime = 0;
  if(error_check_on==1){
    output_cp_pimd(class,general_data,bonded,cp);
  }
  if(num_proc>1){Barrier(world);}
  general_data->stat_avg.updates = 0.0;
  general_data->stat_avg.acpu = 0.0;
  if(bonded->bond_free.num != 0){
    for(i=1;i<= (bonded->bond_free.num);i++){
      bonded->bond_free.hist[i] = 0.0;
    }
  }
  if(bonded->bend_free.num != 0){
    for(i=1;i<= (bonded->bend_free.num);i++){
      bonded->bend_free.hist[i] = 0.0;
    }
  }
  if(bonded->tors_free.num == 1){
    for(i=1;i<= bonded->tors_free.num;i++){
      bonded->tors_free.hist[i] = 0.0;
    }
  }
  if(bonded->tors_free.num == 2){
    for(i=1;i<= bonded->tors_free.nhist;i++){
    for(j=1;j<= bonded->tors_free.nhist;j++){
      bonded->tors_free.hist_2d[i][j] = 0.0;
    }
    }
  }
  if(bonded->constrnt.iconstrnt==1){
     init_constraint(bonded,&(general_data->ptens));
  }
    general_data->stat_avg.iter_shake = 0;
    general_data->stat_avg.iter_ratl = 0;
    general_data->stat_avg.iter_23 = 0;
    general_data->stat_avg.iter_33 = 0;
    general_data->stat_avg.iter_46 = 0;
  class->energy_ctrl.iget_full_inter = 1;
  class->energy_ctrl.iget_res_inter = 0;
  if(general_data->timeinfo.int_res_ter==1){
    class->energy_ctrl.iget_res_inter=1;
  }
  class->energy_ctrl.iget_full_intra = 1;
  class->energy_ctrl.iget_res_intra = 0;
  if((general_data->timeinfo.int_res_tra)==1){
    class->energy_ctrl.iget_res_intra=1;
  }
  if((class->nbr_list.iver)==1){
    if(error_check_on==1){
     printf("======================================\n");
     if((class->nbr_list.verlist.nolst_ver_update)==1){
        printf("Checking verlist update type: no_lst\n");
     }else{
        printf("Checking verlist update type: lnk_lst\n");
     }
     printf("--------------------------------------\n\n");
    }
    if(num_proc>1){Barrier(world);}
    cputime(&cpu1);
      verlist_control(&(class->clatoms_info),&(class->clatoms_pos[1]),
                  &(class->nbr_list),
                  &(bonded->excl),&(class->atommaps),&(general_data->cell),
                  &(bonded->intra_scr),&(class->for_scr),
                  &(general_data->timeinfo),&(class->interact),error_check_on,
                  &(class->class_comm_forc_pkg));
    cputime(&cpu2);
    cpu = cpu2-cpu1;
    npairs = class->nbr_list.verlist.nter[(class->clatoms_info.natm_tot)]
            + class->nbr_list.verlist.jver_off[(class->clatoms_info.natm_tot)];
    np_tot = (class->clatoms_info.natm_tot)*(class->clatoms_info.natm_tot-1)
             /2 - (bonded->excl.nlst);
    if(error_check_on==1){
     printf("Number of pairs = %d out of %d; cpu time %g\n",npairs,np_tot,cpu);
     printf("\n--------------------------------------\n");
     printf("Finished checking list update         \n");
     printf("======================================\n\n");
     printf("Enter an integer to continue:  ");
     scanf("%d",&iii); printf("\n");
    }
    if(num_proc>1){Barrier(world);}
  }
  test_energy_cp_pimd(class,bonded,general_data,cp);
  get_tvten_pimd(class,general_data);
  get_cpke_pimd(&(cp->cpcoeffs_info),(cp->cpcoeffs_pos),
                &(general_data->stat_avg),cp->cpopts.cp_lsda,
                class->clatoms_info.pi_beads_proc,
                class->communicate.np_states);
if(myid_bead<np_beads){
  if((general_data->ensopts.nvt)==1){
     iflag_mass = 1;
     if(class->clatoms_info.pi_beads_proc_st==1){
       init_NHC_par(&(class->clatoms_info),&(class->clatoms_pos[1]),
              &(class->therm_info_class),&(class->therm_class),
              &(class->int_scr),iflag_mass,&(class->class_comm_forc_pkg));
     }
     iflag_mass = 2;
     for(ip=start_proc;ip<=pi_beads_proc;ip++){
      init_NHC_par(&(class->clatoms_info),&(class->clatoms_pos[ip]),
                    &(class->therm_info_bead),&(class->therm_bead[ip]),
                    &(class->int_scr),iflag_mass,&(class->class_comm_forc_pkg));
     }
    iflag = 0;
    nhc_vol_potkin_pimd(class,general_data,iflag);
  }
  if((general_data->ensopts.npt_i)==1){
     if(class->clatoms_info.pi_beads_proc_st==1){
       init_NHCPI_par(&(class->clatoms_info),&(class->clatoms_pos[1]),
                &(class->therm_info_class),&(class->therm_class),
                &(general_data->baro),
                &(class->int_scr),&(class->class_comm_forc_pkg));
     }
     iflag_mass = 2;
     for(ip=start_proc;ip<=pi_beads_proc;ip++){
      init_NHC_par(&(class->clatoms_info),&(class->clatoms_pos[ip]),
                    &(class->therm_info_bead),&(class->therm_bead[ip]),
                    &(class->int_scr),iflag_mass,&(class->class_comm_forc_pkg));
     }
    iflag = 1;
    nhc_vol_potkin_pimd(class,general_data,iflag);
  }
  if((general_data->ensopts.npt_f)==1){
     if(class->clatoms_info.pi_beads_proc_st==1){
       init_NHCPF_par(&(class->clatoms_info),&(class->clatoms_pos[1]),
                &(class->therm_info_class),&(class->therm_class),
                &(general_data->baro),
                &(general_data->par_rahman),&(general_data->cell),
                &(class->int_scr),&(class->class_comm_forc_pkg));
     }
     iflag_mass = 2;
     for(ip=start_proc;ip<=pi_beads_proc;ip++){
      init_NHC_par(&(class->clatoms_info),&(class->clatoms_pos[ip]),
                    &(class->therm_info_bead),&(class->therm_bead[ip]),
                    &(class->int_scr),iflag_mass,&(class->class_comm_forc_pkg));
     }
    iflag = 2;
    nhc_vol_potkin_pimd(class,general_data,iflag);
  }
}
if(num_proc>1){Barrier(comm_beads);}
  if((general_data->ensopts.npt_i+general_data->ensopts.npt_f)==0){
    general_data->stat_avg.kinet_v = 0.0;
  }
  if((general_data->ensopts.npt_i+general_data->ensopts.npt_f+
                                  general_data->ensopts.nvt)==0){
    general_data->stat_avg.kinet_nhc = 0.0;
  }
  if(cp->cptherm_info.num_c_nhc > 0){
   for(ip=1;ip<=pi_beads_proc;ip++){
    init_cp_NHC(&(cp->cptherm_info),&(cp->cptherm_pos[ip]),
                &(cp->cpcoeffs_info),&(cp->cpcoeffs_pos[ip]),
                &(cp->cpscr),cp->cpopts.cp_lsda,comm_states,
                cp->communicate.np_states,cp->communicate.myid_state);
   }
    nhc_cp_potkin_pimd(&(cp->cptherm_info),(cp->cptherm_pos),
                       &(general_data->stat_avg),pi_beads);
  }
if(num_proc>1){
   Reduce(&(general_data->stat_avg.cp_ehart), &cp_ehart_temp,1,MPI_DOUBLE,
                   MPI_SUM,0,world);
   Reduce(&(general_data->stat_avg.cp_exc), &cp_exc_temp,1,MPI_DOUBLE,
                   MPI_SUM,0,world);
   Reduce(&(general_data->stat_avg.cp_muxc), &cp_muxc_temp,1,MPI_DOUBLE,
                   MPI_SUM,0,world);
   Reduce(&(general_data->stat_avg.cp_eext), &cp_eext_temp,1,MPI_DOUBLE,
                   MPI_SUM,0,world);
   Reduce(&(general_data->stat_avg.cp_enl), &cp_enl_temp,1,MPI_DOUBLE,
                   MPI_SUM,0,world);
   Reduce(&(general_data->stat_avg.cp_eke), &cp_eke_temp,1,MPI_DOUBLE,
                   MPI_SUM,0,world);
   Reduce(&(general_data->stat_avg.kinet_cp), &kinet_cp_temp,1,
                   MPI_DOUBLE,MPI_SUM,0,world);
   if(myid_bead<np_beads){
     Reduce(&(general_data->stat_avg.kinet), &kinet_temp,1,MPI_DOUBLE,
                   MPI_SUM,0,class->communicate.comm_beads);
     Reduce(&(general_data->stat_avg.kinet_nhc_bead), &kinet_nhc_bead_temp,1,
                   MPI_DOUBLE,MPI_SUM,0,class->communicate.comm_beads);
     Reduce(&(general_data->stat_avg.kinet_nhc), &kinet_nhc_temp,1,
                   MPI_DOUBLE,MPI_SUM,0,class->communicate.comm_beads);
     general_data->stat_avg.kinet = kinet_temp;
     general_data->stat_avg.kinet_nhc_bead = kinet_nhc_bead_temp;
     general_data->stat_avg.kinet_nhc = kinet_nhc_temp;
   }
   if(num_proc>1){Barrier(comm_beads);}
   general_data->stat_avg.kinet_cp = kinet_cp_temp;
   general_data->stat_avg.cp_ehart = cp_ehart_temp;
   general_data->stat_avg.cp_exc = cp_exc_temp;
   general_data->stat_avg.cp_muxc = cp_muxc_temp;
   general_data->stat_avg.cp_eext = cp_eext_temp;
   general_data->stat_avg.cp_enl = cp_enl_temp;
   general_data->stat_avg.cp_eke = cp_eke_temp;
 }
  if(error_check_on==1){
    initial_output_cp_pimd(class,general_data,bonded,cp);
  }
  if(num_proc>1){Barrier(world);}
  if(error_check_on==1){
    printf("\n");
    {int i;for(i=0;i<=78;i++){printf("-");}printf("\n");};
    printf("Completed debug\n");
    {int i;for(i=0;i<=78;i++){printf("=");}printf("\n");};printf("\n");
  }
  if(num_proc>1){Barrier(world);}
   }

variable_types: struct class { struct clatoms_info { int natm_tot; int pi_beads; int pi_beads_proc; int pi_beads_proc_st; int pi_beads_proc_end; int nfree; int nfree_pimd; int nchrg; int pi_beads_full_ter; int pi_beads_res_ter; int pi_beads_full_tra; int pi_beads_res_tra; int cg_reset_flag; int natm_mall; int nchrg_mall; int hess_calc; int natm_proc; int N_H2; int i_H2_start; int nab_initio; int myatm_start; double gamma_adb; double wght_pimd; double pi_temperature; double pi_beads_full_ter_wght; double pi_beads_res_ter_wght; double pi_beads_full_tra_wght; double pi_beads_res_tra_wght; double rcut_spread; double mass_sc_fact; int *ip_lab; int *ichrg; int *cp_vlnc_up; int *cp_atm_flag; double *mass; double *q; double *alp_pol; double *b_neut; double *roll_sc; double *text_atm; double *text_mol; double *xold; double *prekf; double *xmod; double alp_ewd; } clatoms_info; struct clatoms_tran { int pi_beads_proc; int pi_atm_proc; int pi_atm_proc_use; int pi_proc_rem; int nwork; int *sendcounts; int *senddspls; int *ifax; double *rat1_stag; double *path_eig; double *work; double *work3; double *x_trans; double *x_temp; double *xt_temp; } clatoms_tran; struct clatoms_pos { double *mass; double *x; double *vx; double *fx; double *fxt; double *fxm; double *hess_xx; } *clatoms_pos; struct ghost_atoms { int nghost_tot; int natm_comp_max; int nghost_mall; int nghost_old; int ncomp_mall; int ncomp_old; int *ighost_map; int *natm_comp; int **iatm_comp; double **coef; } ghost_atoms; struct atommaps { int nmol_typ; int nres_typ; int natm_typ; int nfreeze; int nfreeze_mall; int natm_typ_mall; int nres_typ_max; int nres_max; int nres_tot; int nres_sum; int pimd_freez_typ; char (*atm_typ)[50]; char (*res_typ)[50]; char (*mol_typ)[50]; int *nmol_jmol_typ; int *nres_1mol_jmol_typ; int *jatm_jmol_typ_strt; int *jres_jmol_typ_strt; int *ires_typ_jres_jmol_typ; int *jatm_jres_1mol_jmol_typ_strt; int *natm_1mol_jmol_typ; int *natm_jres_jmol_typ; int *nfree_1mol_jmol_typ; int *nfree_jres_jmol_typ; int *icons_jmol_typ; int *icons_jres_jmol_typ; int *natm_jmol_typ; int *iatm_mol_typ; int *iatm_res_typ; int *iatm_atm_typ; int *iatm_atm_typ_nl; int *iatm_atm_typ_nl_rev; int *imap_atm_typ_nl; int *imap_atm_typ_nl_gh; int *iatm_mol_num; int *iatm_proc_num; int *iatm_res_num; int *ighost_flag; int *freeze_flag; int *freeze_map; int *atom_label; int *cp_atm_lst; } atommaps; struct therm_info { int num_nhc; int len_nhc; int nres_nhc; int nyosh_nhc; int therm_typ; int num_nhc_proc; int num_nhc_share; int mytherm_start; double dt_nhc; int *inhc_x; int *itherm_nshare; double *ditherm_nshare_i; int *map_share; double *text_nhc; double *wdti; double **mass_nhc; } therm_info_class; struct therm_info therm_info_bead; struct therm_pos { double **x_nhc; double x_nhc_tot; } therm_class; struct therm_pos *therm_bead; struct vel_samp_class { int ivel_smpl_on; int ivel_scale_on; int nvx_smpl; int nvx_scale; int nvnhc_smpl; int iseed; double qseed; } vel_samp_class; struct energy_ctrl { int pme_on; int int_res_ter; int isep_vvdw; int iswit_vdw; int block_std_on; int iget_pe_real_inter_freq; int iget_pe_real_inter; int itime; int iget_full_inter; int iget_full_intra; int iget_full_pimd; } energy_ctrl; struct nbr_list { int iver; int ilnk; int nolst; int brnch_root_list_opt; double *x0; struct verlist { int iver_init; int iver_fill; int nolst_ver_update; int jver_pad; int nmem_min_lst; int nver_lst; int nver_lst_res; int nver_lst_now; int nver_lst_now_res; int *nter; int *jter; int *jver_off; int *nter_res; int *jter_res; int *jver_off_res; double mem_safe; } verlist; struct lnklist { int ilnk_init; int lnk_for_odd; int ncell_div_avg; int lnk_excl_safe; int lnk_vol_safe; int ncell_a; int natm_cell_max; int lnk_list_dim; int nshft_lnk; int nshft_lnk_res; double vol_lnk_map; double rcut_max; int *lnk_list; int *ishft_a; int *iexl_chk; int *ishft_a_res; int *iexl_chk_res; int *natm_cell; double *shft_wght; double *shft_wght_res; double *hmat_lnk; } lnklist; struct brnch_root { int nbrnch_tot; int nroot_tot; int natm_add_tot; int nbrnch_root_max; double brnch_root_dist_max; double cutdif_min_brnch_root; double cutdif_min_brnch_brnch; double cutdif_min_brnch_root_res; double cutdif_min_brnch_brnch_res; double r2_nocheck_dist; double r2_nocheck_dist_res; double cutskin_bb_min; double cutskin_bb_min_res; int *brnch_atm_list; int *brnch_atm_root; int *root_atm_list; int *root_atm_map; int *brnch_atm_map; int *nbrnch_of_root_big; int *nbrnch_of_root; int **ibrnch_of_root; int *natm_add; int *iatm_add; int *iatm_add_off; } brnch_root; } nbr_list; struct interact { int nsplin; int iswit_vdw; int dielectric_opt; int ishave_opt; int nter_typ; int nsplin_tot; int ninter_mall; int nsplin_mall_tot; int *inter_map_index; double dielectric_rheal; double dielectric_cut; double dielectric_eps; double brnch_root_skin; double skin; double brnch_root_cut; double rheal_res; double pten_inter_guess; double pten_kin_guess; double clong; double clong_res; double spread_now; double spread_lnk; double brnch_root_skin_lnk; double cutoff_max; double *cutoff; double *cutoff_res; double *cutti; double *cutskin; double *cutskin_res; double *cutskin_root; double *cutskin_root_res; double *vcut_coul; double *rmin_spl; double *dr_spl; double *cv0; double *cdv0; double *cv0_c; double *cdv0_c; } interact; struct int_scr { double v_lnv; double *x; double *vx; double *gx; double **x_nhc; double *vgmat; double *x_vol_nhc; double *sc; double *sc_temp; double *atm_kin; double *step_up; struct therm_scr { double *sc; double *atm_kin; } *therm_scr; } int_scr; struct ewd_scr { double *q; double *x; double *fx; double *heli; double *cossc; double *fx2; double *temp; double *helr_now; } ewd_scr; struct for_scr { int nlen; int nsplin_t; int num_brk; int intact; double wght_lnk; double wght_ter; double wght_ter_res; double wght_tra; double wght_tra_res; double wght_pimd; int *j_indext; int *i_indext2; int *j_lnk; int *j_index; int *num_brk_i; int *iexcl; int *index_atm; } for_scr; double tot_memory; struct part_mesh { int pme_on; int kmax_pme; int n_interp; int pme_res_on; int kmax_pme_res; int n_interp_res; int pme_para_opt; int nlen_pme; int nktot_pme; int ngrid_a; int nktot_pme_res; int ngrid_a_res; int ninterp_mall; int ninterp_tot_mall; int *iatemp; int *nc; int **igrid_a; int **igrid_now; double ecut; double ecut_res; double *bweight_tot_res; double *bweight_tot; double *qgrid; double *qgrid_scr; double *qgrid_tmp_real; double *qgrid_tmp_imag; double *frac_a; double *aj; double **ua; double **mn_a; double **dmn_a; double **qgrid_now; } part_mesh; struct surface { int isurf_on; int natm_typ; int nsplin_surf; int nsplin_tot; double zheal; double surface_height; double *surface_pot; double *surface_forc; double *zcut_off; double *dz_spl; double *dzi_spl; double *zmin_spl; char surface_type[50]; } surface; struct communicate { int np_beads; int myid; int myid_bead_forc; int myid_bead; int myid_bead_prime; int myid_state; int myid_forc; int myid_forc_source; int myid_forc_target; int world; int comm_beads; int comm_beads_forc; int comm_states; int comm_forc; int comm_forc_source; int comm_forc_target; int comm_faux; } communicate; struct class_comm_forc_pkg { int num_proc; int myid; int myatm_start; int mytherm_start; int *displs_atm; int *displs_therm; int comm; int world; double dbl_num_proc; struct class_plimpton_ind { int num_proc_source; int num_proc_target; int myid_source; int myid_target; int natoms_tot; int *index_src; int *index_src_even; int *index_src_odd; int *index_trg; int *index_trg_even; int *index_trg_odd; int *displs_atm_trg; int *displs_atm_src; int *src_odd_end; int *src_even_end; int *trg_odd_end; int *trg_even_end; int *src_odd_begin; int *src_even_begin; int *trg_odd_begin; int *trg_even_begin; int my_src_odd_counts; int my_src_even_counts; int my_trg_odd_counts; int my_trg_even_counts; int *my_src_odd; int *my_src_even; int *my_trg_odd; int *my_trg_even; int **jmax; int *jmin; int **imax; int source; int target; } plimpton_ind; } class_comm_forc_pkg; } *

variable_types: struct bonded { struct bond { int npow; int ntyp_pow; int ncon; int ntyp_con; int nbond_pow_mall; int nbond_typ_pow_mall; int nbond_con_mall; int nbond_typ_con_mall; int block_pow_on; int ncon_tot; int ncon_max; int nblock_pow; int nblock_con; int *j1_pow; int *jtyp_pow; int *j1_con; int *jtyp_con; int *iblock_pow_size; int *iblock_pow_conflict_1; int *iblock_con_size; int *iblock_con_conflict_1; double *eq_pow; double *eq_pow_res; double *c_0; double *dc_0; double *al_con; double *eq_con; } bond; struct grp_bond_con { int num_33; int num_21; int num_43; int ntyp_33; int num_23; int ntyp_23; int num_46; int ntyp_46; int max_iter; int ngrp_21_mall; int ngrp_33_mall; int ngrp_43_mall; int ngrp_23_mall; int ngrp_46_mall; int ngrp_typ_21_mall; int ngrp_typ_33_mall; int ngrp_typ_43_mall; int ngrp_typ_23_mall; int ngrp_typ_46_mall; int num_21_tot; double tol; int *j1_33; int *j1_21; int *j2_43; int *jtyp_33; int *j1_23; int *jtyp_23; int *j1_46; int *jtyp_46; double **al_33; double **al_23; double **al_21; double **eq_21; double **al_46; int ncons_gather_tot; int ncons_gather; int ncons_gather_max; int *ind_gather_fwd; int *ind_gather_bck; int *ind_gather_scr; } grp_bond_con; struct grp_bond_watts { int num_33; int num_33_tot; int ntyp_33; int ngrp_33_mall; int ngrp_typ_33_mall; int *j1_33; int *jtyp_33; double *cos_thet0_2; double **eq_33; double **c_0_33; double **c_4_33; double **dc_0_33; double **dc_4_33; } grp_bond_watts; struct constrnt { int iconstrnt; int iroll; int max_iter; double tolshake; double tolratl; } constrnt; struct bond_free { int num; int j1; int npow; int nhist; double fk; double eq; double del; double rmin; double rmax; char *file; double *hist; } bond_free; struct bend { int npow; int ntyp_pow; int ncon; int ntyp_con; int nbend_pow_mall; int nbend_typ_pow_mall; int nbend_con_mall; int nbend_typ_con_mall; int block_pow_on; int ncon_tot; int nblock_pow; int nblock_con; int *j1_pow; int *jtyp_pow; int *j1_con; int *jtyp_con; int *iblock_pow_size; int *iblock_pow_conflict_1; int *iblock_pow_conflict_3; int *iblock_con_size; int *iblock_con_conflict_1; int *iblock_con_conflict_3; double *eq_pow; double *c_0; double *s_0; double *dc_0; double *ds_0; double *al_con; double *eq_con; } bend; struct bend_free { int num; int j1; int npow; int nhist; double fk; double eq; double del; char *file; double *hist; } bend_free; struct bend_bnd { int num; int ntyp; int nbend_bnd_mall; int nbend_bnd_typ_mall; int block_on; int nblock; int *j1; int *jtyp; int *iblock_size; int *iblock_conflict_1; int *iblock_conflict_3; double *eq_bond; double *eq_bend; double *cbond_0; double *dcbond_0; double *cbend_0; double *sbend_0; double *dcbend_0; double *dsbend_0; } bend_bnd; struct tors { int npow; int ntyp_pow; int nimpr; int ncon; int ntyp_con; int ntors_pow_mall; int ntors_typ_pow_mall; int ntors_con_mall; int ntors_typ_con_mall; int block_pow_on; int block_con_on; int ncon_tot; int nblock_pow; int nblock_con; int *j1_pow; int *jtyp_pow; int *j1_con; int *jtyp_con; int *iblock_pow_size; int *iblock_pow_conflict_1; int *iblock_pow_conflict_3; int *iblock_con_size; int *iblock_con_conflict_1; int *iblock_con_conflict_3; double *c_0; double *s_0; double *dc_0; double *ds_0; double *eq_pow; double *al_con; double *eq_con; } tors; struct tors_free { int num; int npow; int nhist; int j1[3]; double fk; double eq[3]; double del; char *file; double *hist; double **hist_2d; } tors_free; struct rbar_sig_free { int nfree; int nhist_bar; int iopt; int *j1; double fk_bar; double fk_sigma; double eq_bar; double eq_sigma; double del_bar; double rmin; double smin; double rnfree; double **hist; double **hist_rn; char *file; } rbar_sig_free; struct onfo { int num; int ntyp; int nonfo_mall; int nonfo_typ_mall; int block_on; int nblock; int *j1; int *jtyp; int *iblock_size; int *iblock_conflict_1; double *feps; double *s6; double *sc; } onfo; struct ecor { int nsplin; int num; int block_on; int nblock; int nktot_res; int necor_mall; double alp_ewd; double ecut; double rmin_spl; double rmax_spl; double dr_spl; int *j1; int *iblock_size; int *iblock_conflict_1; double *cv0; } ecor; struct excl { int nlst; int nlst_root; int num_cp; int *num; int *j; int *j_off; int *j1_cp; } excl; struct intra_scr { int nlen; double wght_ter; double wght_ter_res; double wght_tra; double wght_tra_res; double int_res_inter; int *iatm_typ; int *jatm_typ; double *vpot; double *p11; double *p21; double *p31; double *x1; double *x2; double *x3; double *x4; double *x5; double *x6; double *x7; double *x8; double *fx1; double *fx2; double *fx3; double *fx4; double *dx12; double *dx13; double *dx23; double *dx42; double *dx43; double *dx56; double *dx57; double *dx67; double *dx86; double *dx87; double *c_0; double *dc_0; double *ds_0; double *s_0; double *eq; double *m1; double *vx1; double *vx2; double *sc_1; double *sc; double *q1; double *rmin; double *dri; double *vcut_coul; double *del_r; double *swit; double *cutoff_res; } intra_scr; } *

variable_types: struct general_data { struct simopts { int md; int pimd; int minimize; int cp; int cp_pimd; int cp_wave; int cp_wave_pimd; int cp_wave_min_pimd; int cp_min; int cp_wave_min; int debug; int debug_pimd; int debug_cp; int debug_cp_pimd; int pi_beads; int pi_md_typ; int initial_spread_opt; int anneal_opt; double ann_rate; double ann_start_temp; double ann_target_temp; } simopts; struct minopts { int min_std; int min_cg; int min_diis; int diis_hist_len; int cp_min_std; int cp_min_cg; int cp_min_diis; int cp_diis_hist_len; int cp_cg_line_min_len; int min_atm_com_fix_opt; double tol_coef; double tol_atom; } minopts; struct ensopts { int nve; } ensopts; struct filenames { char *iname; char *dname; char *dnamec; char *cpname; char *ksname; char *elfname; char *cvname; char *ccname; char *cpparname; char *centname; char *forcename; int low_lim_par; int high_lim_par; int iwrite_screen; int iwrite_inst; int iwrite_dump; int iwrite_kseigs; int iwrite_confv; int iwrite_confp; int iwrite_par_confp; int iwrite_confc; int iwrite_path_cent; int ifile_open; int iwrite_conf_binary; int iwrite_units; int iwrite_atm_for; int iwrite_elf; } filenames; struct statepoint { double pext; } statepoint; struct cell { int iperd; int intra_perds; int cubic_box_flag; int hmat_int_typ; int hmat_cons_typ; int imov_cp_box; double vol; double vol_cp; double vol0; double area; double alpha_conv_dual; double *hmat; double *hmat_ewd; double *hmat_cp; double *cp_box_center; double *cp_box_center_rel; double *cp_vbox_center; double *cp_fbox_center; } cell; struct timeinfo { int ntime; int ix_respa; int int_res_ter; int nres_ter; int int_res_tor; int int_res_pimd; int iget_pe_real_inter_freq; int exit_flag; double dt; } timeinfo; struct baro { int len_nhc; double x_lnv; double v_lnv_glob; double v_lnv_g; double f_lnv_p; double vol; double mass_lnv; double c2_lnv; double roll_scv; double roll_scg; double roll_scg0; double x_lnv_o; double v_lnv_g_wght; double area; double *x_vol_nhc; double *f_vol_nhc; double *hmato; } baro; struct par_rahman { double vol; double mass_hm; double c1_hm; double roll_scg; double roll_scg0; double area; double *vgmat; double *vgmat_glob; double *fgmat_p; double *roll_mtv; double *roll_mtvv; double *vtemps; double *vexpdt; double *vtempx; double *hmat_t; double *fv1; double *vgmat_g_wght; } par_rahman; struct ptens { double *tvten; double *pvten; double *pvten_inc; double *pvten_tmp_res; double *pvten_inc_t1; double *pvten_inc_a; double *pvten_inc_old; double *count_inc; double *pvten_inc_glob; double *pvten_mode; } ptens; struct stat_avg { int nexclt; int iter_shake; int iswit_vdw; int itime_update; int iter_shake_cp; int write_cp_atm_flag; double vintert; double vintrat; double vsurft; double vbondt; double vbend_bndt; double vbend_bnd_bond; double vbondt_watts; double vreal; double vvdw; double vlong; double vbond_free; double vbar_free; double kinet; double kinet_v; double vol; double kinet_nhc; double kinet_nhc_bead; double aikinet_nhc_bead; double akinet_nhc_bead; double vpot_v; double vpotnhc; double aiter_shake; double iter_23; double aiter_23; double aiter_21; double iter_23r; double aiter_23r; double aiter_21r; double acella; double aicella; double acellab; double aicellab; double apress; double press_inter; double apress_inter; double apress_intra; double press_kin; double apress_kin; double econv0; double cp_kconv0; double cpu1; double updates; double kinet_cp_up; double kinet_cp_dn; double kinet_cp; double kinet_nhc_cp; double vpotnhc_cp; double cp_ehart; double cp_eext; double cp_exc; double cp_muxc; double cp_eke; double cp_enl; double aiter_shake_cp; double maxfc; double pi_ke_prim; double api_ke_prim; double aipi_ke_prim; double kin_harm; double *apten; double fc_mag_up; double fc_max_up; double fatm_max; double count_diag_srot; double econv_now; double isokconv; } stat_avg; struct ewald { int nsplin_g; int nktot; int nktot_res; int nktot_mall; int nktot_res_mall; int nkc_max; int nkb_max; double alp_ewd; double self_erf; double ecut; double ecut_clus; double alp_clus; double gs_max; int *kastr; int *ibrk1; int *kastr_res; int *ibrk1_res; double *clus_corr_r; double *clus_corr_r_res; double *cvgs_2d0; double *vgc_1d_y; } ewald; struct para_fft_pkg3d { int nktot; int ncoef_use; int nfft_size; int nfft; int igeneric_opt; int scale_opt; int len_ifax; int nwork1; double ecut; int comm; int num_proc; int *map_proc; int *recv_counts_rho; int *recv_counts_coef; int *map_pme_dn; int *recvcounts_pme_dn; int *sendcounts_pme_dn; int *map_pme_up; int *recvcounts_pme_up; int *sendcounts_pme_up; int ndata_kc; int nkf3; int str_fft_kc_proc; int ska_fft_kc_proc; int skb_fft_kc_proc; int *sendcounts_fft_kc; int *recvcounts_fft_kc; int *sum_fft_kc_proc; int nka_fft_kc; int *ka_fft_kc; int *ifax_c_f; double *work_1c_f; double *work_1c_r; int ndata_kb; int nkf2; int str_fft_kb_proc; int ska_fft_kb_proc; int skc_fft_kb_proc; int *ska_fft_kb_proc_all; int *skc_fft_kb_proc_all; int *sendcounts_fft_kb; int *recvcounts_fft_kb; int *sum_fft_kb_proc; int *ifax_b_f; double *work_1b_f; double *work_1b_r; int ndata_ka; int nkf1; int str_fft_ka_proc; int skb_fft_ka_proc; int skc_fft_ka_proc; int *skb_fft_ka_proc_all; int *skc_fft_ka_proc_all; int *sendcounts_fft_ka; int *recvcounts_fft_ka; int *ifax_a_f; double *work_1a_f; double *work_1a_r; int *send_counts_row_big_small; int *recv_counts_row_big_small; int *sdispls_row_big_small; int *rdispls_row_big_small; int *send_counts_dual_map; int *recv_counts_dual_map; int *sdispls_dual_map; int *rdispls_dual_map; int *send_counts_row_big_small_upack; int *recv_counts_row_big_small_upack; int *sdispls_row_big_small_upack; int *rdispls_row_big_small_upack; int *send_counts_dual_map_upack; int *recv_counts_dual_map_upack; int *sdispls_dual_map_upack; int *rdispls_dual_map_upack; int *send_counts_ioff_big_small; int *recv_counts_ioff_big_small; int *sdispls_ioff_big_small; int *rdispls_ioff_big_small; } pme_fft_pkg; struct para_fft_pkg3d pme_res_fft_pkg; int error_check_on; } *

variable_types: struct cp { struct cpopts { int cp_lda; int cp_sic; int cp_gga; int cp_nonint; int cp_norb; int cp_gauss; int cp_ptens_calc; int cp_init_orthog; int cp_gs; int cp_ngrid_skip; int cp_hess_calc; int zero_cp_vel; int iwrite_coef_binary; int iread_coef_binary; int icheck_perd_size; int icheck_dual_size; int cp_para_opt; int cp_becke; int cp_pw91x; int cp_fila_1x; int cp_fila_2x; int cp_pbe_x; int cp_revpbe_x; int cp_rpbe_x; int cp_xpbe_x; int cp_brx89; int cp_brx2k; int cp_lyp; int cp_lypm1; int cp_pw91c; int cp_pbe_c; int cp_xpbe_c; int cp_tau1_c; int cp_debug_xc; int cp_dual_grid_opt; int cp_isok_opt; double te_ext; double tol_edge_dist; double tol_coef; double *occ_up; double *rocc_sum_up; double *rocc_sum_dn; } cpopts; struct cpcoeffs_info { int pi_beads; int nstate_up; int icmass_unif; int ks_rot_on; int n_ks_rot; int cp_ke_dens_on; int cp_tau_functional; int cp_elf_calc_frq; int cp_laplacian_on; int cp_nfree; int cp_nfree_up; int cp_nfree_dn; int pi_beads_proc; int pi_beads_proc_st; int pi_beads_proc_end; int nstate_up_proc; int istate_up_st; int istate_up_end; int cg_reset_flag; int diis_reset_flag; int ncoef; int ncoef_l; int ncoef_l_dens_cp_box; int icoef_start_up; int nstate_ncoef_proc_up; int nstate_ncoef_proc_max_up; int icoef_start_dn; int nstate_ncoef_proc_dn; int nstate_ncoef_proc_max_dn; int *ioff_up; int *ioff_upt; double ecut; double ecut_dens_cp_box; double cp_hess_cut; double pseud_hess_loc; double max_off_diag; double max_diag; double *cmass; double k0_up; } cpcoeffs_info; struct cpcoeffs_pos { double *cre_up; double *cre_dn; double *vcre_up; double *vcre_dn; double *fcre_up; double *fcre_dn; double *cp_hess_re_up; double *cp_hess_im_up; double *cp_hess_re_dn; double *cp_hess_im_dn; double *ksmat_up; double *ksmat_eig_up; double *ksmat_eig_dn; double ks_offset; double *norbmat_up; double *norbmati_up; double *ovmat_eigv_up; double *ovmat_eigv_dn; int icoef_form_up; int ivcoef_form_up; int ifcoef_form_up; int icoef_orth_up; int ivcoef_orth_up; int ifcoef_orth_up; double max_diag; } *cpcoeffs_pos; struct cptherm_info { int num_c_nhc; int num_c_nhc_proc; int num_c_nhc_norm; int len_c_nhc; int nres_c_nhc; int nyosh_c_nhc; int massiv_flag; int istate_nhc_opt; double cp_therm_heat_fact; double dt_nhc; double c_gkt_massiv; double cmass_nhc_massiv; int *icmapup_nhc; int *icmapdn_nhc; double *wdti; double **c_gkt; double **cmass_nhc; } cptherm_info; struct cptherm_pos { double c_nhc_massiv; double **c_nhc; double **vc_nhc; double **fc_nhc; int itherm_form_up; int itherm_form_dn; } *cptherm_pos; struct electronic_properties { double *cp_elf_up; } electronic_properties; struct cpewald { int nktot_sm; int nktot_dens_cp_box; int nktot_cp_mall; int nktot_cp_sm_mall; int nktot_dens_cp_box_mall; int box_rat; double dbox_rat; double gw_gmin; double gw_gmin_dens_cp_box; int *kmax_cp; int *kmax_cp_dens_cp_box; int *kastr_sm; int *kastr_dens_cp_box; int *ibrk1_sm; int *ibrk1_dens_cp_box; double *ak2; double *ak2_dens_cp_box; } cpewald; struct cpconstrnt { double c_tolshake; double c_tolratl; double c_tolnorb; } cpconstrnt; struct pseudo { int n_ang_max; int n_ang_max_gh; int n_ang_max_kb; int n_rad_max; int nsplin_g; int nsplin_g_tot; int num_nl_lst; int nl_cut_on; int n_ang_mall; int nsplin_g_mall; int nvpsnorm_mall; int nlist_mall; int n_interp_pme_dual; int natm_typ_nl; int natm_typ_gh; int ngh; double gmin_true; double gmin_spl; double gmax_spl; double dg_spl; double gga_cut; double nlvps_skin; double alpha_conv_dual; int *n_ang; int *nrad_0; int *nrad_max_l; int *loc_opt; int *ivps_label; int *np_nl; int *np_nl_gh; int **np_nl_rad_str; int **np_nl_rad_end; int *ip_nl; int *ip_nl_rev; int *ip_nl_gh; int *ip_nl_rev_gh; int *map_nl; int np_loc_cp_box; int np_nonloc_cp_box; int np_nonloc_cp_box_kb; int np_nonloc_cp_box_gh; int *ip_loc_cp_box; int *ip_nonloc_cp_box; double *vps0; double *dvps0; double *gzvps; double *gzvps0; double *vpsnorm; double *rcut_nl; double *rgh; double *x0w; double *q_pseud; char *vxc_typ; char *ggax_typ; char *ggac_typ; } pseudo; struct cpscr { struct cpscr_loc { double *vextr; double *vextr_dens_cp_box; double *dvextr; } cpscr_loc; struct cpscr_nonloc { int natm_nls_max; int nlscr_up; int nlscr_dn; double *vnlre_up; double *vnlre_dn; double *dvnlre_x_up; double *dvnlim_x_up; double *dvnlre_x_dn; double *dvnlim_x_dn; double *dvnlre_gxgx_up; double *dvnlre_gygy_up; double *dvnlre_gzgz_up; double *dvnlre_gxgy_up; double *dvnlre_gygz_up; double *dvnlre_gxgz_up; double *dvnlre_gxgx_dn; double *dvnlre_gygy_dn; double *dvnlre_gzgz_dn; double *dvnlre_gxgy_dn; double *dvnlre_gygz_dn; double *dvnlre_gxgz_dn; } cpscr_nonloc; struct cpscr_rho { int iset_map_flag; int iset_map_upack_flag; int iset_map_flag_pme; int iset_map_upack_flag_pme; int *map_dual; int *map_dual_upack; double *v_ks_up; double *v_ks_dn; double *v_ks_tau_up; double *v_ks_tau_dn; double *rho_up; double *rho_dn; double *rhocr_up; double *rhocr_scr; double *rhocr_up_dens_cp_box; double *rhocr_dn; double *rhocr_dn_dens_cp_box; } cpscr_rho; struct cpscr_grho { double *d2_rho_up; double *d2_rho_dn; double *d2_rho_up_store; double *d2_rho_dn_store; double *d_rhox_up; double *d_rhox_dn; double *dm_rhox_up; double *dm_rhox_dn; double *elec_ke_dens_up; double *g_rhor_x; double *g_rhoi_x; double *g2_rhor; double *rhocr_up_st; double *rhocr_dn_st; } cpscr_grho; struct cpscr_ovmat { double *ovlap1; double *ovlap3; double *ovlap5; double *ovlap7; double *state_vec1; double *state_vec2; double *state_vec3; double *state_vec4; double *state_vec5; double *state_vec6; double *state_vec7; } cpscr_ovmat; struct cpscr_wave { double *zfft; int zfft_mall_size; double *cre_up; double *cre_dn; } cpscr_wave; struct cpscr_therm { double *coef_kin; double *sc_cp; } cpscr_therm; struct cpscr_dual_pme { int *iatemp; int **igrid_a; int **igrid_now; double *a_pme; double *frac_a; double *aj; double **mn_a; double **ua; double *bw_r; int nfft_send_big_small; int nfft_recv_big_small; int num_rows_tot; int *ioff_lg_sm; int **joff_sm_lg; } cpscr_dual_pme; struct cpscr_atom_pme { int pme_on; int n_interp; int pme_para_opt; int nlen_pme; int nktot_pme; int nkf1; int ngrid_a; int *iatemp; int *nc; int **igrid_a; int **igrid_now; double *frac_a; double *aj; double **ua; double **mn_a; double **dmn_a; double **qgrid_now; double *qgrid; double *qgrid_scr; double *qgrid_tmp_real; double *qgrid_tmp_imag; double *bweight_tot; double *bw_r; } cpscr_atom_pme; } cpscr; struct communicate communicate; struct para_fft_pkg3d cp_sclr_fft_pkg3d_sm; struct para_fft_pkg3d cp_para_fft_pkg3d_sm; struct para_fft_pkg3d cp_sclr_fft_pkg3d_dens_cp_box; struct para_fft_pkg3d cp_para_fft_pkg3d_dens_cp_box; struct para_fft_pkg3d cp_sclr_fft_pkg3d_lg; struct para_fft_pkg3d cp_para_fft_pkg3d_lg; struct cp_comm_state_pkg { int num_proc; int myid; int nstate; int nstate_max; int ncoef; int nstate_proc; int nstate_proc_max; int nstate_ncoef_proc_max; int nstate_ncoef_proc; int icoef_start; int comm; int world; int ioff_therm_norm[3]; } cp_comm_state_pkg_up; struct cp_comm_state_pkg cp_comm_state_pkg_dn; struct vel_samp_cp { int ivelc_smpl_on; int ivelc_scal_on; int nvc_smpl; int nvcnhc_smpl; int nvc_scal; int iseed; int iauto_vc_scal_opt; double qseed; double vc_scal_tol; double div_scal; } vel_samp_cp; } *

variable_types: i int

variable_types: j int

variable_types: ip int

variable_types: iflag int

variable_types: start int

variable_types: npairs int

variable_types: cpu double

variable_types: rank int

variable_types: world int

user_defined_types: struct class { struct clatoms_info clatoms_info; struct clatoms_tran clatoms_tran; struct clatoms_pos *clatoms_pos; struct ghost_atoms ghost_atoms; struct atommaps atommaps; struct therm_info therm_info_class; struct therm_info therm_info_bead; struct therm_pos therm_class; struct therm_pos *therm_bead; struct vel_samp_class vel_samp_class; struct energy_ctrl energy_ctrl; struct nbr_list nbr_list; struct interact interact; struct int_scr int_scr; struct ewd_scr ewd_scr; struct for_scr for_scr; double tot_memory; struct part_mesh part_mesh; struct surface surface; struct communicate communicate; struct class_comm_forc_pkg class_comm_forc_pkg; }

user_defined_types: struct bonded { struct bond bond; struct grp_bond_con grp_bond_con; struct grp_bond_watts grp_bond_watts; struct constrnt constrnt; struct bond_free bond_free; struct bend bend; struct bend_free bend_free; struct bend_bnd bend_bnd; struct tors tors; struct tors_free tors_free; struct rbar_sig_free rbar_sig_free; struct onfo onfo; struct ecor ecor; struct excl excl; struct intra_scr intra_scr; }

user_defined_types: struct general_data { struct simopts simopts; struct minopts minopts; struct ensopts ensopts; struct filenames filenames; struct statepoint statepoint; struct cell cell; struct timeinfo timeinfo; struct baro baro; struct par_rahman par_rahman; struct ptens ptens; struct stat_avg stat_avg; struct ewald ewald; struct para_fft_pkg3d pme_fft_pkg; struct para_fft_pkg3d pme_res_fft_pkg; int error_check_on; }

user_defined_types: struct cp { struct cpopts cpopts; struct cpcoeffs_info cpcoeffs_info; struct cpcoeffs_pos *cpcoeffs_pos; struct cptherm_info cptherm_info; struct cptherm_pos *cptherm_pos; struct electronic_properties electronic_properties; struct cpewald cpewald; struct cpconstrnt cpconstrnt; struct pseudo pseudo; struct cpscr cpscr; struct communicate communicate; struct para_fft_pkg3d cp_sclr_fft_pkg3d_sm; struct para_fft_pkg3d cp_para_fft_pkg3d_sm; struct para_fft_pkg3d cp_sclr_fft_pkg3d_dens_cp_box; struct para_fft_pkg3d cp_para_fft_pkg3d_dens_cp_box; struct para_fft_pkg3d cp_sclr_fft_pkg3d_lg; struct para_fft_pkg3d cp_para_fft_pkg3d_lg; struct cp_comm_state_pkg cp_comm_state_pkg_up; struct cp_comm_state_pkg cp_comm_state_pkg_dn; struct vel_samp_cp vel_samp_cp; }

user_defined_types: struct therm_pos { double **x_nhc; double x_nhc_tot; }

user_defined_types: struct vel_samp_class { int ivel_smpl_on; int ivel_scale_on; int nvx_smpl; int nvx_scale; int nvnhc_smpl; int iseed; double qseed; }

user_defined_types: struct nbr_list { int iver; int ilnk; int nolst; int brnch_root_list_opt; double *x0; struct verlist verlist; struct lnklist lnklist; struct brnch_root brnch_root; }

user_defined_types: struct int_scr { double v_lnv; double *x; double *vx; double *gx; double **x_nhc; double *vgmat; double *x_vol_nhc; double *sc; double *sc_temp; double *atm_kin; double *step_up; struct therm_scr *therm_scr; }

user_defined_types: struct ewd_scr { double *q; double *x; double *fx; double *heli; double *cossc; double *fx2; double *temp; double *helr_now; }

user_defined_types: struct class_comm_forc_pkg { int num_proc; int myid; int myatm_start; int mytherm_start; int *displs_atm; int *displs_therm; int comm; int world; double dbl_num_proc; struct class_plimpton_ind plimpton_ind; }

user_defined_types: struct constrnt { int iconstrnt; int iroll; int max_iter; double tolshake; double tolratl; }

user_defined_types: struct bond_free { int num; int j1; int npow; int nhist; double fk; double eq; double del; double rmin; double rmax; char *file; double *hist; }

user_defined_types: struct bend_free { int num; int j1; int npow; int nhist; double fk; double eq; double del; char *file; double *hist; }

user_defined_types: struct tors_free { int num; int npow; int nhist; int j1[3]; double fk; double eq[3]; double del; char *file; double *hist; double **hist_2d; }

user_defined_types: struct excl { int nlst; int nlst_root; int num_cp; int *num; int *j; int *j_off; int *j1_cp; }

user_defined_types: struct electronic_properties { double *cp_elf_up; }

user_defined_types: struct cpconstrnt { double c_tolshake; double c_tolratl; double c_tolnorb; }

user_defined_types: struct cpscr { struct cpscr_loc cpscr_loc; struct cpscr_nonloc cpscr_nonloc; struct cpscr_rho cpscr_rho; struct cpscr_grho cpscr_grho; struct cpscr_ovmat cpscr_ovmat; struct cpscr_wave cpscr_wave; struct cpscr_therm cpscr_therm; struct cpscr_dual_pme cpscr_dual_pme; struct cpscr_atom_pme cpscr_atom_pme; }

user_defined_types: struct clatoms_pos { double *mass; double *x; double *vx; double *fx; double *fxt; double *fxm; double *hess_xx; }

user_defined_types: struct cptherm_pos { double c_nhc_massiv; double **c_nhc; double **vc_nhc; double **fc_nhc; int itherm_form_up; int itherm_form_dn; }

user_defined_types: struct cpscr_loc { double *vextr; double *vextr_dens_cp_box; double *dvextr; }

user_defined_types: struct cpscr_wave { double *zfft; int zfft_mall_size; double *cre_up; double *cre_dn; }

user_defined_types: struct cpscr_therm { double *coef_kin; double *sc_cp; }

user_defined_types: struct therm_scr { double *sc; double *atm_kin; }


decompiled_code:
int __fastcall set_res_bond_params(const char *a1, __int64 a2, int a3, const char *a4, int a5, __int64 a6, int a7, __int64 a8, int a9, int a10)
{
__int64 v11; // rbp
_QWORD *v13; // r14
int i; // er15
__int64 v15; // rbp
const char *v16; // r14
const char *v17; // r15
int v18; // eax
int v19; // eax
const char *v20; // rdi
int v21; // eax
const char *v22; // rdi
__int64 v23; // r13
__int64 v24; // rbp
__int64 v25; // rbx
__int64 v26; // rbx
int result; // eax
int v28; // er8
const char *v29; // rdi
const char *v30; // rdi
int s1; // [rsp+0h] [rbp-58h]
__int64 v32; // [rsp+8h] [rbp-50h]
unsigned int v33; // [rsp+18h] [rbp-40h] BYREF
unsigned int v34[15]; // [rsp+1Ch] [rbp-3Ch] BYREF

v11 = a3;
if ( a5 > 0 )
{
v13 = a4 + 216;
for ( i = 1; i <= a5; ++i )
{
if ( *v13 == 0x100000000LL )
{
v32 = a6;
s1 = a5;
keyword_miss(a4, a1, a2, (unsigned int)i);
a6 = v32;
a5 = s1;
}
v13 = (_QWORD *)((char *)v13 + 212);
}
}
v15 = a6 + 924 * v11;
v16 = (const char *)(v15 + 78);
v17 = (const char *)(v15 + 128);
strcpy((char *)(v15 + 78), a4 + 274);
strcpy((char *)(v15 + 128), a4 + 486);
_isoc99_sscanf(a4 + 698, &LC0, &v33);
v18 = v33;
*(_DWORD *)(v15 + 4) = v33;
if ( v18 <= 0 || v18 > a7 )
keyarg_barf(a4, a1, a2, 3LL);
_isoc99_sscanf(a4 + 910, &LC0, v34);
v19 = v34[0];
*(_DWORD *)(v15 + 8) = v34[0];
if ( v19 > a7 || v19 <= 0 )
keyarg_barf(a4, a1, a2, 4LL);
strcpy((char *)(v15 + 178), a4 + 1122);
if ( !strcasecmp(a4 + 1122, "null") )
{
puts("@@@@@@@@@@@@@@@@@@@@_error_@@@@@@@@@@@@@@@@@@@@");
v30 = "You have defined the null bond site!!! ";
LABEL_27:
puts(v30);
puts("Atoms are defaulted to the null bond site. ");
puts("Choose another name for your bond site and ");
v29 = "be excellent to your residue. ";
goto LABEL_28;
}
strcpy((char *)(v15 + 228), a4 + 1334);
if ( !strcasecmp(a4 + 1334, "null") )
{
puts("@@@@@@@@@@@@@@@@@@@@_error_@@@@@@@@@@@@@@@@@@@@");
v30 = "You have defined the null bond site!!! ";
goto LABEL_27;
}
strcpy((char *)(v15 + 278), a4 + 1546);
strcpy((char *)(v15 + 328), a4 + 1758);
v20 = a4 + 1970;
if ( strcasecmp(a4 + 1970, "con") )
{
v28 = strcasecmp(v20, "null");
v21 = 2;
if ( v28 )
{
v21 = strcasecmp(v20, "on");
if ( v21 )
{
keyarg_barf(a4, a1, a2, 9LL);
v21 = -1;
}
}
goto LABEL_15;
}
if ( !strcasecmp(v20, "null") )
{
v21 = 2;
LABEL_15:
*(_DWORD *)v15 = v21;
goto LABEL_16;
}
*(_DWORD *)v15 = 1;
if ( a10 > 1 )
{
puts("@@@@@@@@@@@@@@@@@@@@_error_@@@@@@@@@@@@@@@@@@@@");
puts("Constraints not implemented under ");
v29 = " path integral dynamics. ";
LABEL_28:
puts(v29);
goto LABEL_29;
}
LABEL_16:
strcpy((char *)(v15 + 28), a4 + 2182);
v22 = (const char *)(v15 + 78);
v23 = *(_QWORD *)(a8 + 104);
v24 = *(_QWORD *)(a8 + 56);
v25 = 50LL * *(int *)(v23 + 4LL * (int)(v33 + a9));
if ( strcasecmp(v22, (const char *)(v24 + v25)) )
{
puts("@@@@@@@@@@@@@@@@@@@@_error_@@@@@@@@@@@@@@@@@@@@");
puts("Input error in ~res_bond_def");
printf("1st Residue type, 1st residue index mismatch in file %s\n", a1);
printf("Residue index %d is of type %s not of type %s\n", v33, v16, (const char *)(v25 + *(_QWORD *)(a8 + 56)));
goto LABEL_29;
}
v26 = 50LL * *(int *)(v23 + 4LL * (v34[0] + a9));
result = strcasecmp(v17, (const char *)(v24 + v26));
if ( result )
{
puts("@@@@@@@@@@@@@@@@@@@@_error_@@@@@@@@@@@@@@@@@@@@");
puts("Input error in ~res_bond_def");
printf("2nd Residue type, 2nd residue index mismatch in file %s\n", a1);
printf("Residue index %d is of type %s not of type %s\n", v34[0], v17, (const char *)(v26 + *(_QWORD *)(a8 + 56)));
LABEL_29:
puts("@@@@@@@@@@@@@@@@@@@@_error_@@@@@@@@@@@@@@@@@@@@");
fflush(stdout);
exit(1);
}
return result;
}

original_code:
void set_res_bond_params(char *filename,char fun_key[],int ires_bond,
    DICT_WORD res_bond_dict[],int num_res_bond_dict,
    RESBOND_PRM resbond_prm[],
                         int nres_now,ATOMMAPS *atommaps,int ires_off,
                         int pi_beads)
{
  int num,i,index,ires1,ires2,ires_typ;
  for(i=1;i<=num_res_bond_dict;i++){
    if(res_bond_dict[i].iuset==0 && res_bond_dict[i].key_type==1){
      keyword_miss(res_bond_dict,filename,fun_key,i);}
  }
  strcpy(resbond_prm[ires_bond].res1_typ,res_bond_dict[1].keyarg);
  strcpy(resbond_prm[ires_bond].res2_typ,res_bond_dict[2].keyarg);
  sscanf(res_bond_dict[3].keyarg,"%d",&ires1);
  resbond_prm[ires_bond].res1_index=ires1;
  index = 3;
  if((ires1 <=0)|| (ires1 > nres_now)){
    keyarg_barf(res_bond_dict,filename,fun_key,index);
  }
  sscanf(res_bond_dict[4].keyarg,"%d",&ires2);
  resbond_prm[ires_bond].res2_index=ires2;
  index = 4;
  if((ires2 <=0 || (ires2>nres_now))){
    keyarg_barf(res_bond_dict,filename,fun_key,index);
  }
  strcpy(resbond_prm[ires_bond].res1_site,res_bond_dict[5].keyarg);
  if(strcasecmp(res_bond_dict[5].keyarg,"null")==0){
        printf("@@@@@@@@@@@@@@@@@@@@_error_@@@@@@@@@@@@@@@@@@@@\n");
        printf("You have defined the null bond site!!!     \n");
        printf("Atoms are defaulted to the null bond site. \n");
        printf("Choose another name for your bond site and \n");
        printf("be excellent to your residue.              \n");
        printf("@@@@@@@@@@@@@@@@@@@@_error_@@@@@@@@@@@@@@@@@@@@\n");
        fflush(stdout);
        exit(1);
  }
  strcpy(resbond_prm[ires_bond].res2_site,res_bond_dict[6].keyarg);
  if(strcasecmp(res_bond_dict[6].keyarg,"null")==0){
        printf("@@@@@@@@@@@@@@@@@@@@_error_@@@@@@@@@@@@@@@@@@@@\n");
        printf("You have defined the null bond site!!!    \n");
        printf("Atoms are defaulted to the null bond site. \n");
        printf("Choose another name for your bond site and \n");
        printf("be excellent to your residue.              \n");
        printf("@@@@@@@@@@@@@@@@@@@@_error_@@@@@@@@@@@@@@@@@@@@\n");
        fflush(stdout);
        exit(1);
  }
  strcpy(resbond_prm[ires_bond].res1_file,res_bond_dict[7].keyarg);
  strcpy(resbond_prm[ires_bond].res2_file,res_bond_dict[8].keyarg);
  index = 9;
  num=-1;
  if(strcasecmp(res_bond_dict[9].keyarg,"on")==0){num= 0;}
  if(strcasecmp(res_bond_dict[9].keyarg,"con")==0){num= 1;}
  if(strcasecmp(res_bond_dict[9].keyarg,"null")==0){num= 2;}
  if((num <0)){keyarg_barf(res_bond_dict,filename,fun_key,index);}
  resbond_prm[ires_bond].opt = num;
  if(num == 1 && pi_beads>1){
        printf("@@@@@@@@@@@@@@@@@@@@_error_@@@@@@@@@@@@@@@@@@@@\n");
        printf("Constraints not implemented under  \n");
        printf(" path integral dynamics.            \n");
        printf("@@@@@@@@@@@@@@@@@@@@_error_@@@@@@@@@@@@@@@@@@@@\n");
        fflush(stdout);
        exit(1);
  }
  strcpy(resbond_prm[ires_bond].label,res_bond_dict[10].keyarg);
  ires_typ = atommaps->ires_typ_jres_jmol_typ[ires1+ires_off];
  if(strcasecmp(resbond_prm[ires_bond].res1_typ,
                atommaps->res_typ[ires_typ])!=0){
     printf("@@@@@@@@@@@@@@@@@@@@_error_@@@@@@@@@@@@@@@@@@@@\n");
     printf("Input error in ~res_bond_def\n");
     printf("1st Residue type, 1st residue index mismatch in file %s\n",
             filename);
     printf("Residue index %d is of type %s not of type %s\n",
           ires1,resbond_prm[ires_bond].res1_typ,atommaps->res_typ[ires_typ]);
     printf("@@@@@@@@@@@@@@@@@@@@_error_@@@@@@@@@@@@@@@@@@@@\n");
     fflush(stdout);
     exit(1);
  }
  ires_typ = atommaps->ires_typ_jres_jmol_typ[ires2+ires_off];
  if(strcasecmp(resbond_prm[ires_bond].res2_typ,
  atommaps->res_typ[ires_typ])!=0){
     printf("@@@@@@@@@@@@@@@@@@@@_error_@@@@@@@@@@@@@@@@@@@@\n");
     printf("Input error in ~res_bond_def\n");
     printf("2nd Residue type, 2nd residue index mismatch in file %s\n",
             filename);
     printf("Residue index %d is of type %s not of type %s\n",
            ires2,resbond_prm[ires_bond].res2_typ,
     atommaps->res_typ[ires_typ]);
     printf("@@@@@@@@@@@@@@@@@@@@_error_@@@@@@@@@@@@@@@@@@@@\n");
     fflush(stdout);
     exit(1);
  }
}

canonical_original_code:
void set_res_bond_params(char *filename, char fun_key[], int ires_bond, struct dict_word res_bond_dict[], int num_res_bond_dict, struct resbond_prm resbond_prm[], int nres_now, struct atommaps *atommaps, int ires_off, int pi_beads)
{
  int num; int i; int index; int ires1; int ires2; int ires_typ;
  for(i=1;i<=num_res_bond_dict;i++){
    if(res_bond_dict[i].iuset==0 && res_bond_dict[i].key_type==1){
      keyword_miss(res_bond_dict,filename,fun_key,i);}
  }
  strcpy(resbond_prm[ires_bond].res1_typ,res_bond_dict[1].keyarg);
  strcpy(resbond_prm[ires_bond].res2_typ,res_bond_dict[2].keyarg);
  sscanf(res_bond_dict[3].keyarg,"%d",&ires1);
  resbond_prm[ires_bond].res1_index=ires1;
  index = 3;
  if((ires1 <=0)|| (ires1 > nres_now)){
    keyarg_barf(res_bond_dict,filename,fun_key,index);
  }
  sscanf(res_bond_dict[4].keyarg,"%d",&ires2);
  resbond_prm[ires_bond].res2_index=ires2;
  index = 4;
  if((ires2 <=0 || (ires2>nres_now))){
    keyarg_barf(res_bond_dict,filename,fun_key,index);
  }
  strcpy(resbond_prm[ires_bond].res1_site,res_bond_dict[5].keyarg);
  if(strcasecmp(res_bond_dict[5].keyarg,"null")==0){
        printf("@@@@@@@@@@@@@@@@@@@@_error_@@@@@@@@@@@@@@@@@@@@\n");
        printf("You have defined the null bond site!!!     \n");
        printf("Atoms are defaulted to the null bond site. \n");
        printf("Choose another name for your bond site and \n");
        printf("be excellent to your residue.              \n");
        printf("@@@@@@@@@@@@@@@@@@@@_error_@@@@@@@@@@@@@@@@@@@@\n");
        fflush(stdout);
        exit(1);
  }
  strcpy(resbond_prm[ires_bond].res2_site,res_bond_dict[6].keyarg);
  if(strcasecmp(res_bond_dict[6].keyarg,"null")==0){
        printf("@@@@@@@@@@@@@@@@@@@@_error_@@@@@@@@@@@@@@@@@@@@\n");
        printf("You have defined the null bond site!!!    \n");
        printf("Atoms are defaulted to the null bond site. \n");
        printf("Choose another name for your bond site and \n");
        printf("be excellent to your residue.              \n");
        printf("@@@@@@@@@@@@@@@@@@@@_error_@@@@@@@@@@@@@@@@@@@@\n");
        fflush(stdout);
        exit(1);
  }
  strcpy(resbond_prm[ires_bond].res1_file,res_bond_dict[7].keyarg);
  strcpy(resbond_prm[ires_bond].res2_file,res_bond_dict[8].keyarg);
  index = 9;
  num=-1;
  if(strcasecmp(res_bond_dict[9].keyarg,"on")==0){num= 0;}
  if(strcasecmp(res_bond_dict[9].keyarg,"con")==0){num= 1;}
  if(strcasecmp(res_bond_dict[9].keyarg,"null")==0){num= 2;}
  if((num <0)){keyarg_barf(res_bond_dict,filename,fun_key,index);}
  resbond_prm[ires_bond].opt = num;
  if(num == 1 && pi_beads>1){
        printf("@@@@@@@@@@@@@@@@@@@@_error_@@@@@@@@@@@@@@@@@@@@\n");
        printf("Constraints not implemented under  \n");
        printf(" path integral dynamics.            \n");
        printf("@@@@@@@@@@@@@@@@@@@@_error_@@@@@@@@@@@@@@@@@@@@\n");
        fflush(stdout);
        exit(1);
  }
  strcpy(resbond_prm[ires_bond].label,res_bond_dict[10].keyarg);
  ires_typ = atommaps->ires_typ_jres_jmol_typ[ires1+ires_off];
  if(strcasecmp(resbond_prm[ires_bond].res1_typ,
                atommaps->res_typ[ires_typ])!=0){
     printf("@@@@@@@@@@@@@@@@@@@@_error_@@@@@@@@@@@@@@@@@@@@\n");
     printf("Input error in ~res_bond_def\n");
     printf("1st Residue type, 1st residue index mismatch in file %s\n",
             filename);
     printf("Residue index %d is of type %s not of type %s\n",
           ires1,resbond_prm[ires_bond].res1_typ,atommaps->res_typ[ires_typ]);
     printf("@@@@@@@@@@@@@@@@@@@@_error_@@@@@@@@@@@@@@@@@@@@\n");
     fflush(stdout);
     exit(1);
  }
  ires_typ = atommaps->ires_typ_jres_jmol_typ[ires2+ires_off];
  if(strcasecmp(resbond_prm[ires_bond].res2_typ,
  atommaps->res_typ[ires_typ])!=0){
     printf("@@@@@@@@@@@@@@@@@@@@_error_@@@@@@@@@@@@@@@@@@@@\n");
     printf("Input error in ~res_bond_def\n");
     printf("2nd Residue type, 2nd residue index mismatch in file %s\n",
             filename);
     printf("Residue index %d is of type %s not of type %s\n",
            ires2,resbond_prm[ires_bond].res2_typ,
     atommaps->res_typ[ires_typ]);
     printf("@@@@@@@@@@@@@@@@@@@@_error_@@@@@@@@@@@@@@@@@@@@\n");
     fflush(stdout);
     exit(1);
  }
}

variable_types:
filename
char *

variable_types: struct dict_word { int iflag; char keyword[50]; char error_mes[100]; } []

variable_types: struct resbond_prm { int opt; int res1_index; int iatm_res1_site; int natm_res1_1back; char label[50]; char res1_typ[50]; char res1_site[50]; char res1_file[50]; int improp_res1[5]; int iatm_res1_1back[7]; int natm_res1_2back[7]; int iatm_res1_2back[7][7]; } []

variable_types: struct atommaps { int nmol_typ; int nres_typ; int natm_typ; int nfreeze; int nfreeze_mall; int natm_typ_mall; int nres_typ_max; int nres_max; int nres_tot; int nres_sum; int pimd_freez_typ; char (*atm_typ)[50]; char (*res_typ)[50]; char (*mol_typ)[50]; int *nmol_jmol_typ; int *nres_1mol_jmol_typ; int *jatm_jmol_typ_strt; int *jres_jmol_typ_strt; int *ires_typ_jres_jmol_typ; int *jatm_jres_1mol_jmol_typ_strt; int *natm_1mol_jmol_typ; int *natm_jres_jmol_typ; int *nfree_1mol_jmol_typ; int *nfree_jres_jmol_typ; int *icons_jmol_typ; int *icons_jres_jmol_typ; int *natm_jmol_typ; int *iatm_mol_typ; int *iatm_res_typ; int *iatm_atm_typ; int *iatm_atm_typ_nl; int *iatm_atm_typ_nl_rev; int *imap_atm_typ_nl; int *imap_atm_typ_nl_gh; int *iatm_mol_num; int *iatm_proc_num; int *iatm_res_num; int *ighost_flag; int *freeze_flag; int *freeze_map; int *atom_label; int *cp_atm_lst; } *

variable_types: num int

variable_types: index int