From 4593763b43ad40700fc52e8126a547508ba41391 Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Sun, 23 Aug 2015 21:43:38 +0000 Subject: mcf2graph (23aug15) git-svn-id: svn://tug.org/texlive/trunk@38188 c570f23f-e606-0410-a88d-b1316a301751 --- Master/texmf-dist/metapost/mcf2graph/mcf2graph.mf | 158 +++++++++++++--------- 1 file changed, 93 insertions(+), 65 deletions(-) (limited to 'Master/texmf-dist/metapost') diff --git a/Master/texmf-dist/metapost/mcf2graph/mcf2graph.mf b/Master/texmf-dist/metapost/mcf2graph/mcf2graph.mf index 0263485267c..8576614b35c 100644 --- a/Master/texmf-dist/metapost/mcf2graph/mcf2graph.mf +++ b/Master/texmf-dist/metapost/mcf2graph/mcf2graph.mf @@ -1,5 +1,5 @@ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -% mcf2graph ver 3.58 Copyright (c) 2013-2015 Akira Yamaji +% mcf2graph ver 3.59 Copyright (c) 2013-2015 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, @@ -42,9 +42,10 @@ path pA,pB,pC,pT; string info[],tblA[],com_str[],calc_formula,mp_log_name,mol_name,mol_formula,calc_weight_str; picture atom_font[],chem_structure,temp_picture; %------------------------------------------------------------------------------------------------- -sw_numberA:=sw_numberB:=sw_frame:=sw_logout:=sw_solid:=sw_expand:=sw_start_vector:=0; -sw_atom_frame:=sw_checklist:=sw_MOLfile:=char_num:=str_cnt:=size_changed:=proc_end:=0; -sw_info_file:=sw_info_char:=1; sw_info_lenx:=sw_info_leny:=sw_info_weight:=sw_info_formula:=0; +sw_numberA:=sw_numberB:=sw_mol_frame:=sw_logout:=sw_solid:=sw_expand:=sw_start_vector:=0; +sw_font_frame:=sw_atom_frame:=sw_checklist:=sw_MOLfile:=0; +sw_info_file:=sw_info_char:=1; sw_info_lenx:=sw_info_leny:=sw_info_weight:=sw_info_formula:=0; +char_num:=str_cnt:=size_changed:=proc_end:=0; if known green: f_MP:=1; mp_log_name:=jobname&"-info.aux"; if ahlength=1: proc_end:=1; fi % first molecular only @@ -69,11 +70,11 @@ clearit; chem_structure:=currentpicture; let DIV= /; let MUL= *; let LT= <; let GT= >; let AND= &; let :: = : ; let == = =; ?3:=?20:=??3:=??20:=Ph:=Ph1:=Ph2:=ph:=ph1:=ph2:=hz:=0; vt:=1; first_def_number:=500; user_def_number:=2500; ab_def_number:=3000; unit_e:=1/2048; -lr_margin:=tb_margin:=0.4mm; ratio_cr:=-0.66; ratio_atom_bond:=0.33; -ratio_thickness_bond:=0.015; offset_atom#:=0.7pt#; max_bond_width:=0.15; -ratio_pen_wd:=1.4; ratio_bondgap_bond:=0.15; ratio_zebra_gap:=0.12; -ratio_zebra_black:=0.4; ratio_wedge_bond:=0.15; font_gap:=.066; -offset_thick#:=0.2pt#; offset_gap#:=0.3pt#; offset_zebra_gap#:=0.1pt#; +lr_margin:=tb_margin:=0.4mm; ratio_chain_ring:= 0.66; ratio_atom_bond:=0.36; +ratio_thickness_bond:=0.015; offset_atom#:=0.8pt#; max_bond_width:=0.25; +ratio_char_bond:=1.5; ratio_bondgap_bond:=0.15; ratio_zebra_gap:=0.12; +ratio_zebra_black:=0.4; ratio_wedge_bond:=0.15; font_gap:=.066; +offset_thick#:=0.2pt#; offset_gap#:=0.3pt#; offset_zebra_gap#:=0.1pt#; par_s=ASCII("{"); par_e=ASCII("}"); score_u=ASCII("_"); hat=ASCII("^"); max_info_num:=12; for i:=1 upto max_info_num: info[i]:=":"; endfor def def_com(expr n)(text tx)= nA:=n; forsuffixes list=tx:: list:=nA; nA:=nA+1; endfor enddef; @@ -83,15 +84,18 @@ def_com(-4000)(_term,_jp_atom,_jp_atom_abs,_jp_bond,_cyc,_cyc_sB,_cyc_eB,_set_li _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,zf,zb,ov,dt,no,ar,vf,vb,wv,nl); %------------------------------------------------------------------------------------------------- -def parameter_list= sw_checklist,sw_numberA,sw_numberB,sw_frame,sw_logout,sw_solid,sw_expand, - sw_MOLfile,sw_start_vector,sw_atom_frame,lr_margin,tb_margin,ratio_atom_bond,ratio_thickness_bond, - ratio_cr,offset_atom,max_bond_width,ratio_pen_wd,ratio_bondgap_bond,ratio_zebra_black, - ratio_zebra_gap,ratio_wedge_bond,font_gap,offset_zebra_gap,offset_gap,offset_thick enddef; +def parameter_list= sw_checklist,sw_numberA,sw_numberB,sw_mol_frame,sw_logout,sw_solid,sw_expand, + sw_MOLfile,sw_start_vector,sw_atom_frame,sw_font_frame, + lr_margin,tb_margin,ratio_atom_bond,ratio_thickness_bond,ratio_char_bond, + ratio_chain_ring,offset_atom,max_bond_width,ratio_bondgap_bond,ratio_zebra_black, + ratio_zebra_gap,ratio_wedge_bond,font_gap,offset_zebra_gap,offset_gap,offset_thick +enddef; %------------------------------------------------------------------------------------------------- nA:=0; for list=parameter_list: st_p[incr nA]:=list; endfor def store_par(text t)= nA:=0; for list=t: if st_p[incr nA]<>list: st_p[nA]:=list; fi endfor enddef; def restore_par(text t)= nA:=0; - forsuffixes list=t: if list<>st_p[incr nA]: list:=st_p[nA]; fi endfor enddef; + forsuffixes list=t: if list<>st_p[incr nA]: list:=st_p[nA]; fi endfor +enddef; %------------------------------------------------------------------------------------------------- def beginfont(text s)= mol_name:=mol_formula:=""; len_x:=len_y:=cntA:=info_num:=mol_weight:=0; store_par(parameter_list); ratio_bond_width:=1mm#/font_wd#; @@ -100,11 +104,11 @@ def beginfont(text s)= mol_name:=mol_formula:=""; len_x:=len_y:=cntA:=info_num: if substring (0,2) of list="FM": mol_formula:=substring (3,length(list)) of list; fi if substring (0,2) of list="MW": mol_weight:=scantokens(substring (3,length(list)) of list); fi endfor - beginchar(char_num,font_wd#,font_ht#,0); clearit; enddef; + beginchar(char_num,font_wd#,font_ht#,0); clearit; +enddef; %------------------------------------------------------------------------------------------------- def endfont= - if sw_frame=1: AUX(draw_frame(len_x,len_y,(min_x,min_y),0.2pt);) fi - if sw_start_vector=1: AUX(start_vector) fi + if sw_font_frame=1: AUX(0,0)(draw_frame(font_wd,font_ht,(0,0),0.2pt);) fi if (sw_logout=1)or(sw_checklist=1)or(sw_MOLfile=1): mol_check; fi if sw_logout=1: logfile_out; fi if sw_checklist=1: checklist_out; fi @@ -116,15 +120,16 @@ def endfont= if proc_end=1: scantokens("bye"); fi enddef; %------------------------------------------------------------------------------------------------- -def size_setup= BL# := font_wd#*ratio_bond_width; - wedge_wd# := ratio_wedge_bond*BL#; +def size_setup= BL# := font_wd#*ratio_bond_width; + wedge_wd# := ratio_wedge_bond*BL#; zebra_gap# := ratio_zebra_gap*BL#+offset_zebra_gap#; - AL# := ratio_atom_bond*BL#+offset_atom#; - gap# := ratio_bondgap_bond*BL#+offset_gap#; - pen_wd# := ratio_thickness_bond*BL#+offset_thick#; - Apen_wd# := ratio_pen_wd*pen_wd#; - define_pixels(BL,zebra_gap,wedge_wd,AL,gap,pen_wd,Apen_wd,font_wd,font_ht); - font_size_setup; enddef; + AL# := ratio_atom_bond*BL#+offset_atom#; + gap# := ratio_bondgap_bond*BL#+offset_gap#; + bond_pen_wd# := ratio_thickness_bond*BL#+offset_thick#; + char_pen_wd# := ratio_char_bond*bond_pen_wd#; + define_pixels(BL,zebra_gap,wedge_wd,AL,gap,bond_pen_wd,char_pen_wd,font_wd,font_ht); + font_size_setup; +enddef; %------------------------------------------------------------------------------------------------- def scaling= min_x:=min_y:= 4095.999; max_x:=max_y:=-4095.999; for i=1 upto cntA: xpos:=xpart(posA[i]); ypos:=ypart(posA[i]); @@ -150,14 +155,16 @@ enddef; def resize(expr WD,HT)= if (len_y/len_x)>(font_ht/font_wd): factor:=(font_ht*HT-2tb_margin)/len_y; else: factor:=(font_wd*WD-2lr_margin)/len_x; fi - ratio_bond_width:=ratio_bond_width*factor; len_x:=len_x*factor; len_y:=len_y*factor; enddef; + ratio_bond_width:=ratio_bond_width*factor; len_x:=len_x*factor; len_y:=len_y*factor; +enddef; %------------------------------------------------------------------------------------------------- for i=1 upto 128: f_FON[i]=0; endfor asc0:=ASCII("0"); asc9:=ASCII("9"); def font_use_check= for i=1 upto 128: if f_FON[i]<>0: f_FON[i]:=0; fi endfor if (sw_numberA=1)or(sw_numberB=1): for j=asc0 upto asc9: f_FON[j]:=1; endfor else: for i=1 upto cntA: if strA[i]<>0: for j=0 upto length(com_str[strA[i]])-1: - f_FON[ASCII(pic_c(j,com_str[strA[i]]))]:=1; endfor fi endfor fi enddef; + f_FON[ASCII(pic_c(j,com_str[strA[i]]))]:=1; endfor fi endfor fi +enddef; %------------------------------------------------------------------------------------------------- vardef '(text s)= ''(incr mc_num)(s); mc_num enddef; def set_def_MC= @@ -198,14 +205,16 @@ enddef; %------------------------------------------------------------------------------------------------- def !?(expr a)(expr b)(expr c) = PB(_jp_bond,a) PB(_get_len,a) PB(_push,c) PB(_chg_len,_ring_len) for i==1 upto b-2:: PB(_mk_bond,360 DIV b) endfor PB(_pop,c) - if a>=1:: PB(_cyc_eB,0) elseif a<=0:: PB(_cyc_eB,a-b+2) else:: PB(_cyc_eB,a) fi enddef; + if a>=1:: PB(_cyc_eB,0) elseif a<=0:: PB(_cyc_eB,a-b+2) else:: PB(_cyc_eB,a) fi +enddef; %------------------------------------------------------------------------------------------------- def !!?(expr a)(expr b)(expr c)(expr n) = PB(_jp_bond,xpart(a)) PB(_push,n) if b==6:: PB(_chg_len,0) for i==1 upto c-1:: PB(_mk_bond,60) endfor elseif b==5:: if c==2:: PB(_chg_len,1.25) PB(_mk_bond,80) elseif c==3:: PB(_chg_len,1.1) PB(_mk_bond,78) PB(_mk_bond,72) fi elseif b==4:: PB(_chg_len,1.225) PB(_mk_bond,105) fi - PB(_pop,n) if ypart(a)<=0:: PB(_cyc_eB,ypart(a)-c+1) else:: PB(_cyc_eB,ypart(a)) fi enddef; + PB(_pop,n) if ypart(a)<=0:: PB(_cyc_eB,ypart(a)-c+1) else:: PB(_cyc_eB,ypart(a)) fi +enddef; %------------------------------------------------------------------------------------------------- def PB(expr b,c)= comMC[ab_num][incr cntBS]:=b; parMC[ab_num][cntBS]:=c; enddef; def $$(text t)(expr e) = begingroup save cntBS; cntBS:=0; ab_num:=ab_num+1; @@ -262,17 +271,19 @@ def ps_get(expr n)= cntC:=cntMC[0]; cntPS:=cntP; if ps_rot[i]<>0: PS(_rot_ang,ps_rot[i]) fi if ps_env[i]<>hz: PS(_chg_env,ps_env[i]) fi if (ps_line[i]<>0)and(ps_line[i]<>nl): PS(_tmp_line,ps_line[i]) fi - if ps_len[i]<>ratio_cr: PS(_tmp_len,ps_len[i]) fi PS(_chg_len,ratio_cr) + if ps_len[i]<>chainRT: PS(_tmp_len,ps_len[i]) fi PS(_chg_len,chainRT) if ps_line[i]<>nl: if ps_line[i]=no: PS(_adj_ang,0) fi PS(_mk_bond,0) fi for j=1 upto cntMC[ps_com[i]]: PS(comMC[ps_com[i]][j],parMC[ps_com[i]][j]) endfor PS(_pop,1) PS(_term,0) endfor - proc_atom(cntC+1); if cntP>cntPS: ps_get(cntPS+1); fi enddef; + proc_atom(cntC+1); if cntP>cntPS: ps_get(cntPS+1); fi +enddef; %------------------------------------------------------------------------------------------------- -def AUX(text s)=s addto chem_structure also currentpicture shifted(sft_X,sft_Y); clearit; enddef; +def AUX(expr a,b)(text s)=s addto chem_structure also currentpicture shifted(a,b); clearit; enddef; def MCf(text s)= MCd(1,1)(.5,.5)(s); enddef; %------------------------------------------------------------------------------------------------- -def MCd(expr RW,RH)(expr FW,FH)(text s)= mc_num:=user_def_number; ab_num:=ab_def_number; +def MCd(expr RW,RH)(expr FW,FH)(text s)= + mc_num:=user_def_number; ab_num:=ab_def_number; chainRT:=-ratio_chain_ring; adrA:=adrB:=cntA:=cntB:=adrS:=cntPS:=angA[0]:=angB[0]:=br_ang[0]:=sB[0]:=cntC:=cntP:=0; stkA[0]:=stkB[0]:=stkL[0]:=stkM[0]:=strAT:=f_lineT:=f_lenT:=f_envT:=f_rotT:=0; eB[0]:=1; com_str[0]:=""; lineT:=si; str_cnt:=2000; posA[0]:=posB[0]:=posB[1]:=(0,0); @@ -291,19 +302,22 @@ def MCd(expr RW,RH)(expr FW,FH)(text s)= mc_num:=user_def_number; ab_num:=ab_ if sw_numberA=1: put_string(i,posA[i],0,decimal(i),1); elseif sw_numberB=1: else: put_string(i,posA[i],br_ang[i],com_str[strA[i]],strW[strA[i]]); fi endfor sft_X:=-min_x+(font_wd-len_x)*FW; sft_Y:=-min_y+(font_ht-len_y)*FH; + if sw_mol_frame=1: AUX(sft_X,sft_Y)(draw_frame(len_x,len_y,(min_x,min_y),0.2pt);) fi + if sw_start_vector=1: AUX(sft_X,sft_Y)(start_vector) fi addto chem_structure also currentpicture shifted (sft_X,sft_Y); clearit; enddef; %------------------------------------------------------------------------------------------------ -def draw_frame(expr LX,LY,PS,PN)= - draw unitsquare xscaled LX yscaled LY shifted PS wpcs PN; enddef; +def draw_frame(expr LX,LY,PS,PN)= draw unitsquare xscaled LX yscaled LY shifted PS wpcs PN; +enddef; def start_vector= draw (posA[1] shifted (-1mm,0))--(posA[1] shifted (-4mm,0)) - withpen penrazor rotated 90 scaled .8mm; - fill (posA[1] shifted (-2mm,-1mm))--posA[1]--(posA[1] shifted (-2mm,1mm))--cycle; enddef; + withpen penrazor rotated 90 scaled .8mm; + fill (posA[1] shifted (-2mm,-1mm))--posA[1]--(posA[1] shifted (-2mm,1mm))--cycle; +enddef; %------------------------------------------------------------------------------------------------ def proc_atom(expr n)= f_Br:=f_En:=f_T:=rotT:=adrS:=f_lineT:=f_rotT:=f_lenT:=f_envT:=envT:=env:=0; - stkL[0]:=B_len:=ratio_cr; lenT:=ratio_cr; stkA[1]:=stkB[1]:=1; + stkL[0]:=B_len:=chainRT; lenT:=chainRT; stkA[1]:=stkB[1]:=1; for i=n upto cntMC[0]: com:= comMC[0][i]; par:=parMC[0][i]; if com=_push: if par=1: stkL[adrS]:=B_len; stkA[incr adrS]:=adrA:=cntA; stkB[adrS]:=adrB:=cntB; @@ -324,10 +338,10 @@ def proc_atom(expr n)= elseif com=_chg_atom: strA[getA(adrT)]:=parMC[par][1]; elseif com=_chg_len: if par=_ring_len: B_len:=ring_len; elseif par=0: - if lenT<>ratio_cr: B_len:=lenT; else: if B_len<0: B_len:=1; fi fi + if lenT<>chainRT: B_len:=lenT; else: if B_len<0: B_len:=1; fi fi else: B_len:=par; fi - elseif com=_get_len: if par=0: if B_len=ratio_cr: B_len:=lenT; fi - else: ring_len:=lenB[getB(par)]; fi + elseif com=_get_len: if par=0: if B_len=chainRT: B_len:=lenT; fi + else: ring_len:=lenB[getB(par)]; fi elseif com=_tmp_len: lenT:=par; elseif com=_set_line: lineB[getB(adrT)]:=par; elseif com=_dl: lineB[getB(par)]:=dl; @@ -340,8 +354,8 @@ def proc_atom(expr n)= elseif com=_tmp_env: envT:=par; elseif com=_set_clr: if par=1: if lineT<>si: f_lineT:=1; fi if rotT<>0: f_rotT:=1; fi - if lenT<>ratio_cr: f_lenT:=1; fi if envT<>hz: f_envT:=1; fi fi - if par=0: f_lineT:=f_rotT:=f_lenT:=f_envT:=rotT:=envT:=0; lineT:=si; lenT:=ratio_cr; fi + if lenT<>chainRT: f_lenT:=1; fi if envT<>hz: f_envT:=1; fi fi + if par=0: f_lineT:=f_rotT:=f_lenT:=f_envT:=rotT:=envT:=0; lineT:=si; lenT:=chainRT; fi elseif com=_term: termA; elseif com=_set_colorA: colorA[getA(adrT)]:=par; elseif com=_set_colorB: colorB[getB(adrT)]:=par; @@ -351,14 +365,16 @@ enddef; %------------------------------------------------------------------------------------------------- def ps_put(expr n,p)= ps_adr[incr cntP]:=n; ps_com[cntP]:=p; ps_len[cntP]:=lenT; ps_line[cntP]:=lineT; ps_rot[cntP]:=rotT; ps_env[cntP]:=envT; - if f_lineT=0: lineT:=si; fi if f_lenT=0: lenT:=ratio_cr; fi - if f_rotT=0: rotT:=0; fi if f_envT=0: envT:=hz; fi enddef; + if f_lineT=0: lineT:=si; fi if f_lenT=0: lenT:=chainRT; fi + if f_rotT=0: rotT:=0; fi if f_envT=0: envT:=hz; fi +enddef; %------------------------------------------------------------------------------------------------- def add_atom= lineB[incr cntB]:=lineT; lineT:=si; - if lenT=ratio_cr: lenB[cntB]:=B_len; else: lenB[cntB]:=lenT; lenT:=ratio_cr; fi + if lenT=chainRT: lenB[cntB]:=B_len; else: lenB[cntB]:=lenT; lenT:=chainRT; fi if f_Br=0: cntA:=cntA+1; sB[cntB]:=cntA; strA[cntA]:=strAT; strAT:=0; if f_MP=1: colorA[cntA]:=colorB[cntA]:=0; fi else: f_Br:=0; fi - if f_En=0: eB[cntB]:=cntA+1; f_T:=0; else: eB[cntB]:=f_En; f_En:=0; f_T:=1; fi enddef; + if f_En=0: eB[cntB]:=cntA+1; f_T:=0; else: eB[cntB]:=f_En; f_En:=0; f_T:=1; fi +enddef; %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% def proc_skelton= stkA[1]:=stkB[1]:=1; envT:=env:=f_lineT:=f_rotT:=f_lenT:=f_envT:=0; adrA:=adrB:=cntA:=cntB:=angT:=adrS:=f_En:=f_Br:=rotT:=f_T:=0; @@ -382,11 +398,11 @@ def proc_skelton= stkA[1]:=stkB[1]:=1; envT:=env:=f_lineT:=f_rotT:=f_lenT:=f_en elseif (com>=_postA)and(com<=_postF): rotT:=0; elseif com=_chg_env: env:=par; elseif com=_tmp_env: envT:=par; - elseif com=_set_clr: f_clr:=par; if par=0: lineT:=si; lenT:=ratio_cr; rotT:=envT:=0; fi + elseif com=_set_clr: f_clr:=par; if par=0: lineT:=si; lenT:=chainRT; rotT:=envT:=0; fi elseif com=_cyc: f_En:=1; proc_cyc(getA(par)); elseif com=_cyc_sB: f_En:=1; proc_cyc(sB[getB(par)]); elseif com=_cyc_eB: f_En:=1; proc_cyc(eB[getB(par)]); - elseif com=_term: termB; + elseif com=_term: termB; fi endfor enddef; @@ -401,7 +417,8 @@ def termB= if f_T=0: if f_Br=0: br_ang[incr cntA]:=angT; else: f_Br:=0; fi f_T:= def proc_cyc(expr n)= add_B(angle(posA[n]-posB[cntB+1])-angT); enddef; def glu_c(expr n)= if strA[n]<>0: nB:=angT mod 180; nC:=.5strW[strA[n]]*AL; if (nB<45)or(nB>135):glu:=glu+((sind(nB)*nC)++nC); - else :glu:=glu+((cosd(nB)*.5AL)++.5AL) fi fi enddef; + else :glu:=glu+((cosd(nB)*.5AL)++.5AL) fi fi +enddef; %------------------------------------------------------------------------------------------------- def add_B(expr m)= cntB:=cntB+1; if m=_arg_ang: tn:=proc_env(angT,env,60,-60); else: tn:=m; fi @@ -420,7 +437,8 @@ vardef proc_env(expr n,m,a,b)= r:=(n mod 360); if m>=first_def_number: parMC[m][cntB-temp_cntB-1] else: if m=hz:if r=0:a elseif r<=90:b elseif r<=180:a elseif r<270:b else:a fi elseif m=vt:if r=0:b elseif r<90:a elseif r<=180:b elseif r<=271:a else:b fi - elseif (m>=-180)and(m<=180): m fi fi enddef; + elseif (m>=-180)and(m<=180): m fi fi +enddef; %------------------------------------------------------------------------------------------------- def pic_c(expr i,s)= substring(i,i+1) of s enddef; def put_string(expr n,p,r,s,w)= @@ -436,7 +454,8 @@ def put_string(expr n,p,r,s,w)= if (sw_numberA=1)or(sw_numberB=1): erase fill unitsquare xscaled nA yscaled AL shifted pairA wpcs 0.01pt; fi addto currentpicture also atom_font[nB] shifted (pairA-(0,atom_d[nB])) Cp(colorA[n]); - pairT:=pairT+(nA*dx,0); fi endfor enddef; + pairT:=pairT+(nA*dx,0); fi endfor +enddef; %------------------------------------------------------------------------------------------------- def wpcs expr n= withpen pencircle scaled n enddef; def sqr(expr WD,HT)= ((0,0)--(WD,0)--(WD,HT)--(0,HT)--cycle) enddef; @@ -455,18 +474,19 @@ def clipping(expr SA,SB,PA,PB,LEN)= pT:=PA--PB; tn:=0.6AL/LEN; elseif SB=0: Ls:= cut_off(pT,AL*strW[SA],AL,PA); Le:=PB; pA:=Ls--Le; pB:=tn[PA,PB]--Le; pC:=Ls--(0.1)[PB,PA]; else: Ls:=cut_off(pT,AL*strW[SA],AL,PA); Le:=cut_off(pT,AL*strW[SB],AL,PB); - pB:=tn[PA,PB]--tn[PB,PA]; pC:=pA:=Ls--Le; fi enddef; + pB:=tn[PA,PB]--tn[PB,PA]; pC:=pA:=Ls--Le; fi +enddef; %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -def draw_wv= nB:=3pen_wd; nA:=nB/length(Le-Ls); +def draw_wv= nB:=3bond_pen_wd; nA:=nB/length(Le-Ls); draw Le for i=1 upto 1/nA: if odd(i): ..controls(((i-.5)*nA)[sfB(Le,nB,ap),sfB(Ls,nB,ap)]) else: ..controls(((i-.5)*nA)[sfB(Le,nB,am),sfB(Ls,nB,am)]) fi ..(i*nA)[Le,Ls] endfor ..Ls; enddef; %------------------------------------------------------------------------------------------------- def put_bond(expr n,BP,EP,ANG,LN)= nC:=length(posA[EP]-posA[BP]); -if (nC>0)and(LN<>0): ww:=wedge_wd; hpt:=.5pen_wd; ap:=ANG+90; am:=ANG-90; +if (nC>0)and(LN<>0): ww:=wedge_wd; hpt:=.5bond_pen_wd; ap:=ANG+90; am:=ANG-90; if sw_numberB=1: clipping(0,0,posA[BP],posA[EP],nC); else: clipping(strA[BP],strA[EP],posA[BP],posA[EP],nC); fi - pickup pencircle scaled pen_wd; + pickup pencircle scaled bond_pen_wd; if known colorB[n]: nB:=colorB[n]; fi if LN=si:draw pA Cp(nB); elseif LN=dl:draw pA Cp(nB); draw sfB(pC,gap,ap) Cp(nB); @@ -539,13 +559,15 @@ enddef; def font_size_set(expr m)(expr n)(expr o)(expr s)=% for j=0 upto length(s)-1: num_a:=ASCII(pic_c(j,s)); if f_FON[num_a]=1: atom_w[num_a]:=m*AL; atom_h[num_a]:=n*AL; atom_d[num_a]:=o*AL; fi - endfor enddef; + endfor +enddef; def font_size_setup= font_size_set( 1)( 1)(0)("CGHMNOQ"); font_size_set( .9)( 1)(0)("ABDEFIJKLPRSTUVWXYZ-+/>n: - warning(fdr(4)(s)&" ["&com_str[strA[s]]&"] has "&fdr(3)(nA)&" bonds"); fi fi enddef; + warning(fdr(4)(s)&" ["&com_str[strA[s]]&"] has "&fdr(3)(nA)&" bonds"); fi fi +enddef; vardef stripP(expr a)=if length(a)=4: substring (1,3) of a else: a fi enddef; def STa(expr a,b)= tblA[incr tbl_cnt]:=a; tblN[tbl_cnt]:=0; wtA[tbl_cnt]:=b; enddef; def STb(expr a)(text s)= tblA[incr tbl_cnt]:=a; tblN[tbl_cnt]:=0; for list=s: tblN[tbl_cnt]:=tblN[tbl_cnt]+1; for j=1 upto tbl_max: if list=tblA[j]: tblB[tbl_cnt][tblN[tbl_cnt]]:=j; fi endfor - endfor enddef; + endfor +enddef; %------------------------------------------------------------------------------------------------- tbl_cnt:=0; STa("C",12.0107); STa("H",1.00794); STa("{Al}",26.9815); STa("{As}",74.9236); STa("B",10.811); @@ -711,7 +736,8 @@ def checklist_out= nA:=0; calc_weight_str:=""; message "% width * height = " & fdr(8)(max_x-min_x)&" * "&fdr(8)(max_y-min_y); message "% Shift width * height = "& fdr(8)(min_x)&" * "&fdr(8)(min_y); message "% Bond length = "&fdr(3)(BL)&" Atom size = "&fdr(3)(AL); - message "% Atom count="&fdr(3)(cntA)&" Bond count="&fdr(3)(cntB)&" Ring count="&fdr(3)(cntB-cntA+1); + message "% Atom count="&fdr(3)(cntA)&" Bond count="&fdr(3)(cntB)& + " Ring count="&fdr(3)(cntB-cntA+1); message "% Hide H = "&fdr(3)(hide_H); message "%-----------------------------------< atom >< bond >-------"; for i=1 upto cntA: message "% "&fdr(3)(i)&" ("&fdr(10)(xpart(posA[i])/BL)&" ) ("& @@ -729,7 +755,8 @@ def checklist_out= nA:=0; calc_weight_str:=""; message "% Weight Calc: " &calc_weight_str &" / Input: " if mol_weight>0: &decimal(mol_weight) &" / weight gap= " &decimal(calc_weight-mol_weight) fi; message "% Fomula Calc: "&calc_formula&" / Input: " - if mol_formula<>"":&mol_formula&" / "& if mol_formula=calc_formula: "MACTCH" else: "NOT MACTCH" fi fi; + if mol_formula<>"":&mol_formula&" / "& + if mol_formula=calc_formula: "MACTCH" else: "NOT MACTCH" fi fi; message "%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%"; enddef; %------------------------------------------------------------------------------------------------ @@ -745,5 +772,6 @@ def MOL_out= mp_log_name:=jobname&"-"&fit_zero(char_num)&decimal(char_num)&"-"& elseif (lineB[i]=zf)or(lineB[i]=wb)or(lineB[i]=dt): nB:=6; elseif lineB[i]=wv: nB:=4; else: nA:=1; nB:=0; fi printf fdr(3)(sB[i])&fdr(3)(eB[i])&fdr(3)(nA)&fdr(3)(nB)&" 0 0"; fi endfor - printf "M END"; enddef; + printf "M END"; +enddef; %------------------------------------------------------------------------------------------------ -- cgit v1.2.3