void set_res_morph_params(DICT_WORD res_name_dict[],int num_res_name_dict, char fun_key[],char file_name[],NAME res_typ[], int natm_jres_jmol_typ[],int jmol_typ, int jres,int jres_off, int ires_typ_jres_jmol_typ[]) /*==========================================================================*/ { int i,index,index2; /*=======================================================================*/ /* I) Check for missing key words*/ for(i=1;i<=1;i++){ if(res_name_dict[i].iuset==0 && res_name_dict[i].key_type==1){ keyword_miss(res_name_dict,file_name,fun_key,i);} } /*endfor*/ /*======================================================================*/ /* II) Set the keywords */ /*-------------------------------------------------------------------------*/ /* 1) \residue_name{} */ index = 1; index2 = ires_typ_jres_jmol_typ[(jres+jres_off)]; if(strcasecmp(res_typ[index2],res_name_dict[1].keyarg)!=0){ keyarg_barf(res_name_dict,file_name,fun_key,index);} /*---------------------------------------------------------------------*/ } /*end routine*/
void set_mol_name_params(DICT_WORD mol_name_dict[],int num_mol_name_dict, char fun_key[],char filename[],NAME mol_typ[], int natm_1mol_jmol_typ[],int jmol_typ,int nres_expt) /*==========================================================================*/ { int num,i,index; /*=======================================================================*/ /* I) Check for missing key words*/ for(i=1;i<=num_mol_name_dict;i++){ if(mol_name_dict[i].iuset==0 && mol_name_dict[i].key_type==1){ keyword_miss(mol_name_dict,filename,fun_key,i);} } /*endfor*/ /*======================================================================*/ /* II) Set the keywords */ /*-------------------------------------------------------------------------*/ /* 1) \mol_name{} */ index = 1; if(strcasecmp(mol_typ[jmol_typ],mol_name_dict[1].keyarg)!=0){ keyarg_barf(mol_name_dict,filename,fun_key,index);} /*-------------------------------------------------------------------------*/ /* 2) \nresidue{} */ sscanf(mol_name_dict[2].keyarg,"%d",&num); index = 2; if(num < 0){ keyarg_barf(mol_name_dict,filename,fun_key,index); } if(num != nres_expt){ printf("@@@@@@@@@@@@@@@@@@@@_ERROR_@@@@@@@@@@@@@@@@@@@@\n"); printf("Number of residue's specified %d not equal to number expected %d\n", num,nres_expt); printf("in file %s\n",filename); printf("@@@@@@@@@@@@@@@@@@@@_ERROR_@@@@@@@@@@@@@@@@@@@@\n"); fflush(stdout); exit(1); } /*-------------------------------------------------------------------------*/ /* 3) \natom{} */ sscanf(mol_name_dict[3].keyarg,"%d",&num); index = 3; if(num<0){ keyarg_barf(mol_name_dict,filename,fun_key,index); } natm_1mol_jmol_typ[jmol_typ] = num; /*---------------------------------------------------------------------*/ } /*end routine*/
void set_surf_params(char *molsetname, char *fun_key, DICT_WORD surface_dict[],int num_surface_dict, MDSURFACE *mdsurface) /*==========================================================================*/ { /* Begin routine */ /*==========================================================================*/ int i,index; double real_key_arg; /*==========================================================================*/ /* I) Check for missing key words*/ for(i=1;i<num_surface_dict;i++){ if(surface_dict[i].iuset==0 && surface_dict[i].key_type==1){ keyword_miss(surface_dict,molsetname,fun_key,i); }/*endif*/ }/*endfor*/ /*==========================================================================*/ /* II) Fill the surface structure */ /*------------------------------------------------------------------------*/ /* 1)\surface_type{} */ strcpy(mdsurface->surface_type,surface_dict[1].keyarg); /*------------------------------------------------------------------------*/ /* 2)\surface_height{} */ sscanf(surface_dict[2].keyarg,"%lg",&real_key_arg); mdsurface->surface_height = real_key_arg; /*------------------------------------------------------------------------*/ /* 3)\num_spline_pts{} */ sscanf(surface_dict[3].keyarg,"%lg",&real_key_arg); mdsurface->nsplin_surf = (int) real_key_arg; index = 3; if(real_key_arg<=0.0){ keyarg_barf(surface_dict,molsetname,fun_key,index); }/*endif*/ /*------------------------------------------------------------------------*/ /* 4)\healing_length{} */ sscanf(surface_dict[4].keyarg,"%lg",&real_key_arg); mdsurface->zheal = real_key_arg; index = 4; if(real_key_arg<=0.0){ keyarg_barf(surface_dict,molsetname,fun_key,index); }/*endif*/ /*------------------------------------------------------------------------*/ /*==========================================================================*/ }/*end routine*/
/*==========================================================================*/ void search_base_vps(char filename[],CVPS *cvps_typ, DICT_WORD fun_dict[],int num_fun_dict, DICT_WORD *vps_dict_tmp[], DICT_WORD vps_dict[],int num_vps_dict_ret,int *ifound) {/*begin routine*/ /*=======================================================================*/ /* Local variable declarations */ int nline,nkey,i,num; int ifirst,nfun_key; int num_vps_dict = num_vps_dict_ret; NAME fun_key; DICT_WORD word; FILE *fp; /*========================================================================*/ fp = cfopen(filename,"r"); *ifound = 0; ifirst = 0; nline = 0; nkey = 0; nfun_key = 0; while(get_fun_key(fp,fun_key,&nline,&nfun_key,filename)){ get_fun_key_index(fun_key,num_fun_dict,fun_dict,nline, nfun_key,filename,&num); if(num==6){ set_potvps_dict(vps_dict_tmp,&num_vps_dict,ifirst); while(get_word(fp,&word,&nline,&nkey,nfun_key,filename)){ put_word_dict(&word,*vps_dict_tmp,num_vps_dict, fun_key,nline,nkey,nfun_key,filename); }/*endwhile*/ if(strcasecmp((*vps_dict_tmp)[1].keyarg,cvps_typ->atm1)==0){ *ifound = 1; dict_save(*vps_dict_tmp,vps_dict,num_vps_dict); } }else{ close_fun_key_cnt(fp,fun_key,&nline,nfun_key,filename); }/*endif*/ }/*end while*/ fclose(fp); if(*ifound==1){ for(i=1;i<=num_vps_dict;i++){ if((vps_dict[i].iuset==0)&&(vps_dict[i].key_type==1)){ keyword_miss(vps_dict,filename,fun_key,i);} }/*endfor*/ }/*endif*/ } /*end routine*/
void set_bend_params(DICT_WORD intra_dict[],int num_intra_dict, char *fun_key,char *file_name,int jmol_typ, CLATOMS_INFO *clatoms_info,ATOMMAPS *atommaps, BEND *bend,NULL_INTER_PARSE *null_inter_parse, BUILD_INTRA *build_intra, int iresidue, int ires_off) /*==========================================================================*/ { int num,index,ifound,igo; int itype1,itype2,itype3; int iatm_ind1,iatm_ind2,iatm_ind3; int imask1,imask2,imask3; int i,itype; /*========================================================================*/ /* I) Check for missing key words*/ for(i=1;i<=3;i++){ if(intra_dict[i].iuset==0 && intra_dict[i].key_type==1){ keyword_miss(intra_dict,file_name,fun_key,i); } } /*endfor*/ /*=======================================================================*/ /* II) Fill the dictionary with words */ /*-----------------------------------------------------------------------*/ /* 1) \atom1{} */ index = 1; sscanf(intra_dict[1].keyarg,"%d",&num); iatm_ind1 = num; if(iatm_ind1>build_intra->natmind_1res_now||iatm_ind1<0){ keyarg_barf(intra_dict,file_name,fun_key,index); } imask1 = build_intra->mask_atm[iatm_ind1]; if(imask1>0)iatm_ind1 = build_intra->index_atm[iatm_ind1]; /*------------------------------------------------------------------------*/ /* 2) \atom2{} */ index = 2; sscanf(intra_dict[2].keyarg,"%d",&num); iatm_ind2 = num; if(iatm_ind2>build_intra->natmind_1res_now||iatm_ind2<0){ keyarg_barf(intra_dict,file_name,fun_key,index); } imask2 = build_intra->mask_atm[iatm_ind2]; if(imask2>0)iatm_ind2 = build_intra->index_atm[iatm_ind2]; /*-----------------------------------------------------------------------*/ /* 3) \atom3{} */ index = 3; sscanf(intra_dict[3].keyarg,"%d",&num); iatm_ind3 = num; if(iatm_ind3>build_intra->natmind_1res_now||iatm_ind3<0){ keyarg_barf(intra_dict,file_name,fun_key,index);} imask3 = build_intra->mask_atm[iatm_ind3]; if(imask3>0)iatm_ind3 = build_intra->index_atm[iatm_ind3]; /*-----------------------------------------------------------------------*/ /* 5) \modifier{} */ index = 5; ifound = 0; if(strcasecmp(intra_dict[5].keyarg,"on")==0) {ifound = 1;} if(strcasecmp(intra_dict[5].keyarg,"con")==0){ifound = 2;} if(strcasecmp(intra_dict[5].keyarg,"off")==0){ifound = 3;} if(ifound==0){ keyarg_barf(intra_dict,file_name,fun_key,index); } if(ifound == 2 && clatoms_info->pi_beads>1){ printf("@@@@@@@@@@@@@@@@@@@@_error_@@@@@@@@@@@@@@@@@@@@\n"); printf("Constraints not implemented under \n"); printf(" path integral dynamics. \n"); printf("@@@@@@@@@@@@@@@@@@@@_error_@@@@@@@@@@@@@@@@@@@@\n"); fflush(stdout); exit(1); }/*endif*/ /*-----------------------------------------------------------------------*/ /* 6) bend type */ igo = imask1*imask2*imask3; if(igo==1){ itype1 = atommaps->iatm_atm_typ[(clatoms_info->natm_tot+iatm_ind1)]; itype2 = atommaps->iatm_atm_typ[(clatoms_info->natm_tot+iatm_ind2)]; itype3 = atommaps->iatm_atm_typ[(clatoms_info->natm_tot+iatm_ind3)]; strcpy(build_intra->cbend_typ_now->atm1,atommaps->atm_typ[itype1]); strcpy(build_intra->cbend_typ_now->atm2,atommaps->atm_typ[itype2]); strcpy(build_intra->cbend_typ_now->atm3,atommaps->atm_typ[itype3]); strcpy(build_intra->cbend_typ_now->label,intra_dict[6].keyarg); }/*endif*/ /*=======================================================================*/ /* III) Spread Power bends */ if(ifound==1&&igo==1){ /* A) Add more space */ if(bend->npow > build_intra->nbend_pow_max){ build_intra->nbend_pow_max += NMEM_MIN; bend->j1_pow =(int*)crealloc(&(bend->j1_pow)[1], build_intra->nbend_pow_max*sizeof(int))-1; bend->j2_pow =(int*)crealloc(&(bend->j2_pow)[1], build_intra->nbend_pow_max*sizeof(int))-1; bend->j3_pow =(int*)crealloc(&(bend->j3_pow)[1], build_intra->nbend_pow_max*sizeof(int))-1; bend->jtyp_pow=(int*)crealloc(&(bend->jtyp_pow)[1], build_intra->nbend_pow_max*sizeof(int))-1; }/*endif*/ /*--------------------------------------------------------------------*/ /* C) Check type */ itype = bend->ntyp_pow+1; for(i=1;i<=bend->ntyp_pow;i++){ if((strcasecmp(build_intra->cbend_typ_pow[i].atm1, build_intra->cbend_typ_now->atm1)==0) &&(strcasecmp(build_intra->cbend_typ_pow[i].atm2, build_intra->cbend_typ_now->atm2)==0) &&(strcasecmp(build_intra->cbend_typ_pow[i].atm3, build_intra->cbend_typ_now->atm3)==0) &&(strcasecmp(build_intra->cbend_typ_pow[i].label, build_intra->cbend_typ_now->label)==0)) {itype=i;} if((strcasecmp(build_intra->cbend_typ_pow[i].atm1, build_intra->cbend_typ_now->atm3)==0) &&(strcasecmp(build_intra->cbend_typ_pow[i].atm2, build_intra->cbend_typ_now->atm2)==0) &&(strcasecmp(build_intra->cbend_typ_pow[i].atm3, build_intra->cbend_typ_now->atm1)==0) &&(strcasecmp(build_intra->cbend_typ_pow[i].label, build_intra->cbend_typ_now->label)==0)) {itype=i;} } /*endfor*/ /*---------------------------------------------------------------------*/ /* D) Add space */ if(itype>build_intra->nbend_typ_pow_max){ build_intra->nbend_typ_pow_max += NMEM_MIN; build_intra->cbend_typ_pow = (CBEND *) crealloc(&build_intra->cbend_typ_pow[1], build_intra->nbend_typ_pow_max*sizeof(CBEND))-1; }/*endif*/ /*----------------------------------------------------------------------*/ /* E) Add a type */ if(itype==bend->ntyp_pow+1){ bend->ntyp_pow++; strcpy(build_intra->cbend_typ_pow[itype].atm1, build_intra->cbend_typ_now->atm1); strcpy(build_intra->cbend_typ_pow[itype].atm2, build_intra->cbend_typ_now->atm2); strcpy(build_intra->cbend_typ_pow[itype].atm3, build_intra->cbend_typ_now->atm3); strcpy(build_intra->cbend_typ_pow[itype].label, build_intra->cbend_typ_now->label); }/*endif*/ /*---------------------------------------------------------------------*/ /* B) Spread */ bend->npow += 1; bend->j1_pow[bend->npow] = iatm_ind1 + clatoms_info->natm_tot; bend->j2_pow[bend->npow] = iatm_ind2 + clatoms_info->natm_tot; bend->j3_pow[bend->npow] = iatm_ind3 + clatoms_info->natm_tot; bend->jtyp_pow[bend->npow] = itype; }/*endif*/ /*=======================================================================*/ /* IV) Spread Con bends */ if(ifound==2&&igo==1){ ires_off = atommaps->jres_jmol_typ_strt[jmol_typ]-1; atommaps->nfree_jres_jmol_typ[ires_off+iresidue] -= 1; atommaps->icons_jres_jmol_typ[ires_off+iresidue] = 1; /*---------------------------------------------------------------------*/ /* A) Add more space */ if(bend->ncon+1 > build_intra->nbend_con_max){ build_intra->nbend_con_max += NMEM_MIN; bend->j1_con = (int *)crealloc(&(bend->j1_con)[1], build_intra->nbend_con_max*sizeof(int))-1; bend->j2_con = (int *)crealloc(&(bend->j2_con)[1], build_intra->nbend_con_max*sizeof(int))-1; bend->jtyp_con=(int *)crealloc(&(bend->jtyp_con)[1], build_intra->nbend_con_max*sizeof(int))-1; }/*endif*/ /*---------------------------------------------------------------------*/ /* C) Check type */ itype = (bend->ntyp_con)+1; for(i=1;i<=bend->ntyp_con;i++){ if((strcasecmp(build_intra->cbend_typ_con[i].atm1, build_intra->cbend_typ_now->atm1)==0) &&(strcasecmp(build_intra->cbend_typ_con[i].atm2, build_intra->cbend_typ_now->atm2)==0) &&(strcasecmp(build_intra->cbend_typ_con[i].atm3, build_intra->cbend_typ_now->atm3)==0) &&(strcasecmp(build_intra->cbend_typ_con[i].label, build_intra->cbend_typ_now->label)==0)) {itype=i;} if((strcasecmp(build_intra->cbend_typ_con[i].atm1, build_intra->cbend_typ_now->atm3)==0) &&(strcasecmp(build_intra->cbend_typ_con[i].atm2, build_intra->cbend_typ_now->atm2)==0) &&(strcasecmp(build_intra->cbend_typ_con[i].atm3, build_intra->cbend_typ_now->atm1)==0) &&(strcasecmp(build_intra->cbend_typ_con[i].label, build_intra->cbend_typ_now->label)==0)) {itype=i;} }/*endfor*/ /*--------------------------------------------------------------------*/ /* D) Add space */ if(itype>build_intra->nbend_typ_con_max){ build_intra->nbend_typ_con_max += NMEM_MIN; build_intra->cbend_typ_con = (CBEND *) crealloc(&(build_intra->cbend_typ_con[1]), build_intra->nbend_typ_con_max*sizeof(CBEND))-1; }/*endif*/ /*---------------------------------------------------------------------*/ /* E) Add a type */ if(itype==(bend->ntyp_con)+1){ bend->ntyp_con+=1; strcpy(build_intra->cbend_typ_con[itype].atm1, build_intra->cbend_typ_now->atm1); strcpy(build_intra->cbend_typ_con[itype].atm2, build_intra->cbend_typ_now->atm2); strcpy(build_intra->cbend_typ_con[itype].atm3, build_intra->cbend_typ_now->atm3); strcpy(build_intra->cbend_typ_con[itype].label, build_intra->cbend_typ_now->label); }/*endif*/ /*---------------------------------------------------------------------*/ /* B) Assign */ bend->ncon += 1; bend->j1_con[bend->ncon] = iatm_ind1 + clatoms_info->natm_tot; bend->j2_con[bend->ncon] = iatm_ind2 + clatoms_info->natm_tot; bend->j3_con[bend->ncon] = iatm_ind3 + clatoms_info->natm_tot; bend->jtyp_con[bend->ncon] = itype; /*---------------------------------------------------------------------*/ /* F) Error */ if((atommaps->ighost_flag[bend->j1_con[bend->ncon]]!=0)|| (atommaps->ighost_flag[bend->j2_con[bend->ncon]]!=0)|| (atommaps->ighost_flag[bend->j3_con[bend->ncon]]!=0)){ printf("@@@@@@@@@@@@@@@@@@@@_error_@@@@@@@@@@@@@@@@@@@@\n"); printf("Ghost atoms are not permitted in constrained bends\n"); printf("in molecule index %d in residue index %d in file %s\n", jmol_typ,iresidue,file_name); printf("@@@@@@@@@@@@@@@@@@@@_error_@@@@@@@@@@@@@@@@@@@@\n"); fflush(stdout); exit(1); }/*endif*/ }/*endif*/ /*=======================================================================*/ /* V) Spread nul bends */ if(ifound==3&&igo==1){ /*---------------------------------------------------------------------*/ /* A) Add more space */ if(null_inter_parse->nbend_nul+1 > build_intra->nbend_nul_max){ build_intra->nbend_nul_max += NMEM_MIN; null_inter_parse->jbend1_nul = (int *) crealloc(&(null_inter_parse->jbend1_nul)[1], build_intra->nbend_nul_max*sizeof(int))-1; null_inter_parse->jbend2_nul = (int *) crealloc(&(null_inter_parse->jbend2_nul)[1], build_intra->nbend_nul_max*sizeof(int))-1; null_inter_parse->jbend3_nul = (int *) crealloc(&(null_inter_parse->jbend3_nul)[1], build_intra->nbend_nul_max*sizeof(int))-1; } /*endif*/ /*---------------------------------------------------------------------*/ /* B) Spread */ null_inter_parse->nbend_nul += 1; (null_inter_parse->jbend1_nul)[(null_inter_parse->nbend_nul)] = iatm_ind1 + clatoms_info->natm_tot; (null_inter_parse->jbend2_nul)[(null_inter_parse->nbend_nul)] = iatm_ind2 + clatoms_info->natm_tot; (null_inter_parse->jbend3_nul)[(null_inter_parse->nbend_nul)] = iatm_ind3 + clatoms_info->natm_tot; }/*endif*/ /*----------------------------------------------------------------------*/ }/*end routine*/
void set_atm_params(DICT_WORD atm_dict[],int num_atm_dict, char fun_key[],char filename[], int jmol_typ,int jres, int jres_off, CPATOM_MAPS *cpatom_maps,MDATOM_MAPS *atommaps, BUILD_INTRA *build_intra,MDCLATOMS_INFO *clatoms_info, MDGHOST_ATOMS *ghost_atoms,MDCONSTRNT *mdconstrnt) /*=======================================================================*/ {/*begin routine*/ /*=======================================================================*/ /* Local Variables */ NAME site; int i,iii,num,num2,num3,num4,iatm_ind,imask,index,num1; int itype,iatm_ind_sm,ifound; double dnum; /*=======================================================================*/ /* I) Check for missing key words */ for(i=1;i<=num_atm_dict;i++){ if(atm_dict[i].iuset==0 && atm_dict[i].key_type==1){ keyword_miss(atm_dict,filename,fun_key,i);} }/*endfor*/ /*=======================================================================*/ /* II) Get atm index */ sscanf(atm_dict[2].keyarg,"%d",&iatm_ind); index = 2; if(iatm_ind>build_intra->natmind_1res_now||iatm_ind<0){ keyarg_barf(atm_dict,filename,fun_key,index);} imask = build_intra->mask_atm[iatm_ind]; /*=======================================================================*/ /*=======================================================================*/ if(imask>0){ /*=======================================================================*/ /* III) Get rejiggered atm index */ /*-----------------------------------------------------------------------*/ iatm_ind = (build_intra->index_atm)[iatm_ind]; if(iatm_ind>build_intra->natm_1res_now||iatm_ind<0){ keyarg_barf(atm_dict,filename,fun_key,index);} build_intra->iatm_ind_chk[iatm_ind]++; iatm_ind_sm = iatm_ind; iatm_ind = iatm_ind + clatoms_info->natm_tot; /*=======================================================================*/ /* IV) Fill the dictionary with words */ /*-----------------------------------------------------------------------*/ /* 3) \mass{} */ sscanf(atm_dict[3].keyarg,"%lg",&dnum); index = 3; if(dnum<=0.0){ keyarg_barf(atm_dict,filename,fun_key,index); }/*endif*/ clatoms_info->mass[iatm_ind] = dnum; /*--------------------------------------------------------------------*/ /* 4) \charge{} */ sscanf(atm_dict[4].keyarg,"%lg",&dnum); clatoms_info->q[iatm_ind] = dnum; /*--------------------------------------------------------------------*/ /* 5) \alpha_pol{} */ sscanf(atm_dict[5].keyarg,"%lg",&dnum); index = 5; if(dnum<0.0){ keyarg_barf(atm_dict,filename,fun_key,index); }/*endif*/ clatoms_info->alp_pol[iatm_ind] = dnum; /*--------------------------------------------------------------------*/ /* 6) \b_neut{} */ sscanf(atm_dict[6].keyarg,"%lg",&dnum); clatoms_info->b_neut[iatm_ind] = dnum; /*--------------------------------------------------------------------*/ /* 7) \valence{} */ sscanf(atm_dict[7].keyarg,"%d",&num); build_intra->bond_site[iatm_ind_sm].valence = num; index = 7; if(num<0||num>MAX_VALENCE){ keyarg_barf(atm_dict,filename,fun_key,index);} /*--------------------------------------------------------------------*/ /* 8) \improper_def{} */ strcpy(build_intra->strip1,atm_dict[8].keyarg); parse_improp(build_intra->strip1,build_intra->strip2,&num1,&num2,&num3, &num4); build_intra->bond_site[iatm_ind_sm].improper_ind[1]=num1+1; build_intra->bond_site[iatm_ind_sm].improper_ind[2]=num2+1; build_intra->bond_site[iatm_ind_sm].improper_ind[3]=num3+1; build_intra->bond_site[iatm_ind_sm].improper_ind[4]=num4+1; index = 8; if((num1+num2+num3+num4)!=0&&(num1+num2+num3+num4)!=6){ keyarg_barf(atm_dict,filename,fun_key,index);} if((num1+num2+num3+num4)==6){ if(num1<0||num1>3||num2<0||num2>3||num3<0||num3>3||num4<0||num4>3|| num1==num2||num1==num3||num2==num3||num1==num4||num2==num4|| num3==num4){ keyarg_barf(atm_dict,filename,fun_key,index);}} /*--------------------------------------------------------------------*/ /* 9) \bond_site_1{} */ strcpy(build_intra->strip1,atm_dict[9].keyarg); parse_bond_site(build_intra->strip1,build_intra->strip2,site,&num2,&num3); strcpy(build_intra->bond_site[iatm_ind_sm].bond_site_name[1],site); build_intra->bond_site[iatm_ind_sm].branch_1[1] = num2; build_intra->bond_site[iatm_ind_sm].branch_2[1] = num3; index = 9; if(strlen(site)==0||num2<-1||num3<-1||num2>MAX_VALENCE||num3>MAX_VALENCE){ keyarg_barf(atm_dict,filename,fun_key,index); }/*endif*/ /*--------------------------------------------------------------------*/ /* 10) \bond_site_2{} */ strcpy(build_intra->strip1,atm_dict[10].keyarg); parse_bond_site(build_intra->strip1,build_intra->strip2,site,&num2,&num3); strcpy(build_intra->bond_site[iatm_ind_sm].bond_site_name[2],site); build_intra->bond_site[iatm_ind_sm].branch_1[2] = num2; build_intra->bond_site[iatm_ind_sm].branch_2[2] = num3; index = 10; if(strlen(site)==0||num2<-1||num3<-1||num2>MAX_VALENCE||num3>MAX_VALENCE){ keyarg_barf(atm_dict,filename,fun_key,index); } /*---------------------------------------------------------------------*/ /* 11) \bond_site_3{} */ strcpy(build_intra->strip1,atm_dict[11].keyarg); parse_bond_site(build_intra->strip1,build_intra->strip2,site,&num2,&num3); strcpy(build_intra->bond_site[iatm_ind_sm].bond_site_name[3],site); build_intra->bond_site[iatm_ind_sm].branch_1[3] = num2; build_intra->bond_site[iatm_ind_sm].branch_2[3] = num3; index = 11; if(strlen(site)==0||num2<-1||num3<-1||num2>MAX_VALENCE||num3>MAX_VALENCE){ keyarg_barf(atm_dict,filename,fun_key,index);} /*---------------------------------------------------------------------*/ /* 12) \bond_site_4{} */ strcpy(build_intra->strip1,atm_dict[12].keyarg); parse_bond_site(build_intra->strip1,build_intra->strip2,site,&num2,&num3); strcpy(build_intra->bond_site[iatm_ind_sm].bond_site_name[4],site); build_intra->bond_site[iatm_ind_sm].branch_1[4] = num2; build_intra->bond_site[iatm_ind_sm].branch_2[4] = num3; index = 12; if(strlen(site)==0||num2<-1||num3<-1||num2>MAX_VALENCE||num3>MAX_VALENCE){ keyarg_barf(atm_dict,filename,fun_key,index);} /*------------------------------------------------------------------------*/ /* 15) \cp_atom{} */ ifound = 0; if(strcasecmp(atm_dict[15].keyarg,"yes")==0){ ifound=1;cpatom_maps->cp_atm_flag[iatm_ind] = 1; } if(strcasecmp(atm_dict[15].keyarg,"no")==0){ ifound=1;cpatom_maps->cp_atm_flag[iatm_ind] = 0; } /*--------------------------------------------------------------------*/ /* 13) \cp_valence_up{} */ cpatom_maps->cp_vlnc_up[iatm_ind] = 0; if(atm_dict[13].iuset==1){ sscanf(atm_dict[13].keyarg,"%d",&num); cpatom_maps->cp_vlnc_up[iatm_ind] = num; }/*endif*/ if(atm_dict[13].iuset==0 && cpatom_maps->cp_atm_flag[iatm_ind]==1){ index = 13; keyarg_barf(atm_dict,filename,fun_key,index); }/*endif*/ /*--------------------------------------------------------------------*/ /* 14) \cp_valence_dn{} */ cpatom_maps->cp_vlnc_dn[iatm_ind] = cpatom_maps->cp_vlnc_up[iatm_ind]; if(atm_dict[14].iuset == 1){ sscanf(atm_dict[14].keyarg,"%d",&num); cpatom_maps->cp_vlnc_dn[iatm_ind] = num; }/*endif*/ /*------------------------------------------------------------------------*/ /* 16) /def_ghost1{} */ ghost_atoms->ighost_flag[iatm_ind] = 0; if(atm_dict[16].iuset!=0){ set_ghost(ghost_atoms,clatoms_info,atommaps,build_intra, atm_dict,num_atm_dict, filename,fun_key,iatm_ind); }/*endif*/ /*------------------------------------------------------------------------*/ /* 17) \label{} */ index = 16+NCOEF_GHOST_MAX; ifound = 0; if(strcasecmp(atm_dict[index].keyarg,"standard")==0){ ifound=1;mdconstrnt->atom_label[iatm_ind] = 0; } if(strcasecmp(atm_dict[index].keyarg,"backbone")==0){ ifound=1;mdconstrnt->atom_label[iatm_ind] = 1; } if(strcasecmp(atm_dict[index].keyarg,"sidechain")==0){ ifound=1;mdconstrnt->atom_label[iatm_ind] = 2; } if(ifound==0){ keyarg_barf(atm_dict,filename,fun_key,index); }/*endif*/ /*--------------------------------------------------------------------*/ /* 18+NCOEF_GHOST_MAX) \cp_valence_true_up{} */ cpatom_maps->cp_vlnc_true_up[iatm_ind] = cpatom_maps->cp_vlnc_up[iatm_ind]; if(atm_dict[18+NCOEF_GHOST_MAX].iuset == 1){ sscanf(atm_dict[18+NCOEF_GHOST_MAX].keyarg,"%d",&num); cpatom_maps->cp_vlnc_true_up[iatm_ind] = num; if (num>cpatom_maps->cp_vlnc_up[iatm_ind]){ index = 18+NCOEF_GHOST_MAX; keyarg_barf(atm_dict,filename,fun_key,index); }/*endif*/ }/*endif*/ /*--------------------------------------------------------------------*/ /* 19+NCOEF_GHOST_MAX) \cp_valence_true_dn{} */ cpatom_maps->cp_vlnc_true_dn[iatm_ind] = cpatom_maps->cp_vlnc_true_up[iatm_ind]; if(atm_dict[19+NCOEF_GHOST_MAX].iuset == 1){ sscanf(atm_dict[19+NCOEF_GHOST_MAX].keyarg,"%d",&num); cpatom_maps->cp_vlnc_true_dn[iatm_ind] = num; if (num>cpatom_maps->cp_vlnc_dn[iatm_ind]){ index = 19+NCOEF_GHOST_MAX; keyarg_barf(atm_dict,filename,fun_key,index); }/*endif*/ }/*endif*/ /*------------------------------------------------------------------------*/ /*====================================================================*/ /* IV) Do up atom types */ itype = atommaps->natm_typ + 1; for(i=1;i<=atommaps->natm_typ;i++){ if(strcasecmp(atm_dict[1].keyarg,atommaps->atm_typ[i])==0) itype=i; } /*endfor*/ if(itype>build_intra->natm_typ_max){ build_intra->natm_typ_max+=NMEM_MIN; atommaps->atm_typ = (NAME *) crealloc(&(atommaps->atm_typ[1]), (build_intra->natm_typ_max)*sizeof(NAME),"set_atm_params")-1; }/*endif*/ if(itype==atommaps->natm_typ+1){ atommaps->natm_typ+=1; strcpy(atommaps->atm_typ[itype],atm_dict[1].keyarg); }/*endif*/ /*====================================================================*/ /* V) Do up types */ atommaps->iatm_mol_typ[iatm_ind] = jmol_typ; atommaps->iatm_mol_num[iatm_ind] = 1; atommaps->iatm_res_num[iatm_ind] = jres; atommaps->iatm_atm_typ[iatm_ind] = itype; atommaps->iatm_res_typ[iatm_ind] = atommaps->ires_typ_jres_jmol_typ[jres+jres_off]; /*====================================================================*/ /*====================================================================*/ } /*endif (imask>0) */ /*======================================================================*/ } /*end routine*/
void set_onfo_params(DICT_WORD *intra_dict,int num_intra_dict, char *fun_key,char *file_name,int jmol_typ, MDCLATOMS_INFO *clatoms_info,MDATOM_MAPS *atommaps, MDONFO *onfo,NULL_INTER_PARSE *null_inter_parse, BUILD_INTRA *build_intra, int iresidue, int ires_off) /*==========================================================================*/ {/*begin routine */ int num,index,ifound,igo; int itype1,itype2; int iatm_ind1,iatm_ind2; int imask1,imask2; int i,itype; /*=======================================================================*/ /* I) Check for missing key words*/ for(i=1;i<=2;i++){ if(intra_dict[i].iuset==0 && intra_dict[i].key_type==1){ keyword_miss(intra_dict,file_name,fun_key,i);} } /*endfor*/ /*=======================================================================*/ /* II) Fill the dictionary with words */ /*-----------------------------------------------------------------------*/ /* 1) \atom1{} */ index = 1; sscanf(intra_dict[1].keyarg,"%d",&num); iatm_ind1 = num; if(iatm_ind1>build_intra->natmind_1res_now||iatm_ind1<0){ keyarg_barf(intra_dict,file_name,fun_key,index);} imask1 = build_intra->mask_atm[iatm_ind1]; if(imask1>0)iatm_ind1 = build_intra->index_atm[iatm_ind1]; /*------------------------------------------------------------------------*/ /* 2) \atom2{} */ index = 2; sscanf(intra_dict[2].keyarg,"%d",&num); iatm_ind2 = num; if(iatm_ind2>build_intra->natmind_1res_now||iatm_ind2<0){ keyarg_barf(intra_dict,file_name,fun_key,index);} imask2 = build_intra->mask_atm[iatm_ind2]; if(imask2>0)iatm_ind2 = build_intra->index_atm[iatm_ind2]; /*-----------------------------------------------------------------------*/ /* 5) \modifier{} */ index = 5; ifound = 0; if(strcasecmp(intra_dict[5].keyarg,"on")==0) {ifound = 1;} if(strcasecmp(intra_dict[5].keyarg,"off")==0){ifound = 2;} if(ifound==0){ keyarg_barf(intra_dict,file_name,fun_key,index); } /*-----------------------------------------------------------------------*/ /* 6) bond type */ igo = imask1*imask2; if(igo==1){ itype1 = atommaps->iatm_atm_typ[(clatoms_info->natm_tot+iatm_ind1)]; itype2 = atommaps->iatm_atm_typ[(clatoms_info->natm_tot+iatm_ind2)]; strcpy(build_intra->confo_typ_now->atm1,atommaps->atm_typ[itype1]); strcpy(build_intra->confo_typ_now->atm2,atommaps->atm_typ[itype2]); strcpy(build_intra->confo_typ_now->label,intra_dict[6].keyarg); }/*endif*/ /*======================================================================*/ /* III) Spread onfos */ if(ifound==1&&igo==1){ /*---------------------------------------------------------------------*/ /* A) Add more space */ if(onfo->num+1 > build_intra->nonfo_max){ build_intra->nonfo_max += NMEM_MIN; onfo->j1 =(int *) crealloc(&(onfo->j1)[1], build_intra->nonfo_max*sizeof(int),"set_onfo_params")-1; onfo->j2 =(int *) crealloc(&(onfo->j2)[1], build_intra->nonfo_max*sizeof(int),"set_onfo_params")-1; onfo->jtyp =(int *) crealloc(&(onfo->jtyp)[1], build_intra->nonfo_max*sizeof(int),"set_onfo_params")-1; }/*endif*/ /*--------------------------------------------------------------------*/ /* C) Check type */ itype = (onfo->ntyp)+1; for(i=1;i<=onfo->ntyp;i++){ if((strcasecmp(build_intra->confo_typ[i].atm1, build_intra->confo_typ_now->atm1)==0) &&(strcasecmp(build_intra->confo_typ[i].atm2, build_intra->confo_typ_now->atm2)==0) &&(strcasecmp(build_intra->confo_typ[i].label, build_intra->confo_typ_now->label)==0)) {itype=i;} if((strcasecmp(build_intra->confo_typ[i].atm1, build_intra->confo_typ_now->atm2)==0) &&(strcasecmp(build_intra->confo_typ[i].atm2, build_intra->confo_typ_now->atm1)==0) &&(strcasecmp(build_intra->confo_typ[i].label, build_intra->confo_typ_now->label)==0)) {itype=i;} }/*endfor*/ /*---------------------------------------------------------------------*/ /* D) Add space */ if(itype>build_intra->nonfo_typ_max){ build_intra->nonfo_typ_max += NMEM_MIN; build_intra->confo_typ = (CBOND *) crealloc(&(build_intra->confo_typ)[1], build_intra->nonfo_typ_max*sizeof(CBOND),"set_onfo_params")-1; }/*endif*/ /*---------------------------------------------------------------------*/ /* E) Add a type */ if(itype==(onfo->ntyp)+1){ onfo->ntyp+=1; strcpy(build_intra->confo_typ[itype].atm1, build_intra->confo_typ_now->atm1); strcpy(build_intra->confo_typ[itype].atm2, build_intra->confo_typ_now->atm2); strcpy(build_intra->confo_typ[itype].label, build_intra->confo_typ_now->label); }/*endif*/ /*---------------------------------------------------------------------*/ /* B) Spread */ onfo->num += 1; onfo->j1[onfo->num] = iatm_ind1 + clatoms_info->natm_tot; onfo->j2[onfo->num] = iatm_ind2 + clatoms_info->natm_tot; onfo->jtyp[onfo->num] = itype; }/*endif*/ /*======================================================================*/ /* V) Spread nul onfos */ if(ifound==3&&igo==1){ /*--------------------------------------------------------------------*/ /* A) Add more space */ if(null_inter_parse->nonfo_nul+1 > build_intra->nonfo_nul_max){ build_intra->nonfo_nul_max += NMEM_MIN; null_inter_parse->jonfo1_nul = (int *) crealloc(&(null_inter_parse->jonfo1_nul)[1], build_intra->nonfo_nul_max*sizeof(int),"set_onfo_params")-1; null_inter_parse->jonfo2_nul = (int *) crealloc(&(null_inter_parse->jonfo2_nul)[1], build_intra->nonfo_nul_max*sizeof(int),"set_onfo_params")-1; }/*endif*/ /*--------------------------------------------------------------------*/ /* B) Spread */ null_inter_parse->nonfo_nul += 1; null_inter_parse->jonfo1_nul[null_inter_parse->nonfo_nul] = iatm_ind1 + clatoms_info->natm_tot; null_inter_parse->jonfo2_nul[null_inter_parse->nonfo_nul] = iatm_ind2 + clatoms_info->natm_tot; }/*endif*/ /*----------------------------------------------------------------------*/ }/*end routine*/
void set_rbar_free_params(char *molsetname,char fun_key[], DICT_WORD rbar_free_dict[], int num_rbar_free_dict, RBAR_SIG_FREE *rbar_sig_free,FREE_PARSE *free_parse, int nmol_typ) /*========================================================================*/ { /*begin routine */ /*========================================================================*/ /* Local variables */ int num,i,index; double dnum; FILE *fp; /*========================================================================*/ /* I) Check for missing key words*/ for(i=1; i<num_rbar_free_dict; i++) { if((rbar_free_dict[i].iuset==0) && (rbar_free_dict[i].key_type==1)) { keyword_miss(rbar_free_dict,molsetname,fun_key,i); }/*endif*/ }/*endfor*/ /*=========================================================================*/ /* II) Set the params */ /*-----------------------------------------------------------------------*/ /* 1)\num_bond{} */ sscanf(rbar_free_dict[1].keyarg,"%d",&num); rbar_sig_free->nfree = num; free_parse->nbar_bond = num; index = 1; if((num <=0)) { keyarg_barf(rbar_free_dict,molsetname,fun_key,index); } /*-----------------------------------------------------------------------*/ /* 3)\eq_bar{} */ sscanf(rbar_free_dict[3].keyarg,"%lg",&dnum); rbar_sig_free->eq_bar = dnum/BOHR; index = 3; if((dnum < 0)) { keyarg_barf(rbar_free_dict,molsetname,fun_key,index); } /*-----------------------------------------------------------------------*/ /* 4)\fk_bar{} */ sscanf(rbar_free_dict[4].keyarg,"%lg",&dnum); rbar_sig_free->fk_bar = dnum*BOHR*BOHR/BOLTZ; index = 4; if((dnum < 0)) { keyarg_barf(rbar_free_dict,molsetname,fun_key,index); } /*-----------------------------------------------------------------------*/ /* 5)\eq_sig{} */ sscanf(rbar_free_dict[5].keyarg,"%lg",&dnum); rbar_sig_free->eq_sigma = dnum/BOHR; index = 5; if((dnum < 0)) { keyarg_barf(rbar_free_dict,molsetname,fun_key,index); } /*-----------------------------------------------------------------------*/ /* 6)\fk_sig{} */ sscanf(rbar_free_dict[6].keyarg,"%lg",&dnum); rbar_sig_free->fk_sigma = dnum*BOHR*BOHR/BOLTZ; index = 6; if((dnum < 0)) { keyarg_barf(rbar_free_dict,molsetname,fun_key,index); } /*-----------------------------------------------------------------------*/ /* 7)\rmin_hist{} */ sscanf(rbar_free_dict[7].keyarg,"%lg",&dnum); rbar_sig_free->rmin = dnum/BOHR; index = 7; if((dnum < 0)) { keyarg_barf(rbar_free_dict,molsetname,fun_key,index); } /*-----------------------------------------------------------------------*/ /* 8)\rmax_hist{} */ sscanf(rbar_free_dict[8].keyarg,"%lg",&dnum); rbar_sig_free->rmax = dnum/BOHR; index = 8; if((dnum < 0)|| (dnum< rbar_sig_free->rmin)) { keyarg_barf(rbar_free_dict,molsetname,fun_key,index); } /*-----------------------------------------------------------------------*/ /* 9)\num_rbar_hist{} */ sscanf(rbar_free_dict[9].keyarg,"%d",&num); rbar_sig_free->nhist_bar = num; index = 9; if((num <=0)) { keyarg_barf(rbar_free_dict,molsetname,fun_key,index); } /*-----------------------------------------------------------------------*/ /* 10)\smin_hist{} */ sscanf(rbar_free_dict[10].keyarg,"%lg",&dnum); rbar_sig_free->smin = dnum/BOHR; index = 10; if((dnum < 0)) { keyarg_barf(rbar_free_dict,molsetname,fun_key,index); } /*-----------------------------------------------------------------------*/ /* 11)\smax_hist{} */ sscanf(rbar_free_dict[11].keyarg,"%lg",&dnum); rbar_sig_free->smax = dnum/BOHR; index = 11; if((dnum < 0)|| (dnum< rbar_sig_free->smin)) { keyarg_barf(rbar_free_dict,molsetname,fun_key,index); } /*-----------------------------------------------------------------------*/ /* 12)\num_sig_hist{} */ sscanf(rbar_free_dict[12].keyarg,"%d",&num); rbar_sig_free->nhist_sig = num; index = 12; if((num <=0)) { keyarg_barf(rbar_free_dict,molsetname,fun_key,index); } /*-----------------------------------------------------------------------*/ /* 13)\hist_file{} */ strcpy(rbar_sig_free->file,rbar_free_dict[13].keyarg); /*-----------------------------------------------------------------------*/ /*=========================================================================*/ /* III) Use the data and malloc */ rbar_sig_free->del_bar = ((rbar_sig_free->rmax)- (rbar_sig_free->rmin))/ ((double)(rbar_sig_free->nhist_bar)); rbar_sig_free->del_sig = ((rbar_sig_free->smax)- (rbar_sig_free->smin))/ ((double)(rbar_sig_free->nhist_sig)); num = rbar_sig_free->nfree; rbar_sig_free->rnfree = (double) num; free_parse->imoltyp_rbar1_free = (int *)cmalloc(num*sizeof(int))-1; free_parse->imoltyp_rbar2_free = (int *)cmalloc(num*sizeof(int))-1; free_parse->imol_rbar1_free = (int *)cmalloc(num*sizeof(int))-1; free_parse->imol_rbar2_free = (int *)cmalloc(num*sizeof(int))-1; free_parse->ires_rbar1_free = (int *)cmalloc(num*sizeof(int))-1; free_parse->ires_rbar2_free = (int *)cmalloc(num*sizeof(int))-1; free_parse->iatm_rbar1_free = (int *)cmalloc(num*sizeof(int))-1; free_parse->iatm_rbar2_free = (int *)cmalloc(num*sizeof(int))-1; /*=========================================================================*/ /* IV) Read in the indicies */ fp = cfopen(rbar_free_dict[2].keyarg,"r"); fscanf(fp,"%d",&num); readtoendofline(fp); if(num!=rbar_sig_free->nfree) { printf("To have no errors,\n"); printf("Would be life without meaning,\n"); printf("No struggle, no joy.\n"); printf("Number of free energy bonds %d in file %s,\n",num, rbar_free_dict[2].keyarg); printf("does not match the request value %d \n",rbar_sig_free->nfree); fflush(stdout); exit(1); }/*endif*/ for(i=1; i<=num; i++) { fscanf(fp,"%d %d %d %d", &(free_parse->imoltyp_rbar1_free[i]), &(free_parse->imol_rbar1_free[i]), &(free_parse->ires_rbar1_free[i]), &(free_parse->iatm_rbar1_free[i])); readtoendofline(fp); fscanf(fp,"%d %d %d %d", &(free_parse->imoltyp_rbar2_free[i]), &(free_parse->imol_rbar2_free[i]), &(free_parse->ires_rbar2_free[i]), &(free_parse->iatm_rbar2_free[i])); readtoendofline(fp); }/*endfor*/ fclose(fp); /*-----------------------------------------------------------------------*/ }/*end routine*/
void set_tors_free_params(char molsetname[],char fun_key[], DICT_WORD tors_free_dict[], int num_tors_free_dict, TORS_FREE *tors_free,FREE_PARSE *free_parse, int nmol_typ) /*==========================================================================*/ { /*begin routine*/ /*==========================================================================*/ /* Local variables */ int i,num,index,ntors; double dnum; /*==========================================================================*/ /* I) Check for missing key words*/ for(i=1; i<=num_tors_free_dict; i++) { if(tors_free_dict[i].iuset==0 && tors_free_dict[i].key_type==1) { keyword_miss(tors_free_dict,molsetname,fun_key,i); } } /*endfor*/ /*==========================================================================*/ /* II) Set the params */ /*-----------------------------------------------------------------------*/ /* 39)\ntors{} */ index = 39; sscanf(tors_free_dict[index].keyarg,"%d",&num); ntors = num; tors_free->num = num; if(num <=0 || num > 2) { keyarg_barf(tors_free_dict,molsetname,fun_key,index); } if(ntors>1) { for(i=22; i<=33; i++) { if(tors_free_dict[i].iuset==0) { keyword_miss(tors_free_dict,molsetname,fun_key,i); } }/*endfor*/ if(tors_free_dict[38].iuset==0) { keyword_miss(tors_free_dict,molsetname,fun_key,i); }/*endif*/ }/*endif*/ /*-----------------------------------------------------------------------*/ /* 1)\atom1.1_moltyp_ind{} */ sscanf(tors_free_dict[1].keyarg,"%d",&num); free_parse->imoltyp_tors_free[1] = num; index = 1; if((num <=0)|| (num>nmol_typ)) { keyarg_barf(tors_free_dict,molsetname,fun_key,index); } /*-----------------------------------------------------------------------*/ /* 2)\atom2.1_moltyp_ind{} */ sscanf(tors_free_dict[2].keyarg,"%d",&num); free_parse->imoltyp_tors_free[2] = num; index = 2; if((num <=0)|| (num>nmol_typ)) { keyarg_barf(tors_free_dict,molsetname,fun_key,index); } /*-----------------------------------------------------------------------*/ /* 3)\atom3.1_moltyp_ind{} */ sscanf(tors_free_dict[3].keyarg,"%d",&num); free_parse->imoltyp_tors_free[3] = num; index = 3; if((num <=0)|| (num>nmol_typ)) { keyarg_barf(tors_free_dict,molsetname,fun_key,index); } /*-----------------------------------------------------------------------*/ /* 4)\atom4.1_moltyp_ind{} */ sscanf(tors_free_dict[4].keyarg,"%d",&num); free_parse->imoltyp_tors_free[4] = num; index = 4; if((num <=0)|| (num>nmol_typ)) { keyarg_barf(tors_free_dict,molsetname,fun_key,index); } /*-----------------------------------------------------------------------*/ /* 5)\atom1.1_mol_ind{} */ sscanf(tors_free_dict[5].keyarg,"%d",&num); free_parse->imol_tors_free[1] = num; index = 5; if((num <=0)) { keyarg_barf(tors_free_dict,molsetname,fun_key,index); } /*-----------------------------------------------------------------------*/ /* 6)\atom2.1_mol_ind{} */ sscanf(tors_free_dict[6].keyarg,"%d",&num); free_parse->imol_tors_free[2] = num; index = 6; if((num <=0)) { keyarg_barf(tors_free_dict,molsetname,fun_key,index); } /*-----------------------------------------------------------------------*/ /* 7)\atom3.1_mol_ind{} */ sscanf(tors_free_dict[7].keyarg,"%d",&num); free_parse->imol_tors_free[3] = num; index = 7; if((num <=0)) { keyarg_barf(tors_free_dict,molsetname,fun_key,index); } /*-----------------------------------------------------------------------*/ /* 8)\atom4.1_mol_ind{} */ sscanf(tors_free_dict[8].keyarg,"%d",&num); free_parse->imol_tors_free[4] = num; index = 8; if((num <=0)) { keyarg_barf(tors_free_dict,molsetname,fun_key,index); } /*-----------------------------------------------------------------------*/ /* 9)\atom1.1_atm_ind{} */ sscanf(tors_free_dict[9].keyarg,"%d",&num); free_parse->iatm_tors_free[1] = num; index = 9; if((num <=0)) { keyarg_barf(tors_free_dict,molsetname,fun_key,index); } /*-----------------------------------------------------------------------*/ /* 10)\atom2.1_atm_ind{} */ sscanf(tors_free_dict[10].keyarg,"%d",&num); free_parse->iatm_tors_free[2] = num; index = 10; if((num <=0)) { keyarg_barf(tors_free_dict,molsetname,fun_key,index); } /*-----------------------------------------------------------------------*/ /* 11)\atom3.1_atm_ind{} */ sscanf(tors_free_dict[11].keyarg,"%d",&num); free_parse->iatm_tors_free[3] = num; index = 11; if((num <=0)) { keyarg_barf(tors_free_dict,molsetname,fun_key,index); } /*-----------------------------------------------------------------------*/ /* 12)\atom4.1_atm_ind{} */ sscanf(tors_free_dict[12].keyarg,"%d",&num); free_parse->iatm_tors_free[4] = num; index = 12; if((num <=0)) { keyarg_barf(tors_free_dict,molsetname,fun_key,index); } /*-----------------------------------------------------------------------*/ /* 13)\eq_1{} */ sscanf(tors_free_dict[13].keyarg,"%lg",&dnum); tors_free->eq[1] = dnum*M_PI/180.0; index = 13; if((dnum <-180.0)||(dnum >180.0)) { keyarg_barf(tors_free_dict,molsetname,fun_key,index); } /*-----------------------------------------------------------------------*/ /* 14)\fk{} */ sscanf(tors_free_dict[14].keyarg,"%lg",&dnum); tors_free->fk = dnum/BOLTZ; index = 14; if((dnum < 0.)) { keyarg_barf(tors_free_dict,molsetname,fun_key,index); } /*-----------------------------------------------------------------------*/ /* 15)\num_hist{} */ sscanf(tors_free_dict[15].keyarg,"%d",&num); tors_free->nhist = num; index = 15; if((num <=0)) { keyarg_barf(tors_free_dict,molsetname,fun_key,index); } /*-----------------------------------------------------------------------*/ /* 16)\power{} */ sscanf(tors_free_dict[16].keyarg,"%d",&num); tors_free->npow = num; index = 16; if((num <=0)) { keyarg_barf(tors_free_dict,molsetname,fun_key,index); } /*-----------------------------------------------------------------------*/ /* 17)\hist_file{} */ strcpy(tors_free->file,tors_free_dict[17].keyarg); /*-----------------------------------------------------------------------*/ /* 18)\atom1.1_residue_ind{} */ sscanf(tors_free_dict[18].keyarg,"%d",&num); free_parse->ires_tors_free[1] = num; index = 18; if((num <=0)) { keyarg_barf(tors_free_dict,molsetname,fun_key,index); } /*-----------------------------------------------------------------------*/ /* 19)\atom2.1_iresidue_ind{} */ sscanf(tors_free_dict[19].keyarg,"%d",&num); free_parse->ires_tors_free[2] = num; index = 19; if((num <=0)) { keyarg_barf(tors_free_dict,molsetname,fun_key,index); } /*-----------------------------------------------------------------------*/ /* 20)\atom3.1_iresidue_ind{} */ sscanf(tors_free_dict[20].keyarg,"%d",&num); free_parse->ires_tors_free[3] = num; index = 20; if((num <=0)) { keyarg_barf(tors_free_dict,molsetname,fun_key,index); } /*-----------------------------------------------------------------------*/ /* 21)\atom4.1_iresidue_ind{} */ sscanf(tors_free_dict[21].keyarg,"%d",&num); free_parse->ires_tors_free[4] = num; index = 21; if(num <=0) { keyarg_barf(tors_free_dict,molsetname,fun_key,index); } /*-----------------------------------------------------------------------*/ /*-----------------------------------------------------------------------*/ /* 22)\atom1.2_moltyp_ind{} */ index = 22; sscanf(tors_free_dict[index].keyarg,"%d",&num); free_parse->imoltyp_tors_free[5] = num; if((num <=0)|| (num>nmol_typ)) { keyarg_barf(tors_free_dict,molsetname,fun_key,index); } /*-----------------------------------------------------------------------*/ /* 23)\atom2.2_moltyp_ind{} */ index = 23; sscanf(tors_free_dict[index].keyarg,"%d",&num); free_parse->imoltyp_tors_free[6] = num; if((num <=0)|| (num>nmol_typ)) { keyarg_barf(tors_free_dict,molsetname,fun_key,index); } /*-----------------------------------------------------------------------*/ /* 24)\atom3.2_moltyp_ind{} */ index = 24; sscanf(tors_free_dict[index].keyarg,"%d",&num); free_parse->imoltyp_tors_free[7] = num; if((num <=0)|| (num>nmol_typ)) { keyarg_barf(tors_free_dict,molsetname,fun_key,index); } /*-----------------------------------------------------------------------*/ /* 25)\atom4.2_moltyp_ind{} */ index = 25; sscanf(tors_free_dict[index].keyarg,"%d",&num); free_parse->imoltyp_tors_free[8] = num; if((num <=0)|| (num>nmol_typ)) { keyarg_barf(tors_free_dict,molsetname,fun_key,index); } /*-----------------------------------------------------------------------*/ /* 26)\atom1.2_mol_ind{} */ index = 26; sscanf(tors_free_dict[index].keyarg,"%d",&num); free_parse->imol_tors_free[5] = num; if((num <=0)) { keyarg_barf(tors_free_dict,molsetname,fun_key,index); } /*-----------------------------------------------------------------------*/ /* 27)\atom2.2_mol_ind{} */ index = 27; sscanf(tors_free_dict[index].keyarg,"%d",&num); free_parse->imol_tors_free[6] = num; if((num <=0)) { keyarg_barf(tors_free_dict,molsetname,fun_key,index); } /*-----------------------------------------------------------------------*/ /* 28)\atom3.2_mol_ind{} */ index = 28; sscanf(tors_free_dict[index].keyarg,"%d",&num); free_parse->imol_tors_free[7] = num; if((num <=0)) { keyarg_barf(tors_free_dict,molsetname,fun_key,index); } /*-----------------------------------------------------------------------*/ /* 29)\atom4.2_mol_ind{} */ index = 29; sscanf(tors_free_dict[index].keyarg,"%d",&num); free_parse->imol_tors_free[8] = num; if((num <=0)) { keyarg_barf(tors_free_dict,molsetname,fun_key,index); } /*-----------------------------------------------------------------------*/ /* 30)\atom1.2_atm_ind{} */ index = 30; sscanf(tors_free_dict[index].keyarg,"%d",&num); free_parse->iatm_tors_free[5] = num; if((num <=0)) { keyarg_barf(tors_free_dict,molsetname,fun_key,index); } /*-----------------------------------------------------------------------*/ /* 31)\atom2.2_atm_ind{} */ index = 31; sscanf(tors_free_dict[index].keyarg,"%d",&num); free_parse->iatm_tors_free[6] = num; if((num <=0)) { keyarg_barf(tors_free_dict,molsetname,fun_key,index); } /*-----------------------------------------------------------------------*/ /* 32)\atom3.2_atm_ind{} */ index = 32; sscanf(tors_free_dict[index].keyarg,"%d",&num); free_parse->iatm_tors_free[7] = num; if((num <=0)) { keyarg_barf(tors_free_dict,molsetname,fun_key,index); } /*-----------------------------------------------------------------------*/ /* 33)\atom4.2_atm_ind{} */ index = 33; sscanf(tors_free_dict[index].keyarg,"%d",&num); free_parse->iatm_tors_free[8] = num; if((num <=0)) { keyarg_barf(tors_free_dict,molsetname,fun_key,index); } /*-----------------------------------------------------------------------*/ /* 34)\atom1.2_residue_ind{} */ index = 34; sscanf(tors_free_dict[index].keyarg,"%d",&num); free_parse->ires_tors_free[5] = num; if((num <=0)) { keyarg_barf(tors_free_dict,molsetname,fun_key,index); } /*-----------------------------------------------------------------------*/ /* 35)\atom2.2_iresidue_ind{} */ index = 35; sscanf(tors_free_dict[index].keyarg,"%d",&num); free_parse->ires_tors_free[6] = num; if((num <=0)) { keyarg_barf(tors_free_dict,molsetname,fun_key,index); } /*-----------------------------------------------------------------------*/ /* 36)\atom3.2_iresidue_ind{} */ index = 36; sscanf(tors_free_dict[index].keyarg,"%d",&num); free_parse->ires_tors_free[7] = num; if((num <=0)) { keyarg_barf(tors_free_dict,molsetname,fun_key,index); } /*-----------------------------------------------------------------------*/ /* 37)\atom4.2_iresidue_ind{} */ index = 37; sscanf(tors_free_dict[index].keyarg,"%d",&num); free_parse->ires_tors_free[8] = num; if(num <=0) { keyarg_barf(tors_free_dict,molsetname,fun_key,index); } /*-----------------------------------------------------------------------*/ /* 38)\eq_2{} */ index = 38; sscanf(tors_free_dict[index].keyarg,"%lg",&dnum); tors_free->eq[2] = dnum*M_PI/180.0; if((dnum <-180.0)||(dnum >180.0)) { keyarg_barf(tors_free_dict,molsetname,fun_key,index); } /*-----------------------------------------------------------------------*/ tors_free->del = (2.0*M_PI)/((double)(tors_free->nhist)); /*-----------------------------------------------------------------------*/ } /*end routine*/
void set_bond_free_params(char *molsetname,char fun_key[], DICT_WORD bond_free_dict[], int num_bond_free_dict, BOND_FREE *bond_free,FREE_PARSE *free_parse, int nmol_typ) /*========================================================================*/ { /*begin routine */ /*========================================================================*/ /* Local variables */ int num,i,index; double dnum; /*========================================================================*/ /* I) Check for missing key words*/ for(i=1; i<num_bond_free_dict; i++) { if(bond_free_dict[i].iuset==0 && bond_free_dict[i].key_type==1) { keyword_miss(bond_free_dict,molsetname,fun_key,i); } }/*endfor*/ /*=========================================================================*/ /* II) Set the params */ /*-----------------------------------------------------------------------*/ /* 1)\atom1_moltyp_ind{} */ sscanf(bond_free_dict[1].keyarg,"%d",&num); free_parse->imoltyp_bond_free[1] = num; index = 1; if((num <=0)|| (num>nmol_typ)) { keyarg_barf(bond_free_dict,molsetname,fun_key,index); } /*-----------------------------------------------------------------------*/ /* 2)\atom2_moltyp_ind{} */ sscanf(bond_free_dict[2].keyarg,"%d",&num); free_parse->imoltyp_bond_free[2] = num; index = 2; if((num <=0)|| (num>nmol_typ)) { keyarg_barf(bond_free_dict,molsetname,fun_key,index); } /*-----------------------------------------------------------------------*/ /* 3)\atom1_mol_ind{} */ sscanf(bond_free_dict[3].keyarg,"%d",&num); free_parse->imol_bond_free[1] = num; index = 3; if((num <=0)) { keyarg_barf(bond_free_dict,molsetname,fun_key,index); } /*-----------------------------------------------------------------------*/ /* 4)\atom2_mol_ind{} */ sscanf(bond_free_dict[4].keyarg,"%d",&num); free_parse->imol_bond_free[2] = num; index = 4; if((num <=0)) { keyarg_barf(bond_free_dict,molsetname,fun_key,index); } /*-----------------------------------------------------------------------*/ /* 5)\atom1_atm_ind{} */ sscanf(bond_free_dict[5].keyarg,"%d",&num); free_parse->iatm_bond_free[1] = num; index = 5; if((num <=0)) { keyarg_barf(bond_free_dict,molsetname,fun_key,index); } /*-----------------------------------------------------------------------*/ /* 6)\atom2_atm_ind{} */ sscanf(bond_free_dict[6].keyarg,"%d",&num); free_parse->iatm_bond_free[2] = num; index = 6; if((num <=0)) { keyarg_barf(bond_free_dict,molsetname,fun_key,index); } /*-----------------------------------------------------------------------*/ /* 7)\eq{} */ sscanf(bond_free_dict[7].keyarg,"%lg",&dnum); bond_free->eq = dnum/BOHR; index = 7; /*-----------------------------------------------------------------------*/ /* 8)\fk{} */ sscanf(bond_free_dict[8].keyarg,"%lg",&dnum); bond_free->fk = dnum*BOHR*BOHR/BOLTZ; index = 8; if((dnum < 0)) { keyarg_barf(bond_free_dict,molsetname,fun_key,index); } /*-----------------------------------------------------------------------*/ /* 9)\rmin_hist{} */ sscanf(bond_free_dict[9].keyarg,"%lg",&dnum); bond_free->rmin = dnum/BOHR; /*-----------------------------------------------------------------------*/ /* 10)\rmax_hist{} */ sscanf(bond_free_dict[10].keyarg,"%lg",&dnum); bond_free->rmax = dnum/BOHR; /*-----------------------------------------------------------------------*/ /* 11)\num_hist{} */ sscanf(bond_free_dict[11].keyarg,"%d",&num); bond_free->nhist = num; index = 11; if((num <=0)) { keyarg_barf(bond_free_dict,molsetname,fun_key,index); } /*-----------------------------------------------------------------------*/ /* 12)\power{} */ sscanf(bond_free_dict[12].keyarg,"%d",&num); bond_free->npow = num; index = 12; if((num <=0)) { keyarg_barf(bond_free_dict,molsetname,fun_key,index); } /*-----------------------------------------------------------------------*/ /* 13)\hist_file{} */ strcpy(bond_free->file,bond_free_dict[13].keyarg); /*-----------------------------------------------------------------------*/ /* 14)\atom1_residue_ind{} */ sscanf(bond_free_dict[14].keyarg,"%d",&num); free_parse->ires_bond_free[1] = num; index = 14; if((num <=0)) { keyarg_barf(bond_free_dict,molsetname,fun_key,index); } /*-----------------------------------------------------------------------*/ /* 15)\atom2_residue_ind{} */ sscanf(bond_free_dict[15].keyarg,"%d",&num); free_parse->ires_bond_free[2] = num; index = 15; if((num <=0)) { keyarg_barf(bond_free_dict,molsetname,fun_key,index); } /*-----------------------------------------------------------------------*/ bond_free->del =((bond_free->rmax)- (bond_free->rmin))/ ((double)(bond_free->nhist)); /*-----------------------------------------------------------------------*/ /*end routine*/ }