diff options
author | Karl Berry <karl@freefriends.org> | 2022-11-06 20:44:55 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2022-11-06 20:44:55 +0000 |
commit | ced74a501b9292feaff4e90bff67529c37df17a9 (patch) | |
tree | c7d49d2cbcc8a91466cbd89963449e081c3ad45d /Master/texmf-dist/doc/metapost/mcf2graph/mcf2graph.mp | |
parent | 2811c1ffc08d69c5c856ffbfb6ffb086e46ef31a (diff) |
mcf2graph (6nov22)
git-svn-id: svn://tug.org/texlive/trunk@64948 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/doc/metapost/mcf2graph/mcf2graph.mp')
-rw-r--r-- | Master/texmf-dist/doc/metapost/mcf2graph/mcf2graph.mp | 56 |
1 files changed, 23 insertions, 33 deletions
diff --git a/Master/texmf-dist/doc/metapost/mcf2graph/mcf2graph.mp b/Master/texmf-dist/doc/metapost/mcf2graph/mcf2graph.mp index 729be297d03..1961a2ee890 100644 --- a/Master/texmf-dist/doc/metapost/mcf2graph/mcf2graph.mp +++ b/Master/texmf-dist/doc/metapost/mcf2graph/mcf2graph.mp @@ -1,5 +1,5 @@ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -% mcf2graph ver 4.88 Copyright (c) 2013-2022 Akira Yamaji +% mcf2graph ver 4.89 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,7 +33,7 @@ % Set output MOL file (V3000) : mpost -s ahlength=6 FILENAME % Set output report : mpost -s ahlength=7 FILENAME %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -message "* This is mcf2graph ver 4.88 2022.10.10"; +message "* This is mcf2graph ver 4.89 2022.11.06"; tracingstats:=1; prologues:=3; warningcheck:=0; %------------------------------------------------------------------------------------------------- newinternal string EN_; @@ -338,6 +338,9 @@ vardef read_ud(text t)= parts_num:=parts_num+1; read_mcf(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 bond__bond b = (a,b) enddef; +tertiarydef a bond___bond b = (a+0.5,b) enddef; +tertiarydef a bond____bond b = (a+0.5,b+0.5) enddef; tertiarydef a op_equ b = if (known a)and(known b):: change_bond(a,b) else:: _nop fi enddef; tertiarydef a op_col b = if (known a)and(known b):: change_atom(a,b) else:: _nop fi enddef; tertiarydef a op_hat b = if known b:: (_tmp_rot,b),a else:: _nop,a fi enddef; @@ -393,8 +396,9 @@ def read_mcf(expr n)(text t)= enddef; %------------------------------------------------------------------------------------------------- vardef read_number(text t)= - save :,','`; - let : == from_until; def ' == +0.5 enddef; def '` == +0.5` enddef; parts_int:=parts_int+1; + save --,---,----,:,','`; + let : == from_until; let -- == bond__bond; let --- == bond___bond; let ---- == bond____bond; + def ' == +0.5 enddef; def '` == +0.5` enddef; parts_int:=parts_int+1; nA:=0; for list==t:: if known list:: @@ -470,22 +474,15 @@ vardef change_bond(expr a,b) = if b==?6:: 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 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((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) CA(_set_line,dl,-1) CA(_set_line,dl,-3) ef b==Ph2:: fuse_ring_bonds((parts_com[a][i],parts_par[a][i]),6,4) @@ -498,15 +495,8 @@ vardef change_bond(expr a,b) = 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 - ef pair a:: - if b==?6:: fuse_ring_bonds(a,6,4) - ef b==?5:: fuse_ring_bonds(a,5,3) - ef b==?4:: fuse_ring_bonds(a,4,2) - ef b==?6[3]:: fuse_ring_bonds(a,6,3) - ef b==?6[2]:: fuse_ring_bonds(a,6,2) - ef b==?5[2]:: fuse_ring_bonds(a,5,2) - ef b==Ph1:: fuse_ring_bonds(a,6,4) CA(_set_line,dl,-1) CA(_set_line,dl,-3) - ef b==Ph2:: fuse_ring_bonds(a,6,4) CA(_set_line,dl,-2) CA(_set_line,dl,-4) fi fi fi + fi + fi elseif color b:: color_list[incr cntC]:=b; CA(_set_colorB,cntC,a) fi parts_cnt[parts_int]:=nC; parts_int fi enddef; @@ -515,7 +505,7 @@ vardef change_atom(expr a,b)= if known b:: parts_int:=parts_int+1; nC:=0; if numeric b:: if (b GT parts_emb_start)and(b<=parts_atom_end):: CA(_chg_atom,b,a) - ef b==NH:: CA(_chg_atom,N,a) if NH<>xNH:: CP(_tmp_line,nl) fi + ef b==NH:: CA(_chg_atom,N,a) CP(_tmp_line,nl) CP(_com,_group_s) CA(_group_si,H,a) CP(_com,_group_e) ef b==N!:: CA(_chg_atom,N,a) CP(_com,_group_s) CA(_group_si,_,a) CP(_com,_group_e) ef b==N!2:: CA(_chg_atom,N,a) CP(_com,_group_s) CA(_group_si,!,a) CP(_com,_group_e) @@ -1322,7 +1312,7 @@ def proc_mol_out(expr n)= %-V3000--------------------------------------------------------------------------------------- elseif n=2: printf ""; printf " -MCFtoMOL- "&fsl(20)(info_s[1]); printf ""; - printf " 0 0 0 0 0 999 V3000"; + printf " 0 0 0 0 0 0 0 0 0 0 0 V3000"; printf "M V30 BEGIN CTAB"; printf "M V30 COUNTS "&decimal(cntA)&" "&decimal(cntB)&" 0 0 0"; printf "M V30 BEGIN ATOM"; @@ -1416,7 +1406,6 @@ 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 Ph:=Ph1:='(?6,-2=dl,-4=dl,-6=dl); Ph2:='(?6,-1=dl,-3=dl,-5=dl); -for i=4,5,6: for j=2 upto i-2: ?[i][j]:='(); endfor endfor for i=5,6,7,8: for j=11 upto 15: ?[i][j]:='(); endfor endfor %------------------------------------------------------------------------------------------------- !:=!1:='((_mk_bond,_arrange_ang)); !!:='(!~db); !!!:='(!~tm); @@ -1455,9 +1444,10 @@ R6:='("R6"); R7:='("{R^7^}"); R8:='("{R^8^}"); R9:='("{R^9^}"); R10:='("R^10^"); hexose_hp:='(#1.4,-30~wf_r,30~bd_r`1,30~wb_r,120,O,30,&1,##); Pyranose_hp:='(#1.4,-35~wf_r,35~bd_r`1,30~wb_r,130`1.66,O,&1,##); %------------------------------------------------------------------------------------------------- -xCH3:='(/H,/H^60,/H^-60); xNH:='(N,/H); xNH2:='(N,/H^60,/H^-60); xNO2:='(N,//O^60,//O^-60); -xOH:='(O,/H); xNO:='(N,//O); xSO2H:='(S,//O^60,/OH^-60); xSO3H:='(S,/OH,//O^60,//O^-60); -xCHO:='(//O^-60,/H^60); xCOOH:='(//O^-60,/xOH^60); xCN:='(/N~tm); xSH:='(S,/H); +xCH3:='(/H,/H^60,/H^-60); xNH:='(N,/H~nl); xNH2:='(N,/H~nl^60,/H~nl^-60); +xNO2:='(N,//O^60,//O^-60); xOH:='(O,/H~nl); xNO:='(N,//O); +xSO2H:='(S,//O^60,/OH^-60); xSO3H:='(S,/OH,//O^60,//O^-60); +xCHO:='(//O^-60,/H^60); xCOOH:='(//O^-60,/xOH^60); xCN:='(/N~tm); xSH:='(S,/H~nl); !xOH:='(!,xOH); !xCHO:='(!,xCHO); !xCOOH:='(!,xCOOH); !xCH3:='(!,xCH3); !xCN:='(!,xCN); !xNH2:='(!,xNH2); !xNO2:='(!,xNO2); !xSH:='(!,xSH); %================================================================================================= @@ -1555,10 +1545,10 @@ def proc_err(expr e,n)= err_adr[incr err_cnt]:=n; err_code[err_cnt]:=e; %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% def mc_query(text s)= begingroup - save f_mcf,f_line,unit_row,unit_cnt,line_s,row_cnt,semic_cnt,info_cnt,order,min_n,max_n, + save f_mcf,f_line,unit_row,unit_cnt,line_s,row_cnt,semic_cnt,info_cnt,order,min_n,max_n,firstc, sign_at,sign_n,filter_n,filter_tag,filter_var,filter_sign,filter_cnt,filter_p,lib_unit_cnt, at_colon,at_equal,at_less,at_greater,at_n,sort_tbl,key_s,sort_s,sign_s,sV,sS,sT,sort_oder; - string line_s[][],sort_s,sort_tbl[],key_s,filter_tag[],filter_var[],sign_s[],sV,sS,sT; + string line_s[][],sort_s,sort_tbl[],key_s,filter_tag[],filter_var[],sign_s[],sV,sS,sT,firstc; numeric row_cnt[],order[],order_tbl[],filter_sign[],filter_p[]; unit_row:=f_mcf:=mc_row:=info_cnt:=filter_cnt:=lib_unit_cnt:=0; unit_cnt:=1; file_input:=default_library; file_output:=default_temp_file; @@ -1592,10 +1582,10 @@ def mc_query(text s)= endfor %----------------------------------------------------------------------------------------------- forever: - temps:=readfrom file_input; exitif temps=EOF; - if subc(1,temps)<>"%": + temps:=readfrom file_input; exitif temps=EOF; firstc:=subc(1,temps); + if firstc<>"%": line_s[unit_cnt][incr unit_row]:=temps; - if subc(1,temps)=";": + if firstc=";": row_cnt[unit_cnt]:=unit_row; f_mcf:=unit_row:=0; filter_n:=1; for i=1 upto filter_cnt: filter_p[i]:=0; endfor sort_s:=""; @@ -1616,8 +1606,8 @@ def mc_query(text s)= for i=1 upto filter_cnt: if filter_p[i]=0: filter_n:=0; fi endfor info_cnt:=0; lib_unit_cnt:=lib_unit_cnt+1; if filter_n=1: if key_s<>"": sort_tbl[unit_cnt]:=sort_s; fi unit_cnt:=unit_cnt+1; fi - ef (subc(1,temps)=":")or(subc(1,temps)="="): f_mcf:=1; mc_row:=1; - ef subc(1,temps)<>"%": + ef (firstc=":")or(firstc="="): f_mcf:=1; mc_row:=1; + ef firstc<>"%": if f_mcf=1: mc_row:=mc_row+1; else: info_cnt:=split_str(temps,";")(arg_s); fi fi fi endfor |