From d4bcdd471d32a18a14ce486284c593d3cb90f7a1 Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Mon, 10 Oct 2016 21:14:36 +0000 Subject: mcf2graph (10oct16) git-svn-id: svn://tug.org/texlive/trunk@42248 c570f23f-e606-0410-a88d-b1316a301751 --- Master/texmf-dist/metapost/mcf2graph/mcf2graph.mf | 204 +++++++++++++--------- 1 file changed, 122 insertions(+), 82 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 b674e468a9c..bca5145d9b3 100644 --- a/Master/texmf-dist/metapost/mcf2graph/mcf2graph.mf +++ b/Master/texmf-dist/metapost/mcf2graph/mcf2graph.mf @@ -1,5 +1,5 @@ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -% mcf2graph ver 3.97 Copyright (c) 2013-2016 Akira Yamaji +% mcf2graph ver 3.98 Copyright (c) 2013-2016 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 3.9 2016.8"; +message " This is mcf2graph ver 4.0 2016.10"; %------------------------------------------------------------------------------------------------- pair posB[],posA[],pairT,Ls,Le,pairA; numeric angB[],angA[],br_ang[],sB[],eB[],f_FON[],atom_w[],atom_h[],atom_d[],strA[],stkB[],stkA[], @@ -38,13 +38,13 @@ numeric angB[],angA[],br_ang[],sB[],eB[],f_FON[],atom_w[],atom_h[],atom_d[],strA comMC[][],parMC[][],stock_p[],cntMC[],colorA[],colorB[],tblN[],tblB[][],wtA[],sumA[], CH[],NH[],NO[],SO[],CCl[],CF[],CBr[],?[],![],Ph[]; path pA,pB,pC,pT; -string info[],tblA[],com_str[],var[],tag[],cal_FM,mp_log_name,inf_EN,inf_JN,inf_FM, - inf_CAS,inf_USE,inf_EXA,inf_EXB,inf_str,cal_MW_str,aux_delimiter; +string info[],tblA[],com_str[],var[],tag[],cal_FM,mp_log_name,inf_NO,inf_MW,inf_EN,inf_JN,inf_FM, + inf_CAS,inf_USE,inf_EXA,inf_EXB,inf_str,cal_MW_str,aux_delimiter,s_tag,s_var; picture atom_font[],chem_structure,temp_picture; %------------------------------------------------------------------------------------------------- sw_numberA:=sw_numberB:=sw_mol_frame:=sw_auxout:=sw_solid:=sw_expand:=sw_start_vector:=0; -char_num:=str_cnt:=proc_end:=sw_font_frame:=sw_atom_frame:=sw_checklist:=sw_MOLout:=0; -sw_subst_off:=sw_bond_single:=sw_auxfix:=0; +char_num:=str_cnt:=proc_end:=sw_font_frame:=sw_atom_frame:=sw_checklist:=0; +sw_MOLout:=sw_subst_off:=sw_bond_single:=sw_auxfix:=sw_clip:=0; numberA_start:=numberB_start:=1; numberA_end:=numberB_end:=4095; aux_max:=20; aux_delimiter:=";"; var1:="jobname"; tag1:="F"; var2:="char_num"; tag2:="C"; for i=3 upto aux_max: var[i]:=tag[i]:=""; endfor @@ -78,11 +78,12 @@ primarydef a SUB b = a-b enddef; ?3:=?20:=Ph:=Ph1:=Ph2:=hz:=0; vt:=1; first_def_number:=500; user_def_number:=2500; ab_def_number:=3000; margin_left_right:=margin_top_bottom:=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_zebragap_bond:=0.12; -ratio_zebra_black:=0.4; ratio_wedge_bond:=0.12; ratio_atomgap_atom:=.050; -offset_thickness#:=0.2pt#; offset_bond_gap#:=0.3pt#; offset_zebra_gap#:=0.1pt#; -offset_wedge#:=0.4pt#; +ratio_thickness_bond:=0.015; offset_atom#:=0.8pt#; +ratio_char_bond:=1.5; ratio_bondgap_bond:=0.15; ratio_zebragap_bond:=0.12; +ratio_zebra_black:=0.4; ratio_wedge_bond:=0.12; ratio_atomgap_atom:=.050; +offset_thickness#:=0.2pt#; offset_bond_gap#:=0.3pt#; offset_zebra_gap#:=0.1pt#; +offset_wedge#:=0.4pt#; thickness_font_frame#:=0.2pt#; +max_bond_length#:=10mm; bond_len#:=8mm#; par_s=ASCII("{"); par_e=ASCII("}"); score_u=ASCII("_"); hat=ASCII("^"); max_inf_num:=12; for i:=1 upto max_inf_num: info[i]:=":"; endfor def def_com(expr n)(text tx)= nA:=n; forsuffixes list=tx:: list:=nA; nA:=nA+1; endfor enddef; @@ -94,12 +95,12 @@ def_com(1)(si,dl,dr,dm,tm,wf,wb,bd,bz,zf,zb,dt,no,ar,vf,vb,wv,nl,si_,wf_,wb_,bd_ %------------------------------------------------------------------------------------------------- def parameter_list= sw_checklist,sw_numberA,sw_numberB,sw_mol_frame,sw_auxout,sw_solid,sw_expand,sw_MOLout, - sw_start_vector,sw_atom_frame,sw_font_frame,sw_subst_off,sw_bond_single, + sw_start_vector,sw_atom_frame,sw_font_frame,sw_subst_off,sw_bond_single,sw_clip, margin_left_right,margin_top_bottom,ratio_atom_bond,ratio_thickness_bond,ratio_char_bond, - ratio_chain_ring,offset_atom,offset_atom#,max_bond_width,ratio_bondgap_bond,ratio_zebra_black, - ratio_zebragap_bond,ratio_wedge_bond,ratio_atomgap_atom,offset_wedge,offset_wedge#, - offset_zebra_gap,offset_zebra_gap#,offset_bond_gap,offset_bond_gap#, - offset_thickness,offset_thickness#,numberA_start,numberA_end,numberB_start,numberB_end + ratio_chain_ring,offset_atom#,max_bond_width,ratio_bondgap_bond,ratio_zebra_black, + ratio_zebragap_bond,ratio_wedge_bond,ratio_atomgap_atom,bond_len#, + offset_wedge#,max_bond_length#,offset_zebra_gap#,offset_bond_gap#,thickness_font_frame#, + offset_thickness#,numberA_start,numberA_end,numberB_start,numberB_end enddef; %------------------------------------------------------------------------------------------------- nA:=0; for list=parameter_list: stock_p[incr nA]:=list; endfor @@ -110,29 +111,33 @@ def restore_par(text t)= nA:=0; enddef; %------------------------------------------------------------------------------------------------- def beginfont(text s)= - inf_EN:=inf_JN:=inf_FM:=inf_CAS:=inf_USE:=inf_EXA:=inf_EXB:=""; - len_x:=len_y:=cntA:=inf_num:=inf_MW:=f_beginchar:=0; - store_par(parameter_list); stock_wd#:=font_wd#; stock_ht#:=font_ht#; - ratio_bond_width:=1/30; - for list=s: inf_num:=inf_num+1; info[inf_num]:=list; - if substring (0,2) of list="NO": inf_NO:=scantokens(substring (3,length(list)) of list); - elseif substring (0,2) of list="MW": inf_MW:=scantokens(substring (3,length(list)) of list); - elseif substring (0,2) of list="EN": inf_EN:=substring (3,length(list)) of list; - elseif substring (0,2) of list="JN": inf_JN:=substring (3,length(list)) of list; - elseif substring (0,2) of list="FM": inf_FM:=substring (3,length(list)) of list; - elseif substring (0,3) of list="CAS": inf_CAS:=substring (4,length(list)) of list; - elseif substring (0,3) of list="USE": inf_USE:=substring (4,length(list)) of list; - elseif substring (0,3) of list="EXA": inf_EXA:=substring (4,length(list)) of list; - elseif substring (0,3) of list="EXB": inf_EXB:=substring (4,length(list)) of list; fi + inf_EN:=inf_JN:=inf_FM:=inf_CAS:=inf_USE:=inf_EXA:=inf_EXB:=""; inf_MW:="0"; + len_x:=len_y:=cntA:=inf_num:=f_beginchar:=0; + store_par(parameter_list); save_wd#:=font_wd#; save_ht#:=font_ht#; + ratio_bond_width:=0.025; + clearit; + for list=s: + inf_num:=inf_num+1; info[inf_num]:=list; + nA:=0; for i=0 upto length(list): if pic_c(i,list)=":": nA:=i; fi exitif nA>0; endfor + if nA>0: + s_tag:=substring (0,nA) of list; s_var:=substring (nA+1,length(list)) of list; + if s_tag="NO": inf_NO:=s_var; elseif s_tag="MW": inf_MW:=s_var; + elseif s_tag="EN": inf_EN:=s_var; elseif s_tag="JN": inf_JN:=s_var; + elseif s_tag="FM": inf_FM:=s_var; elseif s_tag="CAS": inf_CAS:=s_var; + elseif s_tag="USE": inf_USE:=s_var; elseif s_tag="EXA": inf_EXA:=s_var; + elseif s_tag="EXB": inf_EXB:=s_var; + fi + fi endfor enddef; %------------------------------------------------------------------------------------------------- def endfont= if (sw_font_frame=1)or(sw_font_frame=3): - AUX(0,0)(draw_frame(font_wd,font_ht,(0,0),0.2pt);) fi + AUX(0,0)(draw_frame(font_wd,font_ht,(0,0),thickness_font_frame);) fi if (sw_font_frame=2)or(sw_font_frame=3): AUX(0,0)(draw_frame(font_wd-2margin_left_right,font_ht-2margin_top_bottom, - (margin_left_right,margin_top_bottom),0.2pt);) fi + (margin_left_right,margin_top_bottom),thickness_font_frame);) fi + if sw_font_frame=4: AUX(0,0)(draw_corner(font_wd,font_ht,thickness_font_frame);) fi if (sw_auxout=1)or(sw_checklist=1)or(sw_MOLout=1): mol_check; fi if sw_auxout=1: auxfile_out; fi if sw_checklist=1: checklist_out; fi @@ -140,38 +145,44 @@ def endfont= if f_beginchar=1: char_num:=char_num+1; currentpicture:=chem_structure; chem_structure:=nullpicture; endchar; fi - restore_par(parameter_list); font_wd#:=stock_wd#; font_ht#:=stock_ht#; + restore_par(parameter_list); font_wd#:=save_wd#; font_ht#:=save_ht#; if proc_end=1: scantokens("bye"); fi enddef; %------------------------------------------------------------------------------------------------- def size_setup= - BL# := font_wd#*ratio_bond_width; - wedge_wd# := ratio_wedge_bond*BL#+offset_wedge#; - zebra_gap# := ratio_zebragap_bond*BL#+offset_zebra_gap#; - if (ratio_atom_bond*BL#+offset_atom#)<.8BL#: - AL#:=ratio_atom_bond*BL#+offset_atom#; else: AL#:=.8BL#; ratio_chain_ring:= .5; fi - gap# := ratio_bondgap_bond*BL#+offset_bond_gap#; - bond_pen_wd# := ratio_thickness_bond*BL#+offset_thickness#; - 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); + if sw_solid=0: bond_len#:=font_wd#*ratio_bond_width; fi + wedge_wd# := ratio_wedge_bond*bond_len#+offset_wedge#; + zebra_gap# := ratio_zebragap_bond*bond_len#+offset_zebra_gap#; + if (ratio_atom_bond*bond_len#+offset_atom#)<.8bond_len#: + atom_wd#:=ratio_atom_bond*bond_len#+offset_atom#; + else: + atom_wd#:=.8bond_len#; ratio_chain_ring:= .5; + fi + gap#:= ratio_bondgap_bond*bond_len#+offset_bond_gap#; + bond_pen_wd# := ratio_thickness_bond*bond_len#+offset_thickness#; + char_pen_wd# := ratio_char_bond*bond_pen_wd#; + define_pixels(bond_len,zebra_gap,wedge_wd,atom_wd,gap,bond_pen_wd,char_pen_wd, + font_wd,font_ht,thickness_font_frame); font_size_setup; enddef; %------------------------------------------------------------------------------------------------- -def scaling= min_x:=min_y:= 4095.999; max_x:=max_y:=-4095.999; +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]); if strA[i]<>0: str_len:=nC:=num_d:=0; - for j=0 upto length(com_str[strA[i]])-1: nA:=ASCII(pic_c(j,com_str[strA[i]])); + for j=0 upto length(com_str[strA[i]])-1: + nA:=ASCII(pic_c(j,com_str[strA[i]])); if (nA=score_u)or(nA=hat)or(nA=par_s)or(nA=par_e): - if (nA=hat)and(nC<.5AL): nC:=.5AL; fi; - if (nA=score_u)and(num_d<.5AL): num_d:=.5AL; fi; + if (nA=hat)and(nC<.5atom_wd): nC:=.5atom_wd; fi; + if (nA=score_u)and(num_d<.5atom_wd): num_d:=.5atom_wd; fi; else: str_len:=str_len+atom_w[nA]; fi endfor str_ang:=(br_ang[i] mod 360); num_f:=str_len; if (str_ang<=91)or(str_ang>=269): num_f:=0; else: str_len:=0; fi - if (xpos-num_f+.5AL)max_x: max_x:=xpos+str_len-.5AL; fi - if (ypos-num_d-.5AL)max_y: max_y:=ypos+nC+.5AL; fi + if (xpos-num_f+.5atom_wd)max_x: max_x:=xpos+str_len-.5atom_wd; fi + if (ypos-num_d-.5atom_wd)max_y: max_y:=ypos+nC+.5atom_wd; fi else: if xposmax_x: max_x:=xpos; fi if yposmax_y: max_y:=ypos; fi fi endfor @@ -365,7 +376,6 @@ def AUX(expr a,b)(text s)=s addto chem_structure also currentpicture shifted(a,b def MCf(text s)= MCd(1,1)(.5,.5)(s); enddef; % MC fill draw %------------------------------------------------------------------------------------------------- def MCd(expr RW,RH)(expr FW,FH)(text s)= - if f_beginchar=0: beginchar(char_num,font_wd#,font_ht#,0); clearit; f_beginchar:=1; fi mc_num:=user_def_number; ab_num:=ab_def_number; crR:=-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; @@ -375,13 +385,31 @@ def MCd(expr RW,RH)(expr FW,FH)(text s)= ''(0)(s,(_term,0)); proc_bond_atom(1); cntA_skeleton:=cntA; cntB_skeleton:=cntB; if cntP>0: ps_get(1); fi font_use_check; - if sw_solid=1: size_setup; proc_skeleton; scaling; - else: size_setup; proc_skeleton; scaling; resize(RW,RH); size_setup; - if ratio_bond_width>max_bond_width: - ratio_bond_width:=max_bond_width; size_setup; proc_skeleton; scaling; - else: for i=1 upto 4: proc_skeleton; scaling; resize(RW,RH); size_setup; endfor fi fi + if sw_solid>=1: + size_setup; proc_skeleton; scaling; + else: + size_setup; proc_skeleton; scaling; resize(RW,RH); size_setup; + if bond_len#>max_bond_length#: + sw_solid:=1; bond_len#:=max_bond_length#; + size_setup; proc_skeleton; scaling; sw_solid:=0; + else: + for i=1 upto 4: proc_skeleton; scaling; resize(RW,RH); size_setup; endfor + fi + fi font_setup; if sw_subst_off=1: cntA:=cntA_skeleton; cntB:=cntB_skeleton; fi + %---------------------------------------------------------------------------------------- + if f_beginchar=0: + if sw_clip=1: + f_wd#:=font_wd#*((len_x+2margin_left_right)/font_wd); + f_ht#:=font_ht#*((len_y+2margin_top_bottom)/font_ht); + font_wd:=len_x+2margin_left_right; font_ht:=len_y+2margin_top_bottom; + else: + f_wd#:=font_wd#; f_ht#:=font_ht#; + fi + beginchar(char_num,f_wd#,f_ht#,0); + f_beginchar:=1; + fi for i=1 upto cntB: if lineB[i]=si_: draw_bond(i,sB[i],eB[i],angB[i],lineB[i]); fi endfor for i=1 upto cntA: @@ -389,19 +417,27 @@ def MCd(expr RW,RH)(expr FW,FH)(text s)= if sw_numberA=2: nA:=i-numberA_start+1; elseif sw_numberA=3: if numberA_end=1: else: draw_atom(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; + sft_X:=margin_left_right-min_x+(font_wd-len_x-2margin_left_right)*FW; + sft_Y:=margin_top_bottom-min_y+(font_ht-len_y-2margin_top_bottom)*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; +def draw_frame(expr LX,LY,PS,PN)= + draw ((PN/2,PN/2)--(LX-PN/2,PN/2)--(LX-PN/2,LY-PN/2)--(PN/2,LY-PN/2)--cycle) shifted PS wpss PN; +enddef; +def draw_corner(expr LX,LY,PN)= + drawdot (PN/2,PN/2) wpss PN; drawdot (LX-PN/2,PN/2) wpss PN; + drawdot (LX-PN/2,LY-PN/2) wpss PN; drawdot (PN/2,LY-PN/2) wpss PN; enddef; def start_vector= draw (posA[1] shifted (-1mm,0))--(posA[1] shifted (-4mm,0)) withpen penrazor rotated 90 scaled .8mm; @@ -510,9 +546,9 @@ def termA= if f_term=0: if f_bra=0: strA[incr cntA]:=strAT; strAT:=0; def termB= if f_term=0: if f_bra=0: br_ang[incr cntA]:=angT; else: f_bra:=0; fi f_term:=1; fi enddef; def proc_cyc(expr n)= add_bond(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; +def glu_c(expr n)= if strA[n]<>0: nB:=angT mod 180; nC:=.5strW[strA[n]]*atom_wd; if (nB<45)or(nB>135):glu:=glu+((sind(nB)*nC)++nC); - else :glu:=glu+((cosd(nB)*.5AL)++.5AL) fi fi + else :glu:=glu+((cosd(nB)*.5atom_wd)++.5atom_wd) fi fi enddef; %------------------------------------------------------------------------------------------------- def add_bond(expr m)= @@ -521,9 +557,9 @@ def add_bond(expr m)= if tn>=0: br_ang[cntA]:=angT+tn/2-90; else: br_ang[cntA]:=angT+tn/2+90; fi else: f_bra:=0; fi angB[cntB]:=angT:=(angT+tn) mod 360; - if f_end=0: if lenB[cntB]=_size_a: posB[cntB+1]:=sfB(posB[cntB],AL,angT); + if f_end=0: if lenB[cntB]=_size_a: posB[cntB+1]:=sfB(posB[cntB],atom_wd,angT); else: nA:=lenB[cntB];glu:=0; if nA<0: nA:=-nA; glu_c(adrT);glu_c(cntA+1); fi - posB[cntB+1]:=sfB(posB[cntB],nA*BL+glu,angT); fi + posB[cntB+1]:=sfB(posB[cntB],nA*bond_len+glu,angT); fi posA[cntA+1]:=posB[cntB+1]; f_term:=0; else: f_end:=0; f_term:=1; fi enddef; @@ -539,21 +575,23 @@ enddef; def pic_c(expr i,s)= substring(i,i+1) of s enddef; def draw_atom(expr n,p,r,s,w)= if ((r mod 360)<=90+1)or((r mod 360)>=270-1): dx:=1; else: dx:=-1; fi - pairT:=p-(.5AL*w*dx,.5AL); u:=j:=0; + pairT:=p-(.5atom_wd*w*dx,.5atom_wd); u:=j:=0; for i=0 upto length(s)-1: nB:=ASCII(pic_c(i,s)); if dx<0: if nB=par_s:k:=i+1;j:=1;forever:exitif pic_c(i+(incr j),s)="}";endfor fi if j>0: nB:=ASCII(pic_c(k+(decr j),s)); fi fi if nB=score_u: if u=0: u:=-.5; else:u:=0; fi; elseif nB=hat: if u=0: u:= .5; else:u:=0; fi; - elseif (nB<>par_s)and(nB<>par_e): nA:=atom_w[nB]; pairA:=pairT+(.5*((dx-1)*nA),u*AL); - if sw_atom_frame=1: draw_frame(nA,AL,pairA,0.01pt); fi + elseif (nB<>par_s)and(nB<>par_e): + nA:=atom_w[nB]; pairA:=pairT+(.5*((dx-1)*nA),u*atom_wd); + if sw_atom_frame=1: draw_frame(nA,atom_wd,pairA,0.1pt); fi if (sw_numberA>=1)or(sw_numberB>=1): - erase fill unitsquare xscaled nA yscaled AL shifted pairA wpcs 0.01pt; fi + erase fill unitsquare xscaled nA yscaled atom_wd 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; %------------------------------------------------------------------------------------------------- def wpcs expr n= withpen pencircle scaled n enddef; +def wpss expr n= withpen pensquare scaled n enddef; def sqr(expr WD,HT)= ((0,0)--(WD,0)--(WD,HT)--(0,HT)--cycle) enddef; def sfB(expr p,l,r)= p shifted ((l,0) rotated r) enddef; def wz_put(expr PA,PB,PD,CL)= save nA,nC,nD; nC:=length(Le-Ls); @@ -568,13 +606,13 @@ def bz_put(expr PA,PB,PC,PD,CL)= save nA,nC,nD; nC:=length(Le-Ls); def cut_off(expr p,w,h,s)= p intersectionpoint sqr(1.1w,1.1h) shifted (s-(.5(1.1w),.5(1.1h))); enddef; def clipping(expr SA,SB,PA,PB,LEN)= - pT:=PA--PB; tn:=0.6AL/LEN; + pT:=PA--PB; tn:=0.6atom_wd/LEN; if (SA=0)and(SB=0): Ls:=PA; Le:=PB; pA:=pB:=pT; pC:=0.1[PA,PB]--0.1[PB,PA]; - elseif SA=0: Ls:=PA; Le:=cut_off(pT,AL*strW[SB],AL,PB); + elseif SA=0: Ls:=PA; Le:=cut_off(pT,atom_wd*strW[SB],atom_wd,PB); pA:=Ls--Le; pB:=Ls--tn[PB,PA]; pC:=0.1[PA,PB]--Le; - elseif SB=0: Ls:= cut_off(pT,AL*strW[SA],AL,PA); Le:=PB; + elseif SB=0: Ls:= cut_off(pT,atom_wd*strW[SA],atom_wd,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); + else: Ls:=cut_off(pT,atom_wd*strW[SA],atom_wd,PA); Le:=cut_off(pT,atom_wd*strW[SB],atom_wd,PB); pB:=tn[PA,PB]--tn[PB,PA]; pC:=pA:=Ls--Le; fi enddef; %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% @@ -679,7 +717,7 @@ 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 + if f_FON[num_a]=1: atom_w[num_a]:=m*atom_wd; atom_h[num_a]:=n*atom_wd; atom_d[num_a]:=o*atom_wd; fi endfor enddef; def font_size_setup= font_size_set( 1)( 1)(0)("CGHMNOQ"); @@ -703,7 +741,7 @@ if f_FON[ASCII(c)]=1: z01=( 0,hP); z02=(hP, 0); z03=(hP,hP); z05=(aW,hP); z07=(fW, 0); z08=( 0,hH); z09=(hP,hH); z10=(fW,hH); z12=( 0,fH); z13=(hP,fH); z14=(hW,fH); z16=(aW,fH); z18=(hP,aH); z19=(hW,hP); s; - atom_font[ASCII(c)]:=currentpicture shifted (ratio_atomgap_atom*AL,ratio_atomgap_atom*AL); + atom_font[ASCII(c)]:=currentpicture shifted (ratio_atomgap_atom*atom_wd,ratio_atomgap_atom*atom_wd); clearxy; save x,y; clearit; fi enddef; %------------------------------------------------------------------------------------------------- @@ -860,27 +898,29 @@ def checklist_out= " warnings / Expanded command count= "&decimal(cntMC[0]); 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 "% 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 ="&fdr(3)(hide_H); message "%-----------------------------------< atom >< bond >-------"; - for i=1 upto cntA: message "% "&fdr(3)(i)&" ("&fdr(10)(xpart(posA[i])/BL)&" ) ("& - fdr(10)(ypart(posA[i])/BL)&" ) "&fixed_l(8)(com_str[strA[i]])&" "&fdr(3)(Bcnt[i]); endfor + for i=1 upto cntA: message "% "&fdr(3)(i)&" ("&fdr(10)(xpart(posA[i])/bond_len)&" ) ("& + fdr(10)(ypart(posA[i])/bond_len)&" ) "&fixed_l(8)(com_str[strA[i]])&" "&fdr(3)(Bcnt[i]); + endfor message "%Bond list---------------------------------------------------------"; for i=1 upto cntB: if lineB[i]<>0: message "% "&fdr(3)(incr nA)&" "&fdr(3)(sB[i])& - " -> "&fdr(3)(eB[i])&" ("&fdr(3)(bondC[i]-si+1)&")"; fi endfor + " -> "&fdr(3)(eB[i])&" ("&fdr(3)(bondC[i]-si+1)&")"; fi + endfor message "%Fomula / Molecular weight ---------------------------------------"; if cal_MWp<=40: cal_MW_str:=fdr(10)(cal_MW); else: cal_MW_str:=fdr(10)(cal_MWp)&" * 100"; fi for i=1 upto tbl_max: if sumA[i]>=1: message "% "&fixed_l(4)(stripP(tblA[i]))&"("&fdr(9)(wtA[i])&") * "&fdr(6)(sumA[i])&" = " - if tmp_wtp<=40: &fdr(12)(wtA[i]*sumA[i]); else: &fdr(12)(tmp_wtp)&" * 100"; fi fi endfor + if tmp_wtp<=40: &fdr(12)(wtA[i]*sumA[i]); else: &fdr(12)(tmp_wtp)&" * 100"; fi fi + endfor message "% Weight Calc: " &cal_MW_str &" / Input: " - if inf_MW>0: &decimal(inf_MW) &" / weight gap= " &decimal(cal_MW-inf_MW) fi; + if scantokens(inf_MW)>0: &inf_MW &" / weight gap= " &decimal(cal_MW-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; + if inf_FM<>"":&inf_FM&" / "& if inf_FM=cal_FM: "MACTCH" else: "NOT MACTCH" fi fi; message "%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%"; enddef; %------------------------------------------------------------------------------------------------ @@ -888,7 +928,7 @@ def MOLfileout= mp_log_name:=jobname&"-"&fit_zero(char_num)&decimal(char_num)&"-"&inf_EN&".mol"; printf ""; printf " -MCFtoMOL- "&fixed_l(20)(info[1]); printf ""; printf fdr(3)(cntA)&fdr(3)(cntB)&" 0 0 0 0 0 0 0 0999 V2000"; - for i=1 upto cntA: printf fdr(10)(xpart(posA[i])/BL)& fdr(10)(ypart(posA[i])/BL)& + for i=1 upto cntA: printf fdr(10)(xpart(posA[i])/bond_len)& fdr(10)(ypart(posA[i])/bond_len)& fdr(10)(0)&" "&fixed_l(2)(stripP(com_str[strA[i]]))&" 0 0 0 0"; endfor for i=1 upto cntB: if lineB[i]<>0: if (lineB[i]=dl)or(lineB[i]=dr)or(lineB[i]=dm): nA:=2; -- cgit v1.2.3