diff options
author | Norbert Preining <norbert@preining.info> | 2022-02-28 03:02:40 +0000 |
---|---|---|
committer | Norbert Preining <norbert@preining.info> | 2022-02-28 03:02:40 +0000 |
commit | 7a8d1925127ad121a8f591db931524f9b8eacb93 (patch) | |
tree | df5084184ea4d6732d6a9fae1d263b6915dbb36d /graphics/mcf2graph/mcf2graph.mp | |
parent | a911d39178540078c8ff5bc880418478d7433c40 (diff) |
CTAN sync 202202280302
Diffstat (limited to 'graphics/mcf2graph/mcf2graph.mp')
-rw-r--r-- | graphics/mcf2graph/mcf2graph.mp | 560 |
1 files changed, 233 insertions, 327 deletions
diff --git a/graphics/mcf2graph/mcf2graph.mp b/graphics/mcf2graph/mcf2graph.mp index b440e07e06..a34c4a9054 100644 --- a/graphics/mcf2graph/mcf2graph.mp +++ b/graphics/mcf2graph/mcf2graph.mp @@ -1,5 +1,5 @@ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -% mcf2graph ver 4.80 Copyright (c) 2013-2022 Akira Yamaji +% mcf2graph ver 4.81 Copyright (c) 2013-2022 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, @@ -33,18 +33,14 @@ % Set output MOL file (V3000) : mpost -s ahlength=6 FILENAME % Set output report : mpost -s ahlength=7 FILENAME %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -tracingstats:=1; -message "* This is mcf2graph ver 4.80 2022.02.20"; +message "* This is mcf2graph ver 4.81 2022.02.27"; +tracingstats:=1; prologues:=3; warningcheck:=0; %------------------------------------------------------------------------------------------------- -newinternal numeric nA,nB,nC,nD,nE,nF,nH,nN,nL,nR,nS,nU,nP,nW,nX,nY,mc_row; -newinternal string tempc,temps,blanks,aux_delimiter,atomfont,sC,sI,sS,sT,sV,cC,cH,cO,cN,cS,cF,cP, - file_input,file_output; -numeric save_num[],comD[][],parD[][],adrD[][],cntD[],tbl_atom[],tbl_group[][],tbl_atom_wt[], +numeric save_num[],parts_com[][],parts_par[][],parts_cnt[],tbl_atom[],tbl_group[][],tbl_atom_wt[], tbl_atom_mi[],tbl_char_wd[],tbl_char_ht[]; -string mc[],mc,save_str[],tbl_atom_str[],strD[],tag[],default_data_file,default_temp_file,mpfont; -pair save_pair[],msize,mposition,fsize,fmargin,dum,mpos; -picture mol_pic[]; -color color_list[]; +string save_str[],tbl_atom_str[],str_tbl[],tag[],aux_delimiter,default_data_file, + default_temp_file,mpfont,atomfont,tempc,temps,blanks; +pair save_pair[],msize,mposition,fsize,fmargin,dum,save_mposition; %------------------------------------------------------------------------------------------------- fig_num:=str_cnt:=tbl_cnt:=mangle:=sw_expand:=sw_frame:=sw_trimming:=sw_ext_all:=0; sw_abbreviate:=sw_numbering:=sw_output:=0; numbering_start:=1; numbering_end:=4095; @@ -60,7 +56,6 @@ a_ast:=ASCII("*"); a_sls:=ASCII("/"); a_gtn:=ASCII("<"); a_ltn:=ASCII(">"); a_an a_dol:=ASCII("$"); a_hsh:=ASCII("#"); a_hat:=ASCII("^"); a_tld:=ASCII("~"); a_bqt:=ASCII("`"); a_cln:=ASCII(":"); a_amk:=ASCII("@"); a_zero:=ASCII("0"); a_nine:=ASCII("9"); a_qut:=ASCII("'"); a_bar:=ASCII("|"); a_plus:=ASCII("+"); a_minus:=ASCII("-"); -cC:="C"; cH:="H"; cO:="O"; cN:="N"; cS:="S"; cF:="F"; cP:="P"; %------------------------------------------------------------------------------------------------- let DIV= /; let MUL= *; let LT= <; let GT= >; let AND= &; let :: = : ; let == = =; let ef=elseif; let ISP=intersectionpoint; def ]]]=] ] ] enddef; @@ -84,8 +79,6 @@ vardef fdl(expr n)(expr s)= fsl(n)(decimal(s)) enddef; def printf expr s= write s to file_output enddef; def warning(expr s)= message "% "&decimal(fig_num)&fdr(3)(incr warning_cnt)&")"&s; enddef; %================================================================================================= -prologues:=3; -warningcheck:=0; default_data_file:="mcf_data_base.mcf"; default_temp_file:="temp.mcf"; mpfont:="uhvr8r"; atomfont:="draw"; defaultfont:=mpfont; %--default ahangle=45--------------------------------------------------------------------- @@ -109,35 +102,25 @@ fi if bboxmargin=3: ext(defaultfont:=mpfont; defaultscale:=.3; label.rt(inf_EN,(0,0));) ef bboxmargin=4: sw_output:=Fig+Calc; ext(defaultfont:=mpfont; defaultscale:=.3; - label.rt(inf_EN&" / "&cal_MW&" / "&decimal(num_MW-scantokens(inf_MW)),(0,0));) -fi + label.rt(inf_EN&" / "&cal_MW&" / "&decimal(num_MW-scantokens(inf_MW)),(0,0));) fi %--default outputtemplate:="%j-%3c."&"mps"------------------------------------------------ if (outputformat="eps")and(ahangle<>3): outputtemplate:="%j-%3c."&"mps"; -else: outputtemplate:="%j-%3c."&outputformat; -fi +else: outputtemplate:="%j-%3c."&outputformat; fi %----------------------------------------------------------------------------------------- if sw_output>=Info: - message "* jobname="&jobname; - message "* numbersystem="&numbersystem; + message "* jobname="&jobname; message "* numbersystem="&numbersystem; if (ahlength=1)or(ahlength=2): - message "* output information file"; - message "* file name="&jobname&"-info.aux"; + message "* output information file"; message "* file name="&jobname&"-info.aux"; message "* info delimiter="&aux_delimiter; - ef ahlength=3: message "* output data-base file"; + ef ahlength=3: message "* output data-base file"; message "* data-base file name="&jobname&"-data.aux"; - ef ahlength=5: message "* output MOL file(V2000)"; - message "* "&jobname&"-nnn-"&"inf_EN"&".mol"; - ef ahlength=6: message "* output MOL file(V3000)"; - message "* "&jobname&"-nnn-"&"inf_EN"&".mol"; - ef ahlength=7: message "* output report file"; - message "* file name="&jobname&"-report.txt"; - fi + ef ahlength=5: message "* output MOL file(V2000)"; message "* "&jobname&"-nnn-"&"inf_EN"&".mol"; + ef ahlength=6: message "* output MOL file(V3000)"; message "* "&jobname&"-nnn-"&"inf_EN"&".mol"; + ef ahlength=7: message "* output report file"; message "* file name="&jobname&"-report.txt"; fi message "* outputformat="&outputformat; if outputformat="png": message "* hppp="&decimal(hppp)&"/vppp="&decimal(vppp); fi message "* outputtemplate="&outputtemplate; - message "* atomfont="&atomfont; - message "* defaultfont="&defaultfont; -fi + message "* atomfont="&atomfont; message "* defaultfont="&defaultfont; fi clearit; %-------------------------------------------------------------------------------------------------- ?3:=?20:=Ph:=Ph1:=Ph2:=hz:=0; vt:=1; @@ -149,10 +132,9 @@ offset_wedge:=0.4; thickness_frame:=0.2; max_blength:=10mm; blength:=mangle:=0; max_labelsize:=20mm; dottedline_gap:=1.5; %-------------------------------------------------------------------------------------------------- fsize:=(30mm,20mm); fmargin:=(0.4mm,0.4mm); msize:=(1,1); mposition:=(0.5,0.5); -%================================================================================================== -bboxmargin:=0; % 2bp => 0 +%=== bboxmargin:=0; % 2bp => 0 ==================================================================== ahangle:=45; ahlength:=4; defaultsize:=8; defaultscale:=1; labeloffset:=3; ext_defaultline:=0.5; -lonepairdiam:=lonepairspace:=circlediam:=circlepen:=0; +lonepairdiam:=lonepairspace:=circlediam:=circlepen:=bboxmargin:=0; %================================================================================================== parts_emb_start:=1000; % 1001 => 2000 for embedded parts (max 1900) parts_emi_start:=1900; % 1901 => 2000 for embedded internal parts (max 100) @@ -160,8 +142,9 @@ 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,_tmp_line, - _chg_len,_get_len,_ring_len,_tmp_len,_rot_ang,_adj_ang,_chg_env,_tmp_env,_set_colorA,_set_colorB, _group_si,_group_dm,_group_wf,_group_zf,_set_adr,_mk_bond,_set_atom,_arrange_ang,_chg_atom, +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,_group_dm,_group_wf,_group_zf,_set_adr,_mk_bond,_set_atom,_arrange_ang,_chg_atom, _tmp_rot,_fuse,_size_atom,_numeric,_jump_at,_set_add,_chg_add,_nop,_mark,_moff,_term,_len_s, _len_e,_len_ss,_len_ee,_group_s,_group_e,_rest,_charge,_from,_until, si,dl,dl_,dr,dr_,db,dm,dm_,tm,wf,wb,bd,bz,zf,zb,dt,wv,nl,vf,vb,nb,wf_r,wb_r,bd_r, @@ -179,52 +162,52 @@ enddef; %-------------------------------------------------------------------------------------------------- def init_par(text t)= nA:=nB:=nC:=0; - for list=t: - if numeric list: nA:=nA+1; save_num[nA]:=list; - ef pair list: nB:=nB+1; save_pair[nB]:=list; - ef string list: nC:=nC+1; save_str[nC]:=list; - fi + for list=t: if numeric list: nA:=nA+1; save_num[nA]:=list; + ef pair list: nB:=nB+1; save_pair[nB]:=list; + ef string list: nC:=nC+1; save_str[nC]:=list; fi endfor enddef; %-------------------------------------------------------------------------------------------------- def store_par(text t)= nA:=nB:=nC:=0; - for list=t: - if numeric list: nA:=nA+1; if save_num[nA]<>list: save_num[nA]:=list; fi - ef pair list: nB:=nB+1; if save_pair[nB]<>list: save_pair[nB]:=list; fi - ef string list: nC:=nC+1; if save_str[nC]<>list: save_str[nC]:=list; fi - fi + for list=t: if numeric list: nA:=nA+1; if save_num[nA]<>list: save_num[nA]:=list; fi + ef pair list: nB:=nB+1; if save_pair[nB]<>list: save_pair[nB]:=list; fi + ef string list: nC:=nC+1; if save_str[nC]<>list: save_str[nC]:=list; fi fi endfor enddef; %-------------------------------------------------------------------------------------------------- def restore_par(text t)= nA:=nB:=nC:=0; - forsuffixes list=t: - if numeric list: nA:=nA+1; if list<>save_num[nA]: list:=save_num[nA]; fi - ef pair list: nB:=nB+1; if list<>save_pair[nB]: list:=save_pair[nB]; fi - ef string list: nC:=nC+1; if list<>save_str[nC]: list:=save_str[nC]; fi - fi + forsuffixes list=t: if numeric list: nA:=nA+1; if list<>save_num[nA]: list:=save_num[nA]; fi + ef pair list: nB:=nB+1; if list<>save_pair[nB]: list:=save_pair[nB]; fi + ef string list: nC:=nC+1; if list<>save_str[nC]: list:=save_str[nC]; fi fi endfor enddef; %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% def beginfigm(text s)= begingroup - save ',f_ext,blen,ext,add,ang_br,fw_n,bw_n,at_colon,info_cnt,group_num,info_s,bond_cntA, - warning_cnt,hideH_cnt,filter_s,mc_indent,cntM,cntA,cntB,minX,minY,maxX,maxY,posA,posM,hideH, lineB,sB,eB,angB,angA,lenB,angX,numS,sumA,bond_num,wdM,htM,chargeA,addA,add_rot,cal_FM, - cal_MW,cal_MI,inf_Cat,inf_NO,inf_EN,inf_JN,inf_FM,inf_CAS,inf_USE,inf_EXA,inf_EXB,inf_MW; - numeric mc_indent[],hideH[],lineB[],sB[],eB[],angB[],angA[],lenB[],angX[],numS[],sumA[], - bond_num[],wdM[],htM[],chargeA[],addA[],add_rot[]; + save ',mc,f_ext,blen,ext,add,ang_br,fw_n,bw_n,at_colon,info_cnt,group_num,info_s,bond_cntA, + warning_cnt,hideH_cnt,filter_s,mc_indent,cntM,cntA,cntB,minX,minY,maxX,maxY,posA,posM, + hideH,lineB,sB,eB,angB,angA,lenB,angX,numS,sumA,bond_num,wdM,htM,chargeA,addA,add_rot, + file_input,file_output,cal_FM,cal_MW,cal_MI,inf_Cat,inf_NO,inf_EN,inf_JN,inf_FM,inf_CAS, + inf_USE,inf_EXA,inf_EXB,inf_MW,mol_pic,sC,sI,sS,sT,sV,color_list, + unit_cnt,f_end,semic_cnt,f_match,var_n,tag_a,var_a,at_semic; + numeric mc_indent[],hideH[],lineB[],sB[],eB[],angB[],angA[],lenB[],angX[],strA[],sumA[], + bond_num[],wdM[],htM[],chargeA[],addA[],add_rot[],at_semic[]; pair posA[],posM[][]; - string info_s[],filter_s,cal_FM,cal_MW,cal_MI,inf_Cat,inf_NO,inf_EN,inf_JN,inf_FM,inf_CAS, - inf_USE,inf_EXA,inf_EXB,inf_MW; + string info_s[],mc[],tag_a[],var_a[],mc,filter_s,file_input,file_output,cal_FM,cal_MW,cal_MI, + inf_Cat,inf_NO,inf_EN,inf_JN,inf_FM,inf_CAS,inf_USE,inf_EXA,inf_EXB,inf_MW, + sC,sI,sS,sT,sV; + picture mol_pic[]; + color color_list[]; %------------------------------------------------------------------------------------------------ - def ext=ext_to_fig enddef; def add=add_to_molecule enddef; def '=read_ud enddef; + let ext=ext_to_fig; let add=add_to_molecule; def '=read_ud enddef; %------------------------------------------------------------------------------------------------ inf_NO:=inf_EN:=inf_JN:=inf_MW:=inf_FM:=inf_CAS:=inf_Cat:=inf_EXA:=inf_EXB:="-"; mc:=temps:=cal_MW:=cal_MI:=cal_FM:=filter_s:=""; file_input:=default_data_file; %------------------------------------------------------------------------------------------------ - parts_cnt:=parts_usr_start; parts_int:=parts_int_start; + parts_num:=parts_usr_start; parts_int:=parts_int_start; %------------------------------------------------------------------------------------------------ store_par(parameter_list); fig_num:=fig_num+1; f_ext:=cntM:=mc_row:=info_cnt:=f_EOF:=0; @@ -242,9 +225,7 @@ def beginfigm(text s)= ef sT="t": temps:=sV; ef sT="v": pickup_data_unit(temps,sV,1); ef sT="v+": pickup_data_unit(temps,sV,0); - else: if known scantokens("inf_"&sT): scantokens("inf_"&sT):=sV; fi - fi - fi + else: if known scantokens("inf_"&sT): scantokens("inf_"&sT):=sV; fi fi fi endfor %------------------------------------------------------------------------------------------------ mol_pic[0]:=nullpicture; @@ -266,8 +247,7 @@ def endfigm= if ypart(posM[1][i])<nC: nC:=ypart(posM[1][i]); fi if ypart(posM[2][i])>nD: nD:=ypart(posM[2][i]); fi endfor - fig_wd:=nB-nA+2margin_lr; fig_ht:=nD-nC+2margin_tb; - fsize:=(fig_wd,fig_ht); + fig_wd:=nB-nA+2margin_lr; fig_ht:=nD-nC+2margin_tb; fsize:=(fig_wd,fig_ht); for i=1 upto cntM: posM[0][i]:=posM[0][i]+(margin_lr-nA,margin_tb-nC); posM[1][i]:=posM[1][i]+(margin_lr-nA,margin_tb-nC); @@ -305,7 +285,7 @@ def endfigm= if scan_bit(sw_output,MOL2k): proc_mol_out(1); fi if scan_bit(sw_output,MOL3k): proc_mol_out(2); fi %------------------------------------------------------------------------------------------- - %% message "* parts_cnt (0)="& decimal(parts_cnt) &" "& decimal(parts_usr-parts_usr_start); + %% message "* parts_num (0)="& decimal(parts_num) &" "& decimal(parts_usr-parts_usr_start); %% message "* parts_int (0)="& decimal(parts_int) &" "& decimal(parts_int-parts_int_start); %------------------------------------------------------------------------------------------- fi @@ -315,10 +295,6 @@ def endfigm= enddef; %------------------------------------------------------------------------------------------------- def pickup_data_unit(expr t,v,f)= - begingroup - save unit_cnt,f_end,semic_cnt,f_match,var_n,tag_a,var_a,at_semic; - string tag_a[],var_a[]; - numeric at_semic[]; f_end:=unit_cnt:=semic_cnt:=f_match:=inf_num:=0; if t="n": var_n:=scantokens(v); fi forever: @@ -332,8 +308,7 @@ def pickup_data_unit(expr t,v,f)= if sS=EOF: f_EOF:=1; fi exitif sS=EOF; exitif subc(1,sS)="+"; if subc(1,sS)<>"%": fw_n:=scan_char(" ",sS,1,1); mc_row:=mc_row+1; mc_indent[mc_row]:=fw_n-1; - mc[mc_row]:=substring(fw_n-1,length(sS)) of sS; mc:=mc&mc[mc_row]; - fi + mc[mc_row]:=substring(fw_n-1,length(sS)) of sS; mc:=mc&mc[mc_row]; fi endfor for i=1 upto inf_num: if known scantokens("inf_"&tag_a[i]): scantokens("inf_"&tag_a[i]):=var_a[i]; fi @@ -349,8 +324,7 @@ def pickup_data_unit(expr t,v,f)= semic_cnt:=split_semic(sS); inf_num:=semic_cnt+1; for i=1 upto inf_num: if i<=semic_cnt: sI:=substring(at_semic[i-1],at_semic[i]-1) of sS; - else: sI:=substring(at_semic[semic_cnt],length(sS)) of sS; - fi + else: sI:=substring(at_semic[semic_cnt],length(sS)) of sS; fi nA:=scan_char(":",sI,0,1); tag_a[i]:=substring(0,nA-1) of sI; var_a[i]:=substring(nA,length(sI)) of sI; if t=tag_a[i]: if v=var_a[i]: f_match:=1; fi fi @@ -359,7 +333,6 @@ def pickup_data_unit(expr t,v,f)= exitif f_end=1; endfor if f=1: closefrom file_input; fi - endgroup; enddef; %-------------------------------------------------------------------------------------------------- vardef scan_bit(expr n,b)= if b>=1: odd(floor(n/b)) else: odd(floor((frac n)/b)) fi enddef; @@ -368,14 +341,12 @@ vardef scan_char(expr c,s,d,n)= nN:=0; if d=0: for i=n upto length(s): if subc(i,s)=c: nN:=i; fi exitif nN>0; endfor ef d=1: for i=n upto length(s): if subc(i,s)<>c: nN:=i; fi exitif nN>0; endfor - ef d=-1: for i=length(s) downto n: if subc(i,s)<>c: nN:=i; fi exitif nN>0; endfor - fi - nN + ef d=-1: for i=length(s) downto n: if subc(i,s)<>c: nN:=i; fi exitif nN>0; endfor fi nN enddef; %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -vardef '(text t)= parts_cnt:=parts_cnt+1; read_mcf(parts_cnt)(t); parts_cnt enddef; -vardef read_id(text t)=read_mcf(incr parts_cnt)(|,#rate_cr,t,##,(_com,_rest)); parts_cnt enddef; -vardef read_ud(text t)=read_mcf(incr parts_cnt)(dum,dum,|,t,(_com,_rest)); parts_cnt enddef; +vardef '(text t)= parts_num:=parts_num+1; read_mcf(parts_num)(t); parts_num enddef; +vardef read_id(text t)=read_mcf(incr parts_num)(|,#rate_cr,t,##,(_com,_rest)); parts_num enddef; +vardef read_ud(text t)=read_mcf(incr parts_num)(dum,dum,|,t,(_com,_rest)); parts_num enddef; vardef abs_adress primary n = if n LT 0:: (n+360)-4095 else:: n-4095 fi enddef; primarydef a from_until b = (_from,a),(_until,b) enddef; tertiarydef a op_equ b = if (known a)and(known b):: change_bond(a,b) else:: _nop fi enddef; @@ -384,15 +355,14 @@ tertiarydef a op_hat b = if known b:: (_tmp_rot,b),a else:: _nop,a fi enddef; tertiarydef a op_til b = if known b:: (_tmp_line,b),a else:: _nop,a fi enddef; tertiarydef a op_lt b = if known b:: (_tmp_env,b),a else:: _nop,a fi enddef; tertiarydef a op_bq b = if known b:: (_tmp_len,b),a else:: _nop,a fi enddef; -def rot_angle primary n = (_rot_ang,n) enddef; -def cyc_atom primary n = (_cyc,n) enddef; +def rot_angle primary n = (_rot_ang,n) enddef; def cyc_atom primary n = (_cyc,n) enddef; def jump_atom_abs primary a = if numeric a:: (_jp_atom,$a) ef pair a:: (_jp_atom,$1),<$0,angle(a)~0`length(a),<$0 fi enddef; def jump_atom primary a = if numeric a:: (_jp_atom,a) ef pair a:: <$0,angle(a)~0`length(a),<$0 fi enddef; -def chg_length primary n = (_com,_len_s),(_chg_len,n) enddef; +def chg_length primary n = (_com,_len_s),(_chg_len,n) enddef; def group_si secondary n = if known n:: (_group_si,n) else:: _nop fi enddef; def group_dm secondary n = if known n:: (_group_dm,n) else:: _nop fi enddef; def group_wf secondary n = if known n:: (_group_wf,n) else:: _nop fi enddef; @@ -407,39 +377,34 @@ def read_mcf(expr n)(text t)= save nCP; if unknown inside_MC:: save /,//,/*,*/,**,*/*,~,^,',`,<,>,:,=,\,\\,*\,\*,*\*,@,@$,$,&,&$,#,##,{,},|,||,_,inside_MC; - pair |,||,##; - | :=(_com,_mark); || := (_com,_moff); ##:=(_com,_len_e); - _:=Me; \:=0; \\:=zero_dm; *\:=zero_wf; \*:=zero_zf; *\*:=zero_wv; - let = ==op_equ; let : == op_col; let ^ ==op_hat; let ~ ==op_til; let > ==op_lt; let ` ==op_bq; - def { == read_number( enddef; let } == ); - def @$ == jump_atom_abs enddef; def ' == read_id enddef; - def < == rot_angle enddef; def @ == jump_atom enddef; def & == cyc_atom enddef; - def # == chg_length enddef; def $ == abs_adress enddef; def &$ == &.$ enddef; - def / == group_si enddef; def // == group_dm enddef; def */ == group_wf enddef; - def /* == group_zf enddef; def */* == group_wv enddef; def ** == group_nb enddef; + | :=mark_adress; || :=reset_adress; ##:=reset_length; _:=Me; + \:=0; \\:=zero_dm; *\:=zero_wf; \*:=zero_zf; *\*:=zero_wv; + let = ==op_equ; let : ==op_col; let ^==op_hat; let ~==op_til; let > ==op_lt; let `==op_bq; + def $==abs_adress enddef; def &$==&.$ enddef; def '==read_id enddef; + def {==read_number( enddef; + let }==); let @$==jump_atom_abs; let < ==rot_angle; let @==jump_atom; let &==cyc_atom; + let #==chg_length; let /==group_si; let //==group_dm; let */==group_wf; let /*==group_zf; + let */*==group_wv; let **==group_nb; inside_MC:=1; fi %---------------------------------------------------------------------------------------------- nCP:=0; for list==t:: if known list:: - if pair list:: nCP:=nCP+1; comD[n][nCP]:=xpart(list); parD[n][nCP]:=ypart(list); + if pair list:: nCP:=nCP+1; parts_com[n][nCP]:=xpart(list); parts_par[n][nCP]:=ypart(list); ef numeric list:: if list==_nop:: message "unknown command in "AND decimal(n); ef 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]; + for i==1 upto parts_cnt[list]:: + nCP:=nCP+1; + parts_com[n][nCP]:=parts_com[list][i]; parts_par[n][nCP]:=parts_par[list][i]; endfor - else:: nCP:=nCP+1; comD[n][nCP]:=_mk_bond; parD[n][nCP]:=list; + else:: nCP:=nCP+1; parts_com[n][nCP]:=_mk_bond; parts_par[n][nCP]:=list; fi fi - ef string list:: - 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(n); fi endfor - cntD[n]:=nCP; + parts_cnt[n]:=nCP; endgroup enddef; %------------------------------------------------------------------------------------------------- @@ -451,21 +416,22 @@ vardef read_number(text t)= if known list:: if numeric list:: if list==_nop:: message "unknown command in "AND decimal(parts_int); - else:: nA:=nA+1; comD[parts_int][nA]:=_numeric; parD[parts_int][nA]:=list; + else:: nA:=nA+1; parts_com[parts_int][nA]:=_numeric; parts_par[parts_int][nA]:=list; fi ef pair list:: if xpart(list)==_from:: nB:=ypart(list); ef xpart(list)==_until:: nC:=ypart(list); for i==nB upto nC:: - nA:=nA+1; comD[parts_int][nA]:=_numeric; parD[parts_int][nA]:=i; + nA:=nA+1; parts_com[parts_int][nA]:=_numeric; parts_par[parts_int][nA]:=i; endfor - else:: nA:=nA+1; comD[parts_int][nA]:=xpart(list); parD[parts_int][nA]:=ypart(list); + else:: nA:=nA+1; + parts_com[parts_int][nA]:=xpart(list); parts_par[parts_int][nA]:=ypart(list); fi fi else:: message "unknown command in "AND decimal(parts_int); fi endfor - cntD[parts_int]:=nA; parts_int + parts_cnt[parts_int]:=nA; parts_int enddef; %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% def fuse_ring(expr a,b) = @@ -498,54 +464,54 @@ vardef change_bond(expr a,b) = if numeric b:: if (b>=si)and(b<=bd_):: if a>=parts_int_start:: - for i==1 upto cntD[a]:: - if comD[a][i]==_numeric:: - if frac parD[a][i]==0:: com_par(_set_adr,parD[a][i]) com_par(_set_line,b) - ef b==dl:: com_par(_set_adr,floor parD[a][i]) com_par(_set_line,dr) - ef b==dr:: com_par(_set_adr,floor parD[a][i]) com_par(_set_line,dl) - else:: com_par(_set_adr,floor parD[a][i]) com_par(_set_line,b) - fi - fi + for i==1 upto parts_cnt[a]:: + if parts_com[a][i]==_numeric:: + if frac parts_par[a][i]==0:: com_par(_set_adr,parts_par[a][i]) com_par(_set_line,b) + ef b==dl:: com_par(_set_adr,floor parts_par[a][i]) com_par(_set_line,dr) + ef b==dr:: com_par(_set_adr,floor parts_par[a][i]) com_par(_set_line,dl) + else:: com_par(_set_adr,floor parts_par[a][i]) com_par(_set_line,b) fi fi endfor else:: com_par(_set_adr,a) com_par(_set_line,b) fi elseif (b>=?3)and(b<=?8[15]):: if numeric a:: if a>=parts_int_start:: - for i==1 upto cntD[a]:: - if comD[a][i]==_numeric:: - if b==Ph1:: fuse_ring(parD[a][i],6) + for i==1 upto parts_cnt[a]:: + if parts_com[a][i]==_numeric:: + if b==Ph1:: fuse_ring(parts_par[a][i],6) CP(_set_adr,-2) CP(_set_line,dl) CP(_set_adr,-4) CP(_set_line,dl) - ef b==Ph2:: fuse_ring(parD[a][i],6) + ef b==Ph2:: fuse_ring(parts_par[a][i],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) ef (b>=?5[11])and(b<=?5[15]):: fuse_ring_size(a,5,b-?5[11]+11) ef (b>=?6[11])and(b<=?6[15]):: fuse_ring_size(a,6,b-?6[11]+11) ef (b>=?7[11])and(b<=?7[15]):: fuse_ring_size(a,7,b-?7[11]+11) ef (b>=?8[11])and(b<=?8[15]):: fuse_ring_size(a,8,b-?8[11]+11) - else:: fuse_ring(parD[a][i],b-?3+3) - fi + else:: fuse_ring(parts_par[a][i],b-?3+3) fi else:: if b==?6:: - if (frac comD[a][i]==0)and(frac parD[a][i]==0):: - fuse_ring_bonds((comD[a][i],parD[a][i]),6,4) - ef frac comD[a][i]==0:: fuse_ring_bonds((comD[a][i],floor parD[a][i]),6,3) - ef frac parD[a][i]==0:: fuse_ring_bonds((floor comD[a][i],parD[a][i]),6,3) - else:: fuse_ring_bonds((floor comD[a][i],floor parD[a][i]),6,2) - fi + if (frac parts_com[a][i]==0)and(frac parts_par[a][i]==0):: + fuse_ring_bonds((parts_com[a][i],parts_par[a][i]),6,4) + ef frac parts_com[a][i]==0:: + fuse_ring_bonds((parts_com[a][i],floor parts_par[a][i]),6,3) + ef frac parts_par[a][i]==0:: + fuse_ring_bonds((floor parts_com[a][i],parts_par[a][i]),6,3) + else:: fuse_ring_bonds((floor parts_com[a][i],floor parts_par[a][i]),6,2) fi ef b==?5:: - if (frac comD[a][i]==0)and(frac parD[a][i]==0):: - fuse_ring_bonds((comD[a][i],parD[a][i]),5,3) - ef frac comD[a][i]==0:: fuse_ring_bonds((comD[a][i],floor parD[a][i]),5,2) - ef frac parD[a][i]==0:: fuse_ring_bonds((floor comD[a][i],floor parD[a][i]),5,2) + if (frac parts_com[a][i]==0)and(frac parts_par[a][i]==0):: + fuse_ring_bonds((parts_com[a][i],parts_par[a][i]),5,3) + ef frac parts_com[a][i]==0:: + fuse_ring_bonds((parts_com[a][i],floor parts_par[a][i]),5,2) + ef frac parts_par[a][i]==0:: + fuse_ring_bonds((floor parts_com[a][i],floor parts_par[a][i]),5,2) fi - ef b==?4:: fuse_ring_bonds((comD[a][i],parD[a][i]),4,2) - ef b==?6[3]:: fuse_ring_bonds((comD[a][i],parD[a][i]),6,3) - ef b==?6[2]:: fuse_ring_bonds((comD[a][i],parD[a][i]),6,2) - ef b==?5[2]:: fuse_ring_bonds((comD[a][i],parD[a][i]),5,2) - ef b==Ph1:: fuse_ring_bonds((comD[a][i],parD[a][i]),6,4) + ef b==?4:: fuse_ring_bonds((parts_com[a][i],parts_par[a][i]),4,2) + ef b==?6[3]:: fuse_ring_bonds((parts_com[a][i],parts_par[a][i]),6,3) + ef b==?6[2]:: fuse_ring_bonds((parts_com[a][i],parts_par[a][i]),6,2) + ef b==?5[2]:: fuse_ring_bonds((parts_com[a][i],parts_par[a][i]),5,2) + ef b==Ph1:: fuse_ring_bonds((parts_com[a][i],parts_par[a][i]),6,4) CP(_set_adr,-1) CP(_set_line,dl) CP(_set_adr,-3) CP(_set_line,dl) - ef b==Ph2:: fuse_ring_bonds((comD[a][i],parD[a][i]),6,4) + ef b==Ph2:: fuse_ring_bonds((parts_com[a][i],parts_par[a][i]),6,4) CP(_set_adr,-2) CP(_set_line,dl) CP(_set_adr,-4) CP(_set_line,dl) fi fi @@ -559,9 +525,7 @@ vardef change_bond(expr a,b) = ef (b>=?6[11])and(b<=?6[15]):: fuse_ring_size(a,6,b-?6[11]+11) ef (b>=?7[11])and(b<=?7[15]):: fuse_ring_size(a,7,b-?7[11]+11) ef (b>=?8[11])and(b<=?8[15]):: fuse_ring_size(a,8,b-?8[11]+11) - else:: fuse_ring(a,b-?3+3) - fi - fi + else:: fuse_ring(a,b-?3+3) fi fi ef pair a:: if b==?6:: fuse_ring_bonds(a,6,4) ef b==?5:: fuse_ring_bonds(a,5,3) @@ -572,13 +536,11 @@ vardef change_bond(expr a,b) = ef b==Ph1:: fuse_ring_bonds(a,6,4) CP(_set_adr,-1) CP(_set_line,dl) CP(_set_adr,-3) CP(_set_line,dl) ef b==Ph2:: fuse_ring_bonds(a,6,4) - CP(_set_adr,-2) CP(_set_line,dl) CP(_set_adr,-4) CP(_set_line,dl) - fi + CP(_set_adr,-2) CP(_set_line,dl) CP(_set_adr,-4) CP(_set_line,dl) fi fi fi - elseif color b:: color_list[incr cntC]:=b; CPe(a)(_set_colorB,cntC) - fi - cntD[parts_int]:=nC; parts_int + elseif color b:: color_list[incr cntC]:=b; CPe(a)(_set_colorB,cntC) fi + parts_cnt[parts_int]:=nC; parts_int fi enddef; %------------------------------------------------------------------------------------------------- @@ -601,33 +563,33 @@ vardef change_atom(expr a,b)= ef pair b:: CP(_com,_group_s) if a>=parts_emb_start:: - for i==1 upto cntD[a]:: - if comD[a][i]==_numeric:: + for i==1 upto parts_cnt[a]:: + if parts_com[a][i]==_numeric:: if xpart(b)==_group_wf:: - if frac parD[a][i]==0:: CP(_set_adr,parD[a][i]) CP(_group_wf,ypart(b)) - else:: CP(_set_adr,floor parD[a][i]) CP(_group_zf,ypart(b)) fi + if frac parts_par[a][i]==0:: CP(_set_adr,parts_par[a][i]) CP(_group_wf,ypart(b)) + else:: CP(_set_adr,floor parts_par[a][i]) CP(_group_zf,ypart(b)) fi ef xpart(b)==_group_zf:: - if frac parD[a][i]==0:: CP(_set_adr,parD[a][i]) CP(_group_zf,ypart(b)) - else:: CP(_set_adr,floor parD[a][i]) CP(_group_wf,ypart(b)) fi - else:: CP(_set_adr,parD[a][i]) CP(xpart(b),ypart(b)) fi - else:: CP(comD[a][i],parD[a][i]) fi + if frac parts_par[a][i]==0:: CP(_set_adr,parts_par[a][i]) CP(_group_zf,ypart(b)) + else:: CP(_set_adr,floor parts_par[a][i]) CP(_group_wf,ypart(b)) fi + else:: CP(_set_adr,parts_par[a][i]) CP(xpart(b),ypart(b)) fi + else:: CP(parts_com[a][i],parts_par[a][i]) fi endfor else:: CP(_set_adr,a) CP(xpart(b),ypart(b)) fi CP(_com,_group_e) ef color b:: color_list[incr cntC]:=b; CPe(a)(_set_colorA,cntC) fi - cntD[parts_int]:=nC; parts_int + parts_cnt[parts_int]:=nC; parts_int fi enddef; %------------------------------------------------------------------------------------------------- -def com_par(expr a,b)= nC:=nC+1; comD[parts_int][nC]:=a; parD[parts_int][nC]:=b; enddef; +def com_par(expr a,b)= nC:=nC+1; parts_com[parts_int][nC]:=a; parts_par[parts_int][nC]:=b; enddef; %------------------------------------------------------------------------------------------------- def com_par_ex(expr f)(expr c)(expr a,b)= 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 + for i==1 upto parts_cnt[c]:: + if parts_com[c][i]==_numeric:: com_par(_set_adr,parts_par[c][i]) com_par(a,b) + ef f==1:: com_par(parts_com[c][i],parts_par[c][i]) fi endfor else:: com_par(_set_adr,c) com_par(a,b) fi @@ -691,22 +653,27 @@ vardef lone_pair_add expr n= image(draw (0,0) wpcs lonepairdiam; draw ((0,lonepairspace) rotated n) wpcs lonepairdiam;) enddef; %================================================================================================= -def MCat(expr w,h)(text t)= mpos:=mposition; mposition:=(w,h); MC(t) mposition:=mpos; enddef; +def MCat(expr w,h)(text t)= + save_mposition:=mposition; mposition:=(w,h); MC(t) mposition:=save_mposition; +enddef; %------------------------------------------------------------------------------------------------- def MC(text t)= begingroup - save f_bra,strAT,temp_lenE,temp_lenF,temp_cntB,f_term,f_at,f_lineT,f_rotT,angL,lenL,cpos,tpos, - f_lenT,f_envT,factor,m_wd,m_ht,raise_pos,slen,sdir,char_wd,char_ht,tcol,f_col,knownA, + save f_bra,temp_strA,temp_lenE,temp_lenF,temp_cntB,f_term,f_at,f_lineT,f_rotT,angL,lenL,cpos, + tpos,f_lenT,f_envT,factor,m_wd,m_ht,raise_pos,slen,sdir,char_wd,char_ht,tcol,f_col,knownA, markA,markB,saveA,saveB,bondL,lenT,lineT,angT,rotT,envT,envB,rate_cr,posBs,posBe, - f_char,group_par,group_cnt,group_com,colorA,colorB; - numeric f_char[],group_com[][],group_par[][],group_cnt[],colorA[],colorB[]; - pair cpos,tpos,raise_pos,posBs,posBe; - path frameA[]; + group_par,group_cnt,group_com,colorA,colorB,aW,aH,fW,fH,hW,hW,hH,qH,fP,hP, + ww,aw,ap,am,Ls,Le,pA,zA,zL,cC,cH,cO,cN,cS,cF,cP; + numeric group_com[][],group_par[][],group_cnt[],colorA[],colorB[]; + string cC,cH,cO,cN,cS,cF,cP; + pair cpos,tpos,raise_pos,posBs,posBe,pA,Ls,Le; + path frameA[],zA,zL; %----------------------------------------------------------------------------------------------- if (sw_expand=1)or(scan_bit(sw_output,MOL2k))or(scan_bit(sw_output,MOL3k)): expand_set; rate_cr:=1; else: rate_cr:=-ratio_chain_ring; fi - cntA:=cntB:=cntC:=group_num:=0; strD[0]:=cC; str_cnt:=2000; + cC:="C"; cH:="H"; cO:="O"; cN:="N"; cS:="S"; cF:="F"; cP:="P"; + cntA:=cntB:=cntC:=group_num:=0; str_tbl[0]:=cC; str_cnt:=2000; %----------------------------------------------------------------------------------------------- fig_wd:=xpart(fsize); fig_ht:=ypart(fsize); margin_lr:=xpart(fmargin); margin_tb:=ypart(fmargin); @@ -714,7 +681,6 @@ def MC(text t)= read_mcf(0)(t,(_com,_term)); proc_bond_atom(0)(1); if (group_num>0)and(not scan_bit(sw_abbreviate,Group)): read_group(0)(1); fi - char_use_check; %-scaling--------------------------------------------------------------------------------------- if blength>1: blen:=blength; proc_size_setup; proc_skeleton(0); proc_scaling; elseif blength>0: blen:=fig_wd*blength; proc_size_setup; proc_skeleton(0); proc_scaling; @@ -749,13 +715,13 @@ def MC(text t)= %=============================================================================================== if scan_bit(sw_output,Fig): %-draw atom----------------------------------------------------------------------------------- - if sw_numbering=0: for i=1 upto cntA: if numS[i]<>0: draw_atom(i); fi endfor fi + if sw_numbering=0: for i=1 upto cntA: if strA[i]<>0: draw_atom(i); fi endfor fi %-draw add to atom---------------------------------------------------------------------------- if (not scan_bit(sw_numbering,Atom))and(not scan_bit(sw_numbering,Bond)): for i=1 upto cntA: if addA[i]<>0: - nA:=angX[i]+add_rot[i]; nC:=nA mod 90; - if numS[i]=0: nB:=.5atom_wd; else: nB:=atom_wd; fi + nA:=angX[i]+add_rot[i]; nC:=nA mod 90; + if strA[i]=0: nB:=.5atom_wd; else: nB:=atom_wd; fi draw_char(char(addA[i]),sfrt(posA[i],nB,nA)); fi endfor @@ -816,7 +782,7 @@ def add_group= if envT<>hz: store_group(_chg_env,envT) fi 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[nP]: store_group(comD[nP][i],parD[nP][i]) endfor + for i=1 upto parts_cnt[nP]: store_group(parts_com[nP][i],parts_par[nP][i]) endfor 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:=rate_cr; fi @@ -830,10 +796,11 @@ def store_group(expr a,b)= enddef; %================================================================================================= def read_group(expr a)(expr n)= - save_group_cnt:=group_num; save_cntD:=cntD[a]; + save_group_cnt:=group_num; save_cntD:=parts_cnt[a]; for i=n upto group_num: for j=1 upto group_cnt[i]: - cntD[a]:=cntD[a]+1; comD[a][cntD[a]]:=group_com[i][j]; parD[a][cntD[a]]:=group_par[i][j]; + parts_cnt[a]:=parts_cnt[a]+1; + parts_com[a][parts_cnt[a]]:=group_com[i][j]; parts_par[a][parts_cnt[a]]:=group_par[i][j]; endfor endfor proc_bond_atom(a)(save_cntD+1); @@ -861,10 +828,10 @@ def proc_scaling= minX:=minY:=4095; maxX:=maxY:=-4095; for i=1 upto cntA: nX:=xpart(posA[i]); nY:=ypart(posA[i]); - if numS[i]<>0: + if strA[i]<>0: nU:=nD:=nP:=nL:=nR:=0; - for j=1 upto length(strD[numS[i]]): - tempc:=subc(j,strD[numS[i]]); + for j=1 upto length(str_tbl[strA[i]]): + tempc:=subc(j,str_tbl[strA[i]]); if tempc="^": nU:=.5atom_wd; ef tempc="_": nD:=.5atom_wd; ef (tempc<>"{")and(tempc<>"}"): nP:=nP+atom_wd*tbl_char_wd[ASCII(tempc)]; @@ -881,25 +848,13 @@ def proc_scaling= endfor mol_wd:=maxX-minX; mol_ht:=maxY-minY; enddef; -%------------------------------------------------------------------------------------------------- -def char_use_check= - for i=1 upto 128: f_char[i]:=0; endfor - if sw_numbering>=1: for j=a_zero upto a_nine: f_char[j]:=1; endfor - else: - for i=1 upto cntA: - if numS[i]<>0: - for j=1 upto length(strD[numS[i]]): f_char[ASCII(subc(j,strD[numS[i]]))]:=1; endfor - fi - endfor - fi -enddef; %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% def proc_bond_atom(expr a)(expr n)= - f_bra:=f_term:=rotT:=f_lineT:=f_rotT:=f_lenT:=f_envT:=envT:=envB:=strAT:=f_at:=0; + f_bra:=f_term:=rotT:=f_lineT:=f_rotT:=f_lenT:=f_envT:=envT:=envB:=temp_strA:=f_at:=0; bondL:=rate_cr; lenT:=rate_cr; sB[0]:=0; eB[0]:=1; lineT:=si; addAT:=markA:=markB:=saveA:=saveB:=0; %----------------------------------------------------------------------------------------------- - for i=n upto cntD[a]: nC:=comD[a][i]; nP:=parD[a][i]; + for i=n upto parts_cnt[a]: nC:=parts_com[a][i]; nP:=parts_par[a][i]; if nC=_mk_bond: if (nP=0)and(rotT<>0): rotT:=0; fi add_atom(0); ef nC=_set_adr: adrT:=nP; ef nC=_com: if nP=_mark: saveA:=markA; saveB:=markB; markA:=cntA; markB:=cntB; @@ -911,9 +866,8 @@ def proc_bond_atom(expr a)(expr n)= ef nP=_group_s: f_at:=1; if lineT<>si: f_lineT:=1; fi if rotT<>0: f_rotT:=1; fi if lenT<>rate_cr: f_lenT:=1; fi if envT<>hz: f_envT:=1; fi ef nP=_group_e: f_at:=0; f_lineT:=f_rotT:=f_lenT:=f_envT:=rotT:=envT:=0; - lineT:=si; lenT:=rate_cr; - fi - ef nC=_set_atom: strAT:=nP; + lineT:=si; lenT:=rate_cr; fi + ef nC=_set_atom: temp_strA:=nP; ef nC=_group_si: add_group; ef nC=_group_dm: lineT:=dm; add_group; ef nC=_group_wf: lineT:=wf; add_group; @@ -921,7 +875,7 @@ def proc_bond_atom(expr a)(expr n)= ef nC=_jp_bond: termA; nA:=getB(nP); check_adrB(nA); sB[cntB+1]:=sB[nA]; f_bra:=1; ef nC=_jp_atom: termA; nA:=getA(nP); check_adrA(nA); sB[cntB+1]:=nA; f_bra:=1; ef nC=_jp_absA: sB[cntB+1]:=nP; f_bra:=1; temp_cntB:=cntB; - ef nC=_chg_atom: numS[getA(adrT)]:=parD[nP][1]; + ef nC=_chg_atom: strA[getA(adrT)]:=parts_par[nP][1]; ef nC=_chg_len: if nP=_ring_len: bondL:=ringL; else: bondL:=nP; fi ef nC=_get_len: if nP=_tmp_len: if bondL=rate_cr: bondL:=lenT; fi ef nP=_ring_len: @@ -948,8 +902,8 @@ enddef; def add_atom(expr n)= cntB:=cntB+1; lineB[cntB]:=lineT; lineT:=si; if lenT=rate_cr: lenB[cntB]:=bondL; else: lenB[cntB]:=lenT; lenT:=rate_cr; fi - if f_bra=0: cntA:=cntA+1; sB[cntB]:=cntA; numS[cntA]:=strAT; - addA[cntA]:=addAT; addAT:=strAT:=add_rot[cntA]:=0; + if f_bra=0: cntA:=cntA+1; sB[cntB]:=cntA; strA[cntA]:=temp_strA; + addA[cntA]:=addAT; addAT:=temp_strA:=add_rot[cntA]:=0; if rotT<>0: add_rot[cntA]:=rotT; rotT:=0; fi else: f_bra:=0; fi if n=0: eB[cntB]:=cntA+1; f_term:=0; else: eB[cntB]:=n; f_term:=1; fi @@ -965,13 +919,12 @@ def proc_skeleton(expr n)= envT:=envB:=f_lineT:=f_rotT:=f_lenT:=f_envT:=0; lineT:=si; angT:=mangle; angA[0]:=angB[0]:=angX[0]:=0; posA[0]:=posBs:=posBe:=(0,0); %----------------------------------------------------------------------------------------------- - for i=1 upto cntD[n]: nC:=comD[n][i]; nP:=parD[n][i]; + for i=1 upto parts_cnt[n]: nC:=parts_com[n][i]; nP:=parts_par[n][i]; if nC=_mk_bond: if (nP=0)and(rotT<>0):nP:=rotT; rotT:=0; fi add_bond(nP,1); ef nC=_com: if nP=_mark: saveA:=markA; saveB:=markB; markA:=cntA; markB:=cntB; ef nP=_rest: markA:=saveA; markB:=saveB; ef nP=_moff: markA:=markB:=0; ef nP=_term: termB; - ef nP=_group_e: lineT:=si; lenT:=rate_cr; rotT:=envT:=0; - fi + ef nP=_group_e: lineT:=si; lenT:=rate_cr; rotT:=envT:=0; fi ef nC=_jp_bond: termB; nA:=getB(nP); posBs:=posA[sB[nA]]; angT:=angB[nA]; f_bra:=1; rotT:=0; ef nC=_jp_atom: termB; adrT:=getA(nP); posBs:=posA[adrT]; angT:=angX[adrT]; f_bra:=1; rotT:=0; ef nC=_jp_absA: adrT:=nP; posBs:=posA[adrT]; angT:=angX[adrT]; @@ -996,31 +949,25 @@ def add_bond(expr n,f)= if f_bra=0: adrT:=cntA:=cntA+1; posA[cntA]:=posBs; angA[cntA]:=angT; angX[cntA]:=(angT+nA/2+iif(nA>=0,-90,90)) mod 360; - else: f_bra:=0; - fi + else: f_bra:=0; fi cntB:=cntB+1; if nA>-3700: angB[cntB]:=angT:=(angT+nA) mod 360; else: angB[cntB]:=angT:=nA+4095; fi if f=1: if lenB[cntB]=_size_atom: posBe:=sfrt(posBs,atom_wd,angT); else: nA:=lenB[cntB]; if nA<0: nB:=glu_atom(adrT)+glu_atom(cntA+1); nA:=abs(nA); else: nB:=0; fi - posBe:=sfrt(posBs,nA*blen+nB,angT); - fi + posBe:=sfrt(posBs,nA*blen+nB,angT); fi posA[cntA+1]:=posBe; f_term:=0; - else: f_term:=1; - fi + else: f_term:=1; fi posBs:=posBe; enddef; %------------------------------------------------------------------------------------------------- vardef arrange_ang(expr n)= if cntB=0: angT:=(angT-180) mod 360; 180 - else: - if envB>=parts_emb_start: parD[envB][cntB-temp_cntB+3] - else: if envB=hz: if n=0: 60 ef n<=90: -60 ef n<=180: 60 ef n<270: -60 else: 60 fi - ef envB=vt: if n=0: -60 ef n<90: 60 ef n<=180: -60 ef n<=270: 60 else: -60 fi - ef abs(envB)<=180: envB fi - fi - fi + else: if envB>=parts_emb_start: parts_par[envB][cntB-temp_cntB+3] + else: if envB=hz: if n=0: 60 ef n<=90: -60 ef n<=180: 60 ef n<270: -60 else: 60 fi + ef envB=vt: if n=0: -60 ef n<90: 60 ef n<=180: -60 ef n<=270: 60 else: -60 fi + ef abs(envB)<=180: envB fi fi fi enddef; %------------------------------------------------------------------------------------------------- vardef adjust_ang(expr n)= if (n<40)or(n>320): 0 ef n<140: 90 ef n<220: 180 else: 270 fi enddef; @@ -1031,12 +978,10 @@ vardef getB(expr n)= if n>=0: markB+n ef n>=-999: cntB+n+1 else: n+4095 fi endde def termA= if f_term=0: if f_bra=0: - cntA:=cntA+1; numS[cntA]:=strAT; addA[cntA]:=addAT; add_rot[cntA]:=rotT; - addAT:=strAT:=rotT:=0; - else: f_bra:=0; - fi - f_term:=1; - fi + cntA:=cntA+1; strA[cntA]:=temp_strA; addA[cntA]:=addAT; add_rot[cntA]:=rotT; + addAT:=temp_strA:=rotT:=0; + else: f_bra:=0; fi + f_term:=1; fi enddef; %------------------------------------------------------------------------------------------------- def termB= @@ -1044,58 +989,46 @@ def termB= enddef; %------------------------------------------------------------------------------------------------- vardef glu_atom(expr n)= - if numS[n]<>0: nE:=angT mod 90; nF:=0.5atom_wd; (iif(nE<45,sind nE,cosd nE)*nF)++nF else: 0 fi + if strA[n]<>0: nE:=angT mod 90; nF:=0.5atom_wd; (iif(nE<45,sind nE,cosd nE)*nF)++nF else: 0 fi enddef; %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% def draw_atom(expr n)= if atomfont<>"draw": defaultfont:=atomfont; defaultsize:=atom_wd; fi - temps:=strD[numS[n]]; slen:=length(temps); nC:=nS:=0; raise_pos:=(0,0); tpos:=posA[n]; + temps:=str_tbl[strA[n]]; slen:=length(temps); nC:=nS:=0; raise_pos:=(0,0); tpos:=posA[n]; if (angX[n]<=90)or(angX[n]>=270): sdir:=1; else: sdir:=-1; fi for i=1 upto slen: if nC=0: tempc:=subc(i,temps); if (sdir=-1)and(tempc="{"): - nD:=i; nC:=0; for j=nD upto slen: nC:=nC+1; exitif subc(j,temps)="}"; endfor - fi - else: nC:=nC-1; tempc:=subc(nD+nC,temps); - fi + nD:=i; nC:=0; for j=nD upto slen: nC:=nC+1; exitif subc(j,temps)="}"; endfor fi + else: nC:=nC-1; tempc:=subc(nD+nC,temps); fi if tempc="_": raise_pos:=iif(raise_pos=(0,0),(0,-.5atom_wd),(0,0)); ef tempc="^": raise_pos:=iif(raise_pos=(0,0),(0, .5atom_wd),(0,0)); ef (tempc<>"{")and(tempc<>"}"): - nS:=nS+1; - char_wd:=atom_wd*tbl_char_wd[ASCII(tempc)]; char_ht:=atom_wd; + nS:=nS+1; char_wd:=atom_wd*tbl_char_wd[ASCII(tempc)]; char_ht:=atom_wd; if nS=1: if (sdir=-1)and(char_wd<atom_wd): tpos:=tpos+((atom_wd-char_wd)/2,0); fi - else: tpos:=tpos+(.5char_wd*sdir,0); - fi + else: tpos:=tpos+(.5char_wd*sdir,0); fi tcol:=colorA[n]; f_col:=0; if known tcol: if tcol<>0: drawoptions(withcolor color_list[tcol]); f_col:=1; fi fi if atomfont="draw": draw_char(tempc,tpos+raise_pos); else: label(tempc,tpos+raise_pos); fi if f_col=1: drawoptions(); fi - tpos:=tpos+(.5char_wd*sdir,0); - fi + tpos:=tpos+(.5char_wd*sdir,0); fi endfor nA:=0.56atom_wd; nB:=0.06atom_wd; if sdir=1: frameA[n]:=posA[n]-(nA,nA)--tpos+(nB,-nA)--tpos+(nB,nA)--posA[n]+(-nA,nA)--cycle; - else: frameA[n]:=tpos-(nB,nA)--posA[n]+(nA,-nA)--posA[n]+(nA,nA)--tpos+(-nB,nA)--cycle; - fi + else: frameA[n]:=tpos-(nB,nA)--posA[n]+(nA,-nA)--posA[n]+(nA,nA)--tpos+(-nB,nA)--cycle; fi if scan_bit(sw_frame,Atom): draw frameA[n] wpcs thickness_frame; fi enddef; %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% def draw_bond(expr n)= - begingroup - save ww,aw,ap,am,Ls,Le,pA,zA,zL; - pair pA,Ls,Le; - path zA,zL; - %----------------------------------------------------------------------------------------------- nL:=lineB[n]; angL:=angB[n]; nS:=sB[n]; nE:=eB[n]; f_col:=0; tcol:=colorB[n]; zL:=posA[nS]--posA[nE]; ww:=wedge_wd; ap:=angL+90; am:=angL-90; aw:=atom_wd; %----------------------------------------------------------------------------------------------- - if (numS[nS]=0)and(numS[nE]=0)or(sw_numbering>=1): + if (strA[nS]=0)and(strA[nE]=0)or(sw_numbering>=1): Ls:=posA[nS]; Le:=posA[nE]; pA:=(.1,.9); - ef numS[nS]=0: Ls:=posA[nS]; Le:=zL ISP frameA[nE]; pA:=(.15,1); - ef numS[nE]=0: Ls:=zL ISP frameA[nS]; Le:=posA[nE]; pA:=(0,.85); - else: Ls:=zL ISP frameA[nS]; Le:=zL ISP frameA[nE]; pA:=(0,1); - fi + ef strA[nS]=0: Ls:=posA[nS]; Le:=zL ISP frameA[nE]; pA:=(.15,1); + ef strA[nE]=0: Ls:=zL ISP frameA[nS]; Le:=posA[nE]; pA:=(0,.85); + else: Ls:=zL ISP frameA[nS]; Le:=zL ISP frameA[nE]; pA:=(0,1); fi zA:=Ls--Le; lenL:=length(Le-Ls); %----------------------------------------------------------------------------------------------- if known tcol: if tcol<>0: drawoptions(withcolor color_list[tcol]); f_col:=1;fi fi @@ -1150,16 +1083,15 @@ def draw_bond(expr n)= %-- bond type for glycan ---------------------------------------------------------------------- ef nL=arc_lb: draw Ls--Ls-(0,aw)..posA[nE]+(-1.2aw,0)..posA[nE]-(.6aw,0); ef nL=arc_br: draw posA[nS]+(.6aw,0)..posA[nS]+(1.2aw,0)..Le-(0,aw)--Le; - ef nL=arc_lbr: draw posA[nS]+(0,iif(numS[nS]=0,0,-.6aw))--posA[nS]+(0,-.8aw) + ef nL=arc_lbr: draw posA[nS]+(0,iif(strA[nS]=0,0,-.6aw))--posA[nS]+(0,-.8aw) ..0.5[posA[nS],posA[nE]]+(0,-1.7aw)..posA[nE]+(0,-.8aw) - --posA[nE]+(0,iif(numS[nE]=0,0,-.6aw)); - ef nL=arc_ltr: draw posA[nS]+(0,iif(numS[nS]=0,0,0.6aw))--posA[nS]+(0,.8aw) + --posA[nE]+(0,iif(strA[nE]=0,0,-.6aw)); + ef nL=arc_ltr: draw posA[nS]+(0,iif(strA[nS]=0,0,0.6aw))--posA[nS]+(0,.8aw) ..0.5[posA[nS],posA[nE]]+(0,1.7aw)..posA[nE]+(0,.8aw) - --posA[nE]+(0,iif(numS[nE]=0,0,.6aw)); + --posA[nE]+(0,iif(strA[nE]=0,0,.6aw)); %---------------------------------------------------------------------------------------------- fi if f_col=1: drawoptions(); fi - endgroup enddef; %------------------------------------------------------------------------------------------------ def wz_put(expr a,b,c)= @@ -1214,9 +1146,6 @@ def circ_Oh = (hP,qH)..Z_x..(fW,qH)..Z_y..cycle enddef; def circ_Oa = (hP,0.35aH)..Z_x..(fW,0.35aH)..(hW,.7aH)..cycle enddef; %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% def draw_char(expr s,p)= -begingroup -save aW,aH,fW,fH,hW,hW,hH,qH,fP,hP; -%------------------------------------------------------------------------------------------------- aW:=atom_wd*tbl_char_wd[ASCII(s)]*(1-2ratio_atomgap_atom); aH:=atom_wd*tbl_char_ht[ASCII(s)]*(1-2ratio_atomgap_atom); cpos:=p-(aW/2,atom_wd/2*(1-2ratio_atomgap_atom)); @@ -1294,13 +1223,11 @@ ef s="-": dwh Z_m--Z_o; ef s="+": dwv Z_x--Z_s; dwh Z_m--Z_o; else: fi -endgroup enddef; %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% def warning_bond(expr a)= if addA[a]=0: - warning("A"&decimal(a)&" ( "&fsl(8)(strD[numS[a]])&") has"&fdr(2)(bond_cntA)&" bonds"); - fi + warning("A"&decimal(a)&" ( "&fsl(8)(str_tbl[strA[a]])&") has"&fdr(2)(bond_cntA)&" bonds"); fi enddef; %------------------------------------------------------------------------------------------------- vardef erase_brace(expr s)= @@ -1309,10 +1236,8 @@ vardef erase_brace(expr s)= for i=1 upto length(s): sC:=subc(i,s); if (sC<>"{")and(sC<>"}")and(sC<>"_")and(sC<>"^")and(sC<>"+")and(sC<>"-"): sS:=sS&sC; fi - endfor - sS - else: s - fi + endfor sS + else: s fi enddef; %------------------------------------------------------------------------------------------------- vardef erase_space(expr t)= @@ -1325,7 +1250,7 @@ def proc_calc(expr n)= for i=1 upto tbl_atom_end: sumA[i]:=0; endfor for i=1 upto cntA: knownA:=bond_cntA:=0; - nS:=numS[i]; + nS:=strA[i]; for j=1 upto cntB: bond_num[j]:=bond_type(lineB[j]); if (sB[j]=i)or(eB[j]=i): bond_cntA:=bond_cntA+bond_num[j]; fi @@ -1350,19 +1275,17 @@ def proc_calc(expr n)= ef nS=(Br-nE): if bond_cntA<>1: warning_bond(i) fi fi for j=1 upto tbl_group_end: - if strD[nS]=tbl_atom_str[j]: + if str_tbl[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 + endfor fi + knownA:=1; fi exitif knownA=1; endfor - if knownA=0: warning(" Unknown Str("&strD[numS[i]]&") is used "&decimal(i)); fi + if knownA=0: warning(" Unknown Str("&str_tbl[strA[i]]&") is used "&decimal(i)); fi endfor %------------------------------------------------------------------------------------- sumA[2]:=sumA[2]+hideH_cnt; @@ -1370,8 +1293,7 @@ def proc_calc(expr n)= for i=1 upto tbl_atom_max: if sumA[i]>=1: num_MW:= num_MW+tbl_atom_wt[i]*sumA[i]; num_MI:= num_MI+tbl_atom_mi[i]*sumA[i]; - cal_FM:=cal_FM&erase_brace(tbl_atom_str[i]) if sumA[i]>=2: &decimal(sumA[i]) fi; - fi + cal_FM:=cal_FM&erase_brace(tbl_atom_str[i]) if sumA[i]>=2: &decimal(sumA[i]) fi; fi endfor cal_MW:=substring(0,8) of decimal(num_MW); cal_MI:=substring(0,10) of decimal(num_MI); enddef; @@ -1380,8 +1302,7 @@ def proc_info_out(expr f)= message "["&decimal(fig_num)&"]:"&inf_EN; if (f=1)or(f=2): file_output:=jobname&"-info.aux"; ef f=3: file_output:=jobname&"-data.aux"; fi if (fig_num=1)and(f=2): - printf tag[1] for i=2 upto aux_max: exitif tag[i]=""; &aux_delimiter&tag[i] endfor ; - fi + printf tag[1] for i=2 upto aux_max: exitif tag[i]=""; &aux_delimiter&tag[i] endfor ; fi %-------------------------------------------------------------------------------------- for i=1 upto aux_max: exitif tag[i]=""; if i=1: printf "" else: &aux_delimiter fi @@ -1398,8 +1319,7 @@ def proc_info_out(expr f)= 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 + ef tag[i]="EXA": & inf_EXA ef tag[i]="EXB": & inf_EXB fi endfor ; if f=3: printf "+"; for i=1 upto mc_row: printf (substring(0,mc_indent[i]) of blanks)&mc[i]; endfor @@ -1419,10 +1339,9 @@ def proc_report_out(expr f)= printf " row="&fdr(3)(mc_row)&" / length="&fdr(4)(length(mc))&" / commands="&fdr(3)(cnt_cmm); printf " {}=X ="&fdr(3)(cnt_chgB)&" / {}:X ="&fdr(3)(cnt_chgA)& " / '() ="&fdr(3)(cnt_inline_def)&" / @ ="&fdr(3)(cnt_at)& - " / & ="&fdr(3)(cnt_and)&" / < ="&fdr(3)(cnt_gtn); - fi + " / & ="&fdr(3)(cnt_and)&" / < ="&fdr(3)(cnt_gtn); fi printf "---------------------------------------------------------------------------"; - printf " Warnings = "&fdr(3)(warning_cnt)&" / Code= "&decimal(cntD[0]); + printf " Warnings = "&fdr(3)(warning_cnt)&" / Code= "&decimal(parts_cnt[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); @@ -1431,7 +1350,7 @@ def proc_report_out(expr f)= printf "---------------------------------------------------------------------------"; printf "< NO. ><atom(s) >( x axis , y axis )<bond><hideH><chg>"; for i=1 upto cntA: - printf " A"&fdl(6)(i)&fsl(8)(erase_brace(strD[numS[i]]))& + printf " A"&fdl(6)(i)&fsl(8)(erase_brace(str_tbl[strA[i]]))& " ("&fdr(10)(round(xpart(posA[i])/blen))&" , "& fdr(10)(round(ypart(posA[i])/blen))&" ) "&fdr(4)(Bcnt[i])& iif(hideH[i]>0,fdr(6)(hideH[i])," ") @@ -1441,23 +1360,19 @@ def proc_report_out(expr f)= printf "< NO. >< bond (sdt)><angle +( +- )><length ( pt )>"; for i=1 upto cntB: nC:=lenB[i]; if nC=_size_atom: nC:=ratio_atom_bond; elseif nC<0: nC:=-nC; fi - nB:=angB[i]; if nB>180: nB:=nB-360; fi - printf " B"&fdl(4)(i)&fdr(3)(sB[i])&" -> "&fdr(3)(eB[i])& - " ("&fdr(3)(bond_num[i])&")"&fdr(8)(round(angB[i]))& - " ("&fdr(6)(round(nB))&")"&fdr(8)(nC)&" ("&fdr(8)(round(nC*blen))&")"; + nB:=angB[i]; if nB>180: nB:=nB-360; fi + printf " B"&fdl(4)(i)&fdr(3)(sB[i])&" -> "&fdr(3)(eB[i])& + " ("&fdr(3)(bond_num[i])&")"&fdr(8)(round(angB[i]))& + " ("&fdr(6)(round(nB))&")"&fdr(8)(nC)&" ("&fdr(8)(round(nC*blen))&")"; endfor printf "---------------------------------------------------------------------------"; printf "<atom>( atom wt )[ mi wt ] < cnt > < sum wt >[ sum mi wt ]"; 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 " "& - fsl(5)(erase_brace(tbl_atom_str[i]))& - "("&fdr(9)(tbl_atom_wt[i])&")"&"["&fdr(9)(tbl_atom_mi[i])&"]"&" * "&fdr(4)(sumA[i]) - if nA<40: &fdr(15)(tbl_atom_wt[i]*sumA[i])&"["&fdr(12)(tbl_atom_mi[i]*sumA[i])&"]"; - else: &fdr(11)(nA)&"*100"&"["&fdr(9)(nB)&"*100"&"]"; - fi - fi + printf " "&fsl(5)(erase_brace(tbl_atom_str[i]))& + "("&fdr(9)(tbl_atom_wt[i])&")"&"["&fdr(9)(tbl_atom_mi[i])&"]"&" * "&fdr(4)(sumA[i]) + &fdr(15)(tbl_atom_wt[i]*sumA[i])&"["&fdr(12)(tbl_atom_mi[i]*sumA[i])&"]"; + fi endfor printf " Molecular Weight [Mono Isotopic] = "&fsr(12)(cal_MW)&"["&fsr(12)(cal_MI)&"]"; printf "---------------------------------------------------------------------------"; @@ -1478,12 +1393,11 @@ def proc_mol_out(expr n)= 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)&" "& - fsl(2)(erase_brace(strD[numS[i]]))&" 0"&fdr(3)(bond_charge(chargeA[i]))&" 0 0"; + fsl(2)(erase_brace(str_tbl[strA[i]]))&" 0"&fdr(3)(bond_charge(chargeA[i]))&" 0 0"; endfor for i=1 upto cntB: if lineB[i]<>0: printf fdr(3)(sB[i])&fdr(3)(eB[i])&fdr(3)(bond_type(lineB[i]))& - fdr(3)(bond_stereo(lineB[i]))&" 0 0"; - fi + fdr(3)(bond_stereo(lineB[i]))&" 0 0"; fi endfor printf "M END"; %-V3000--------------------------------------------------------------------------------------- @@ -1494,7 +1408,7 @@ def proc_mol_out(expr n)= 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)&" "&erase_brace(strD[numS[i]])&" "& + printf "M V30 "&decimal(i)&" "&erase_brace(str_tbl[strA[i]])&" "& decimal(xpart(posA[i])/blen)&" "&decimal(ypart(posA[i])/blen)&" 0 0" if chargeA[i]<>0: &" CHG="&decimal(chargeA[i]) fi; endfor @@ -1503,8 +1417,7 @@ def proc_mol_out(expr n)= if lineB[i]<>0: printf "M V30 "&decimal(i)&" "&decimal(bond_type(lineB[i]))& " "&decimal(sB[i])&" "&decimal(eB[i]) - if bond_stereo(lineB[i])<>0: &" CFG="&decimal(bond_config(lineB[i])) fi; - fi + if bond_stereo(lineB[i])<>0: &" CFG="&decimal(bond_config(lineB[i])) fi; fi endfor printf "M V30 END BOND"; printf "M V30 END CTAB"; printf "M END"; fi @@ -1526,25 +1439,25 @@ vardef bond_config(expr n)= if (n=wf)or(n=zb)or(n=bd): 1 ef (n=zf)or(n=wb)or(n=dt): 3 ef n=wv: 2 else: 0 fi enddef; %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% vardef STa(expr s,WT,MI)= - str_cnt:=str_cnt+1; tbl_cnt:=tbl_cnt+1; parts_cnt:=parts_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]:=s; + str_cnt:=str_cnt+1; tbl_cnt:=tbl_cnt+1; parts_num:=parts_num+1; + parts_com[parts_num][1]:=_set_atom; parts_par[parts_num][1]:=str_cnt; parts_cnt[parts_num]:=1; + str_tbl[str_cnt]:=tbl_atom_str[tbl_cnt]:=s; tbl_atom[tbl_cnt]:=0; tbl_atom_wt[tbl_cnt]:=WT; tbl_atom_mi[tbl_cnt]:=MI; - parts_cnt + parts_num enddef; %------------------------------------------------------------------------------------------------- vardef STb(expr s)(text t)= - str_cnt:=str_cnt+1; tbl_cnt:=tbl_cnt+1; parts_cnt:=parts_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]:=s; tbl_atom[tbl_cnt]:=0; + str_cnt:=str_cnt+1; tbl_cnt:=tbl_cnt+1; parts_num:=parts_num+1; + parts_com[parts_num][1]:=_set_atom; parts_par[parts_num][1]:=str_cnt; parts_cnt[parts_num]:=1; + str_tbl[str_cnt]:=tbl_atom_str[tbl_cnt]:=s; tbl_atom[tbl_cnt]:=0; for list=t: tbl_atom[tbl_cnt]:=tbl_atom[tbl_cnt]+1; tbl_group[tbl_cnt][tbl_atom[tbl_cnt]]:=list-parts_emb_start; endfor - parts_cnt + parts_num enddef; %================================================================================================= -parts_int:=parts_emi_start; parts_cnt:=parts_emb_start; +parts_int:=parts_emi_start; parts_num:=parts_emb_start; %------------------------------------------------------------------------------------------------- C:= STa("C" ,12.0107, 12.0000000); H:= STa("H" , 1.00794, 1.00782503223); D:= STa("D" ,2.012, 2.01410177812); Ag:=STa("{Ag}",107.868, 106.905095); @@ -1575,7 +1488,7 @@ NO:=STb("NO")(N,O); NO2:=STb("N{O_2_}")(N,O,O); NH2:=STb("N{H_2_}")(N,H,H); SO2H:=STb("S{O_2_}H")(S,O,O,H); SO3H:=STb("S{O_3_}H")(S,O,O,O,H); ONa:=STb("O{Na}")(O,Na); SO3Na:=STb("S{O_3_}{Na}")(S,O,O,O,Na); %------------------------------------------------------------------------------------------------- -tbl_group_end:=tbl_cnt; parts_atom_end:=parts_cnt; +tbl_group_end:=tbl_cnt; parts_atom_end:=parts_num; %================================================================================================= for i=3 upto 20: ?[i]:='((_com,_len_ss),(_get_len,_ring_len),<((-180 DIV i)-90) for j==2 upto i:: ,(360 DIV i) endfor,(_cyc_sB,1-i),(_com,_len_ee)); endfor @@ -1590,6 +1503,7 @@ endfor Me:='(); Et:='(!); iPr:=?!:='(/_,!); ?!2:='(/_,!2); tBu:=??!:='(/_,/_^60,60); !?:='(!,/_); !?!:='(!,/_,!); n_:='((_set_add,a_minus)); p_:='((_set_add,a_plus)); zero_wf:='(0~wf); zero_zf:='(0~zf); zero_dm:='(0~dm); zero_wv:='(0~wv); +mark_adress:='((_com,_mark)); reset_adress:='((_com,_moff)); reset_length:='((_com,_len_e)); %------------------------------------------------------------------------------------------------- NH:='(N,/H~nl); N!:='(N,/_); N!2:='(N,/!); SO:='(S,//O); SOO:='(S,//O^-35,//O^35); O!:='(O,!); O!2:='(O,!,!); O!3:='(O,!,!,!); O!?!:='(O,!,?!); O!??!:='(O,!,??!); OPh:='(O,!,Ph); @@ -1627,7 +1541,7 @@ xCHO:='(//O^-60,/H^60); xCOOH:='(//O^-60,/xOH^60); xCN:='(/N~tm); xSH:='(S,/H); %================================================================================================= init_par(parameter_list); %------------------------------------------------------------------------------------------------- -%%%%message "parts_emb =" & decimal(parts_emb_start) &" => " & decimal(parts_cnt); +%%%%message "parts_emb =" & decimal(parts_emb_start) &" => " & decimal(parts_num); %%%%message "parts_emi =" & decimal(parts_emi_start) &" => " & decimal(parts_int); %------------------------------------------------------------------------------------------------- def expand_set= @@ -1680,10 +1594,8 @@ vardef check(expr s)= ef nC=a_hat: if nD= a_cmm: proc_err(7,nA) fi if nB= a_cmm: proc_err(7,nA) fi % x ^ x ef nC=a_bqt: if nD= a_cmm: proc_err(7,nA) fi if nB= a_cmm: proc_err(7,nA) fi % x ` x ef nC=a_bar: if nD= a_bar: if mc_char[nA+2]=a_bar: nA:=nA+1; % || - ef mc_char[nA+2]<>a_cmm: proc_err(8,nA) % | a - fi - if nB<>a_cmm: proc_err(8,nA) fi % a | - fi + ef mc_char[nA+2]<>a_cmm: proc_err(8,nA) fi % | a + if nB<>a_cmm: proc_err(8,nA) fi fi % a | ef nC=a_prn_s: if nD= a_cmm: proc_err(7,nA) fi % ( x cnt_prn_s:=cnt_prn_s+1; f_depth:=1; if nB=a_qut: cnt_inline_def:=cnt_inline_def+1; fi @@ -1716,8 +1628,9 @@ enddef; %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% def query(text s)= begingroup - save f_mcf,f_line,unit_row,unit_cnt,line_s,row_cnt,semic_cnt,info_cnt,order,min_n,key_cnt,info_s, sign_at,sign_n,filter_n,filter_tag,filter_var,filter_sign,filter_cnt,filter_p,at_semic, - at_colon,at_equal,at_less,at_greater,at_n,sort_all,key_s,sort_s; + save f_mcf,f_line,unit_row,unit_cnt,line_s,row_cnt,semic_cnt,info_cnt,order,min_n,key_cnt, + info_s,sign_at,sign_n,filter_n,filter_tag,filter_var,filter_sign,filter_cnt,filter_p, + at_semic,at_colon,at_equal,at_less,at_greater,at_n,sort_all,key_s,sort_s; string line_s[][],sort_s[],sort_all[],key_s[],filter_tag[],filter_var[],info_s[]; numeric row_cnt[],order[],order_tbl[],filter_sign[],filter_p[],at_semic[]; unit_row:=f_mcf:=mc_row:=info_cnt:=key_cnt:=filter_cnt:=0; unit_cnt:=1; @@ -1733,20 +1646,17 @@ def query(text s)= else: sign_at:=at_equal; sign_n:=1; at_n:=1; fi ef at_greater>=2: if (at_greater-1)=at_less: sign_at:=at_greater; sign_n:=2; at_n:=2; else: sign_at:=at_greater; sign_n:=4; at_n:=1; fi - ef at_less>=2: sign_at:=at_less; sign_n:=3; at_n:=1; - fi + ef at_less>=2: sign_at:=at_less; sign_n:=3; at_n:=1; fi sT:=substring(0,sign_at-at_n) of list; sV:=substring(sign_at,length(list)) of list; %--------------------------------------------------------------------------------------------- if sign_n=0: if sT="f": if scan_char(".",sV,0,1)=0: file_input:=sV&".mcf"; else: file_input:=sV; fi ef sT="o": if scan_char(".",sV,0,1)=0: file_output:=sV&".aux"; else: file_output:=sV; fi - ef sT="s": key_cnt:=key_cnt+1; key_s[key_cnt]:=sV; - fi + ef sT="s": key_cnt:=key_cnt+1; key_s[key_cnt]:=sV; fi else: filter_cnt:=filter_cnt+1; filter_tag[filter_cnt]:=sT; filter_sign[filter_cnt]:=sign_n; if (sign_n>=3)and(is_num(sV)=1): filter_var[filter_cnt]:=fix_num(sV); - else: filter_var[filter_cnt]:=sV; - fi + else: filter_var[filter_cnt]:=sV; fi fi endfor %----------------------------------------------------------------------------------------------- @@ -1773,8 +1683,7 @@ def query(text s)= ef filter_sign[j]=3: if not(temps< filter_var[j]): filter_n:=0; fi ef filter_sign[j]=4: if not(temps> filter_var[j]): filter_n:=0; fi ef filter_sign[j]=5: if not(temps<=filter_var[j]): filter_n:=0; fi - ef filter_sign[j]=6: if not(temps>=filter_var[j]): filter_n:=0; fi - fi + ef filter_sign[j]=6: if not(temps>=filter_var[j]): filter_n:=0; fi fi fi endfor endfor @@ -1782,8 +1691,7 @@ def query(text s)= sort_all[unit_cnt]:=""; for j=1 upto key_cnt: if j=key_cnt: sort_all[unit_cnt]:=sort_all[unit_cnt]&sort_s[j]; - else: sort_all[unit_cnt]:=fix_str(15,sort_s[1]); - fi + else: sort_all[unit_cnt]:=fix_str(15,sort_s[1]); fi endfor info_cnt:=0; if filter_n=1: unit_cnt:=unit_cnt+1; fi ef subc(1,temps)="+": f_mcf:=1; mc_row:=1; @@ -1794,8 +1702,7 @@ def query(text s)= for i=1 upto semic_cnt+1: info_cnt:=info_cnt+1; if i<=semic_cnt: info_s[info_cnt]:=substring(at_semic[i-1],at_semic[i]-1) of temps; - else: info_s[info_cnt]:=substring(at_semic[semic_cnt],length(temps)) of temps; - fi + else: info_s[info_cnt]:=substring(at_semic[semic_cnt],length(temps)) of temps; fi endfor fi fi @@ -1814,8 +1721,7 @@ def query(text s)= for i=1 upto unit_cnt: for j=1 upto row_cnt[order_tbl[i]]: printf line_s[order_tbl[i]][j]; endfor endfor - else: - for i=1 upto unit_cnt: for j=1 upto row_cnt[i]: printf line_s[i][j]; endfor endfor + else: for i=1 upto unit_cnt: for j=1 upto row_cnt[i]: printf line_s[i][j]; endfor endfor fi closefrom file_input; closefrom file_output; endgroup; @@ -1825,13 +1731,13 @@ vardef fix_str(expr n,s)= if length(s)<n: sS:=s&substring(0,n-length(s)) of blanks; ef length(s)>n: sS:=substring(0,n) of s; fi sS enddef; -%--------------------------------------------------------------------------------------------- +%------------------------------------------------------------------------------------------------- vardef fix_num(expr s)= sS:=s; nN:=scan_char(".",sS,0,1); if nN=0: sS:=fsr(4)(sS); ef nN=1: sS:=" 0"&sS; ef nN=2: sS:=" "&sS; ef nN=3: sS:=" "&sS; ef nN=4: sS:=" "&sS; fi sS enddef; -%--------------------------------------------------------------------------------------------- +%------------------------------------------------------------------------------------------------- vardef is_num(expr s)= for i=1 upto length(s): if ((subc(i,s)>="0")and(subc(i,s)<="9"))or(subc(i,s)="."): nN:=1; else: nN:=0; fi endfor nN |