diff options
author | Karl Berry <karl@freefriends.org> | 2017-01-03 22:12:39 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2017-01-03 22:12:39 +0000 |
commit | e5bd1a71b2d73673d39428bdd10199da042ae49b (patch) | |
tree | e695b5f26508115ed4ccad08dd315b3eee8d45c1 /Master/texmf-dist/metapost | |
parent | ee7e5756af0efc841ca12c562874d8fee56d6d1f (diff) |
mcf2graph (3jan17)
git-svn-id: svn://tug.org/texlive/trunk@42854 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/metapost')
-rw-r--r-- | Master/texmf-dist/metapost/mcf2graph/mcf2graph.mf | 66 |
1 files changed, 37 insertions, 29 deletions
diff --git a/Master/texmf-dist/metapost/mcf2graph/mcf2graph.mf b/Master/texmf-dist/metapost/mcf2graph/mcf2graph.mf index 01d2d083e29..223757cbb3a 100644 --- a/Master/texmf-dist/metapost/mcf2graph/mcf2graph.mf +++ b/Master/texmf-dist/metapost/mcf2graph/mcf2graph.mf @@ -1,5 +1,5 @@ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -% mcf2graph ver 4.05 Copyright (c) 2013-2016 Akira Yamaji +% mcf2graph ver 4.06 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, @@ -30,7 +30,7 @@ % Set output checklist : mpost -s ahlength=2 FILENAME %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% tracingstats:=1; -message " This is mcf2graph ver 4.0 2016.11"; +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[], @@ -91,7 +91,7 @@ def_com(-4000)(_term,_jp_atom,_jp_atom_abs,_jp_bond,_cyc,_cyc_sB,_cyc_eB,_set_li _dl,_N,_O,_S,_H,_tmp_line,_chg_len,_get_len,_ring_len,_tmp_len,_rot_ang,_adj_ang,_chg_env, _tmp_env,_set_colorA,_set_colorB,_postA,_postB,_postC,_postD,_postE,_postF,_set_psA,_stack_reset, _set_clr,_set_adr,_mk_bond,_set_atom,_arg_ang,_chg_atom,_tmp_rot,_fuse,_push,_pop,_size_a); -def_com(1)(si,dl,dr,dm,tm,wf,wb,bd,bz,zf,zb,dt,wv,nl,vf,vb,si_,wf_,wb_,bd_); +def_com(1)(si,dl,dr,db,dm,tm,wf,wb,bd,bz,zf,zb,dt,wv,nl,vf,vb,si_,wf_,wb_,bd_); %-------------------------------------------------------------------------------------------------- def parameter_list= sw_checklist,sw_numberA,sw_numberB,sw_mol_frame,sw_auxout,sw_solid,sw_expand,sw_MOLout, @@ -163,7 +163,7 @@ enddef; def set_def_MC= save /,*,//,/*,*/,**,~,~~,^,^^,`,'`,{,},<,>,>>,:>,&,&#,:,=,\,\\,*\,\*,@,$,#,|,||, d,w,z,inside_def_MC; - inside_def_MC:=1; d:=dl; w:=wf; z:=zf; + 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; vardef #primary a == if numeric a:: a-4095 elseif pair a:: a+(0,-4095) fi enddef; @@ -208,13 +208,13 @@ def ''(expr k)(text s)= endgroup enddef; %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -def !?(expr a)(expr b) = +def FR(expr a)(expr b) = PA(_jp_bond,a) PA(_get_len,a) PA(_push,0) PA(_chg_len,_ring_len) for i==1 upto b-2:: PA(_mk_bond,360 DIV b) endfor PA(_pop,0) if a>=1:: PA(_cyc_eB,0) elseif a>=-999:: PA(_cyc_eB,a-b+2) else:: PA(_cyc_eB,a) fi enddef; %------------------------------------------------------------------------------------------------- -def !!?(expr a)(expr b)(expr c) = +def FFR(expr a)(expr b)(expr c) = PA(_jp_bond,xpart(a)) PA(_push,0) if b==6:: PA(_chg_len,0) for i==1 upto c-1:: PA(_mk_bond,60) endfor elseif b==5:: if c==2:: PA(_chg_len,1.25) PA(_mk_bond,80) @@ -223,7 +223,7 @@ def !!?(expr a)(expr b)(expr c) = PA(_pop,0) if ypart(a)<=0:: PA(_cyc_eB,ypart(a)-c+1) else:: PA(_cyc_eB,ypart(a)) fi enddef; %------------------------------------------------------------------------------------------------- -def !??(expr a)(expr b)(expr c) = +def FRR(expr a)(expr b)(expr c) = if b==5:: PA(_jp_bond,a) PA(_push,0) PA(_chg_len,c DIV 10) PA(_mk_bond,72-((c-9) MUL 1.5)) PA(_mk_bond,72+(c-9)) PA(_mk_bond,72+(c-9)) PA(_pop,0) @@ -250,13 +250,13 @@ vardef $$(text t)(expr e) = if known e:: if numeric e:: if (e>=si)and(e<=bd_):: if e==dl:: for list==t:: PA(_dl,list) endfor else:: for list==t:: PA(_set_adr,list) PA(_set_line,e) endfor fi - elseif (e>=?3)and(e<=?20):: for list==t:: !?(list)(e-?3+3) endfor - elseif e==Ph1:: !?(t)(6) PA(_dl,-2) PA(_dl,-4) - elseif e==Ph2:: !?(t)(6) PA(_dl,-1) PA(_dl,-3) PA(_dl,-5) + elseif (e>=?3)and(e<=?20):: for list==t:: FR(list)(e-?3+3) endfor + elseif e==Ph1:: FR(t)(6) PA(_dl,-2) PA(_dl,-4) + elseif e==Ph2:: FR(t)(6) PA(_dl,-1) PA(_dl,-3) PA(_dl,-5) elseif comD[e][1]==_fuse:: - if comD[e][2]<=6:: for list==t:: !!?(list)(parD[e][1])(comD[e][2]) endfor + if comD[e][2]<=6:: for list==t:: FFR(list)(parD[e][1])(comD[e][2]) endfor elseif (comD[e][2]>=11)and(comD[e][2]<=15):: - for list==t:: !??(list)(parD[e][1])(comD[e][2]) endfor + for list==t:: FRR(list)(parD[e][1])(comD[e][2]) endfor fi fi elseif color e:: color_list[incr cntC]:=e; @@ -638,7 +638,7 @@ def draw_atom(expr NUM,POS,ANG,STR,WD)= endgroup enddef; %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -def draw_bond(expr n,BP,EP,ANG,LN)= +def draw_bond(expr NN,BP,EP,ANG,LN)= begingroup save ww,ap,am,hpt,Ls,Le,pA,pB,pC,pT; pair Ls,Le; @@ -650,12 +650,14 @@ def draw_bond(expr n,BP,EP,ANG,LN)= if sw_numberB>=1: clipping(0,0,posA[BP],posA[EP],nC); else: clipping(numS[BP],numS[EP],posA[BP],posA[EP],nC); fi pickup pencircle scaled bond_pen_wd; - if known colorB[n]: nB:=colorB[n]; fi + if known colorB[NN]: nB:=colorB[NN]; fi %--------------------------------------------------------------------------------------------- if (LN=si)or(sw_bond_single=1): draw pA Cp(nB); elseif LN=dl:draw pA Cp(nB); draw sfB(pC,bondgap,ap) Cp(nB); elseif LN=dr:draw pA Cp(nB); draw sfB(pC,bondgap,am) Cp(nB); elseif LN=dm:draw sfB(pB,bondgap/1.75,ap) Cp(nB); draw sfB(pB,bondgap/1.75,am) Cp(nB); + elseif LN=db:if ((ANG-ang_br[BP]) mod 360)<=180: nA:=ap; else: nA:=am; fi + draw pA Cp(nB); draw sfB(pC,bondgap,nA) Cp(nB); elseif LN=tm:draw pA Cp(nB);draw sfB(pA,bondgap,ap) Cp(nB); draw sfB(pA,bondgap,am) Cp(nB); elseif LN=wf:fill Ls--sfB(Le,ww,am)--sfB(Le,ww,ap)--cycle; elseif LN=wb:fill sfB(Ls,ww,am)--Le--sfB(Ls,ww,ap)--cycle; @@ -677,11 +679,11 @@ def draw_bond(expr n,BP,EP,ANG,LN)= elseif LN=bd_:erase draw 0.15[Ls,Le]--0.85[Ls,Le] wpcs 1.6bondgap; draw pA withpen penrazor rotated ap scaled bondgap Cp(nB); fi - if (sw_numberB>=1)and(n>=numberB_start)and(n<=numberB_end): - if sw_numberB=2: nB:=n-numberB_start+1; - elseif sw_numberB=3: if numberB_end<cntB: nB:=numberB_end-n+1; else: nB:=cntB-n+1; fi - else: nB:=n; fi - draw_atom(n,.5[posA[BP],posA[EP]],0,decimal(nB),1); fi + if (sw_numberB>=1)and(NN>=numberB_start)and(NN<=numberB_end): + if sw_numberB=2: nB:=NN-numberB_start+1; + elseif sw_numberB=3: if numberB_end<cntB: nB:=numberB_end-NN+1; else: nB:=cntB-NN+1; fi + else: nB:=NN; fi + draw_atom(NN,.5[posA[BP],posA[EP]],0,decimal(nB),1); fi fi endgroup enddef; @@ -739,12 +741,18 @@ 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,/Me); tBu:='(60,-2\,-3*,60); iPr:='(60,-2\); OMe:='(O,!); -SMe:='(S,!); OEt:='(O,!,Et); SEt:='(S,!,Et); OiPr:='(O,!,iPr); SiPr:='(S,!,iPr); -OPr:='(O,!,Pr); SPr:='(S,!,Pr); COO:='(//O,!,O); COOMe:='(COO,!); COMe:='(//O,!); -OCOMe:='(O,!,//O,!); COOEt:='(COO,!,Et); COOiPr:='(COO,!,iPr); COOPr:='(COO,!,Pr); -COOtBu:='(COO,!,tBu); NMeMe:='(N,/Me,!); NHCOMe:='(NH,!,//O,!); NHiPr:='(NH,!,iPr); -NHtBu:='(NH,!,tBu);NHH:='(N,/H,!,H); NHMe:='(NH,!); NHEt:='(NH,!,Et); +SO3:='("S{O_3_}"); NMe:='(N,/Me); tBu:='(60,-2\,-3*,60); iPr:='(60,-2\); +O!:='(O,!); OMe:=O!; O!2:='(O,!2); OEt:=O!2; O!3:='(O,!3); OPr:=O!3; OiPr:='(O,!,iPr); +S!:='(S,!); SMe:=S!; S!2:='(S,!2); SEt:=S!2; S!3:='(S,!3); SPr:=S!3; SiPr:='(S,!,iPr); +COO:='(//O,!,O); COO!:='(COO,!); COOMe:=COO!; CO!:='(//O,!); COMe:=CO!; +OCO!:='(O,!,//O,!); OCOMe:=OCO!; COO!2:='(COO,!,Et); COOEt:=COO!2; +COOiPr:='(COO,!,iPr); COO!3:='(COO,!3); COOPr:=COO!3; +COOtBu:='(COO,!,tBu); NMeMe:='(N,/Me,!); NHCO!:='(NH,!,//O,!); NHCOMe:=NHCO!; +NHiPr:='(NH,!,iPr); NHtBu:='(NH,!,tBu); NHH:='(N,/H,!,H); +NH!:='(NH,!); NHMe:=NH!; NH!2:='(NH,!2); NHEt:=NH!2; !NH!:='(!,NH,!); !CO!:='(!,//O,!); +!OH:='(!,OH); !SH:='(!,SH); !NH2:='(!,NH2); !O!:='(!,OMe); !OMe:=!O!; !COOH:='(!,COOH); +!CH3:='(!,"C{H_3_}"); !CN:='(!,CN); !iPr:='(!,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); %================================================================================================== @@ -954,10 +962,10 @@ def proc_calc_out= for i=1 upto cntA: knownA:=bond_cnt:=0; for j=1 upto cntB: - if (lineB[j]=dl)or(lineB[j]=dr)or(lineB[j]=dm): bondC[j]:=2; - elseif lineB[j]=tm: bondC[j]:=3; - elseif (lineB[j]=vf)or(lineB[j]=vb): bondC[j]:=0; - else: bondC[j]:=1; + if (lineB[j]>=dl)and(lineB[j]<=dm): bondC[j]:=2; + elseif lineB[j]=tm: bondC[j]:=3; + elseif (lineB[j]=vf)or(lineB[j]=vb): bondC[j]:=0; + else: bondC[j]:=1; fi if (sB[j]=i)or(eB[j]=i): bond_cnt:=bond_cnt+bondC[j]; fi endfor |