diff options
author | Karl Berry <karl@freefriends.org> | 2019-03-21 20:47:41 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2019-03-21 20:47:41 +0000 |
commit | 65438f7ca8b6143d68f1f7f4ad1ace352d467047 (patch) | |
tree | fd377e15001332d353f8c8d1d877b81e93eb6656 /Master/texmf-dist/metapost | |
parent | bc1d30557d3d1db08de2b8c0dc7dc475a21cb6e9 (diff) |
mcf2graph (21mar19)
git-svn-id: svn://tug.org/texlive/trunk@50506 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/metapost')
-rw-r--r-- | Master/texmf-dist/metapost/mcf2graph/mcf2graph.mf | 251 |
1 files changed, 146 insertions, 105 deletions
diff --git a/Master/texmf-dist/metapost/mcf2graph/mcf2graph.mf b/Master/texmf-dist/metapost/mcf2graph/mcf2graph.mf index 0bf24fa9b01..75deb69c4d4 100644 --- a/Master/texmf-dist/metapost/mcf2graph/mcf2graph.mf +++ b/Master/texmf-dist/metapost/mcf2graph/mcf2graph.mf @@ -1,5 +1,5 @@ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -% mcf2graph ver 4.36 Copyright (c) 2013-2019 Akira Yamaji +% mcf2graph ver 4.40 Copyright (c) 2013-2019 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, @@ -36,19 +36,20 @@ % Set to use plain.mp (label,arrow,atom) : mpost -s labeloffset=2 FILENAME %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% tracingstats:=1; -message " This is mcf2graph ver 4.36 2019.02"; +message " This is mcf2graph ver 4.40 2019.03"; %------------------------------------------------------------------------------------------------- newinternal char_num,str_cnt,sub_usr,sub_int,tbl_cnt,sharp_char; -numeric save_para[],comD[][],parD[][],cntD[],tbl_atom[],tbl_subst[][],tbl_atom_wt[], - tbl_atom_mi[],tbl_char_wd[],tbl_char_ht[],andA[],and_rot[],chargeA[]; -string tbl_atom_str[],strD[],var[],tag[],out_file_name,out_file_aux,out_file_rep, +numeric save_num[],comD[][],parD[][],cntD[],tbl_atom[],tbl_subst[][], + tbl_atom_wt[],tbl_atom_mi[],tbl_char_wd[],tbl_char_ht[],andA[],and_rot[],chargeA[]; +string save_str[],tbl_atom_str[],strD[],var[],tag[],out_file_name,out_file_aux,out_file_rep, aux_delimiter,atomfont,save_atomfont,save_defaultfont; +pair save_pair[],msize,mposition,fsize,fmargin,save_mposition; picture mol_stru[]; path arrow_path,arrow_head; %------------------------------------------------------------------------------------------------- -char_num:=str_cnt:=proc_end:=sw_label_emu:=0; -sw_numberA:=sw_numberB:=sw_mol_frame:=sw_aux_out:=sw_solid:=sw_expand:=sw_font_frame:=sw_clip:=0; -sw_atom_frame:=sw_rep_out:=sw_mol_out:=sw_subst_off:=sw_bond_single:=sw_auxfix:=sw_arrow:=0; +char_num:=str_cnt:=proc_end:=mangle:=sw_label_emu:=0; +sw_numberA:=sw_numberB:=sw_mframe:=sw_aux_out:=sw_expand:=sw_fframe:=sw_trimming:=0; +sw_aframe:=sw_rep_out:=sw_mol_out:=sw_subst_off:=sw_single:=sw_auxfix:=sw_arrow:=0; numberA_start:=numberB_start:=1; numberA_end:=numberB_end:=4095; aux_max:=max_inf_num:=20; aux_delimiter:=";"; var1:="jobname"; tag1:="F"; var2:="char_num"; tag2:="C"; for i=3 upto aux_max: var[i]:=tag[i]:=""; endfor @@ -93,7 +94,6 @@ if (known green)and(known ahlength): else: outputtemplate:="%j-%3c."&outputformat; fi %----------------------------------------------------------------------------------------- - def beginchar(expr a,b,c,d)= beginfig(a) w:=b*pt; h:=c*pt; enddef; def endchar = endfig enddef; def printf expr s= write s to out_file_name enddef; def # = enddef; @@ -113,21 +113,22 @@ else: f_MP:=0; fi clearit; %-------------------------------------------------------------------------------------------------- -for i=0 upto 20: mol_stru[i]:=nullpicture; endfor -%-------------------------------------------------------------------------------------------------- let DIV= /; let MUL= *; let LT= <; let GT= >; let AND= &; let :: = : ; let == = =; let ef=elseif; %-------------------------------------------------------------------------------------------------- +primarydef a at b = fat(a,b) enddef; +def fat(expr a,b)= mposition:=b; a enddef; +%-------------------------------------------------------------------------------------------------- ?3:=?20:=Ph:=Ph1:=Ph2:=hz:=0; vt:=1; -margin_left_right:=margin_top_bottom:=0.4mm; -ratio_bond_width:=0.1; ratio_chain_ring:= 0.66; ratio_atom_bond:=0.36; +ratio_chain_ring:= 0.66; ratio_atom_bond:=0.36; ratio_thickness_bond:=0.015; ratio_thickness_char:=0.1; 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:=0.050; offset_thickness:=0.2bp; offset_bond_gap:=0.3bp; offset_zebra_gap:=0.1bp; offset_atom:=0.8pt; offset_wedge:=0.4bp; -thickness_font_frame:=0.2bp; thickness_atom_frame:=0.1bp; -max_bond_length:=10mm; bond_len:=8mm; -font_wd:=30mm; font_ht:=20mm; +thickness_fframe:=0.2bp; thickness_mframe:=0.2bp; thickness_aframe:=0.1bp; +max_blength:=10mm; blength:=0; mangle:=0; +%-------------------------------------------------------------------------------------------------- +fsize:=(30mm,20mm); fmargin:=(0.4mm,0.4mm); msize:=(1,1); mposition:=(0.5,0.5); %================================================================================================== ahangle:=45; ahlength:=4bp; @@ -150,16 +151,18 @@ def_com(-4000)(_term,_jp_atom,_jp_atom_abs,_jp_bond,_cyc,_cyc_sB,_cyc_eB,_set_li 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_rep_out,sw_numberA,sw_numberB,sw_mol_frame,sw_aux_out,sw_solid,sw_expand,sw_mol_out, - sw_atom_frame,sw_font_frame,sw_subst_off,sw_bond_single,sw_clip,sw_arrow,sw_label_emu, - margin_left_right,margin_top_bottom,ratio_atom_bond,ratio_thickness_bond,ratio_char_bond, + sw_rep_out,sw_numberA,sw_numberB,sw_mframe,sw_aux_out,sw_expand,sw_mol_out, + sw_aframe,sw_fframe,sw_subst_off,sw_single,sw_trimming,sw_arrow,sw_label_emu, + ratio_atom_bond,ratio_thickness_bond,ratio_char_bond, ratio_chain_ring,ratio_bondgap_bond,ratio_zebra_black,ratio_zebragap_bond,ratio_thickness_char, - ratio_wedge_bond,ratio_atomgap_atom,ratio_bond_width,font_wd,font_ht, - bond_len,offset_atom,offset_wedge,max_bond_length,offset_zebra_gap,offset_bond_gap, - thickness_font_frame,offset_thickness,numberA_start,numberA_end,numberB_start,numberB_end, - defaultsize,defaultscale,labeloffset, + ratio_wedge_bond,ratio_atomgap_atom, + blength,offset_atom,offset_wedge,max_blength,offset_zebra_gap,offset_bond_gap, + thickness_fframe,thickness_mframe,thickness_aframe,offset_thickness, + numberA_start,numberA_end,numberB_start,numberB_end, + defaultsize,defaultscale,labeloffset,mangle, Me,Et,Pr,Bu,iPr,tBu,CH3,CF3,CCl3,CBr3,NH,NH2,NO2,OH,CHO,COOH,CN,SH,OMe,OEt,SMe,SEt, - !CH3,!NH2,!OH,!CHO,!COOH,!CN,!SH,!NO2 + !CH3,!NH2,!OH,!CHO,!COOH,!CN,!SH,!NO2, + fsize,fmargin,msize,mposition,defaultfont,atomfont enddef; %-------------------------------------------------------------------------------------------------- def ]]]=] ] ] enddef; @@ -167,16 +170,39 @@ vardef iif(expr a,b,c)=if a: b else: c fi enddef; vardef pic_c(expr i,s)= substring(i,i+1) of s enddef; vardef sfB(expr a,b,c)= a shifted ((b,0) rotated c) enddef; %-------------------------------------------------------------------------------------------------- +def init_par(text t)= +nA:=nB:=nC:=0; + for list=t: + if numeric list: nA:=nA+1; save_num[nA]:=list; + elseif pair list: nB:=nB+1; save_pair[nB]:=list; + elseif string list: nC:=nC+1; save_str[nC]:=list; + fi + endfor +enddef; +%-------------------------------------------------------------------------------------------------- def store_par(text t)= - nA:=0; for list=t: nA:=nA+1; if save_para[nA]<>list: save_para[nA]:=list; fi endfor + nA:=nB:=nC:=0; + for list=t: + if numeric list: nA:=nA+1; if save_num[nA]<>list: save_num[nA]:=list; fi + elseif pair list: nB:=nB+1; if save_pair[nB]<>list: save_pair[nB]:=list; fi + elseif string list: nC:=nC+1; if save_str[nC]<>list: save_str[nC]:=list; fi + fi + endfor enddef; +%-------------------------------------------------------------------------------------------------- def restore_par(text t)= - nA:=0; forsuffixes list=t: nA:=nA+1; if list<>save_para[nA]: list:=save_para[nA]; fi endfor + nA:=nB:=nC:=0; + forsuffixes list=t: + if numeric list: nA:=nA+1; if list<>save_num[nA]: list:=save_num[nA]; fi + elseif pair list: nB:=nB+1; if list<>save_pair[nB]: list:=save_pair[nB]; fi + elseif string list: nC:=nC+1; if list<>save_str[nC]: list:=save_str[nC]; fi + fi + endfor enddef; %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% def beginfont(text s)= begingroup - save cntA,cntB,cntM,minX,minY,f_beginchar,numS,sftX,sftY,f_ext, + save cntA,cntB,cntM,minX,minY,f_beginchar,numS,sftX,sftY,f_ext,blen, cal_FM,cal_MW,cal_MW_str,cal_MI,cal_MI_str,wdM,htM, inf_NO,inf_EN,inf_JN,inf_FM,inf_CAS,inf_USE,inf_EXA,inf_EXB,inf_MW, posA,posM,lineB,sB,eB,angB,angA,wdA,dxA,lenB,ang_br,info; @@ -187,16 +213,14 @@ def beginfont(text s)= %------------------------------------------------------------------------------------------------ char_num:=char_num+1; store_par(parameter_list); - save_atomfont:=atomfont; - save_defaultfont:=defaultfont; - %------------------------------------------------------------------------------------------------ for i:=1 upto max_inf_num: info[i]:=":"; endfor f_ext:=inf_num:=cntM:=0; for list=s: inf_num:=inf_num+1; info[inf_num]:=list; endfor + mol_stru[0]:=nullpicture; enddef; %================================================================================================== def endfont= - if sw_clip>=1: + if sw_trimming>=1: nA:=nC:=4095; nB:=nD:=-4095; for i=1 upto cntM: if xpart(posM[1][i])<nA: nA:=xpart(posM[1][i]); fi @@ -204,27 +228,29 @@ def endfont= if ypart(posM[1][i])<nC: nC:=ypart(posM[1][i]); fi if ypart(posM[2][i])>nD: nD:=ypart(posM[2][i]); fi endfor - font_wd:=nB-nA+2margin_left_right; - font_ht:=nD-nC+2margin_top_bottom; - for i=1 upto cntM: posM[0][i]:=posM[0][i]+(margin_left_right-nA,margin_top_bottom-nC); + font_wd:=nB-nA+2margin_lr; + font_ht:=nD-nC+2margin_tb; + fsize:=(font_wd,font_ht); + for i=1 upto cntM: + posM[0][i]:=posM[0][i]+(margin_lr-nA,margin_tb-nC); + posM[1][i]:=posM[1][i]+(margin_lr-nA,margin_tb-nC); endfor fi %----------------------------------------------------------------------------------------------- - beginchar(char_num,font_wd/bp*bp#,font_ht/bp*bp#,0) - if (sw_font_frame=1)or(sw_font_frame=3): draw_frame((0,0),w,h,thickness_font_frame); fi - if (sw_font_frame=2)or(sw_font_frame=3): - nA:=w-2margin_left_right; nB:=h-2margin_top_bottom; - draw_frame((margin_left_right,margin_top_bottom),nA,nB,thickness_font_frame); fi - if sw_font_frame=4: draw_corner(w,h,thickness_font_frame); fi + if f_MP=0: beginchar(char_num,font_wd/bp*bp#,font_ht/bp*bp#,0) + else: beginfig(char_num) w:=charwd:=font_wd; h:=charht:=font_ht; chardp:=0; + fi + if (sw_fframe=1)or(sw_fframe=3): EXT(draw_frame((0,0),w,h,thickness_fframe);) fi + if (sw_fframe=2)or(sw_fframe=3): EXT(draw_frame(p0,w0,h0,thickness_fframe);) fi + if sw_fframe=4: EXT(drawdot(0,0); drawdot(w,0); drawdot(w,h); drawdot(0,h);) fi for i=1 upto cntM: addto currentpicture also mol_stru[i] shifted posM[0][i]; mol_stru[i]:=nullpicture; + if sw_mframe=1: EXT(draw_frame(p[i],w[i],h[i],thickness_mframe)) fi endfor if f_ext=1: addto currentpicture also mol_stru[0]; mol_stru[0]:=nullpicture; fi endchar; clearit; restore_par(parameter_list); - atomfont:=save_atomfont; - defaultfont:=save_defaultfont; endgroup; if proc_end=1: scantokens("bye"); fi enddef; @@ -434,11 +460,11 @@ def EXT(text TXT)= save w,h,wd,ht,n,p,am,aw; pair p[]; ext_setup; - w:=font_wd; - h:=font_ht; - w0:=w-2margin_left_right; - h0:=h-2margin_top_bottom; - p0:=(margin_left_right,margin_top_bottom); + w:=xpart(fsize); + h:=ypart(fsize); + w0:=w-2margin_lr; + h0:=h-2margin_tb; + p0:=(margin_lr,margin_tb); aw:=atom_wd; n:=cntM; for i=1 upto n: p[i]:=posM[1][i]; w[i]:=wdM[i]; h[i]:=htM[i]; endfor @@ -452,8 +478,9 @@ def ext(text TXT)= numeric A[]dir,B[]dir; pair p[],A[],B[],B[]s,B[]e; ext_setup; - w:=mol_wd; h:=mol_ht; l:=bond_len; aw:=atom_wd; - p0:=(minX,minY); An:=cntA; Bn:=cntB; + w:=mol_wd; h:=mol_ht; l:=blength; aw:=atom_wd; + p0:=(minX,minY); + An:=cntA; Bn:=cntB; for i=1 upto An: A[i]:=posA[i]; A[i]dir:=angX[i]; endfor for i=1 upto Bn: B[i]s:=posA[sB[i]]; B[i]e:=posA[eB[i]]; B[i]:=0.5[B[i]s,B[i]e]; B[i]dir:=angB[i]; @@ -541,15 +568,18 @@ def sub_ext(expr c)(expr a,b)= fi enddef; %================================================================================================= -def MCa(expr FW,FH)(text TXT)= MCd(1,1)(FW,FH)(TXT) enddef; -def MCc(expr RW,RH)(text TXT)= MCd(RW,RH)(0.5,0.5)(TXT) enddef; -def MCf(text TXT)= MCd(1,1)(0.5,0.5)(TXT) enddef; +def MCat(expr FW,FH)(text TXT)= + save_mposition:=mposition; + mposition:=(FW,FH); + MC(TXT) + mposition:=save_mposition; +enddef; %------------------------------------------------------------------------------------------------- -def MCd(expr RW,RH)(expr FW,FH)(text TXT)= +def MC(text TXT)= begingroup save com,par,adrA,adrB,f_bra,envT,envB,lenT,lineT,strAT,stkA,stkB,stkL,stkM,cntP,bondL,temp_len, temp_cntB,f_end,f_term,rotT,adrS,f_at,f_lineT,f_rotT,f_lenT,f_envT,angT,tempB,tempA, - maxX,maxY,f_char,ps_adr,ps_com,sA,sC,sD,pA,pB,factor, + maxX,maxY,f_char,ps_adr,ps_com,sA,sC,sD,pA,pB,factor,m_wd,m_ht, op_com,op_par,op_cnt,crR,colorA,colorB,PA,PO,PP,PX,defaultsize,defaultscale; %----------------------------------------------------------------------------------------------- def PA= sub_add enddef; @@ -567,6 +597,11 @@ def MCd(expr RW,RH)(expr FW,FH)(text TXT)= sub_usr:=sub_usr_start; sub_int:=sub_int_start; cntA:=cntB:=cntP:=cntC:=0; strD[0]:=""; str_cnt:=2000; crR:=-ratio_chain_ring; + %----------------------------------------------------------------------------------------------- + font_wd:=xpart(fsize); + font_ht:=ypart(fsize); + margin_lr:=xpart(fmargin); + margin_tb:=ypart(fmargin); %=============================================================================================== ''(0)(TXT,(_term,0)); %----------------------------------------------------------------------------------------------- @@ -576,23 +611,33 @@ def MCd(expr RW,RH)(expr FW,FH)(text TXT)= %----------------------------------------------------------------------------------------------- char_use_check; %-scaling--------------------------------------------------------------------------------------- - if sw_solid=1: bond_len:=font_wd*ratio_bond_width; - proc_size_setup; proc_skeleton; proc_scaling; - elseif sw_solid=2: proc_size_setup; proc_skeleton; proc_scaling; + if blength>1: blen:=blength; proc_size_setup; proc_skeleton; proc_scaling; + elseif blength>0: + blen:=font_wd*blength; + proc_size_setup; proc_skeleton; proc_scaling; else: - bond_len:=3mm; + blen:=3mm; proc_size_setup; + if xpart(msize)<1: m_wd:=font_wd*xpart(msize); else: m_wd:=font_wd; fi + if ypart(msize)<1: m_ht:=font_ht*ypart(msize); else: m_ht:=font_ht; fi for i=1 upto 6: proc_skeleton; proc_scaling; - if (mol_ht/mol_wd)>(font_ht/font_wd): factor:=(font_ht*RH-2margin_top_bottom)/mol_ht; - else: factor:=(font_wd*RW-2margin_left_right)/mol_wd; + if (mol_ht/mol_wd)>(m_ht/m_wd): + if ypart(msize)>1: factor:=ypart(msize)/mol_ht; + else: factor:=((font_ht-2margin_tb)*ypart(msize))/mol_ht; + fi + else: + if xpart(msize)>1: factor:=xpart(msize)/mol_wd; + else: factor:=((font_wd-2margin_lr)*xpart(msize))/mol_wd; + fi fi exitif (factor>=1-eps)and(factor<=1+eps); - bond_len:=bond_len*factor; + blen:=blen*factor; proc_size_setup; endfor - if bond_len>max_bond_length: - bond_len:=max_bond_length; proc_size_setup; proc_skeleton; proc_scaling; fi + if blen>max_blength: + blen:=max_blength; proc_size_setup; proc_skeleton; proc_scaling; + fi fi %-draw atom-------------------------------------------------------------------------------------- if (sw_numberA=0)and(sw_numberB=0): for i=1 upto cntA: draw_atom(i); endfor fi @@ -646,16 +691,19 @@ def MCd(expr RW,RH)(expr FW,FH)(text TXT)= endfor fi %----------------------------------------------------------------------------------------------- - sftX:=margin_left_right-minX+(font_wd-mol_wd-2margin_left_right)*FW; - sftY:=margin_top_bottom-minY+(font_ht-mol_ht-2margin_top_bottom)*FH; + if xpart(mposition)>1: sftX:=xpart(mposition)-minX; + else: sftX:=margin_lr-minX+(font_wd-mol_wd-2margin_lr)*xpart(mposition); + fi + if ypart(mposition)>1: sftY:=ypart(mposition)-minY; + else: sftY:=margin_tb-minY+(font_ht-mol_ht-2margin_tb)*ypart(mposition); + fi cntM:=cntM+1; posM[0][cntM]:=(sftX,sftY); posM[1][cntM]:=(minX+sftX,minY+sftY); posM[2][cntM]:=(maxX+sftX,maxY+sftY); wdM[cntM]:=mol_wd; htM[cntM]:=mol_ht; - if sw_mol_frame=1: draw_frame((minX,minY),mol_wd,mol_ht,thickness_font_frame) fi - addto mol_stru[cntM] also currentpicture; + mol_stru[cntM]:=currentpicture; clearit; endgroup; if ((sw_aux_out=1)or(sw_rep_out=1)or(sw_mol_out>=1))and(f_MP=1): proc_calc_out; fi @@ -699,28 +747,23 @@ def draw_frame(expr PS,LX,LY,PN)= draw ((0,0)--(LX,0)--(LX,LY)--(0,LY)--cycle) shifted PS withpen pensquare scaled PN; enddef; %------------------------------------------------------------------------------------------------- -def draw_corner(expr LX,LY,PN)= - drawdot(0,0) withpen pensquare scaled PN; drawdot(LX,0) withpen pensquare scaled PN; - drawdot(LX,LY) withpen pensquare scaled PN; drawdot(0,LY) withpen pensquare scaled PN; -enddef; -%------------------------------------------------------------------------------------------------- def proc_size_setup= - if (bond_len*ratio_atom_bond+offset_atom)<.8bond_len: - atom_wd:=bond_len*ratio_atom_bond+offset_atom; + if (blen*ratio_atom_bond+offset_atom)<.8blen: + atom_wd:=blen*ratio_atom_bond+offset_atom; else: - atom_wd:=.8bond_len; ratio_chain_ring:= .5; + atom_wd:=.8blen; ratio_chain_ring:= .5; fi - wedge_wd:= bond_len*ratio_wedge_bond+offset_wedge; - zebra_gap:= bond_len*ratio_zebragap_bond+offset_zebra_gap; - bondgap:= bond_len*ratio_bondgap_bond+offset_bond_gap; - bond_pen_wd:= bond_len*ratio_thickness_bond+offset_thickness; + wedge_wd:= blen*ratio_wedge_bond+offset_wedge; + zebra_gap:= blen*ratio_zebragap_bond+offset_zebra_gap; + bondgap:= blen*ratio_bondgap_bond+offset_bond_gap; + bond_pen_wd:= blen*ratio_thickness_bond+offset_thickness; enddef; %------------------------------------------------------------------------------------------------- def proc_scaling= begingroup save nU,nD,nP,nL,nR,xpos,ypos; - minX:=minY:=4095.999; - maxX:=maxY:=-4095.999; + minX:=minY:=4095; + maxX:=maxY:=-4095; for i=1 upto cntA: xpos:=xpart(posA[i]); ypos:=ypart(posA[i]); @@ -733,15 +776,13 @@ def proc_scaling= elseif (sA<>"{")and(sA<>"}"): nP:=nP+atom_wd*tbl_char_wd[ASCII(sA)]; fi endfor - if (angX[i]<=90.1)or(angX[i]>=269.9): nR:=nP; else: nL:=nP; fi - if (xpos-nL+.5atom_wd)<minX: minX:=xpos-nL+.5atom_wd; - elseif (xpos+nR-.5atom_wd)>maxX: maxX:=xpos+nR-.5atom_wd; - fi - if (ypos-nD-.5atom_wd)<minY: minY:=ypos-nD-.5atom_wd; - elseif (ypos+nU+.5atom_wd)>maxY: maxY:=ypos+nU+.5atom_wd; - fi - else: if xpos<minX: minX:=xpos; elseif xpos>maxX: maxX:=xpos; fi - if ypos<minY: minY:=ypos; elseif ypos>maxY: maxY:=ypos; fi + if (angX[i]<=90)or(angX[i]>=270): nR:=nP; else: nL:=nP; fi + if (xpos-nL+.5atom_wd)<minX: minX:=xpos-nL+.5atom_wd; fi + if (xpos+nR-.5atom_wd)>maxX: maxX:=xpos+nR-.5atom_wd; fi + if (ypos-nD-.5atom_wd)<minY: minY:=ypos-nD-.5atom_wd; fi + if (ypos+nU+.5atom_wd)>maxY: maxY:=ypos+nU+.5atom_wd; fi + else: if xpos<minX: minX:=xpos; fi if xpos>maxX: maxX:=xpos; fi + if ypos<minY: minY:=ypos; fi if ypos>maxY: maxY:=ypos; fi fi endfor mol_wd:=maxX-minX; mol_ht:=maxY-minY; @@ -845,8 +886,8 @@ def proc_skeleton= begingroup save posBs,posBe,nC; pair posBs,posBe; - adrA:=adrB:=cntA:=cntB:=angT:=adrS:=f_end:=f_bra:=rotT:=f_term:=f_at:=0; - envT:=envB:=f_lineT:=f_rotT:=f_lenT:=f_envT:=stkM[0]:=0; lineT:=si; + adrA:=adrB:=cntA:=cntB:=adrS:=f_end:=f_bra:=rotT:=f_term:=f_at:=0; + envT:=envB:=f_lineT:=f_rotT:=f_lenT:=f_envT:=stkM[0]:=0; lineT:=si; angT:=mangle; angA[0]:=angB[0]:=angX[0]:=0; posA[0]:=posBs:=posBe:=(0,0); for i=0 upto 5: stkA[i]:=stkB[i]:=0; endfor %----------------------------------------------------------------------------------------------- @@ -867,8 +908,8 @@ def proc_skeleton= angT:=angX[adrT]; f_bra:=1; rotT:=0; ef nC=_jp_atom_abs: adrT:=par; posBs:=posA[adrT]; angT:=angX[adrT]; f_bra:=1; rotT:=0; temp_cntB:=cntB; - ef nC=_adj_ang: if (angT<40)or(angT>320): angT:=0; ef angT<140: angT:=90; - ef angT<220: angT:=180; else: angT:=270; fi + ef nC=_adj_ang: if (angT<40)or(angT>320): angT:=0; + ef angT<140: angT:=90; ef angT<220: angT:=180; else: angT:=270; fi ef nC=_mk_bond: if (par=0)and(rotT<>0):par:=rotT; rotT:=0; fi add_bond(par); ef nC=_rot_ang: angT:=(angT+par) mod 360; ef nC=_tmp_rot: rotT:=par; @@ -902,7 +943,7 @@ def add_bond(expr ROT)= if nA<0: nB:=glu_atom(adrT)+glu_atom(cntA+1); nA:=abs(nA); else: nB:=0; fi - posBe:=sfB(posBs,nA*bond_len+nB,angT); + posBe:=sfB(posBs,nA*blen+nB,angT); fi posA[cntA+1]:=posBe; f_term:=0; else: @@ -997,13 +1038,13 @@ def draw_atom(expr NUM)= if dx=-1: pA:=pA-(f_wd,0); fi addto currentpicture also bA scaled (r_ff*(1-2ratio_atomgap_atom)) shifted (pA+pB+(f_wd*ratio_atomgap_atom,f_ht*ratio_atomgap_atom)) Cp(colorA[NUM]); - if sw_atom_frame=1: draw_frame(pA+pB,f_wd,f_ht,thickness_atom_frame); fi + if sw_aframe=1: draw_frame(pA+pB,f_wd,f_ht,thickness_aframe); fi if dx=1: pA:=pA+(f_wd,0); fi else: f_wd:=atom_wd*tbl_char_wd[ASCII(sB)]; if dx=-1: pA:=pA-(f_wd,0); fi draw_char(sB,pA+pB,atom_wd,bond_pen_wd*ratio_char_bond,NUM); - if sw_atom_frame=1: draw_frame(pA+pB,f_wd,atom_wd,thickness_atom_frame); fi + if sw_aframe=1: draw_frame(pA+pB,f_wd,atom_wd,thickness_aframe); fi if dx=1: pA:=pA+(f_wd,0); fi fi wdA[NUM]:=wdA[NUM]+f_wd; @@ -1031,7 +1072,7 @@ def draw_bond(expr NUM)= zA:=Ls--Le; len:=length(Le-Ls); %------------------------------------------------------------------------------------------------ pickup pencircle scaled bond_pen_wd; - if (nL=si)or(sw_bond_single=1): draw zA Cp(col); + if (nL=si)or(sw_single=1): draw zA Cp(col); ef nL=dl: draw zA Cp(col); draw sfB(subpath pA of zA,bondgap,ap) Cp(col); ef nL=dr: draw zA Cp(col); draw sfB(subpath pA of zA,bondgap,am) Cp(col); ef nL=dm: draw sfB(zA,bondgap/1.75,ap) Cp(col); draw sfB(zA,bondgap/1.75,am) Cp(col); @@ -1127,7 +1168,7 @@ NHiPr:=NHMe!:='(NH,!,iPr); NHtBu:='(NH,!,tBu); NHMe:=NH!:='(NH,!); NHEt:=NH!2:=' !?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); %================================================================================================== -nA:=0; for list=parameter_list: nA:=nA+1; save_para[nA]:=list; endfor +init_par(parameter_list); %-------------------------------------------------------------------------------------------------- %%%%%%message "count of sub_usr =" & decimal(sub_usr); %-------------------------------------------------------------------------------------------------- @@ -1444,14 +1485,14 @@ def proc_report_out= printf " Warnings = "&fdr(3)(warning_cnt)&" / Expanded command = "&decimal(cntD[0]); printf " Width * Height = " & fdr(10)(mol_wd)&" * "&fdr(10)(mol_ht); printf " Shift width * height = "& fdr(10)(minX)&" * "&fdr(10)(minY); - printf " Bond length = "&fdr(3)(bond_len)&" Atom size = "&fdr(3)(atom_wd); + printf " Bond length = "&fdr(3)(blen)&" Atom size = "&fdr(3)(atom_wd); printf " 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); printf "------------------------------------------------------------------"; printf "< NO. >( x axis , y axis )< atom >< bond >< hideH >< chg >"; for i=1 upto cntA: - printf " 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]])& + printf " A"&fdl(4)(i)&" ("&fdr(10)(round_auto(xpart(posA[i])/blen))&" , "& + fdr(10)(round_auto(ypart(posA[i])/blen))&" ) "&fixed_l(8)(strD[numS[i]])& " "&fdr(3)(Bcnt[i]) &iif(hideH[i]>0,fdr(8)(hideH[i])," ") if chargeA[i]<>0: &fdr(8)(chargeA[i]) fi; @@ -1464,7 +1505,7 @@ def proc_report_out= nB:=angB[i]; if nB>180: nB:=nB-360; fi printf " 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))&")"; + " ("&fdr(6)(round_auto(nB))&")"&fdr(8)(nC)&" ("&fdr(8)(round_auto(nC*blen))&")"; fi endfor printf "------------------------------------------------------------------"; @@ -1514,7 +1555,7 @@ def proc_vdk= 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])/bond_len)& fdr(10)(ypart(posA[i])/bond_len)& + printf fdr(10)(xpart(posA[i])/blen)& fdr(10)(ypart(posA[i])/blen)& fdr(10)(0)&" "&fixed_l(2)(stripP(strD[numS[i]]))&" 0 0 0 0"; if chargeA[i]<>0: chg_atm[incr chg_cnt]:=i; chg_chg[chg_cnt]:=chargeA[i]; fi endfor @@ -1540,7 +1581,7 @@ def proc_vtk= printf "M V30 BEGIN ATOM"; for i=1 upto cntA: printf "M V30 "&decimal(i)&" "&stripP(strD[numS[i]])&" "& - decimal(xpart(posA[i])/bond_len)&" "&decimal(ypart(posA[i])/bond_len)&" 0 0" + decimal(xpart(posA[i])/blen)&" "&decimal(ypart(posA[i])/blen)&" 0 0" if chargeA[i]<>0: &" CHG="&decimal(chargeA[i]) fi; endfor printf "M V30 END ATOM"; |