diff options
author | Karl Berry <karl@freefriends.org> | 2017-01-16 23:11:36 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2017-01-16 23:11:36 +0000 |
commit | 4e5fab2a66c40e3caa99cadd5e1a1d3788a14279 (patch) | |
tree | d281dad2bcc27403b2c963b00344079acafab331 /Master/texmf-dist/metapost/mcf2graph/mcf2graph.mf | |
parent | 6c8025cb60ed6910051ed5680516710673d65e19 (diff) |
mcf2graph (15jan17)
git-svn-id: svn://tug.org/texlive/trunk@42970 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/metapost/mcf2graph/mcf2graph.mf')
-rw-r--r-- | Master/texmf-dist/metapost/mcf2graph/mcf2graph.mf | 67 |
1 files changed, 41 insertions, 26 deletions
diff --git a/Master/texmf-dist/metapost/mcf2graph/mcf2graph.mf b/Master/texmf-dist/metapost/mcf2graph/mcf2graph.mf index d89c74fa161..86aed79aff3 100644 --- a/Master/texmf-dist/metapost/mcf2graph/mcf2graph.mf +++ b/Master/texmf-dist/metapost/mcf2graph/mcf2graph.mf @@ -1,5 +1,5 @@ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -% mcf2graph ver 4.07 Copyright (c) 2013-2017 Akira Yamaji +% mcf2graph ver 4.08 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, @@ -34,7 +34,7 @@ message " This is mcf2graph ver 4.0 2017.1"; %------------------------------------------------------------------------------------------------- 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[], - tbl_char_wd[],tbl_char_ht[],tbl_char_dp[]; + tbl_atom_mi[],tbl_char_wd[],tbl_char_ht[],tbl_char_dp[]; string tbl_atom_str[],strD[],var[],tag[],mp_log_name,aux_delimiter; picture atom_font[],mol_stru[]; %------------------------------------------------------------------------------------------------- @@ -744,17 +744,17 @@ Na:='("{Na}");Ca:='("{Ca}");Hg:='("{Hg}");Ni:='("{Ni}");Ti:='("{Ti}");U:='("U"); plus:='("+"); minus:='("-"); HH:='("H{_2_}"); NH:='(N,*/*H); NnoH:='(); SO:='(S,//O); SOO :='(S,//O^-35,//O^35); 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_}"); NMe:=N!:='(N,/Me); tBu:='(60,-2\,-3*,60); iPr:='(60,-2\); -OMe:=O!:='(O,!); OEt:=O!2:='(O,!2); OPr:=O!3:='(O,!3); OiPr:='(O,!,iPr); -SMe:=S!:='(S,!); SEt:=S!2:='(S,!2); SPr:=S!3:='(S,!3); SiPr:='(S,!,iPr); +SO3:='("S{O_3_}"); NMe:=N!:='(N,/Me); iPr:=Me!:='(60,-2\); tBu:='(60,-2\,-3*,60); +OMe:=O!:='(O,!); OEt:=O!2:='(O,!2); OPr:=O!3:='(O,!3); OiPr:=OMe!:='(O,!,iPr); +SMe:=S!:='(S,!); SEt:=S!2:='(S,!2); SPr:=S!3:='(S,!3); SiPr:=SMe!:='(S,!,iPr); COOMe:=COO!:='(//O,!,O,!); COMe:=CO!:='(//O,!); OCOMe:=OCO!:='(O,!,//O,!); COOEt:=COO!2:='(//O,!,O,!2); -COOiPr:='(//O,!,O,!,iPr); COOPr:=COO!3:='(//O,!,O,!3); -COOtBu:='(//O,!,O,!,tBu); NMeMe:='(N,/Me,!); NHCOMe:=NHCO!:='(NH,!,//O,!); -NHiPr:='(NH,!,iPr); NHtBu:='(NH,!,tBu); NHH:='(N,/H,!,H); +COOiPr:=COOMe!:='(//O,!,O,!,iPr); COOPr:=COO!3:='(//O,!,O,!3); +COOtBu:='(//O,!,O,!,tBu); NMeMe:=NMe!:='(N,/Me,!); NHCOMe:=NHCO!:='(NH,!,//O,!); +NHiPr:=NHMe!:='(NH,!,iPr); NHtBu:='(NH,!,tBu); NHH:='(N,/H,!,H); NHMe:=NH!:='(NH,!); NHEt:=NH!2:='(NH,!2); !NH!:='(!,NH,!); !CO!:='(!,//O,!); !OH:='(!,OH); !SH:='(!,SH); !NH2:='(!,NH2); !OMe:=!O!:='(!,OMe); !COOH:='(!,COOH); -!CH3:='(!,"C{H_3_}"); !CN:='(!,CN); !iPr:='(!,iPr); !tBu:='(!,tBu); !Ph:='(!,Ph); +!CH3:='(!,"C{H_3_}"); !CN:='(!,CN); !iPr:=!Me!:='(!,iPr); !tBu:='(!,tBu); !Ph:='(!,Ph); !?3:='(!,?3); !?4:='(!,?4); !?5:='(!,?5); !?6:='(!,?6); 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);O_H:='(O,!,H);CO_H:='(//O,!,H); @@ -911,8 +911,9 @@ def bond_check(expr a)(text s)= enddef; vardef stripP(expr a)=if length(a)=4: substring (1,3) of a else: a fi enddef; %================================================================================================== -def STa(expr a,b)= - tbl_atom_str[incr tbl_cnt]:=a; tbl_atom[tbl_cnt]:=0; tbl_atom_wt[tbl_cnt]:=b; +def STa(expr a,b,c)= + tbl_atom_str[incr tbl_cnt]:=a; tbl_atom[tbl_cnt]:=0; + tbl_atom_wt[tbl_cnt]:=b; tbl_atom_mi[tbl_cnt]:=c; enddef; %---------------------------------------------------------------------------------- def STb(expr a)(text s)= @@ -925,13 +926,22 @@ def STb(expr a)(text s)= enddef; %================================================================================================== tbl_cnt:=0; -STa("C" ,12.0107); STa("H" ,1.00794); STa("{Al}",26.9815); STa("{As}",74.9236); -STa("B" ,10.811); STa("{Br}",79.904); STa("{Ca}",40.078); STa("{Cl}",35.453); -STa("{Cu}",63.546); STa("D" ,2.012); STa("F" ,18.9984); STa("{Fe}",55.845); -STa("{Hg}",200.59); STa("I" ,126.90447); STa("K" ,39.0983); STa("{Li}",6.941); -STa("{Mg}",24.305); STa("N" ,14.0067); STa("{Na}",22.98977); STa("{Ni}",58.693); -STa("O" ,15.9994); STa("P" ,30.973761); STa("S" ,32.065); STa("{Si}",28.0855); -STa("{Sn}",118.71); STa("{Ti}",47.867); STa("{Zn}",65.409); +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("{Na}",22.98977, 22.9897692820); +STa("{Ni}",58.693, 57.93534241); STa("O" ,15.9994, 15.99491461957); +STa("P" ,30.973762, 30.97376199842); STa("S" ,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"); @@ -952,13 +962,13 @@ enddef; %================================================================================================== def proc_calc_out= begingroup - save warning_cnt,cal_MW,cal_MWp,knownA,cal_FM,bondC,tmp_wtp,bond_cnt,cnt_hide_H, + save warning_cnt,cal_MW,MWp,knownA,cal_FM,bondC,tmp_wtp,bond_cnt,cnt_hide_H, inf_NO,inf_EN,inf_JN,inf_FM,inf_CAS,inf_USE,inf_EXA,inf_EXB,inf_MW; numeric sumA[],bondC[],hideH[]; - string cal_FM,cal_MW,cal_MW_str,sumA,s_tag,s_var, + string cal_FM,cal_MW,cal_MW_str,cal_MI,cal_MI_str,sumA,s_tag,s_var, inf_NO,inf_EN,inf_JN,inf_FM,inf_CAS,inf_USE,inf_EXA,inf_EXB,inf_MW; inf_NO:=inf_EN:=inf_JN:=inf_FM:=inf_CAS:=inf_USE:=inf_EXA:=inf_EXB:=inf_MW:=""; - cal_MW:=cal_MW_str:=cal_FM:=""; cnt_hide_H:=warning_cnt:=cal_MW_num:=cal_MWp:=0; + cal_MW:=cal_MW_str:=cal_FM:=""; cnt_hide_H:=warning_cnt:=MW_num:=MI_num:=MWp:=0; %------------------------------------------------------------------------------------------ proc_get_info; for i=1 upto tbl_cnt: sumA[i]:=0; endfor @@ -1001,12 +1011,14 @@ def proc_calc_out= sumA[2]:=sumA[2]+cnt_hide_H; for i=1 upto tbl_cnt: if sumA[i]>=1: - nA:=tbl_atom_wt[i]/100*sumA[i]; cal_MWp:=cal_MWp+nA; - if (cal_MWp<40)and(nA<40): cal_MW_num:= cal_MW_num+tbl_atom_wt[i]*sumA[i]; fi + nA:=tbl_atom_wt[i]/100*sumA[i]; MWp:=MWp+nA; + if (MWp<40)and(nA<40): MW_num:= MW_num+tbl_atom_wt[i]*sumA[i]; + MI_num:= MI_num+tbl_atom_mi[i]*sumA[i]; fi cal_FM:=cal_FM&stripP(tbl_atom_str[i]) if sumA[i]>=2: &decimal(sumA[i]) fi; fi endfor - cal_MW:=substring (0,8) of decimal(cal_MW_num); + cal_MI:=substring (0,10) of decimal(MI_num); + cal_MW:=substring (0,8) of decimal(MW_num); if sw_auxout=1: proc_auxfile_out; fi if sw_checklist=1: proc_checklist_out; fi if sw_MOLout=1: proc_MOLfile_out; fi @@ -1061,7 +1073,9 @@ def proc_checklist_out= fi endfor message "%------------------------------------------------------------------"; - if cal_MWp<=40: cal_MW_str:=cal_MW; else: cal_MW_str:=fdr(10)(cal_MWp)&" * 100"; fi + 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]; @@ -1070,8 +1084,9 @@ def proc_checklist_out= if nA<40: &fdr(12)(tbl_atom_wt[i]*sumA[i]); else: &fdr(12)(nA)&" * 100"; fi fi endfor + message "% Mono isotopic:" &cal_MI_str; message "% Weight Calc: " &cal_MW_str &" / Input: " - if inf_MW<>"": &inf_MW &" / weight gap= " &decimal(cal_MW_num-scantokens(inf_MW)) fi; + if inf_MW<>"": &inf_MW &" / weight gap= " &decimal(MW_num-scantokens(inf_MW)) fi; message "% Fomula Calc: "&cal_FM&" / Input: " if inf_FM<>"": &inf_FM&" / "& if inf_FM=cal_FM: "MACTCH" else: "NOT MACTCH" fi fi; message "%=================================================================="; |