diff options
author | Karl Berry <karl@freefriends.org> | 2017-05-03 21:17:47 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2017-05-03 21:17:47 +0000 |
commit | a39480453d5a8a29aab5e8bf7967851df1d3b22d (patch) | |
tree | bef11eca41025de94134751e3beead2bc0a78fee /Master/texmf-dist/metapost | |
parent | 4e7b82c1404873f4f33e88f28265132a09b95ae7 (diff) |
mcf2graph (3may17)
git-svn-id: svn://tug.org/texlive/trunk@44168 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/metapost')
-rw-r--r-- | Master/texmf-dist/metapost/mcf2graph/mcf2graph.mf | 83 |
1 files changed, 49 insertions, 34 deletions
diff --git a/Master/texmf-dist/metapost/mcf2graph/mcf2graph.mf b/Master/texmf-dist/metapost/mcf2graph/mcf2graph.mf index 3228dc57951..1dff2e0bc02 100644 --- a/Master/texmf-dist/metapost/mcf2graph/mcf2graph.mf +++ b/Master/texmf-dist/metapost/mcf2graph/mcf2graph.mf @@ -1,5 +1,5 @@ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -% mcf2graph ver 4.20 Copyright (c) 2013-2017 Akira Yamaji +% mcf2graph ver 4.21 Copyright (c) 2013-2017 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, @@ -28,10 +28,10 @@ % Set outputformat to MDL Molfile : mpost -s ahangle=3 FILENAME % Set make first font only : mpost -s ahlength=1 FILENAME % Set output report : mpost -s ahlength=2 FILENAME -% Set to use metapost label,arrow : mpost -s ahlength=3 FILENAME +% Set to use plain.mp label,arrow : mpost -s ahlength=3 FILENAME %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% tracingstats:=1; -message " This is mcf2graph ver 4.2 2017.3"; +message " This is mcf2graph ver 4.2 2017.5"; %------------------------------------------------------------------------------------------------- newinternal nA,nB,nC,nD,nE,nF,char_num,str_cnt,def_num,def_int,tbl_cnt; numeric save_para[],comD[][],parD[][],cntD[],tbl_str_wd[],tbl_atom[],tbl_subst[][],tbl_atom_wt[], @@ -186,8 +186,8 @@ def endfont= enddef; %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% def set_def_MC= - save /,*,//,/*,*/,**,~,~~,^,^^,`,'`,{,},<,>,>>,:>,&,&#,:,=,\,\\,*\,\*,@,$,#,|,||,_, - d,w,z,inside_def_MC; + save /,*,//,/*,*/,**,~,~~,^,^^,`,'`,<,>,>>,:>,&,&#,:,=,\,\\,*\,\*,@,$,#, + |,||,|<,>|,|:,:|,_,d,w,z,inside_def_MC; inside_def_MC:=1; d:=db; w:=wf; z:=zf; vardef $(text a)tertiary b == $$(a)(b) enddef; tertiarydef a=b == $$(a)(b) enddef; vardef @(text a)tertiary b == @@(a)(b) enddef; tertiarydef a:b == @@(a)(b) enddef; @@ -201,9 +201,9 @@ def set_def_MC= tertiarydef a~b == ~~b,a enddef; tertiarydef a>b == :>b,a enddef; def * == (0,1) enddef; def \ == *,0 enddef; def \\ == *,0~dm enddef; def *\ == *,0~wf enddef; def \* == *,0~zf enddef; - def { == (_push,1) enddef; def } == (_pop,1) enddef; - def {{ == (_push,0) enddef; def }} == (_pop,0) enddef; - def | == {,} enddef; def || == (_stack_reset,0) enddef; + def |< == (_push,1) enddef; def >| == (_pop,1) enddef; + def | == |<,>| enddef; def || == (_stack_reset,0) enddef; + def |: == (_push,0) enddef; def :| == (_pop,0) enddef; def _ == Me enddef; def /secondary n == (_postA,n) enddef; def //secondary n == (_postB,n) enddef; def */secondary n == (_postC,n) enddef; def /*secondary n == (_postD,n) enddef; @@ -876,12 +876,12 @@ def_num:=def_emb_start; lr:='(60 for i==1 upto 10:: ,-60,60 endfor); rl:='(-60,lr); def ring expr n= <((-180 DIV n)-90),(_chg_len,0), for i==2 upto n:: ,(360 DIV n) endfor,(_cyc_sB,1-n) enddef; -for i=3 upto 20: ?[i]:='({{,ring i,}}); endfor +for i=3 upto 20: ?[i]:='(|:,ring i,:|); endfor Ph:=Ph1:='(?6,(_dl,-2),(_dl,-4),(_dl,-6)); Ph2:='(?6,(_dl,-1),(_dl,-3),(_dl,-5)); !:=!1:='((_mk_bond,_arg_ang)); for i=2 upto 20: - ![i]:='({{,(_get_len,0),! for j==2 upto i::,! endfor,}}); + ![i]:='(|:,(_get_len,0),! for j==2 upto i::,! endfor,:|); endfor !!:='(!,(_mb,db)); !!!:='(!,(_mb,tm)); @@ -1203,50 +1203,66 @@ vardef round_auto(expr n)= enddef; %-------------------------------------------------------------------------------------------------- def proc_report_out= - message "%------------------------------------------------------------------"; - message "% Molecular name = "& inf_EN; - message "% Warnings = "&fdr(3)(warning_cnt)&" / Expanded command = "&decimal(cntD[0]); - message "% Width * Height = " & fdr(10)(mol_wd)&" * "&fdr(10)(mol_ht); - message "% Shift width * height = "& fdr(10)(minX)&" * "&fdr(10)(minY); - message "% Bond length = "&fdr(3)(bond_len)&" Atom size = "&fdr(3)(atom_wd); - message "% Atom count="&fdr(3)(cntA)&" Bond count="&fdr(3)(cntB)& + message "------------------------------------------------------------------"; + message " Molecular name = "& inf_EN; + message " Warnings = "&fdr(3)(warning_cnt)&" / Expanded command = "&decimal(cntD[0]); + message " Width * Height = " & fdr(10)(mol_wd)&" * "&fdr(10)(mol_ht); + message " Shift width * height = "& fdr(10)(minX)&" * "&fdr(10)(minY); + message " Bond length = "&fdr(3)(bond_len)&" Atom size = "&fdr(3)(atom_wd); + message " Atom count="&fdr(3)(cntA)&" Bond count="&fdr(3)(cntB)& " Ring count="&fdr(3)(cntB-cntA+1)&" Hide H count="&fdr(3)(cnt_hide_H); - message "%------------------------------------------------------------------"; - message "%< NO. >( x axis , y axis )< atom >< bond >< hide_H >"; + message "------------------------------------------------------------------"; + message "< NO. >( x axis , y axis )< atom >< bond >< hide_H >"; for i=1 upto cntA: - message "% A"&fdl(4)(i)&" ("&fdr(10)(round_auto(xpart(posA[i])/bond_len))&" , "& + message " A"&fdl(4)(i)&" ("&fdr(10)(round_auto(xpart(posA[i])/bond_len))&" , "& fdr(10)(round_auto(ypart(posA[i])/bond_len))&" ) "&fixed_l(8)(strD[numS[i]])& " "&fdr(3)(Bcnt[i]) if hideH[i]>0: &fdr(8)(hideH[i]) fi; endfor - message "%------------------------------------------------------------------"; - message "%< NO. >< bond (sdt)><angle + ( +- )><length ( pt )>"; + message "------------------------------------------------------------------"; + message "< NO. >< bond (sdt)><angle + ( +- )><length ( pt )>"; for i=1 upto cntB: nC:=lenB[i]; if nC=_size_a: nC:=ratio_atom_bond; elseif nC<0: nC:=-nC; fi if lineB[i]<>0: nB:=angB[i]; if nB>180: nB:=nB-360; fi - message "% B"&fdl(4)(i)&fdr(3)(sB[i])&" -> "&fdr(3)(eB[i])& + message " B"&fdl(4)(i)&fdr(3)(sB[i])&" -> "&fdr(3)(eB[i])& " ("&fdr(3)(bondC[i]-si+1)&")"&fdr(9)(round_auto(angB[i]))& " ("&fdr(6)(round_auto(nB))&")"&fdr(8)(nC)&" ("&fdr(8)(round_auto(nC*bond_len))&")"; fi endfor - message "%------------------------------------------------------------------"; - 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"; + message "------------------------------------------------------------------"; + message "<atom>( atom wt )[ mi wt ] < cnt > < sum wt >[ sum mi wt ]"; + 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: if sumA[i]>=1: nA:=tbl_atom_wt[i]/100*sumA[i]; - message "% "&fixed_l(4)(stripP(tbl_atom_str[i]))&"("&fdr(9)(tbl_atom_wt[i])& - ") * "&fdr(6)(sumA[i])&" = " - if nA<40: &fdr(12)(tbl_atom_wt[i]*sumA[i]); else: &fdr(12)(nA)&" * 100"; fi + nB:=tbl_atom_mi[i]/100*sumA[i]; + message " "& + fixed_l(5)(stripP(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])&"]"; + else: + &fdr(12)(nA)&" * 100"&"["&fdr(12)(nA)&" * 100"&"]"; + fi fi endfor - message "% Monoisotopic mass: "&cal_MI_str; - message "% Weight Calc: " &cal_MW_str &" / Input: " + message " Molecular Weight [Mono Isotopic] = "& + fixed_r(12)(cal_MW_str)&"["&fixed_r(12)(cal_MI_str)&"]"; + message "------------------------------------------------------------------"; + message " Weight Calc: " &cal_MW_str &" / Input: " if inf_MW<>"": &inf_MW &" / weight gap= " &decimal(MW_num-scantokens(inf_MW)) fi; - message "% Fomula Calc: "&cal_FM&" / Input: " + message " Fomula Calc: "&cal_FM&" / Input: " if inf_FM<>"": &inf_FM&" / "& if inf_FM=cal_FM: "MACTCH" else: "NOT MACTCH" fi fi; - message "%=================================================================="; + message "=================================================================="; enddef; %================================================================================================== def proc_MOLfile_out= @@ -1267,4 +1283,3 @@ enddef; %------------------------------------------------------------------------------------------------- vardef fit_zero(expr n)=if n<=9: "00" elseif n<=99: "0" fi enddef; %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -%% |