diff options
Diffstat (limited to 'Master/texmf-dist/metapost/mcf2graph')
-rw-r--r-- | Master/texmf-dist/metapost/mcf2graph/mcf2graph.mf | 626 |
1 files changed, 299 insertions, 327 deletions
diff --git a/Master/texmf-dist/metapost/mcf2graph/mcf2graph.mf b/Master/texmf-dist/metapost/mcf2graph/mcf2graph.mf index 9314283dea8..6fa08622710 100644 --- a/Master/texmf-dist/metapost/mcf2graph/mcf2graph.mf +++ b/Master/texmf-dist/metapost/mcf2graph/mcf2graph.mf @@ -1,5 +1,5 @@ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -% mcf2graph ver 4.53 Copyright (c) 2013-2020 Akira Yamaji +% mcf2graph ver 4.54 Copyright (c) 2013-2020 Akira Yamaji % % Permission is hereby granted, free of charge, to any person obtaining a copy of this software % and associated documentation files (the "Software"), to deal in the Software without restriction, @@ -38,20 +38,25 @@ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% tracingstats:=1; message "---------------------------------------------"; -message "This is mcf2graph ver 4.53 2020.11"; +message "This is mcf2graph ver 4.54 2020.12"; message "---------------------------------------------"; %------------------------------------------------------------------------------------------------- -newinternal com,par,nA,nB,nC,nD,nE,nF,nP; +newinternal cntA,cntB,cntM,minX,minY,sftX,sftY,com,par,nA,nB,nC,nD,nE,nF,nN,nP,nU,nP,nL,nR,nS,nW, + xpos,ypos; numeric save_num[],comD[][],parD[][],adrD[][],cntD[],tbl_atom[],tbl_group[][],f_char[], tbl_atom_wt[],tbl_atom_mi[],tbl_char_wd[],tbl_char_ht[],andA[],and_rot[],chargeA[], - com_group[][],par_group[][],cnt_group[],colorA[],colorB[]; -string save_str[],tbl_atom_str[],strD[],tag[],mpc_name[],out_file_name,out_file_aux, - out_file_rep,out_file_mpc,aux_delimiter,atomfont,save_atomfont,save_defaultfont; -pair save_pair[],msize,mposition,fsize,fmargin,save_mposition,posBs,posBe; -picture mol_stru[],save_picture,temp_picture; + com_group[][],par_group[][],cnt_group[],colorA[],colorB[],sumA[],bondC[],hideH[], + lineB[],sB[],eB[],angB[],angA[],lenB[],angX[],numS[],wdM[],htM[],wdA[],dxA[]; +string info[],save_str[],tbl_atom_str[],strD[],tag[],mpc_name[],out_file_name,out_file_aux, + out_file_rep,out_file_mpc,aux_delimiter,atomfont,save_atomfont,save_defaultfont,temp_c, + s_tag,s_var,cal_FM,cal_MW,cal_MW_str,cal_MI,cal_MI_str, + inf_NO,inf_EN,inf_JN,inf_FM,inf_CAS,inf_USE,inf_EXA,inf_EXB,inf_MW; +pair save_pair[],posA[],posM[][],msize,mposition,fsize,fmargin,save_mposition,posBs,posBe, + temp_p; +picture mol_stru[],atom_picture,save_picture,temp_picture; path arrow_path,dottedline_path,line_path,arrow_head; %------------------------------------------------------------------------------------------------- -char_num:=str_cnt:=proc_end:=mangle:=sw_label_emu:=sw_calc:=sw_ext_all:=0; +char_num:=str_cnt:=tbl_cnt:=proc_end:=mangle:=sw_label_emu:=sw_calc:=sw_ext_all:=0; sw_numberA:=sw_numberB:=sw_aux_out:=sw_expand:=sw_fframe:=sw_mframe:=sw_aframe:=sw_trimming:=0; sw_rep_out:=sw_mol_out:=sw_group_off:=sw_single:=sw_arrow:=0; numberA_start:=numberB_start:=1; numberA_end:=numberB_end:=4095; @@ -181,12 +186,13 @@ labeloffset:=3bp; ext_defaultline:=0.5bp; lonepairdiam:=lonepairspace:=circlediam:=circlepen:=0; %================================================================================================== -parts_emb_start:=500; % 500 => 2499 for embedded parts (max 2000) -parts_usr_start:=2500; % 2500 => 2999 for user parts (max 500) -parts_int_start:=3000; % 3000 => 4000 for internal parts (max 1000) +parts_emb_start:=1000; % 1001 => 2000 for embedded parts (max 1900) +parts_emi_start:=1900; % 1901 => 2000 for embedded internal parts (max 100) +parts_usr_start:=2000; % 2001 => 3000 for user parts (max 1000) +parts_int_start:=3000; % 3001 => 4000 for internal parts (max 1000) %-------------------------------------------------------------------------------------------------- def def_com(expr n)(text tx)= nA:=n; forsuffixes list=tx:: list:=nA; nA:=nA+1; endfor enddef; -def_com(-4090)(_com,_jp_atom,_jp_absA,_jp_bond,_cyc,_cyc_sB,_cyc_eB,_set_line,_dl,_tmp_line, +def_com(-4090)(_com,_jp_atom,_jp_absA,_jp_bond,_cyc,_cyc_sB,_cyc_eB,_set_line,_tmp_line, _chg_len,_get_len,_ring_len,_tmp_len,_rot_ang,_adj_ang,_chg_env,_tmp_env,_set_colorA,_set_colorB, _group_si,_set_adr,_mk_bond,_set_atom,_arg_ang,_chg_atom,_tmp_rot,_fuse,_size_atom,_numeric, _jump_at,_connect_at,_set_and,_chg_charge,_nop,_mark,_moff,_term,_len_s,_len_e,_len_ss,_len_ee, @@ -207,8 +213,11 @@ enddef; %-------------------------------------------------------------------------------------------------- def ]]]=] ] ] enddef; vardef iif(expr a,b,c)=if a: b else: c fi enddef; -vardef pic_c(expr i,s)= substring(i,i+1) of s enddef; -vardef sfB(expr a,b,c)= a shifted ((b,0) rotated c) enddef; +vardef subc(expr i,s)= substring(i,i+1) of s enddef; +vardef sfrt(expr a,b,c)= a shifted ((b,0) rotated c) enddef; +def wpcs expr n= withpen pencircle scaled n enddef; +def ppcs expr n= pickup pencircle scaled n enddef; +def sbp(expr m,n)expr p=subpath(m*length(p),n*length(p)) of p enddef; %-------------------------------------------------------------------------------------------------- def init_par(text t)= nA:=nB:=nC:=0; @@ -242,14 +251,7 @@ enddef; %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% def beginfont(text s)= begingroup - save cntA,cntB,cntM,minX,minY,f_beginchar,numS,sftX,sftY,f_ext,blen,ext,add, - cal_FM,cal_MW,cal_MW_str,cal_MI,cal_MI_str,wdM,htM, - inf_NO,inf_EN,inf_JN,inf_MW,inf_MI,inf_FM,inf_CAS,inf_USE,inf_EXA,inf_EXB, - posA,posM,lineB,sB,eB,angB,angA,wdA,dxA,lenB,ang_br,info; - numeric lineB[],sB[],eB[],angB[],angA[],lenB[],angX[],numS[],wdM[],htM[],wdA[],dxA[]; - pair posA[],posM[][]; - string info[],sumA,s_tag,s_var,cal_FM,cal_MW,cal_MW_str,cal_MI,cal_MI_str, - inf_NO,inf_EN,inf_JN,inf_FM,inf_CAS,inf_USE,inf_EXA,inf_EXB,inf_MW; + save f_beginchar,f_ext,blen,ext,add,ang_br; %------------------------------------------------------------------------------------------------ def ext=ext_to_font enddef; def add=add_to_molecule enddef; @@ -257,6 +259,9 @@ def beginfont(text s)= inf_NO:=inf_EN:=inf_JN:=inf_MW:=inf_FM:=inf_CAS:=inf_USE:=inf_EXA:=inf_EXB:="-"; cal_MW:=cal_MW_str:=cal_MI:=cal_MI_str:=cal_FM:=""; %------------------------------------------------------------------------------------------------ + parts_cnt:=parts_usr_start; + parts_int:=parts_int_start; + %------------------------------------------------------------------------------------------------ char_num:=char_num+1; store_par(parameter_list); for i:=1 upto max_inf_num: info[i]:=":"; endfor @@ -264,7 +269,7 @@ def beginfont(text s)= for list=s: inf_num:=inf_num+1; info[inf_num]:=list; endfor %------------------------------------------------------------------------------------------------ for j=1 upto inf_num: - nA:=0; for i=0 upto length(info[j]): if pic_c(i,info[j])=":": nA:=i; fi exitif nA>0; endfor + nA:=0; for i=0 upto length(info[j]): if subc(i,info[j])=":": nA:=i; fi exitif nA>0; endfor if nA>0: s_tag:=substring (0,nA) of info[j]; s_var:=substring (nA+1,length(info[j])) of info[j]; @@ -310,11 +315,15 @@ def endfont= restore_par(parameter_list); endgroup; if proc_end=1: scantokens("bye"); fi + %----------------------------------------------------------------------------------------------- +%% message "parts_cnt (0)="& decimal(parts_cnt) &" "& decimal(parts_usr-parts_usr_start); +%% message "parts_int (0)="& decimal(parts_int) &" "& decimal(parts_int-parts_int_start); + %----------------------------------------------------------------------------------------------- enddef; %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% def set_def_MC= save /,//,/*,*/,**,*/*,~,^,',`,``,<,>,&,:,=,\,\\,*\,\*,*\*,@,#,@#,$, - {,},|,||,|||,|=,=|,|<,>|,|:,:|,_,d,w,z,inside_def_MC; + {,},|,||,|||,|=,=|,|<,>|,|<<,>>|,:|,_,d,w,z,CP,CPe,CPx,inside_def_MC; inside_def_MC:=1; _:=Me; d:=db; w:=wf; z:=zf; tertiarydef a=b == if (known a)and(known b):: change_bond(a,b) else:: _nop fi enddef; @@ -332,18 +341,22 @@ def set_def_MC= def \ == @,0 enddef; def \\ == \~dm enddef; def *\ == \~wf enddef; def \* == \~zf enddef; def *\* == \~wv enddef; def | == (_com,_mark) enddef; def || == (_com,_moff) enddef; def ||| == (_com,_term) enddef; - def |< == (_com,_len_s) enddef; def >| == (_com,_len_e) enddef; - def |: == (_com,_len_ss) enddef; def :| == (_com,_len_ee) enddef; + def |< == (_com,_len_s) enddef; def >| == (_com,_len_e) enddef; + def |<< == (_com,_len_ss) enddef; def >>| == (_com,_len_ee) enddef; def |=primary n == |<,(_chg_len,n) enddef; def =| == >| enddef; + def :| == (_com,_rest) enddef; def /secondary n == if known n:: (_group_si,n) else:: _nop fi enddef; def //secondary n == /n~dm enddef; def */secondary n == /n~wf enddef; def /*secondary n == /n~zf enddef; def */*secondary n == /n~wv enddef; def **secondary n == /n~nb enddef; - vardef '(text TXT)== read_mcf(incr parts_usr)(|,TXT,(_com,_rest)); parts_usr enddef; + vardef '(text TXT)== read_mcf(incr parts_cnt)(|,``crR,TXT,:|); parts_cnt enddef; + def CP == com_par enddef; + def CPe == com_par_ex(0) enddef; + def CPx == com_par_ex(1) enddef; enddef; -%================================================================================================= -vardef '(text TXT)= read_mcf(incr parts_usr)(TXT); parts_usr enddef; %------------------------------------------------------------------------------------------------- +vardef '(text TXT)= parts_cnt:=parts_cnt+1; read_mcf(parts_cnt)(TXT); parts_cnt enddef; +%================================================================================================= def read_mcf(expr n)(text TXT)= begingroup save list_cnt,nCP; @@ -354,7 +367,7 @@ def read_mcf(expr n)(text TXT)= list_cnt:=list_cnt+1; if pair list:: nCP:=nCP+1; comD[n][nCP]:=xpart(list); parD[n][nCP]:=ypart(list); elseif numeric list:: - if list==_nop:: message "unknown command in "AND decimal(list_cnt); + if list==_nop:: message "unknown command in "AND decimal(n); elseif list>=parts_emb_start:: for i==1 upto cntD[list]:: nCP:=nCP+1; comD[n][nCP]:=comD[list][i]; parD[n][nCP]:=parD[list][i]; @@ -365,7 +378,7 @@ def read_mcf(expr n)(text TXT)= str_cnt:=str_cnt+1; strD[str_cnt]:=list; nCP:=nCP+1; comD[n][nCP]:=_set_atom; parD[n][nCP]:=str_cnt; fi - else:: message "unknown command in "AND decimal(list_cnt); + else:: message "unknown command in "AND decimal(n); fi endfor cntD[n]:=nCP; @@ -373,7 +386,6 @@ def read_mcf(expr n)(text TXT)= enddef; %------------------------------------------------------------------------------------------------- vardef read_number(text TXT)= - save nN; parts_int:=parts_int+1; nN:=0; for list==TXT:: @@ -428,8 +440,10 @@ vardef change_bond(expr a,b) = if a>=parts_int_start:: for i==1 upto cntD[a]:: fuse_ring(parD[a][i],b-?3+3) endfor else:: fuse_ring(a,b-?3+3) fi - elseif b==Ph1:: fuse_ring(a,6) CP(_dl,-2) CP(_dl,-4) - elseif b==Ph2:: fuse_ring(a,6) CP(_dl,-1) CP(_dl,-3) CP(_dl,-5) + elseif b==Ph1:: fuse_ring(a,6) CP(_set_adr,-2) CP(_set_line,dl) + CP(_set_adr,-4) CP(_set_line,dl) + elseif b==Ph2:: fuse_ring(a,6) CP(_set_adr,-1) CP(_set_line,dl) + CP(_set_adr,-3) CP(_set_line,dl) CP(_set_adr,-5) CP(_set_line,dl) elseif b==_jump_at:: CP(_jp_bond,a) elseif b==_connect_at:: CP(_cyc_sB,a) elseif comD[b][1]==_fuse:: @@ -470,7 +484,7 @@ enddef; def com_par(expr a,b)= nCP:=nCP+1; comD[parts_int][nCP]:=a; parD[parts_int][nCP]:=b; enddef; %------------------------------------------------------------------------------------------------- def com_par_ex(expr f)(expr c)(expr a,b)= - if c>=parts_int_start:: + if c>=parts_emb_start:: for i==1 upto cntD[c]:: if comD[c][i]==_numeric:: com_par(_set_adr,parD[c][i]) com_par(a,b) ef f==1:: com_par(comD[c][i],parD[c][i]) fi @@ -480,36 +494,30 @@ def com_par_ex(expr f)(expr c)(expr a,b)= enddef; %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% def puts(expr POS)(expr STR)= - begingroup - save pA,sA,bA; - pair pA; - string sA; - picture bA; - pA:=POS; + temp_p:=POS; nB:=defaultscale*defaultsize; nC:=0; %------------------------------------------------------------------------------------------------ for i=0 upto length(STR)-1: - sA:=pic_c(i,STR); - if sw_label_emu=1: - if sA="_": nC:=iif(nC=-0.5,0,-0.5); - elseif sA="^": nC:=iif(nC= 0.5,0, 0.5); + temp_c:=subc(i,STR); + if sw_label_emu=1: + if temp_c="_": nC:=iif(nC=-0.5,0,-0.5); + elseif temp_c="^": nC:=iif(nC= 0.5,0, 0.5); else: if defaultfont="draw": - draw_char(sA,pA+(0,nB*nC),nB,ratio_thickness_char*defaultscale*defaultsize,0); - pA:=pA+(nB*tbl_char_wd[ASCII(sA)],0); + draw_char(temp_c,temp_p+(0,nB*nC),nB,ratio_thickness_char*defaultscale*defaultsize,0); + temp_p:=temp_p+(nB*tbl_char_wd[ASCII(temp_c)],0); else: - bA:=sA infont defaultfont scaled defaultscale; - addto currentpicture also bA shifted (pA+(0,nB*nC)); - pA:=pA+(lrcorner bA-llcorner bA); + temp_picture:=temp_c infont defaultfont scaled defaultscale; + addto currentpicture also temp_picture shifted (temp_p+(0,nB*nC)); + temp_p:=temp_p+(lrcorner temp_picture-llcorner temp_picture); fi fi else: - draw_char(sA,pA,nB,ratio_thickness_char*defaultscale*defaultsize,0); - pA:=pA+(nB*tbl_char_wd[ASCII(sA)],0); + draw_char(temp_c,temp_p,nB,ratio_thickness_char*defaultscale*defaultsize,0); + temp_p:=temp_p+(nB*tbl_char_wd[ASCII(temp_c)],0); fi endfor - endgroup; enddef; %================================================================================================== def ext_setup= @@ -600,8 +608,7 @@ vardef image_emu(text TXT) = enddef; %-------------------------------------------------------------------------------------------------- vardef scan_picture(expr PIC,SD)= - save save_pic,nA,nB,nC,nD,nE,nS,iw,erase_h,erase_v; - picture save_pic; + save iw,erase_h,erase_v; path erase_h,erase_v; nD:=0.2bp; if (SD=1)or(SD=3): nS:=-max_labelsize; nE:=max_labelsize; nB:=nD; nC:=-nD; @@ -612,7 +619,7 @@ vardef scan_picture(expr PIC,SD)= elseif (SD=3)or(SD=4): erase_v:=unitsquare xscaled nD yscaled 2max_labelsize shifted (nC,-max_labelsize); fi - save_pic:=currentpicture; + temp_picture:=currentpicture; currentpicture:=PIC; erase fill unitsquare scaled nD shifted (-max_labelsize,-max_labelsize); iw:=totalweight currentpicture; @@ -627,7 +634,7 @@ vardef scan_picture(expr PIC,SD)= else: nA:=0; fi - currentpicture:=save_pic; + currentpicture:=temp_picture; nA enddef; %-------------------------------------------------------------------------------------------------- @@ -638,41 +645,34 @@ vardef ulcorner_emu(expr b)= (scan_picture(b,3),scan_picture(b,2)) enddef; %-------------------------------------------------------------------------------------------------- vardef circled_plus_add= nA:=circlediam; nB:=circlepen; - image(draw fullcircle scaled nA withpen pencircle scaled nB; - draw (-.5nA,0)--(.5nA,0) withpen pencircle scaled nB; - draw (0,-.5nA)--(0,.5nA) withpen pencircle scaled nB; - ) + image(draw fullcircle scaled nA wpcs nB; + draw (-.5nA,0)--(.5nA,0) wpcs nB; draw (0,-.5nA)--(0,.5nA) wpcs nB;) enddef; %-------------------------------------------------------------------- vardef circled_minus_add= nA:=circlediam; nB:=circlepen; - image(draw fullcircle scaled nA withpen pencircle scaled nB; - draw (-.5nA,0)--(.5nA,0) withpen pencircle scaled nB; - ) + image(draw fullcircle scaled nA wpcs nB; draw (-.5nA,0)--(.5nA,0) wpcs nB;) enddef; %-------------------------------------------------------------------- vardef lone_pair_add expr ANG= - nA:=lonepairdiam; nB:=lonepairspace; - image(draw (0,0) withpen pencircle scaled nA; - draw ((0,nB) rotated ANG) withpen pencircle scaled nA;) + image(draw (0,0) wpcs lonepairdiam; draw ((0,lonepairspace) rotated ANG) wpcs lonepairdiam;) enddef; %-------------------------------------------------------------------------------------------------- vardef label_emu@#(expr OBJ,POS) = %% modified 'thelabel@#(expr s,z)' of plain.mp - save oft,fx,fy,wds,sC,bA,pA,pB,pC,pD; + save oft,fx,fy,wds,sC,pA,pB,pC,pD; pair oft,oft.lft,oft.rt,oft.top,oft.bot,oft.ulft,oft.llft,oft.urt,oft.lrt,pA,pB,pC,pD; string sC; - picture bA; wds:=0; %--------------------------------------------------------------- if string OBJ: for i=0 upto length(OBJ)-1: - sC:=pic_c(i,OBJ); + sC:=subc(i,OBJ); if not((sw_label_emu=1)and((sC="_")or(sC="^"))): if (defaultfont="draw")or(f_MP=0): wds:=wds+defaultscale*defaultsize*tbl_char_wd[ASCII(sC)]; else: - bA:=sC infont defaultfont scaled defaultscale; - wds:=wds+xpart(lrcorner bA-llcorner bA); + temp_picture:=sC infont defaultfont scaled defaultscale; + wds:=wds+xpart(lrcorner temp_picture-llcorner temp_picture); fi fi endfor @@ -699,9 +699,7 @@ vardef label_emu@#(expr OBJ,POS) = %% modified 'thelabel@#(expr s,z)' of plain.m fi enddef; %------------------------------------------------------------------------------------------------- -vardef dotlabel_emu@#(expr OBJ,POS)= - label_emu@#(OBJ,POS); draw POS withpen pencircle scaled dotlabeldiam; -enddef; +vardef dotlabel_emu@#(expr OBJ,POS)= label_emu@#(OBJ,POS); draw POS wpcs dotlabeldiam; enddef; %================================================================================================== def drawarrow_emu expr PATH = arrow_path:=PATH; draw_arrow enddef; %------------------------------------------------------------------------------------------------- @@ -736,30 +734,20 @@ def draw_dottedline text t = enddef; %================================================================================================= def MCat(expr FW,FH)(text TXT)= - save_mposition:=mposition; - mposition:=(FW,FH); - MC(TXT) - mposition:=save_mposition; + save_mposition:=mposition; mposition:=(FW,FH); MC(TXT) mposition:=save_mposition; enddef; %------------------------------------------------------------------------------------------------- def MC(text TXT)= begingroup save markA,markB,saveA,saveB,f_bra,envT,envB,lenT,lineT,strAT,cnt_group,bondL,temp_lenE, temp_lenF,temp_cntB,f_end,f_term,rotT,f_at,f_lineT,f_rotT,f_lenT,f_envT,angT, - maxX,maxY,sA,sC,sD,pA,pB,factor,m_wd,m_ht,crR,CP,CPe,CPx,defaultsize,defaultscale; - %----------------------------------------------------------------------------------------------- - def CP= com_par enddef; - def CPe= com_par_ex(0) enddef; - def CPx= com_par_ex(1) enddef; + maxX,maxY,sA,sC,factor,m_wd,m_ht,crR,defaultsize,defaultscale; %----------------------------------------------------------------------------------------------- - string sA,sC,sD; - pair pA,pB; + string sA,sC; %----------------------------------------------------------------------------------------------- if (sw_numberA>=1)or(sw_numberB>=1): ratio_atom_bond:=0.25; fi if (sw_expand=1)or(sw_mol_out>=1): expand_set; fi - parts_usr:=parts_usr_start; - parts_int:=parts_int_start; - cntA:=cntB:=cnt_group:=cntC:=0; strD[0]:=""; str_cnt:=2000; crR:=-ratio_chain_ring; + cntA:=cntB:=cnt_group:=cntC:=0; strD[0]:="C"; str_cnt:=2000; crR:=-ratio_chain_ring; %----------------------------------------------------------------------------------------------- font_wd:=xpart(fsize); font_ht:=ypart(fsize); @@ -806,8 +794,8 @@ def MC(text TXT)= if numS[i]=0: nB:=.5atom_wd; else: nB:=.85atom_wd+iif(nC<45,sind(nC),cosd(nC))*.5atom_wd; fi - pA:=sfB(posA[i]-(.35atom_wd,.35atom_wd),nB,nA); - draw_char(sA,pA,atom_wd,bond_pen_wd*ratio_char_bond,0); + temp_p:=sfrt(posA[i]-(.35atom_wd,.35atom_wd),nB,nA); + draw_char(sA,temp_p,atom_wd,bond_pen_wd*ratio_char_bond,0); else: sA:=""; fi nA:=length(strD[numS[i]]); sC:=substring(nA-3,nA-2) of strD[numS[i]]; @@ -865,16 +853,13 @@ def MC(text TXT)= clearit; endgroup; if ((sw_aux_out>=1)or(sw_rep_out=1)or(sw_mol_out>=1)or(sw_calc=1))and(f_MP=1): proc_calc; fi - %----------------------------------------------------------------------------------------------- -%%% message "parts_usr ="& decimal(parts_usr) &" "& decimal(parts_usr-parts_usr_start); -%%% message "parts_int ="& decimal(parts_int) &" "& decimal(parts_int-parts_int_start); - %----------------------------------------------------------------------------------------------- enddef; %------------------------------------------------------------------------------------------------- def add_group= if f_at=1: nE:=getA(adrT); check_adrA(nE); else: nE:=cntA+1; fi cnt_group:=cnt_group+1; cnt_group[cnt_group]:=0; - store_group(_jp_absA,nE) store_group(_com,_len_s) + store_group(_jp_absA,nE) + store_group(_com,_len_s) if lineT<>nb: store_group(_tmp_line,lineT) fi if rotT<>0: store_group(_rot_ang,rotT) fi if lenT<>crR: store_group(_chg_len,lenT) fi @@ -882,7 +867,9 @@ def add_group= if lineT=nl: store_group(_chg_len,_size_atom) store_group(_adj_ang,0) fi if lineT<>nb: store_group(_mk_bond,0) fi for i=1 upto cntD[par]: store_group(comD[par][i],parD[par][i]) endfor - store_group(_com,_len_e) store_group(_chg_env,hz) store_group(_com,_term) + store_group(_com,_len_e) + store_group(_chg_env,hz) + store_group(_com,_term) if f_lineT=0: lineT:=si; fi if f_lenT=0: lenT:=crR; fi if f_rotT=0: rotT:=0; fi @@ -911,10 +898,8 @@ def draw_frame(expr PS,LX,LY,PN)= enddef; %------------------------------------------------------------------------------------------------- def draw_corner(expr PS,LX,LY,PN)= - draw( 0, 0) shifted PS withpen pencircle scaled PN; - draw(LX, 0) shifted PS withpen pencircle scaled PN; - draw(LX,LY) shifted PS withpen pencircle scaled PN; - draw( 0,LY) shifted PS withpen pencircle scaled PN; + draw( 0, 0) shifted PS wpcs PN; draw(LX, 0) shifted PS wpcs PN; + draw(LX,LY) shifted PS wpcs PN; draw( 0,LY) shifted PS wpcs PN; enddef; %------------------------------------------------------------------------------------------------- def proc_size_setup= @@ -928,8 +913,6 @@ def proc_size_setup= enddef; %------------------------------------------------------------------------------------------------- def proc_scaling= - begingroup - save nU,nD,nP,nL,nR,xpos,ypos; minX:=minY:=4095; maxX:=maxY:=-4095; for i=1 upto cntA: @@ -938,7 +921,7 @@ def proc_scaling= if numS[i]<>0: nU:=nD:=nP:=nL:=nR:=0; for j=0 upto length(strD[numS[i]])-1: - sA:=pic_c(j,strD[numS[i]]); + sA:=subc(j,strD[numS[i]]); if (sA="^"): nU:=.5atom_wd; elseif (sA="_"): nD:=.5atom_wd; elseif (sA<>"{")and(sA<>"}"): nP:=nP+atom_wd*tbl_char_wd[ASCII(sA)]; @@ -954,7 +937,6 @@ def proc_scaling= fi endfor mol_wd:=maxX-minX; mol_ht:=maxY-minY; - endgroup enddef; %------------------------------------------------------------------------------------------------- def char_use_check= @@ -964,7 +946,7 @@ def char_use_check= else: for i=1 upto cntA: if numS[i]<>0: - for j=0 upto length(strD[numS[i]])-1: f_char[ASCII(pic_c(j,strD[numS[i]]))]:=1; endfor + for j=0 upto length(strD[numS[i]])-1: f_char[ASCII(subc(j,strD[numS[i]]))]:=1; endfor fi endfor fi @@ -978,16 +960,16 @@ def proc_bond_atom(expr a)(expr n)= for i=n upto cntD[a]: com:=comD[a][i]; par:=parD[a][i]; if com=_mk_bond: if (par=0)and(rotT<>0): rotT:=0; fi add_atom; ef com=_set_adr: adrT:=par; - ef com=_com: if par=_mark: saveA:=markA; saveB:=markB; markA:=cntA; markB:=saveB:=cntB; + ef com=_com: if par=_mark: saveA:=markA; saveB:=markB; markA:=cntA; markB:=cntB; ef par=_rest: markA:=saveA; markB:=saveB; ef par=_moff: markA:=markB:=0; ef par=_term: termA; ef par=_len_s: temp_lenE:=bondL; ef par=_len_e: bondL:=temp_lenE; ef par=_len_ss: temp_lenF:=bondL; ef par=_len_ee: bondL:=temp_lenF; ef par=_group_s: f_at:=1; if lineT<>si: f_lineT:=1; fi if rotT<>0: f_rotT:=1; fi - if lenT<>crR: f_lenT:=1; fi if envT<>hz: f_envT:=1; fi + if lenT<>crR: f_lenT:=1; fi if envT<>hz: f_envT:=1; fi ef par=_group_e: f_at:=0; f_lineT:=f_rotT:=f_lenT:=f_envT:=rotT:=envT:=0; - lineT:=si; lenT:=crR; + lineT:=si; lenT:=crR; fi ef com=_set_atom: strAT:=par; ef com=_group_si: add_group; @@ -998,10 +980,9 @@ def proc_bond_atom(expr a)(expr n)= ef com=_chg_len: if par=_ring_len: bondL:=ringL; else: bondL:=par; fi ef com=_get_len: if par=_tmp_len: if bondL=crR: bondL:=lenT; fi ef par=_ring_len: if lenT<>crR: bondL:=lenT; else: if bondL<0: bondL:=1; fi fi - else: ringL:=lenB[getB(par)]; fi + else: ringL:=lenB[getB(par)]; fi ef com=_tmp_len: lenT:=par; ef com=_set_line: lineB[getB(adrT)]:=par; - ef com=_dl: lineB[getB(par)]:=dl; ef com=_tmp_line: lineT:=par; ef com=_tmp_rot: rotT:=par; ef com=_cyc: f_end:=getA(par); check_adrA(f_end); add_atom; @@ -1040,7 +1021,8 @@ def proc_skeleton(expr a)= %----------------------------------------------------------------------------------------------- for i=1 upto cntD[a]: com:=comD[a][i]; par:=parD[a][i]; if com=_mk_bond: if (par=0)and(rotT<>0):par:=rotT; rotT:=0; fi add_bond(par); - ef com=_com: if par=_mark: markA:=cntA; markB:=cntB; + ef com=_com: if par=_mark: saveA:=markA; saveB:=markB; markA:=cntA; markB:=cntB; + ef par=_rest: markA:=saveA; markB:=saveB; ef par=_moff: markA:=markB:=0; ef par=_term: termB; ef par=_group_e: lineT:=si; lenT:=crR; rotT:=envT:=0; fi ef com=_jp_bond: termB; nA:=getB(par); posBs:=posA[sB[nA]]; angT:=angB[nA]; f_bra:=1; rotT:=0; @@ -1064,11 +1046,10 @@ enddef; %------------------------------------------------------------------------------------------------- def add_bond(expr ROT)= if ROT=_arg_ang: - if cntB=0: - angT:=(angT-180) mod 360; nA:=180; + if cntB=0: angT:=(angT-180) mod 360; nA:=180; else: nB:=(angT mod 360); - if envB>=parts_emb_start: nA:=parD[envB][cntB-temp_cntB]; + if envB>=parts_emb_start: nA:=parD[envB][cntB-temp_cntB+2]; else: if envB=hz: if nB=0:nA:= 60;ef nB<=90:nA:=-60;ef nB<=180:nA:= 60;ef nB<270:nA:=-60;else:nA:= 60; fi @@ -1087,11 +1068,11 @@ def add_bond(expr ROT)= fi angB[cntB+1]:=angT:=(angT+nA) mod 360; if f_end=0: - if lenB[cntB+1]=_size_atom: posBe:=sfB(posBs,atom_wd,angT); + if lenB[cntB+1]=_size_atom: posBe:=sfrt(posBs,atom_wd,angT); else: nA:=lenB[cntB+1]; if nA<0: nB:=glu_atom(adrT)+glu_atom(cntA+1); nA:=abs(nA); else: nB:=0; fi - posBe:=sfB(posBs,nA*blen+nB,angT); + posBe:=sfrt(posBs,nA*blen+nB,angT); fi posA[cntA+1]:=posBe; f_term:=0; else: @@ -1127,59 +1108,58 @@ enddef; %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% def draw_atom(expr NUM)= begingroup - save slen,f_wd,f_ht,r_ff,pA,pB,bA,sA,sB,dx; - string sA,sB; - pair pA,pB; - picture bA; - %---------------------------------------------------------------------------------------------- - sA:=strD[numS[NUM]]; slen:=length(sA)-1; - nA:=angX[NUM]; - dxA[NUM]:=dx:=iif((nA<=90)or(nA>=270),1,-1); - wdA[NUM]:=nC:=0; pB:=(0,0); - pA:=posA[NUM]-(.5atom_wd*dx,.5atom_wd); - if (atomfont<>"draw")and(f_MP=1): - bA:="C" infont atomfont; - r_ff:=atom_wd/(ypart(ulcorner bA)-ypart(llcorner bA)); - fi - for i=0 upto slen: - if nC=0: - sB:=pic_c(i,sA); - if (dx=-1)and(sB="{"): - nD:=i+1; nC:=0; for j=nD upto slen: nC:=nC+1; exitif pic_c(j,sA)="}"; endfor - fi - else: nC:=nC-1; sB:=pic_c(nD+nC,sA); + if numS[NUM]<>0: + save slen,f_wd,f_ht,r_ff,pA,pB,sA,sB,dx; + string sA,sB; + pair pA,pB; + %------------------------------------------------------- + sA:=strD[numS[NUM]]; slen:=length(sA)-1; nA:=angX[NUM]; + dxA[NUM]:=dx:=iif((nA<=90)or(nA>=270),1,-1); + wdA[NUM]:=nC:=0; pB:=(0,0); + pA:=posA[NUM]-(.5atom_wd*dx,.5atom_wd); + if (atomfont<>"draw")and(f_MP=1): + atom_picture:="C" infont atomfont; + r_ff:=atom_wd/(ypart(ulcorner atom_picture)-ypart(llcorner atom_picture)); fi - if sB="_": pB:=iif(pB=(0,0),(0,-.5atom_wd),(0,0)); - elseif sB="^": pB:=iif(pB=(0,0),(0, .5atom_wd),(0,0)); - elseif (sB<>"{")and(sB<>"}"): - if (atomfont<>"draw")and(f_MP=1): - bA:=sB infont atomfont; - f_wd:=(xpart(lrcorner bA)-xpart(llcorner bA))*r_ff; - f_ht:=(ypart(urcorner bA)-ypart(llcorner bA))*r_ff; - if dx=-1: pA:=pA-(f_wd,0); fi - addto currentpicture also bA scaled (r_ff*(1-2ratio_atomgap_atom)) - shifted (pA+pB+(f_wd*ratio_atomgap_atom,f_ht*ratio_atomgap_atom)) Cp(colorA[NUM]); - if sw_aframe=1: draw_frame(pA+pB,f_wd,f_ht,thickness_aframe); fi - if dx=1: pA:=pA+(f_wd,0); fi - else: - f_wd:=atom_wd*tbl_char_wd[ASCII(sB)]; - if dx=-1: pA:=pA-(f_wd,0); fi - draw_char(sB,pA+pB,atom_wd,bond_pen_wd*ratio_char_bond,NUM); - if sw_aframe=1: draw_frame(pA+pB,f_wd,atom_wd,thickness_aframe); fi - if dx=1: pA:=pA+(f_wd,0); fi + for i=0 upto slen: + if nC=0: + sB:=subc(i,sA); + if (dx=-1)and(sB="{"): + nD:=i+1; nC:=0; for j=nD upto slen: nC:=nC+1; exitif subc(j,sA)="}"; endfor + fi + else: nC:=nC-1; sB:=subc(nD+nC,sA); fi - wdA[NUM]:=wdA[NUM]+f_wd; - fi - endfor + if sB="_": pB:=iif(pB=(0,0),(0,-.5atom_wd),(0,0)); + elseif sB="^": pB:=iif(pB=(0,0),(0, .5atom_wd),(0,0)); + elseif (sB<>"{")and(sB<>"}"): + if (atomfont<>"draw")and(f_MP=1): + atom_picture:=sB infont atomfont; + f_wd:=(xpart(lrcorner atom_picture)-xpart(llcorner atom_picture))*r_ff; + f_ht:=(ypart(urcorner atom_picture)-ypart(llcorner atom_picture))*r_ff; + if dx=-1: pA:=pA-(f_wd,0); fi + addto currentpicture also atom_picture scaled (r_ff*(1-2ratio_atomgap_atom)) + shifted (pA+pB+(f_wd*ratio_atomgap_atom,f_ht*ratio_atomgap_atom)) Cp(colorA[NUM]); + if sw_aframe=1: draw_frame(pA+pB,f_wd,f_ht,thickness_aframe); fi + if dx=1: pA:=pA+(f_wd,0); fi + else: + f_wd:=atom_wd*tbl_char_wd[ASCII(sB)]; + if dx=-1: pA:=pA-(f_wd,0); fi + draw_char(sB,pA+pB,atom_wd,bond_pen_wd*ratio_char_bond,NUM); + if sw_aframe=1: draw_frame(pA+pB,f_wd,atom_wd,thickness_aframe); fi + if dx=1: pA:=pA+(f_wd,0); fi + fi + wdA[NUM]:=wdA[NUM]+f_wd; + fi + endfor + fi endgroup enddef; %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% def draw_bond(expr NUM)= begingroup - save ww,ap,am,ang,col,len,Ls,Le,nL,nS,nE,pA,zA,zL,wpcs; + save ww,ap,am,ang,col,len,Ls,Le,pA,zA,zL; pair pA,Ls,Le; path zA,zL; - def wpcs expr n= withpen pencircle scaled n enddef; %----------------------------------------------------------------------------------------------- nL:=lineB[NUM]; ang:=angB[NUM]; nS:=sB[NUM]; nE:=eB[NUM]; col:=colorB[NUM]; zL:=posA[nS]--posA[nE]; ww:=wedge_wd; ap:=ang+90; am:=ang-90; @@ -1194,32 +1174,32 @@ def draw_bond(expr NUM)= %----------------------------------------------------------------------------------------------- pickup pencircle scaled bond_pen_wd; if (nL=si)or(sw_single=1): draw zA Cp(col); - ef nL=dl: draw zA Cp(col); draw sfB(subpath pA of zA,bondgap,ap) Cp(col); - ef nL=dr: draw zA Cp(col); draw sfB(subpath pA of zA,bondgap,am) Cp(col); - ef nL=dm: draw sfB(zA,bondgap/1.75,ap) Cp(col); draw sfB(zA,bondgap/1.75,am) Cp(col); + ef nL=dl: draw zA Cp(col); draw sfrt(subpath pA of zA,bondgap,ap) Cp(col); + ef nL=dr: draw zA Cp(col); draw sfrt(subpath pA of zA,bondgap,am) Cp(col); + ef nL=dm: draw sfrt(zA,bondgap/1.75,ap) Cp(col); draw sfrt(zA,bondgap/1.75,am) Cp(col); ef nL=db: nA:=iif(((ang-angX[nS]) mod 360)<=180,ap,am); - draw zA Cp(col); draw sfB(subpath pA of zA,bondgap,nA) Cp(col); - ef nL=tm: draw zA Cp(col);draw sfB(zA,bondgap,ap) Cp(col); draw sfB(zA,bondgap,am) Cp(col); - ef nL=wf: fill Ls--sfB(Le,ww,am)--sfB(Le,ww,ap)--cycle Cp(col); - ef nL=wb: fill sfB(Ls,ww,am)--Le--sfB(Ls,ww,ap)--cycle Cp(col); + draw zA Cp(col); draw sfrt(subpath pA of zA,bondgap,nA) Cp(col); + ef nL=tm: draw zA Cp(col);draw sfrt(zA,bondgap,ap) Cp(col); draw sfrt(zA,bondgap,am) Cp(col); + ef nL=wf: fill Ls--sfrt(Le,ww,am)--sfrt(Le,ww,ap)--cycle Cp(col); + ef nL=wb: fill sfrt(Ls,ww,am)--Le--sfrt(Ls,ww,ap)--cycle Cp(col); ef nL=bd: draw zA withpen penrazor rotated ap scaled bondgap Cp(col); - ef nL=bz: bz_put(sfB(Ls,ww,ap),sfB(Le,ww,ap),sfB(Ls,ww,am),sfB(Le,ww,am)); - ef nL=zf: wz_put(Ls,sfB(Le,ww,ap),sfB(Le,ww,am)); - ef nL=zb: wz_put(Le,sfB(Ls,ww,am),sfB(Ls,ww,ap)); + ef nL=bz: bz_put(sfrt(Ls,ww,ap),sfrt(Le,ww,ap),sfrt(Ls,ww,am),sfrt(Le,ww,am)); + ef nL=zf: wz_put(Ls,sfrt(Le,ww,ap),sfrt(Le,ww,am)); + ef nL=zb: wz_put(Le,sfrt(Ls,ww,am),sfrt(Ls,ww,ap)); ef nL=dt: for i=0 step .75zebra_gap/len until 1: drawdot i[Ls,Le] Cp(col); endfor ef nL=wv: nA:=3bond_pen_wd; nB:=len/nA; draw Le for i=1 upto nB: - ..controls(((i-.5)/nB)[sfB(Le,nA,iif(odd(i),ap,am)),sfB(Ls,nA,iif(odd(i),ap,am))]) + ..controls(((i-.5)/nB)[sfrt(Le,nA,iif(odd(i),ap,am)),sfrt(Ls,nA,iif(odd(i),ap,am))]) ..(i/nB)[Le,Ls] endfor ..Ls Cp(col); - ef nL=vf: draw zA Cp(col);draw sfB(Le,bondgap,ang-150)--Le--sfB(Le,bondgap,ang+150) Cp(col); - ef nL=vb: draw zA Cp(col);draw sfB(Ls,bondgap,ang-30)--Ls--sfB(Ls,bondgap,ang+30) Cp(col); + ef nL=vf: draw zA Cp(col);draw sfrt(Le,bondgap,ang-150)--Le--sfrt(Le,bondgap,ang+150) Cp(col); + ef nL=vb: draw zA Cp(col);draw sfrt(Ls,bondgap,ang-30)--Ls--sfrt(Ls,bondgap,ang+30) Cp(col); ef nL=si_: erase draw subpath (0.15,0.85) of zA wpcs 0.8bondgap; draw zA Cp(col); - ef nL=wf_: erase draw subpath (0.15,0.85) of (Ls--sfB(Le,ww,am)) wpcs 0.8bondgap; - erase draw subpath (0.15,0.85) of (Ls--sfB(Le,ww,ap)) wpcs 0.8bondgap; - fill Ls--sfB(Le,ww,am)--sfB(Le,ww,ap)--cycle Cp(col); - ef nL=wb_: erase draw subpath (0.15,0.85) of (sfB(Ls,ww,am)--Le) wpcs 0.8bondgap; - erase draw subpath (0.15,0.85) of (sfB(Ls,ww,ap)--Le) wpcs 0.8bondgap; - fill sfB(Ls,ww,am)--Le--sfB(Ls,ww,ap)--cycle Cp(col); + ef nL=wf_: erase draw subpath (0.15,0.85) of (Ls--sfrt(Le,ww,am)) wpcs 0.8bondgap; + erase draw subpath (0.15,0.85) of (Ls--sfrt(Le,ww,ap)) wpcs 0.8bondgap; + fill Ls--sfrt(Le,ww,am)--sfrt(Le,ww,ap)--cycle Cp(col); + ef nL=wb_: erase draw subpath (0.15,0.85) of (sfrt(Ls,ww,am)--Le) wpcs 0.8bondgap; + erase draw subpath (0.15,0.85) of (sfrt(Ls,ww,ap)--Le) wpcs 0.8bondgap; + fill sfrt(Ls,ww,am)--Le--sfrt(Ls,ww,ap)--cycle Cp(col); ef nL=bd_: erase draw subpath(0.15,0.85) of zA wpcs 1.6bondgap; draw zA withpen penrazor rotated ap scaled bondgap Cp(col); ef nL=nb: @@ -1243,41 +1223,76 @@ def bz_put(expr PA,PB,PC,PD)= enddef; %------------------------------------------------------------------------------------------------ vardef frame_str(expr NUM)= - save nA,nB; nA:=1.12atom_wd; nB:=wdA[NUM]+.12atom_wd; ((0,0)--(nB,0)--(nB,nA)--(0,nA)--cycle) shifted (posA[NUM]-(.5nA+iif((dxA[NUM]=-1)and(wdA[NUM]>atom_wd),nB-nA,0),.5nA)) enddef; %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -parts_usr:=parts_emb_start; +vardef STa(expr ATOM,WT,MI)= + str_cnt:=str_cnt+1; parts_cnt:=parts_cnt+1; tbl_cnt:=tbl_cnt+1; + comD[parts_cnt][1]:=_set_atom; parD[parts_cnt][1]:=str_cnt; cntD[parts_cnt]:=1; + strD[str_cnt]:=tbl_atom_str[tbl_cnt]:=ATOM; + tbl_atom[tbl_cnt]:=0; + tbl_atom_wt[tbl_cnt]:=WT; tbl_atom_mi[tbl_cnt]:=MI; + parts_cnt +enddef; +%------------------------------------------------------------------------------------------------- +vardef STb(expr ATOM)(text TXT)= + str_cnt:=str_cnt+1; parts_cnt:=parts_cnt+1; tbl_cnt:=tbl_cnt+1; + comD[parts_cnt][1]:=_set_atom; parD[parts_cnt][1]:=str_cnt; cntD[parts_cnt]:=1; + strD[str_cnt]:=tbl_atom_str[tbl_cnt]:=ATOM; + tbl_atom[tbl_cnt]:=0; + for list=TXT: + tbl_atom[tbl_cnt]:=tbl_atom[tbl_cnt]+1; + tbl_group[tbl_cnt][tbl_atom[tbl_cnt]]:=list-parts_emb_start; + endfor + parts_cnt +enddef; +%================================================================================================= +parts_int:=parts_emi_start; +parts_cnt:=parts_emb_start; +%================================================================================================= +C:= STa("C" ,12.0107, 12.0000000); H:= STa("H" , 1.00794, 1.00782503223); +Al:=STa("{Al}",26.9815, 26.98153853); As:=STa("{As}",74.9216, 74.92159457); +B:= STa("B" ,10.811, 11.00930536); Br:=STa("{Br}",79.904, 78.9183376); +Ca:=STa("{Ca}",40.078, 39.962590863); Cl:=STa("{Cl}",35.453, 34.968852); +Co:=STa("{Co}",58.933194, 58.93319429); Cr:=STa("{Cr}",51.9961, 51.94050623); +Cu:=STa("{Cu}",63.546, 62.92959772); D:= STa("D" ,2.012, 2.01410177812); +F:= STa("F" ,18.9984, 18.99840316273); Fe:=STa("{Fe}",55.845, 55.93493633); +Hg:=STa("{Hg}",200.59, 201.97064340); I:= STa("I" ,126.90447,126.9044719); +K:= STa("K" ,39.0983, 38.9637064864); Li:=STa("{Li}",6.941, 7.0160034366); +Mg:=STa("{Mg}",24.305, 23.985041697); Mn:=STa("{Mn}",54.938044, 54.93804391); +Na:=STa("{Na}",22.98977, 22.9897692820); Ni:=STa("{Ni}",58.693, 57.93534241); +N:= STa("N" ,14.0067, 14.00307400443); O:= STa("O" ,15.9994, 15.99491461957); +P:= STa("P" ,30.973762, 30.97376199842); S:= STa("S" ,32.065, 31.9720711744); +Se:=STa("{Se}",78.971, 79.9165218); Si:=STa("{Si}",28.0855, 27.97692653465); +Sn:=STa("{Sn}",118.71, 119.90220163); Ti:=STa("{Ti}",47.867, 47.94794198); +U:= STa("U", 238.0289, 238.05079); Zn:=STa("{Zn}",65.409, 63.92914201); +tbl_atom_end:=tbl_cnt; +%------------------------------------------------------------------------------------------------- +CH3:=STb("C{H_3_}")(C,H,H,H); CH2:=STb("C{H_3_}")(C,H,H); CN:=STb("CN")(C,N); OH:=STb("OH")(O,H); +CF3:=STb("C{F_3_}")(C,F,F,F); COOH:=STb("COOH")(C,O,O,H); SH:= STb("SH")(S,H); +CHO:= STb("CHO")(C,H,O); NO2:=STb("N{O_2_}")(N,O,O); NH2:=STb("N{H_2_}")(N,H,H); +H2:= STb("{H_2_}")(H,H); ONa:=STb("O{Na}")(O,Na); SO3:= STb("S{O_3_}")(S,O,O,O); %------------------------------------------------------------------------------------------------- +Br[-1]:=STb("{Br^-^}")(Br); Cl[-1]:=STb("{Cl^-^}")(Cl); +N[1]:= STb("{N^+^}")(N); N[-1]:= STb("{N^-^}")(N); +O[1]:= STb("{O^p^}")(O); O[-1]:= STb("{O^-^}")(O); +S[1]:= STb("{S^p^}")(S); S[-1]:= STb("{S^m^}")(S); +tbl_group_end:=tbl_cnt; +%================================================================================================= lr:='(60 for i==1 upto 10:: ,-60,60 endfor); rl:='(-60,lr); -for i=3 upto 20: ?[i]:='(|:,(_get_len,_ring_len),<((-180 DIV i)-90) - for j==2 upto i:: ,(360 DIV i) endfor,(_cyc_sB,1-i),:|); endfor -Ph:=Ph1:='(?6,(_dl,-2),(_dl,-4),(_dl,-6)); Ph2:='(?6,(_dl,-1),(_dl,-3),(_dl,-5)); +for i==3 upto 20: ?[i]:='(|<<,(_get_len,_ring_len),<((-180 DIV i)-90) + for j==2 upto i:: ,(360 DIV i) endfor,(_cyc_sB,1-i),>>|); endfor +Ph:=Ph1:='(?6,-2=dl,-4=dl,-6=dl); Ph2:='(?6,-1=dl,-3=dl,-5=dl); !:=!1:='((_mk_bond,_arg_ang)); !!:='(!~db); !!!:='(!~tm); -for i=2 upto 20: ![i]:='(|:,(_get_len,_tmp_len),! for j==2 upto i::,! endfor ,:|); endfor +for i==2 upto 20: ![i]:='(|<<,(_get_len,_tmp_len),! for j==2 upto i::,! endfor ,>>|); endfor Me:='(); Et:='(!); Pr:='(!,!); Bu:='(!,!,!); for i=4,5,6: for j=2 upto i-2: ?[i][j]:='((_fuse,i),(j,0)); endfor endfor for i=5,6,7,8: for j=11 upto 15: ?[i][j]:='((_fuse,i),(j,0)); endfor endfor -%================================================================================================= -H :='("H");C:='("C");N:='("N");O:='("O");S:='("S");P:='("P");F:='("F");I:='("I"); K:='("K"); -Si:='("{Si}");Al:='("{Al}");Mg:='("{Mg}");Zn:='("{Zn}");As:='("{As}");Co:='("{Co}");Cu:='("{Cu}"); -Ag:='("{Ag}");Au:='("{Au}");Sn:='("{Sn}");Cl:='("{Cl}");Br:='("{Br}");Li:='("{Li}");Cr:='("{Cr}"); -Na:='("{Na}");Ca:='("{Ca}");Hg:='("{Hg}");Ni:='("{Ni}");Ti:='("{Ti}");U:='("U"); -B:='("B");D:='("D");Fe:='("{Fe}");Mn:='("{Mn}");Se:='("{Se}"); -H[1]:= '("{H^+^}"); H[-1]:='("{H^-^}"); C[1]:='("{C^+^}"); C[-1]:='("{C^-^}"); -O[1]:= '("{O^+^}"); O[-1]:='("{O^-^}"); N[1]:='("{N^+^}"); N[-1]:='("{N^-^}"); -S[1]:= '("{S^+^}"); S[-1]:='("{S^-^}"); P[1]:='("{P^+^}"); P[-1]:='("{P^-^}"); -Li[1]:='("{Li^+^}"); Na[1]:='("{Na^+^}"); Cl[-1]:='("{Cl^-^}"); Br[-1]:='("{Br^-^}"); -%------------------------------------------------------------------------------------------------- -R:='("R"); R1:='("{R^1^}"); R2:='("{R^2^}"); R3:='("{R^3^}"); R4:='("R^4^"); R5:='("{R^5^}"); -R6:='("R6"); R7:='("{R^7^}"); R8:='("{R^8^}"); R9:='("{R^9^}"); R10:='("R^10^"); R11:='("{R^11^}"); -%------------------------------------------------------------------------------------------------- -CHO:='("CHO"); OH:='("OH"); COOH:='("COOH"); CH2:='("C{H_2_}"); CH3:='("C{H_3_}"); CN:='("CN"); -NH2:='("N{H_2_}"); NO2:='("N{O_2_}"); SH:='("SH"); SO3:='("S{O_3_}"); NH:='(N,/H~nl); %------------------------------------------------------------------------------------------------- -NMe:=N!:='(N,/_); iPr:=Me!:='(/_,60); tBu:='(/_,/_^60,60); SO:='(S,//O); SOO:='(S,//O^-35,//O^35); +NH:='(N,/H~nl); NMe:=N!:='(N,/_); iPr:=Me!:='(/_,60); tBu:='(/_,/_^60,60); +SO:='(S,//O); SOO:='(S,//O^-35,//O^35); OMe:=O!:='(O,!); OEt:=O!2:='(O,!,!); OPr:=O!3:='(O,!,!,!); OiPr:=OMe!:='(O,!,iPr); SMe:=S!:='(S,!); SEt:=S!2:='(S,!,!); SPr:=S!3:='(S,!,!,!); SiPr:=SMe!:='(S,!,iPr); %------------------------------------------------------------------------------------------------- @@ -1285,8 +1300,6 @@ COO:='(//O,!,O); COOMe:=COO!:='(COO,!); COOEt:=COO!2:='(COO,!,!); COOiPr:=COOMe! COOPr:=COO!3:='(COO,!,!,!); COOtBu:='(COO,!,tBu); COMe:=CO!:='(//O,!); COEt:=CO!2:='(//O,!,!); COPr:=CO!3:='(//O,!,!,!); OCOMe:=OCO!:='(O,!,//O,!); NMeMe:=NMe!:=N!_:='(N!,!); NMeEt:=NMe!2:=N!2_:='(N!,!,!); -NMePr:=NMe!3:='(N!,!,!,!); -NHCOMe:=NHCO!:='(NH,!,//O,!); NHiPr:=NHMe!:='(NH,!,iPr); NHtBu:='(NH,!,tBu); NHMe:=NH!:='(NH,!); NHEt:=NH!2:='(NH,!,!); NHPr:=NH!3:='(NH,!,!,!); %------------------------------------------------------------------------------------------------- !OH:='(!,OH); !SH:='(!,SH); !NH2:='(!,NH2); @@ -1294,11 +1307,7 @@ NHMe:=NH!:='(NH,!); NHEt:=NH!2:='(NH,!,!); NHPr:=NH!3:='(NH,!,!,!); !OMe:=!O!:='(!,O!); !OEt:=!O!2:='(!,O!2); !OPr:=!O!3:='(!,O!3); !OiPr:=!OMe!:='(!,OMe!); !SMe:=!S!:='(!,S!); !SEt:=!S!2:='(!,S!2); !SPr:=!S!3:='(!,S!3); !SiPr:=!SMe!:='(!,SMe!); !NHMe:=!NH!:='(!,NH!); !NHEt:=!NH!2:='(!,NH!2); !NHPr:=!NH!3:='(!,NH!3); -!NHiPr:=!NHMe!:='(!,NHMe!); !COOH:='(!,COOH); !COOMe:=!COO!:='(!,COO!); !COOEt:=!COO!2:='(!,COO!2); -!COOPr:=!COO!3:='(!,COO!3); -!COOtBu:='(!,COOtBu); !OCOMe:=!OCO!:='(!,OCO!); !NMeMe:=!NMe!:='(!,NMe!); -!NMeEt:=!NMe!2:='(!,NMe!2); !NMePr:=!NMe!3:='(!,NMe!3); !CH3:='(!,CH3); !CN:='(!,CN); !iPr:=!Me!:='(!,iPr); !tBu:='(!,tBu); !CHO:='(!,CHO); !NO2:='(!,NO2); !Cl:='(!,Cl); !Br:='(!,Br); !F:='(!,F); !?3:='(!,?3); !?4:='(!,?4); !?5:='(!,?5); !?6:='(!,?6); !?7:='(!,?7); !?8:='(!,?8); !Ph:='(!,Ph); @@ -1310,13 +1319,16 @@ NHMe:=NH!:='(NH,!); NHEt:=NH!2:='(NH,!,!); NHPr:=NH!3:='(NH,!,!,!); CF2:='(/F,60,F); CCl2:='(/Cl,60,Cl); CBr2:='(/Br,60,Br); CF3:='(/F,/F^60,60,F); CCl3:='(/Cl,/Cl^60,60,Cl); CBr3:='(/Br,/Br^60,60,Br); %------------------------------------------------------------------------------------------------- +R:='("R"); R1:='("{R^1^}"); R2:='("{R^2^}"); R3:='("{R^3^}"); R4:='("R^4^"); R5:='("{R^5^}"); +R6:='("R6"); R7:='("{R^7^}"); R8:='("{R^8^}"); R9:='("{R^9^}"); R10:='("R^10^"); R11:='("{R^11^}"); +%------------------------------------------------------------------------------------------------- xCH3:='(/H,/H^60,60,H); xNH:='(N,/H); xNH2:='(N,/H,60,H); xNO2:='(N,//O,60~dm,O); xOH:='(O,!,H); xCHO:='(//O,!,H); xCOOH:='(//O,!,O,!,H); xCN:='(!~tm,N); xSH:='(S,!,H); %================================================================================================= init_par(parameter_list); %------------------------------------------------------------------------------------------------- -parts_emb_end:=parts_usr; -%%%%% message "parts_emb =" & decimal(parts_emb_start) &" => " & decimal(parts_emb_end); +%%message "parts_emb =" & decimal(parts_emb_start) &" => " & decimal(parts_cnt); +%%message "parts_emi =" & decimal(parts_emi_start) &" => " & decimal(parts_int); %------------------------------------------------------------------------------------------------- def expand_set= CH3:=xCH3; NH:=xNH; NH2:=xNH2; NO2:=xNO2; OH:=xOH; CHO:=xCHO; COOH:=xCOOH; CN:=xCN; SH:=xSH; @@ -1327,7 +1339,7 @@ enddef; %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% def char_size_set(expr WD)(expr HT)(expr STR)= for j=0 upto length(STR)-1: - nA:=ASCII(pic_c(j,STR)); tbl_char_wd[nA]:=WD; tbl_char_ht[nA]:=HT; + nA:=ASCII(subc(j,STR)); tbl_char_wd[nA]:=WD; tbl_char_ht[nA]:=HT; endfor enddef; %------------------------------------------------------------------------------------------------- @@ -1349,13 +1361,11 @@ char_size_set( .4)( 1)(".,:;'`^"); %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% def draw_char(expr CHR,POS,WD,PEN,NUM)= begingroup -save Z,aW,aH,fW,fH,hW,hW,hH,fP,hP,zO,zOh,pos,dw,dwh,dwv,cdw,ppcs,sbp,sC; +save Z,aW,aH,fW,fH,hW,hW,hH,fP,hP,zO,zOh,pos,dw,dwh,dwv,cdw,sC; path zO,zOh,zOa; string sC; pair Z[],pos; %------------------------------------------------------------------------------------------------- -def ppcs expr n= pickup pencircle scaled n enddef; -def sbp(expr m,n)expr p=subpath(m*length(p),n*length(p)) of p enddef; def dw expr p = draw (p) shifted pos Cp(colorA[NUM]) enddef; def dwv expr p = draw (p) withpen penrazor scaled fP shifted pos Cp(colorA[NUM]) enddef; def dwvs (expr n)expr p= @@ -1363,15 +1373,17 @@ def dwvs (expr n)expr p= def dwh expr p=draw (p) withpen penrazor rotated 90 scaled fP shifted pos Cp(colorA[NUM]) enddef; def cdw expr p=cutdraw (p) shifted pos Cp(colorA[NUM]) enddef; %------------------------------------------------------------------------------------------------- -sC:=CHR; fP:=PEN; hP:=0.5fP; -aW:=WD*tbl_char_wd[ASCII(sC)]*(1-2ratio_atomgap_atom); -aH:=WD*tbl_char_ht[ASCII(sC)]*(1-2ratio_atomgap_atom); -pos:=POS+(WD*ratio_atomgap_atom,WD*ratio_atomgap_atom); +sC:=CHR; fP:=PEN; hP:=0.5fP; nW:=WD; +aW:=nW*tbl_char_wd[ASCII(sC)]*(1-2ratio_atomgap_atom); +aH:=nW*tbl_char_ht[ASCII(sC)]*(1-2ratio_atomgap_atom); +pos:=POS+(nW*ratio_atomgap_atom,nW*ratio_atomgap_atom); +%------------------------------------------------------------------------------------------------- fW:=aW-hP; hW:=.5aW; fH:=aH-hP; hH:=.5aH; Z01:=( 0,hP); Z02:=(hP, 0); Z03:=(hP,hP); Z04:=(aW,hP); Z05:=(fW, 0); Z06:=(hW,aH); Z07:=(hW, 0); Z08:=( 0,hH); Z09:=(hP,hH); Z10:=(fW,hH); Z11:=(hW,aW); Z12:=( 0,fH); Z13:=(hP,fH); Z14:=(hW,fH); Z15:=(fW,aH); Z16:=(aW,fH); Z17:=(aW,hH); Z18:=(hP,aH); Z19:=(hW,hP); Z20:=(hW,hH); Z21:=(fW,hP); Z22:=(fW,fH); Z23:=(hW,fW); +%------------------------------------------------------------------------------------------------- zO:=Z10..(.8aW,fH-.5hP)..tension 1.5..(.2aW,fH-.5hP)..Z09.. (.2aW,1.5hP)..tension 1.5..(.8aW,1.5hP)..cycle; zOh:=(hP,.25aH)..Z19..(fW,.25aH)..Z20..cycle; @@ -1490,77 +1502,26 @@ vardef fdr(expr n)(expr s)=fixed_r(n)(decimal(s)) enddef; vardef fdl(expr n)(expr s)=fixed_l(n)(decimal(s)) enddef; def warning(expr s)= message "% "&decimal(char_num)&fdr(3)(incr warning_cnt)&")"&s; enddef; %------------------------------------------------------------------------------------------------- -def bond_check(expr a)(text s)= - nF:=0; for list=s: if list=bond_cnt: nF:=1; fi endfor - if nF=0: - warning("A"&decimal(a)&" ( "&fixed_l(8)(strD[numS[a]])&") has"&fdr(2)(bond_cnt)&" bonds"); - fi +def warning_bond(expr a)= + warning("A"&decimal(a)&" ( "&fixed_l(8)(strD[numS[a]])&") has"&fdr(2)(bond_cnt)&" bonds"); enddef; %------------------------------------------------------------------------------------------------- -vardef stripP(expr ATOM)= +vardef cut_paren(expr ATOM)= if length(ATOM)=4: substring (1,3) of ATOM elseif length(ATOM)=6: substring (1,2) of ATOM else: ATOM fi enddef; %================================================================================================= -def STa(expr ATOM,WT,MI)= - tbl_cnt:=tbl_cnt+1; - tbl_atom_str[tbl_cnt]:=ATOM; - tbl_atom[tbl_cnt]:=0; - tbl_atom_wt[tbl_cnt]:=WT; - tbl_atom_mi[tbl_cnt]:=MI; -enddef; -%---------------------------------------------------------------------------------- -def STb(expr ATOM)(text TXT)= - tbl_cnt:=tbl_cnt+1; - tbl_atom_str[tbl_cnt]:=ATOM; - tbl_atom[tbl_cnt]:=0; - for list=TXT: - tbl_atom[tbl_cnt]:=tbl_atom[tbl_cnt]+1; - for j=1 upto tbl_cnt: - if list=tbl_atom_str[j]: tbl_group[tbl_cnt][tbl_atom[tbl_cnt]]:=j; fi - endfor - endfor -enddef; -%================================================================================================= -tbl_cnt:=0; -STa("C" ,12.0107, 12.0000000); STa("H" , 1.00794, 1.00782503223); -STa("{Al}",26.9815, 26.98153853); STa("{As}",74.9216, 74.92159457); -STa("B" ,10.811, 11.00930536); STa("{Br}",79.904, 78.9183376); -STa("{Ca}",40.078, 39.962590863); STa("{Cl}",35.453, 34.968852); -STa("{Co}",58.933194, 58.93319429); STa("{Cr}",51.9961, 51.94050623); -STa("{Cu}",63.546, 62.92959772); STa("D" ,2.012, 2.01410177812); -STa("F" ,18.9984, 18.99840316273); STa("{Fe}",55.845, 55.93493633); -STa("{Hg}",200.59, 201.97064340); STa("I" ,126.90447,126.9044719); -STa("K" ,39.0983, 38.9637064864); STa("{Li}",6.941, 7.0160034366); -STa("{Mg}",24.305, 23.985041697); STa("{Mn}",54.938044, 54.93804391); -STa("N" ,14.0067, 14.00307400443); STa("{N^+^}",14.0067, 14.00307400443); -STa("{N^-^}",14.0067, 14.00307400443); -STa("{Na}",22.98977, 22.9897692820); STa("{Ni}",58.693, 57.93534241); -STa("O" ,15.9994, 15.99491461957); STa("{O^-^}",15.9994, 15.99491461957); -STa("{O^p^}",15.9994, 15.99491461957); STa("P" ,30.973762, 30.97376199842); -STa("S" ,32.065, 31.9720711744); STa("{S^p^}",32.065, 31.9720711744); -STa("{S^m^}",32.065, 31.9720711744); -STa("{Se}",78.971, 79.9165218); STa("{Si}",28.0855, 27.97692653465); -STa("{Sn}",118.71, 119.90220163); STa("{Ti}",47.867, 47.94794198); -STa("{Zn}",65.409, 63.92914201); -%------------------------------------------------------------------------------------------------- -STb("{H_2_}")("H","H"); STb("OH")("O","H"); STb("O{Na}")("O","{Na}"); STb("CN")("C","N"); -STb("SH")("S","H"); STb("CHO")("C","H","O"); STb("N{O_2_}")("N","O","O"); -STb("N{H_2_}")("N","H","H"); STb("S{O_3_}")("S","O","O","O"); STb("COOH")("C","O","O","H"); -STb("C{H_3_}")("C","H","H","H"); STb("C{F_3_}")("C","F","F","F"); -%================================================================================================= def proc_calc= begingroup save warning_cnt,MWp,knownA,bondC,tmp_wtp,bond_cnt,cnt_hide_H; - numeric sumA[],bondC[],hideH[]; - string sumA; - cnt_hide_H:=warning_cnt:=num_MW:=num_MI:=MWp:=0; - %------------------------------------------------------------------------------------------ - for i=1 upto tbl_cnt: sumA[i]:=0; endfor + cnt_hide_H:=warning_cnt:=num_MW:=num_MI:=MWp:=tbl_atom_max:=0; + nE:=parts_emb_start; + for i=1 upto tbl_atom_end: sumA[i]:=0; endfor for i=1 upto cntA: knownA:=bond_cnt:=0; + nS:=numS[i]; for j=1 upto cntB: if (lineB[j]>=dl)and(lineB[j]<=dm): bondC[j]:=2; ef lineB[j]=tm: bondC[j]:=3; @@ -1570,33 +1531,42 @@ def proc_calc= if (sB[j]=i)or(eB[j]=i): bond_cnt:=bond_cnt+bondC[j]; fi endfor Bcnt[i]:=bond_cnt; - if numS[i]=0: strD[numS[i]]:="C"; fi - if (strD[numS[i]]="C")and(bond_cnt<4): + if ((nS=0)or(nS=(C-nE)))and(bond_cnt<4): hideH[i]:=4-bond_cnt; cnt_hide_H:=cnt_hide_H+hideH[i]; else: hideH[i]:=0; fi - if strD[numS[i]]="C": bond_check(i)(1,2,3,4); - ef strD[numS[i]]="N": bond_check(i)(3,5); - ef strD[numS[i]]="H": bond_check(i)(1); - ef strD[numS[i]]="O": bond_check(i)(2); - ef strD[numS[i]]="S": bond_check(i)(2,4,6); - ef strD[numS[i]]="P": bond_check(i)(5); - ef strD[numS[i]]="OH": bond_check(i)(1); - ef strD[numS[i]]="COOH": bond_check(i)(1); - ef strD[numS[i]]="CN": bond_check(i)(1); - ef strD[numS[i]]="N{H_2_}": bond_check(i)(1); - ef strD[numS[i]]="F": bond_check(i)(1); - ef strD[numS[i]]="{Cl}": bond_check(i)(1); - ef strD[numS[i]]="{Br}": bond_check(i)(1); + if nS=0: if bond_cnt>4: warning_bond(i) fi + ef nS=(O-nE): if bond_cnt<>2: warning_bond(i) fi + ef nS=(N-nE): if (bond_cnt<>3)and(bond_cnt<>5): warning_bond(i) fi + ef nS=(S-nE): if (bond_cnt<>2)and(bond_cnt<>4)and(bond_cnt<>6): warning_bond(i) fi + ef nS=(H-nE): if bond_cnt<>1: warning_bond(i) fi + ef nS=(OH-nE): if bond_cnt<>1: warning_bond(i) fi + ef nS=(COOH-nE): if bond_cnt<>1: warning_bond(i) fi + ef nS=(NH2-nE): if bond_cnt<>1: warning_bond(i) fi + ef nS=(CN-nE): if bond_cnt<>1: warning_bond(i) fi + ef nS=(P-nE): if bond_cnt<>5: warning_bond(i) fi + ef nS=(C-nE): if bond_cnt>4: warning_bond(i) fi + ef nS=(F-nE): if bond_cnt<>1: warning_bond(i) fi + ef nS=(Cl-nE): if bond_cnt<>1: warning_bond(i) fi + ef nS=(Br-nE): if bond_cnt<>1: warning_bond(i) fi fi - for j=1 upto tbl_cnt: - if strD[numS[i]]=tbl_atom_str[j]: - if tbl_atom[j]=0: sumA[j]:=sumA[j]+1; - else: for k=1 upto tbl_atom[j]: sumA[tbl_group[j][k]]:=sumA[tbl_group[j][k]]+1; endfor fi - knownA:=1; fi endfor + for j=1 upto tbl_group_end: + if strD[nS]=tbl_atom_str[j]: + if tbl_atom[j]=0: sumA[j]:=sumA[j]+1; if j>tbl_atom_max: tbl_atom_max:=j; fi + else: + for k=1 upto tbl_atom[j]: + sumA[tbl_group[j][k]]:=sumA[tbl_group[j][k]]+1; + if tbl_group[j][k]>tbl_atom_max: tbl_atom_max:=tbl_group[j][k]; fi + endfor + fi + knownA:=1; + fi + exitif knownA=1; + endfor if knownA=0: warning(" Unknown Str("&strD[numS[i]]&") is used "&decimal(i)); fi endfor + %------------------------------------------------------------------------------------- sumA[2]:=sumA[2]+cnt_hide_H; - for i=1 upto tbl_cnt: + for i=1 upto tbl_atom_max: if sumA[i]>=1: nA:=tbl_atom_wt[i]/100*sumA[i]; MWp:=MWp+nA; @@ -1604,9 +1574,10 @@ def proc_calc= num_MW:= num_MW+tbl_atom_wt[i]*sumA[i]; num_MI:= num_MI+tbl_atom_mi[i]*sumA[i]; fi - cal_FM:=cal_FM&stripP(tbl_atom_str[i]) if sumA[i]>=2: &decimal(sumA[i]) fi; + cal_FM:=cal_FM&cut_paren(tbl_atom_str[i]) if sumA[i]>=2: &decimal(sumA[i]) fi; fi endfor + %------------------------------------------------------------------------------------- cal_MI:=substring (0,10) of decimal(num_MI); cal_MW:=substring (0,8) of decimal(num_MW); if sw_aux_out>=1: proc_auxfile_out; fi @@ -1626,28 +1597,29 @@ def proc_auxfile_out= for i=1 upto aux_max: exitif tag[i]=""; if i=1: printf "" else: &aux_delimiter fi if (sw_aux_out=1)or(sw_aux_out=3): &tag[i]&":" fi - if tag[i]="F": & jobname - elseif tag[i]="C": & decimal(char_num) - elseif tag[i]="mw": & cal_MW - elseif tag[i]="fm": & cal_FM - elseif tag[i]="mi": & cal_MI - elseif tag[i]="w": & decimal(xpart(fsize)) - elseif tag[i]="h": & decimal(ypart(fsize)) - elseif tag[i]="w1": & decimal(mol_wd) - elseif tag[i]="h1": & decimal(mol_ht) - elseif tag[i]="An": & decimal(cntA) - elseif tag[i]="Bn": & decimal(cntB) %------------------------------------------- - elseif tag[i]="NO": & inf_NO - elseif tag[i]="EN": & inf_EN - elseif tag[i]="JN": & inf_JN - elseif tag[i]="MW": & inf_MW - elseif tag[i]="MI": & inf_MI - elseif tag[i]="FM": & inf_FM - elseif tag[i]="CAS": & inf_CAS - elseif tag[i]="USE": & inf_USE - elseif tag[i]="EXA": & inf_EXA - elseif tag[i]="EXB": & inf_EXB + if tag[i]="F": & jobname + ef tag[i]="C": & decimal(char_num) + ef tag[i]="mw": & cal_MW + ef tag[i]="fm": & cal_FM + ef tag[i]="mi": & cal_MI + ef tag[i]="w": & decimal(xpart(fsize)) + ef tag[i]="h": & decimal(ypart(fsize)) + ef tag[i]="w1": & decimal(mol_wd) + ef tag[i]="h1": & decimal(mol_ht) + ef tag[i]="An": & decimal(cntA) + ef tag[i]="Bn": & decimal(cntB) + %------------------------------------------- + ef tag[i]="NO": & inf_NO + ef tag[i]="EN": & inf_EN + ef tag[i]="JN": & inf_JN + ef tag[i]="MW": & inf_MW + ef tag[i]="MI": & inf_MI + ef tag[i]="FM": & inf_FM + ef tag[i]="CAS": & inf_CAS + ef tag[i]="USE": & inf_USE + ef tag[i]="EXA": & inf_EXA + ef tag[i]="EXB": & inf_EXB fi endfor if sw_aux_out=3: for i=1 upto inf_num: &aux_delimiter&info[i] endfor; fi @@ -1663,7 +1635,7 @@ def proc_report_out= out_file_name:=out_file_rep; printf "------------------------------------------------------------------"; printf " Molecular name = "& inf_EN; - printf " Warnings = "&fdr(3)(warning_cnt)&" / Expanded command = "&decimal(cntD[1]); + printf " Warnings = "&fdr(3)(warning_cnt)&" / Command count= "&decimal(cntD[0]); printf " Width * Height = " & fdr(10)(mol_wd)&" * "&fdr(10)(mol_ht); printf " Shift width * height = "& fdr(10)(minX)&" * "&fdr(10)(minY); printf " Bond length = "&fdr(3)(blen)&" Atom size = "&fdr(3)(atom_wd); @@ -1694,11 +1666,11 @@ def proc_report_out= if MWp<=40: cal_MW_str:=cal_MW; cal_MI_str:=cal_MI; else: cal_MW_str:=fdr(10)(MWp)&" * 100"; cal_MI_str:=fdr(10)(MIp)&" * 100"; fi - for i=1 upto tbl_cnt: + for i=1 upto tbl_atom_max: if sumA[i]>=1: nA:=tbl_atom_wt[i]/100*sumA[i]; nB:=tbl_atom_mi[i]/100*sumA[i]; printf " "& - fixed_l(5)(stripP(tbl_atom_str[i]))& + fixed_l(5)(cut_paren(tbl_atom_str[i]))& "("&fdr(9)(tbl_atom_wt[i])&")"&"["&fdr(9)(tbl_atom_mi[i])&"]"& " * "&fdr(4)(sumA[i])&" = " if nA<40: &fdr(12)(tbl_atom_wt[i]*sumA[i])&"["&fdr(12)(tbl_atom_mi[i]*sumA[i])&"]"; @@ -1718,7 +1690,7 @@ enddef; %================================================================================================= def proc_mol_out= begingroup - save chg_cnt,chg_atm,chg_chg,nA,nB; + save chg_cnt,chg_atm,chg_chg; nA:=nB:=chg_cnt:=0; message "["&decimal(char_num)&"]:"&inf_EN; out_file_name:=out_file_mol; @@ -1735,7 +1707,7 @@ def proc_vdk= printf fdr(3)(cntA)&fdr(3)(cntB)&" 0 0 0 0 0 0 0 0999 V2000"; for i=1 upto cntA: printf fdr(10)(xpart(posA[i])/blen)& fdr(10)(ypart(posA[i])/blen)& - fdr(10)(0)&" "&fixed_l(2)(stripP(strD[numS[i]]))&" 0 0 0 0"; + fdr(10)(0)&" "&fixed_l(2)(cut_paren(strD[numS[i]]))&" 0 0 0 0"; if chargeA[i]<>0: chg_atm[incr chg_cnt]:=i; chg_chg[chg_cnt]:=chargeA[i]; fi endfor for i=1 upto cntB: @@ -1759,7 +1731,7 @@ def proc_vtk= printf "M V30 COUNTS "&decimal(cntA)&" "&decimal(cntB)&" 0 0 0"; printf "M V30 BEGIN ATOM"; for i=1 upto cntA: - printf "M V30 "&decimal(i)&" "&stripP(strD[numS[i]])&" "& + printf "M V30 "&decimal(i)&" "&cut_paren(strD[numS[i]])&" "& decimal(xpart(posA[i])/blen)&" "&decimal(ypart(posA[i])/blen)&" 0 0" if chargeA[i]<>0: &" CHG="&decimal(chargeA[i]) fi; endfor |