diff options
-rw-r--r-- | Master/texmf-dist/doc/metapost/mcf2graph/CHANGELOG | 7 | ||||
-rw-r--r-- | Master/texmf-dist/doc/metapost/mcf2graph/README | 2 | ||||
-rw-r--r-- | Master/texmf-dist/doc/metapost/mcf2graph/mcf_exa_soc.mf | 3 | ||||
-rw-r--r-- | Master/texmf-dist/doc/metapost/mcf2graph/mcf_example.pdf | bin | 246546 -> 246561 bytes | |||
-rw-r--r-- | Master/texmf-dist/doc/metapost/mcf2graph/mcf_man_soc.mf | 118 | ||||
-rw-r--r-- | Master/texmf-dist/doc/metapost/mcf2graph/mcf_manual.pdf | bin | 425268 -> 433700 bytes | |||
-rw-r--r-- | Master/texmf-dist/doc/metapost/mcf2graph/mcf_manual.tex | 197 | ||||
-rw-r--r-- | Master/texmf-dist/doc/metapost/mcf2graph/mcf_mplib_exa.pdf | bin | 122137 -> 122138 bytes | |||
-rw-r--r-- | Master/texmf-dist/metapost/mcf2graph/mcf2graph.mf | 258 |
9 files changed, 380 insertions, 205 deletions
diff --git a/Master/texmf-dist/doc/metapost/mcf2graph/CHANGELOG b/Master/texmf-dist/doc/metapost/mcf2graph/CHANGELOG index 446920fa3c9..b4cbb0de331 100644 --- a/Master/texmf-dist/doc/metapost/mcf2graph/CHANGELOG +++ b/Master/texmf-dist/doc/metapost/mcf2graph/CHANGELOG @@ -1,6 +1,11 @@ ******************************************************************************* - Changelog of mcf2graph software package by Akira Yamaji 2016-10-23 + Changelog of mcf2graph software package by Akira Yamaji 2016-10-30 ******************************************************************************* +[ver. 4.02 / 2016-10-30] + -add finction EXT(),ext() + -delete option parameter sw_start_vector + -update MCF syntax manual + [ver. 4.01 / 2016-10-23] -many fixes for robustness -update MCF syntax manual diff --git a/Master/texmf-dist/doc/metapost/mcf2graph/README b/Master/texmf-dist/doc/metapost/mcf2graph/README index 7c064a1881c..b144de7a905 100644 --- a/Master/texmf-dist/doc/metapost/mcf2graph/README +++ b/Master/texmf-dist/doc/metapost/mcf2graph/README @@ -1,7 +1,7 @@ ******************************************************************************** mcf2graph : Convert Molecular Coding Format to graphics with METAFONT/METAPOST Author : Akira Yamaji - version : 4.01 2016-10-23 + version : 4.02 2016-10-30 E-mail : mcf2graph@gmail.com Located at : http://www.ctan.org/pkg/mcf2graph ******************************************************************************** diff --git a/Master/texmf-dist/doc/metapost/mcf2graph/mcf_exa_soc.mf b/Master/texmf-dist/doc/metapost/mcf2graph/mcf_exa_soc.mf index a226e61c5d9..bbf4929b2e4 100644 --- a/Master/texmf-dist/doc/metapost/mcf2graph/mcf_exa_soc.mf +++ b/Master/texmf-dist/doc/metapost/mcf2graph/mcf_exa_soc.mf @@ -1,7 +1,7 @@ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % Molecular Coding Format for mcf_example.tex by Akira Yamaji 2016.10.19 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -input mcf2graph.mf; %%% it must be version 4.00 or later +input mcf2graph.mf; %%% it must be version 4.02 or later %------------------------------------------------------------------------- font_wd#:=33mm#; font_ht#:=24mm#; @@ -9,7 +9,6 @@ font_ht#:=24mm#; sw_auxout:=1; sw_font_frame:=0; sw_atom_frame:=0; -sw_start_vector:=0; %%%% sw_expand:=1; var3:="cal_FM"; tag3:="cFM"; var4:="cal_MW"; tag4:="cMW"; diff --git a/Master/texmf-dist/doc/metapost/mcf2graph/mcf_example.pdf b/Master/texmf-dist/doc/metapost/mcf2graph/mcf_example.pdf Binary files differindex e1842b93b60..6dcbe03b339 100644 --- a/Master/texmf-dist/doc/metapost/mcf2graph/mcf_example.pdf +++ b/Master/texmf-dist/doc/metapost/mcf2graph/mcf_example.pdf diff --git a/Master/texmf-dist/doc/metapost/mcf2graph/mcf_man_soc.mf b/Master/texmf-dist/doc/metapost/mcf2graph/mcf_man_soc.mf index 70380700644..8e32a79bc39 100644 --- a/Master/texmf-dist/doc/metapost/mcf2graph/mcf_man_soc.mf +++ b/Master/texmf-dist/doc/metapost/mcf2graph/mcf_man_soc.mf @@ -1,12 +1,11 @@ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -% Molecular Coding Format file for mcf_manual.tex by Akira.Yamaji 2016.10.19 +% Molecular Coding Format file for mcf_manual.tex by Akira.Yamaji 2016.10.30 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -input mcf2graph.mf; %% it must be version 4.00 or later +input mcf2graph.mf; %% it must be version 4.02 or later %------------------------------------------------------------------------ sw_auxout:=0; sw_mol_frame:=0; sw_expand:=0; -sw_start_vector:=0; sw_solid:=2; %%%%%sw_checklist:=1; %*********************************************************************** @@ -690,17 +689,25 @@ beginfont("EN:Switwch numberingB") sw_numberB:=3; MCd(1,1)(.5,.1)(<30,!9) endfont %*********************************************************************** -beginfont("EN:Switwch Solid ratio") - font_wd#:=70mm#; - font_ht#:=20mm#; +beginfont("EN:Switwch Solid ratio=0") + font_ht#:=18mm#; + bond_len#:=8mm#; + MCf(<30,Ph) +endfont +%----------------------------------------------------------------------- +beginfont("EN:Switwch Solid ratio=1") + font_ht#:=18mm#; bond_len#:=8mm#; - MCd(1,1)(0,.5)(Ph) sw_solid:=1; ratio_bond_width:=0.1; - MCd(1,1)(.55,.5)(Ph) + MCf(<30,Ph) +endfont +%----------------------------------------------------------------------- +beginfont("EN:Switwch Solid ratio=2") + font_ht#:=18mm#; + bond_len#:=10mm#; sw_solid:=2; - bond_len#:=6mm#; - MCd(1,1)(1,.5)(Ph) + MCf(<30,Ph) endfont %*********************************************************************** beginfont("EN:Switwch Expand") @@ -724,14 +731,28 @@ beginfont("EN:Switwch bondtype off") MCd(1,1)(.85, .5)(<30,Ph,4:/Cl,3:/F) endfont %*********************************************************************** -beginfont("EN:Switwch start vector") +beginfont("EN:Switwch font frame 0") + font_ht#:=15mm#; + margin_left_right:=5mm; + margin_top_bottom:=2mm; + sw_font_frame:=0; + MCf(<30,Ph,4:/Cl,3:/F) +endfont +beginfont("EN:Switwch font frame 1") font_ht#:=15mm#; - MCd(1,1)(.1, .5)(<30,Ph,4:/Cl,3:/F) - sw_start_vector:=1; - MCd(1,1)(.9, .5)(<30,Ph,4:/Cl,3:/F) + margin_left_right:=5mm; + margin_top_bottom:=2mm; + sw_font_frame:=1; + MCf(<30,Ph,4:/Cl,3:/F) endfont -%*********************************************************************** -beginfont("EN:Switwch font frame") +beginfont("EN:Switwch font frame 2") + font_ht#:=15mm#; + margin_left_right:=5mm; + margin_top_bottom:=2mm; + sw_font_frame:=2; + MCf(<30,Ph,4:/Cl,3:/F) +endfont +beginfont("EN:Switwch font frame 3") font_ht#:=15mm#; margin_left_right:=5mm; margin_top_bottom:=2mm; @@ -756,6 +777,7 @@ beginfont("EN:Switwch clipping") sw_mol_frame:=1; MCf(<30,Ph,4:/Cl,3:/F) endfont +%----------------------------------------------------------------------- beginfont("EN:Switwch clipping") font_ht#:=15mm#; sw_mol_frame:=1; @@ -779,22 +801,62 @@ beginfont("EN:MCf()") MCf(<30,Ph,4:/Cl,3:/F) endfont %*********************************************************************** -beginfont("EN:Local setting") - font_ht#:=15mm#; - MCd(1,1)(0.0,0.5)(Ph) - ratio_thickness_bond:=0.05; - MCd(1,1)(0.5,0.5)(Ph) - ratio_thickness_bond:=0.015; - MCd(1,1)(1.0,0.5)(Ph) +beginfont("EN:EXT()") + sw_solid:=1; + font_ht#:=26mm#; + bond_len#:=8mm#; + sw_mol_frame:=1; + MCd(1,1)(0,0.5)(<30,Ph,2:/OH,5:/OH) + MCd(1,1)(1,0.5)(<30,?6,$(3,6)dl,@(2,5)//O) + EXT(draw ((0,0)--(26mm,0)--(22mm,2mm)) shifted (0.3w,0.5h); + drawdot p1 withpen pencircle scaled 2mm; + drawdot p2 withpen pensquare scaled 2mm;) endfont %*********************************************************************** -beginfont("EN:Global setting") - font_ht#:=15mm#; +beginfont("EN:ext()") + font_wd#:=60mm#; + font_ht#:=20mm#; + bond_len#:=10mm#; + MCf(<30,Ph,4:/Cl,3:/F) + ext(draw p0--(p0+(wd,0))--(p0+(wd,ht)); + draw_vector(p6,a6-180,8mm);) +endfont +%*********************************************************************** +beginfont("EN:Local setting 1") + font_wd#:=15mm#; + font_ht#:=12mm#; + MCf(Ph) +endfont +beginfont("EN:Local setting 2") + font_wd#:=15mm#; + font_ht#:=12mm#; ratio_thickness_bond:=0.05; - MCd(1,1)(0.0,0.5)(Ph) - MCd(1,1)(0.5,0.5)(Ph) - MCd(1,1)(1.0,0.5)(Ph) + MCf(Ph) +endfont +beginfont("EN:Local setting 3") + font_wd#:=15mm#; + font_ht#:=12mm#; + MCf(Ph) +endfont +%*********************************************************************** +save_ratio:=ratio_thickness_bond; +ratio_thickness_bond:=0.05; +beginfont("EN:Local setting 1") + font_wd#:=15mm#; + font_ht#:=12mm#; + MCf(Ph) +endfont +beginfont("EN:Local setting 2") + font_wd#:=15mm#; + font_ht#:=12mm#; + MCf(Ph) +endfont +beginfont("EN:Local setting 3") + font_wd#:=15mm#; + font_ht#:=12mm#; + MCf(Ph) endfont +ratio_thickness_bond:=save_ratio; %*********************************************************************** sw_clip:=1; %% Output molecular infomation diff --git a/Master/texmf-dist/doc/metapost/mcf2graph/mcf_manual.pdf b/Master/texmf-dist/doc/metapost/mcf2graph/mcf_manual.pdf Binary files differindex 7f52968e2da..2275403c8c1 100644 --- a/Master/texmf-dist/doc/metapost/mcf2graph/mcf_manual.pdf +++ b/Master/texmf-dist/doc/metapost/mcf2graph/mcf_manual.pdf diff --git a/Master/texmf-dist/doc/metapost/mcf2graph/mcf_manual.tex b/Master/texmf-dist/doc/metapost/mcf2graph/mcf_manual.tex index f3fc19b2fee..ee720dc7eca 100644 --- a/Master/texmf-dist/doc/metapost/mcf2graph/mcf_manual.tex +++ b/Master/texmf-dist/doc/metapost/mcf2graph/mcf_manual.tex @@ -1,5 +1,5 @@ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -% Molecular Coding Format manual by Akira Yamaji 2016.10.23 +% Molecular Coding Format manual by Akira Yamaji 2016.10.30 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \documentclass[a4paper]{article} %%%%\usepackage{graphicx} @@ -711,21 +711,26 @@ pk font,PNG,SVG,EPS or MDL MOL file(V2000).\\ %----------------------------------------------------------------------------- \subsubsection{Solid mode} \begin{verbatim} - sw_solid=1 : + (sw_solid=0 : fit to font size) + ** default +\end{verbatim} +\MCFstructure +%----------------------------------------- +\begin{verbatim} + (sw_solid=1 : solid ratio bond/font width) ratio_bond_width=0.1 - font_width=70mm - (bond_len#=70mm*0.1=7mm) + font_width=60mm + (bond_len#=60mm#*0.1=6mm#) ** ignore bond_len# - - sw_solid=2 : - bond_len#=6mm# +\end{verbatim} +\MCFstructure +%----------------------------------------- +\begin{verbatim} + (sw_solid=2 : solid bond length) + bond_len#=10mm# ** ignore ratio_bond_width \end{verbatim} -\MCFstructure\\ -\makebox[5mm]{}% -\makebox[25mm]{\tt 0 :default}% -\makebox[25mm]{\tt 1}% -\makebox[20mm]{\tt 2}% +\MCFstructure %----------------------------------------------------------------------------- \subsubsection{Expand mode} \begin{verbatim} @@ -754,27 +759,33 @@ pk font,PNG,SVG,EPS or MDL MOL file(V2000).\\ \makebox[30mm]{\tt 0 :default}% \makebox[30mm]{\tt 1}% %----------------------------------------------------------------------------- -\subsection{Frame,vector} -%----------------------------------------------------------------------------- -\subsubsection{Start vector} -\begin{verbatim} - default: sw_start_vector=0 -\end{verbatim} -\MCFstructure\\ -\makebox[5mm]{}% -\makebox[30mm]{\tt 0 :default}% -\makebox[30mm]{\tt 1}% +\newpage +\subsection{Frame} %----------------------------------------------------------------------------- \subsubsection{Font frame} \begin{verbatim} - sw_font_frame=0 : no frame **default - sw_font_frame=1 : draw frame of font - sw_font_frame=2 : draw frame inside margin - sw_font_frame=3 : draw both - - sw_font_frame:=3; + (No font frame) margin_left_right:=5mm; margin_top_bottom:=2mm; + sw_font_frame:=0; ** default + MCf(<30,Ph,4:/Cl,3:/F) +\end{verbatim} +\MCFstructure +\begin{verbatim} + (Draw font frame) + sw_font_frame:=1; + MCf(<30,Ph,4:/Cl,3:/F) +\end{verbatim} +\MCFstructure +\begin{verbatim} + (Draw frame inside margin) + sw_font_frame:=2; + MCf(<30,Ph,4:/Cl,3:/F) +\end{verbatim} +\MCFstructure +\begin{verbatim} + (Draw both frame) + sw_font_frame:=3; MCf(<30,Ph,4:/Cl,3:/F) \end{verbatim} \MCFstructure @@ -798,44 +809,105 @@ pk font,PNG,SVG,EPS or MDL MOL file(V2000).\\ \subsection{Clipping font} \begin{verbatim} beginfont() - sw_clip:=0; - MCf(<30,Ph,4:/Cl,3:/F) endfont + sw_clip:=0; + MCf(<30,Ph,4:/Cl,3:/F) + endfont ** default: sw_clip=0 \end{verbatim} \MCFstructure \begin{verbatim} beginfont() - sw_clip:=1; - MCf(<30,Ph,4:/Cl,3:/F) endfont + sw_clip:=1; + MCf(<30,Ph,4:/Cl,3:/F) + endfont \end{verbatim} \MCFstructure %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -\newpage -\section{MCF draw function} -\subsection{Function MCd (draw)} +\section{Function} +\subsection{Function MCd()} \begin{verbatim} + (Draw molecular structure) + MCd(a,b)(c,d)(...) a: ratio molecular width/font width b: ratio molecular hight/font hight c: x axis position d: y axis position - MCd(1,0.8)(0.2,0.9)(<30,Ph,3:/F,4:/Cl) - MCd(1,0.8)(0.8,0.1)(<30,Ph,3:/F,4:/Cl) + beginfont() + MCd(1,0.8)(0.2,0.9)(<30,Ph,3:/F,4:/Cl) + MCd(1,0.8)(0.8,0.1)(<30,Ph,3:/F,4:/Cl) + endfont \end{verbatim} \MCFstructure %----------------------------------------------------------------------------- -\subsection{Function MCf (fit draw)} +\subsection{Function MCf()} \begin{verbatim} + (Draw fit to font size) + MCf(...) : MCd(1,1)(0.5,0.5)(...) - sw_font_frame:=1; + beginfont() + MCf(<30,Ph,3:/F,4:/Cl) + endfont +\end{verbatim} +\MCFstructure +%----------------------------------------------------------------------------- +\newpage +\subsection{Function EXT()} +\begin{verbatim} + (Extra graphic to font) + + w: font width + h: font height + wd: font width-margin_left_right*2 + ht: font height-margin_top_bottom*2 + p0: x=margin_left_right + y=margin_top_bottom + n: molecular number + p[m]: molecular origin position + (1<=m<=molecular count) + + beginfont() sw_mol_frame:=1; - MCf(<30,Ph,3:/F,4:/Cl) + MCd(1,1)(0,0.5)(<30,Ph,2:/OH,5:/OH) + MCd(1,1)(1,0.5) + (<30,?6,$(3,6)dl,@(2,5)//O) + EXT( + draw ((0,0)--(26mm,0)--(22mm,2mm)) + shifted (0.3w,0.5h); + drawdot p1 withpen pencircle scaled 2mm; + drawdot p2 withpen pensquare scaled 2mm; + ) + endfont +\end{verbatim} +\MCFstructure +%----------------------------------------------------------------------------- +\subsection{Function ext()} +\begin{verbatim} + (Extra graphic to molecule) + + wd: molecular width + ht: molecular height + p0: origin of molecular structure + n: atom number + p[m]: atom position of A[m] + a[m]: branch angle of A[m] + (1<=m<=atom count) + draw_vector(pos,ang,len) : + pos:position ang:angle len:length + + beginfont() + MCf(<30,Ph,3:/F,4:/Cl) + ext(draw p0--(p0+(wd,0)) + --(p0+(wd,ht); + draw_vector(p6,a6-180,8mm); + ) + endfont \end{verbatim} \MCFstructure %----------------------------------------------------------------------------- -\subsection{Local setting} +\subsection{Local parameter setting} \begin{verbatim} beginfont() MCf(Ph) endfont beginfont() @@ -844,16 +916,18 @@ pk font,PNG,SVG,EPS or MDL MOL file(V2000).\\ endfont beginfont() MCf(Ph) endfont \end{verbatim} -\MCFstructure +\MCFstructure\MCFstructure\MCFstructure %----------------------------------------------------------------------------- -\subsection{Global setting} +\subsection{Global parameter setting} \begin{verbatim} ratio_thickness_bond:=0.05; beginfont() MCf(Ph) endfont beginfont() MCf(Ph) endfont beginfont() MCf(Ph) endfont \end{verbatim} -\MCFstructure +\MCFstructure\MCFstructure\MCFstructure +%----------------------------------------------------------------------------- +\section{Output infomation} %----------------------------------------------------------------------------- \subsection{Output molecular information} \begin{verbatim} @@ -870,10 +944,14 @@ cFM:calculated molecular formula \subsection{Output additional information} \begin{verbatim} beginfont("EN:Tocopherol","CAS:59-02-9") - MCf(...) endfont + MCf(<30,Ph,3=?6, + 7:O,@(1,2,5)/Me,8:/*Me^60,6:/OH, + 8\,|,!12,@(4,8)/*Me,12:/Me) +endfont %% Output to mcf_man_soc-info.aux %% F:mcf_man_soc;C:86;EN:Tocopherol;CAS:59-02-9 +............................................ *F:filename *C:char number EN:molecular name CAS:CAS number *:default output @@ -884,10 +962,19 @@ CAS:CAS number *:default output \begin{verbatim} aux_delimiter:="/"; beginfont("EN:Ampicillin","CAS:69-53-4") - MCf(...) endfont + MCf(<45,?4,2:N,2=?5,-1:S, + @(3^45,4^-45)/*H,1://O^15, + 5:/*COOH^-18,@(6^35,6^-35)/Me, + 4*\^75,NH,!,//O,!,/*NH2,!,Ph) +endfont +beginfont(......) + ........... +endfont +.............. %% Output to mcf_man_soc-info.aux %% F:mcf_man_soc/C:90/EN:Ampicillin/CAS:69-53-4 +............................................ **default aux_delimiter=";" \end{verbatim} @@ -899,11 +986,21 @@ F:mcf_man_soc/C:90/EN:Ampicillin/CAS:69-53-4 tag4:="EN"; var4:="inf_EN"; sw_auxfix:=1; auxtag_out; beginfont("EN:Cholesterol","NO:1") - ..... endfont + MCf(<30,?6,$(-4,-2)?6,-4=?5,7=dl, + 1:*/OH,@(4,12)*/Me^60,9:*/H^60, + 10:/*H^180,11:/*H^-60,17:/*H^-54, + -1\^18,/*Me,-60,!3,/Me,!) + endfont + beginfont(......) + ........... + endfont + .............. %% Output to mcf_man_soc-info.aux %% F;C;NO;EN mcf_man_soc;91;1;Ampicillin + ........................... + \end{verbatim} \MCFstructure %----------------------------------------------------------------------------- @@ -1203,7 +1300,7 @@ M END \end{verbatim}% \newpage %---------------------------------------------------------------------------- -\subsection{\LaTeX file example} +\subsection{LaTeX file example} %############################################################################ \begin{verbatim} %-------------------------------------------------------------------- @@ -1243,7 +1340,7 @@ M END \end{verbatim}% %############################################################################ %------------------------------------------------------------------------ -\INFO{F:mcf_man_soc,C:103,NO:1,cMW:349.40462,cFM:C16H19N3O4S,EN:Ampicillin}% -\INFO{F:mcf_man_soc,C:104,NO:2,cMW:386.6532,cFM:C27H46O,EN:Cholesterol}% +\INFO{F:mcf_man_soc,C:113,NO:1,cMW:349.40462,cFM:C16H19N3O4S,EN:Ampicillin}% +\INFO{F:mcf_man_soc,C:114,NO:2,cMW:386.6532,cFM:C27H46O,EN:Cholesterol}% %------------------------------------------------------------------------ \end{document} diff --git a/Master/texmf-dist/doc/metapost/mcf2graph/mcf_mplib_exa.pdf b/Master/texmf-dist/doc/metapost/mcf2graph/mcf_mplib_exa.pdf Binary files differindex c7ab56140a7..8d127fc8104 100644 --- a/Master/texmf-dist/doc/metapost/mcf2graph/mcf_mplib_exa.pdf +++ b/Master/texmf-dist/doc/metapost/mcf2graph/mcf_mplib_exa.pdf diff --git a/Master/texmf-dist/metapost/mcf2graph/mcf2graph.mf b/Master/texmf-dist/metapost/mcf2graph/mcf2graph.mf index b3461a03db1..60b82397391 100644 --- a/Master/texmf-dist/metapost/mcf2graph/mcf2graph.mf +++ b/Master/texmf-dist/metapost/mcf2graph/mcf2graph.mf @@ -1,5 +1,5 @@ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -% mcf2graph ver 4.01 Copyright (c) 2013-2016 Akira Yamaji +% mcf2graph ver 4.02 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, @@ -32,17 +32,17 @@ tracingstats:=1; message " This is mcf2graph ver 4.0 2016.10"; %------------------------------------------------------------------------------------------------- -newinternal nA,nB,nC,nD,nE,nF,cntA,cntB,cntP,minX,minY,def_num,def_int,tbl_cnt; -pair posB[],posA[]; -numeric lineB[],sB[],eB[],angB[],angA[],strA[],str_wd[],lenB[],ang_br[],stock_para[], +newinternal nA,nB,nC,nD,nE,nF,cntA,cntB,cntM,minX,minY,def_num,def_int,tbl_cnt; +pair posB[],posA[],posM[]; +numeric lineB[],sB[],eB[],angB[],angA[],strA[],str_wd[],lenB[],ang_br[],save_para[], tbl_char_wd[],tbl_char_ht[],tbl_char_dp[],tbl_atom[],tbl_subst[][],tbl_atom_wt[], - comMC[][],parMC[][],cntMC[]; -string info[],tbl_atom_str[],com_str[],var[],tag[],mp_log_name,aux_delimiter; + comD[][],parD[][],cntD[]; +string info[],tbl_atom_str[],strD[],var[],tag[],mp_log_name,aux_delimiter; picture atom_font[],chem_structure; %------------------------------------------------------------------------------------------------- -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:=0; -sw_MOLout:=sw_subst_off:=sw_bond_single:=sw_auxfix:=sw_clip:=0; +char_num:=str_cnt:=proc_end:=sw_numberA:=sw_numberB:=sw_mol_frame:=sw_auxout:=sw_solid:=0; +sw_expand:=sw_font_frame:=sw_atom_frame:=sw_checklist:=sw_MOLout:=sw_subst_off:=sw_bond_single:=0; +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 @@ -85,8 +85,8 @@ max_bond_length#:=10mm; bond_len#:=8mm#; max_inf_num:=12; for i:=1 upto max_inf_num: info[i]:=":"; endfor %-------------------------------------------------------------------------------------------------- def_emb_start:=500; % 500 => 2499 for embedded definition (max 2000) -def_usr_start:=2500; % 2500 => 2999 for user definition (max 500) -def_int_start:=3000; % 3000 => 4000 for internal definition (max 1000) +def_usr_start:=2500; % 2500 => 2999 for user definition (max 500) +def_int_start:=3000; % 3000 => 4000 for internal definition (max 1000) %-------------------------------------------------------------------------------------------------- def def_com(expr n)(text tx)= nA:=n; forsuffixes list=tx:: list:=nA; nA:=nA+1; endfor enddef; def_com(-4000)(_term,_jp_atom,_jp_atom_abs,_jp_bond,_cyc,_cyc_sB,_cyc_eB,_set_line,_chg_line, @@ -97,7 +97,7 @@ 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_clip, + 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,max_bond_width,ratio_bondgap_bond,ratio_zebra_black,ratio_zebragap_bond, ratio_wedge_bond,ratio_atomgap_atom,ratio_bond_width, @@ -107,24 +107,22 @@ enddef; %-------------------------------------------------------------------------------------------------- vardef pic_c(expr i,s)= substring(i,i+1) of s enddef; %-------------------------------------------------------------------------------------------------- -nA:=0; for list=parameter_list: stock_para[incr nA]:=list; endfor +nA:=0; for list=parameter_list: save_para[incr nA]:=list; endfor def store_par(text t)= - nA:=0; for list=t: if stock_para[incr nA]<>list: stock_para[nA]:=list; fi endfor enddef; + nA:=0; for list=t: if save_para[incr nA]<>list: save_para[nA]:=list; fi endfor enddef; def restore_par(text t)= nA:=0; - forsuffixes list=t: if list<>stock_para[incr nA]: list:=stock_para[nA]; fi endfor enddef; + forsuffixes list=t: if list<>save_para[incr nA]: list:=save_para[nA]; fi endfor enddef; %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% def beginfont(text s)= store_par(parameter_list); save_wd#:=font_wd#; save_ht#:=font_ht#; - f_beginchar:=inf_num:=0; + f_beginchar:=inf_num:=cntM:=0; for list=s: info[incr inf_num]:=list; endfor enddef; %-------------------------------------------------------------------------------------------------- def endfont= - if (sw_font_frame=1)or(sw_font_frame=3): AUX(0,0)(draw_frame(w,h,(0,0),thickness_font_frame);) fi - if (sw_font_frame=2)or(sw_font_frame=3): - AUX(0,0)(draw_frame(w-2margin_left_right,h-2margin_top_bottom, - (margin_left_right,margin_top_bottom),thickness_font_frame);) fi - if sw_font_frame=4: AUX(0,0)(draw_corner(w,h,thickness_font_frame);) fi + if (sw_font_frame=1)or(sw_font_frame=3): EXT(draw_frame((0,0),w,h,thickness_font_frame);) fi + if (sw_font_frame=2)or(sw_font_frame=3): EXT(draw_frame(p0,wd,ht,thickness_font_frame);) fi + if sw_font_frame=4: EXT(draw_corner(w,h,thickness_font_frame);) fi if (sw_auxout=1)or(sw_checklist=1)or(sw_MOLout=1): proc_calc_out; fi char_num:=char_num+1; currentpicture:=chem_structure; chem_structure:=nullpicture; endchar; clearit; @@ -155,24 +153,27 @@ def set_def_MC= def */secondary n == (_postC,n) enddef; def /*secondary n == (_postD,n) enddef; def **secondary n == (_postE,n) enddef; def */*secondary n == (_postF,n) enddef; enddef; -%------------------------------------------------------------------------------------------------- +%================================================================================================= vardef '(text s)= ''(incr def_num)(s); def_num enddef; +%------------------------------------------------------------------------------------------------- def ''(expr k)(text s)= begingroup if unknown inside_def_MC:: set_def_MC fi - cntMC[k]:=0; + cntD[k]:=0; for list==s:: if known list:: - if pair list:: comMC[k][incr cntMC[k]]:=xpart(list); parMC[k][cntMC[k]]:=ypart(list); + if pair list:: comD[k][incr cntD[k]]:=xpart(list); parD[k][cntD[k]]:=ypart(list); elseif numeric list:: if list>=def_emb_start:: - for i==1 upto cntMC[list]:: - comMC[k][incr cntMC[k]]:=comMC[list][i]; parMC[k][cntMC[k]]:=parMC[list][i]; + for i==1 upto cntD[list]:: + comD[k][incr cntD[k]]:=comD[list][i]; parD[k][cntD[k]]:=parD[list][i]; endfor - else:: comMC[k][incr cntMC[k]]:=_mk_bond; parMC[k][cntMC[k]]:=list; fi - elseif string list:: com_str[incr str_cnt]:=list; - comMC[k][incr cntMC[k]]:=_set_atom; parMC[k][cntMC[k]]:=str_cnt; - if pic_c(0,list)=="{":: str_wd[str_cnt]:=1.7; else:: str_wd[str_cnt]:=1; fi fi fi + else:: comD[k][incr cntD[k]]:=_mk_bond; parD[k][cntD[k]]:=list; fi + elseif string list:: strD[incr str_cnt]:=list; + comD[k][incr cntD[k]]:=_set_atom; parD[k][cntD[k]]:=str_cnt; + if pic_c(0,list)=="{":: str_wd[str_cnt]:=1.6; else:: str_wd[str_cnt]:=1; fi + fi + fi endfor endgroup enddef; @@ -222,16 +223,16 @@ vardef $$(text t)(expr e) = 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 comMC[e][1]==_fuse:: - if comMC[e][2]<=6:: for list==t:: !!?(list)(parMC[e][1])(comMC[e][2]) endfor - elseif (comMC[e][2]>=11)and(comMC[e][2]<=15):: - for list==t:: !??(list)(parMC[e][1])(comMC[e][2]) endfor + elseif comD[e][1]==_fuse:: + if comD[e][2]<=6:: for list==t:: !!?(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 fi fi elseif color e:: color_list[incr cntC]:=e; for list==t:: PA(_set_adr,list) PA(_set_colorB,cntC) endfor fi fi - cntMC[def_int]:=nA; + cntD[def_int]:=nA; def_int %------- Retern value ------- enddef; %------------------------------------------------------------------------------------------------- @@ -262,37 +263,56 @@ vardef @@(text t)(expr s)= PA(_set_clr,0) elseif color s:: color_list[incr cntC]:=s; for list==t:: PA(_set_adr,list) PA(_set_colorA,cntC) endfor fi fi - cntMC[def_int]:=nA; + cntD[def_int]:=nA; def_int %------- Retern value ------- 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; % MC fill draw -def MCd(expr RW,RH)(expr FW,FH)(text s)= proc_drawing(RW,RH)(FW,FH)(s); enddef; +def EXT(text s)= + begingroup + save wd,ht,n,p; pair p[]; wd:=w-2margin_left_right; ht:=h-2margin_top_bottom; + p0:=(margin_left_right,margin_top_bottom); n:=cntM; for i=1 upto n: p[i]:=posM[i]; endfor + s addto chem_structure also currentpicture; clearit; + endgroup; +enddef; +%-------------------------------------------------------------------------------------------------- +def ext(text s)= + begingroup + save wd,ht,n,a,p; numeric a[]; pair p[]; wd:=mol_wd; ht:=mol_ht; + p0:=(minX,minY); n:=cntA; for i=1 upto n: p[i]:=posA[i]; a[i]:=ang_br[i]; endfor + s addto chem_structure also currentpicture shifted (sftX,sftY); clearit; + endgroup; +enddef; +%================================================================================================= +def MCf(text s)= MCd(1,1)(.5,.5)(s) enddef; % MC fill draw %------------------------------------------------------------------------------------------------- -def proc_drawing(expr RW,RH)(expr FW,FH)(text s)= +def MCd(expr RW,RH)(expr FW,FH)(text TX)= begingroup - save com,par,adrA,adrB,f_bra,envT,envB,lenT,lineT,strAT,stkA,stkB,stkL,stkM,bondL,temp_len, - temp_cntB,f_end,f_term,rotT,adrS,f_lineT,f_rotT,f_lenT,f_envT,PP,angT,tempB,glu,sftX,sftY, - xpos,ypos,str_len,max_x,max_y,par_s,par_e,score_u,hat,f_char,lenB,ps_adr,ps_com,op_com, - op_par,op_cnt,crR,colorA,colorB,PA,PAs,PP,PG; - %----------------------------------------------------------------------------------------------- - def PA(expr a,b)= comMC[def_int][incr nA]:=a; parMC[def_int][nA]:=b; enddef; - def PAs(text t)= for list==t:: PA(xpart(list),ypart(list)) endfor enddef; - def PP(expr a,b)= op_com[cntP][incr op_cnt[cntP]]:=a; op_par[cntP][op_cnt[cntP]]:=b; enddef; - def PG(expr a,b)= comMC[0][incr cntMC[0]]:=a; parMC[0][cntMC[0]]:=b; enddef; + 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_lineT,f_rotT,f_lenT,f_envT,angT,tempB, + glu,sftX,sftY,xpos,ypos,str_len,max_x,max_y,par_s,par_e,score_u,hat,f_char,lenB, + ps_adr,ps_com,op_com,op_par,op_cnt,crR,colorA,colorB; %----------------------------------------------------------------------------------------------- numeric stkB[],stkA[],stkL[],stkM[],f_char[],ps_adr[],ps_com[],colorA[],colorB[], op_com[][],op_par[][],op_cnt[]; %----------------------------------------------------------------------------------------------- + save ww,ap,am,hpt,pA,pB,pC,pT,Ls,Le,dx,j,u,pairA,pairT; + pair Ls,Le,pairA,pairT; + path pA,pB,pC,pT; + %----------------------------------------------------------------------------------------------- + save PA,PAs,PP,PG; + def PA(expr a,b)= comD[def_int][incr nA]:=a; parD[def_int][nA]:=b; enddef; + def PAs(text t)= for list==t:: PA(xpart(list),ypart(list)) endfor enddef; + def PP(expr a,b)= op_com[cntP][incr op_cnt[cntP]]:=a; op_par[cntP][op_cnt[cntP]]:=b; enddef; + def PG(expr a,b)= comD[0][incr cntD[0]]:=a; parD[0][cntD[0]]:=b; enddef; + %----------------------------------------------------------------------------------------------- if (sw_numberA>=1)or(sw_numberB>=1): ratio_atom_bond:=0.25; fi if (sw_expand=1)or(sw_MOLout=1): expand_set; fi def_num:=def_usr_start; def_int:=def_int_start; par_s=ASCII("{"); par_e=ASCII("}"); score_u=ASCII("_"); hat=ASCII("^"); - cntA:=cntB:=cntP:=cntC:=0; com_str[0]:=""; str_cnt:=2000; crR:=-ratio_chain_ring; - %----------------------------------------------------------------------------------------------- - ''(0)(s,(_term,0)); proc_bond_atom(1); if (cntP>0)and(sw_subst_off=0): ps_get(1); fi + cntA:=cntB:=cntP:=cntC:=0; strD[0]:=""; str_cnt:=2000; crR:=-ratio_chain_ring; + %=============================================================================================== + ''(0)(TX,(_term,0)); proc_bond_atom(1); if (cntP>0)and(sw_subst_off=0): ps_get(1); fi define_pixels(font_wd,font_ht,thickness_font_frame); char_use_check; if sw_solid=1: bond_len#:=font_wd#*ratio_bond_width; @@ -309,7 +329,8 @@ def proc_drawing(expr RW,RH)(expr FW,FH)(text s)= if bond_len#>max_bond_length#: bond_len#:=max_bond_length#; proc_size_setup; proc_skeleton; proc_scaling; fi fi - proc_char_setup(char_pen_wd); + proc_char_setup; + %----------------------------------------------------------------------------------------------- if f_beginchar=0: if sw_clip=1: font_wd#:=font_wd#*((mol_wd+2margin_left_right)/font_wd); font_ht#:=font_ht#*((mol_ht+2margin_top_bottom)/font_ht); fi @@ -325,15 +346,15 @@ def proc_drawing(expr RW,RH)(expr FW,FH)(text s)= if i<10: draw_atom(i,posA[i],0,decimal(nA),1); else: draw_atom(i,posA[i]+(-.2atom_wd,0),0,decimal(nA),1); fi elseif sw_numberB>=1: - else: draw_atom(i,posA[i],ang_br[i],com_str[strA[i]],str_wd[strA[i]]); fi + else: draw_atom(i,posA[i],ang_br[i],strD[strA[i]],str_wd[strA[i]]); fi endfor sftX:=margin_left_right-minX+(w-mol_wd-2margin_left_right)*FW; sftY:=margin_top_bottom-minY+(h-mol_ht-2margin_top_bottom)*FH; - if sw_mol_frame=1: AUX(sftX,sftY)(draw_frame(mol_wd,mol_ht,(minX,minY),0.2pt);) fi - if sw_start_vector=1: AUX(sftX,sftY)(start_vector) fi + posM[incr cntM]:=(minX+sftX,minY+sftY); + if sw_mol_frame=1: ext(draw_frame(p0,wd,ht,0.2pt);) fi addto chem_structure also currentpicture shifted (sftX,sftY); clearit; - endgroup + endgroup; % <=added ";" enddef; %------------------------------------------------------------------------------------------------- def ps_put(expr n,p)= @@ -346,17 +367,17 @@ def ps_put(expr n,p)= enddef; %------------------------------------------------------------------------------------------------- def ps_get(expr n)= - nA:=cntP; nB:=cntMC[0]; + nA:=cntP; nB:=cntD[0]; for i=n upto cntP: PG(_jp_atom_abs,ps_adr[i]) PG(_push,1) for j=1 upto op_cnt[i]: PG(op_com[i][j],op_par[i][j]) endfor - for j=1 upto cntMC[ps_com[i]]: PG(comMC[ps_com[i]][j],parMC[ps_com[i]][j]) endfor + for j=1 upto cntD[ps_com[i]]: PG(comD[ps_com[i]][j],parD[ps_com[i]][j]) endfor PG(_pop,1) PG(_term,0) endfor proc_bond_atom(nB+1); if cntP>nA: ps_get(nA+1); fi enddef; %------------------------------------------------------------------------------------------------- -def draw_frame(expr LX,LY,PS,PN)= +def draw_frame(expr PS,LX,LY,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; %------------------------------------------------------------------------------------------------- @@ -365,9 +386,9 @@ def draw_corner(expr LX,LY,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; - fill (posA[1] shifted (-2mm,-1mm))--posA[1]--(posA[1] shifted (-2mm,1mm))--cycle; +def draw_vector(expr POS,ROT,LEN)= + fill (-2mm,-1mm)--(0,0)--(-2mm,1mm)--(-2mm,.4mm)--(-LEN,.4mm)-- + (-LEN,-.4mm)--(-2mm,-.4mm)--cycle rotated ROT shifted POS; enddef; %------------------------------------------------------------------------------------------------- def proc_size_setup= @@ -384,10 +405,11 @@ enddef; %------------------------------------------------------------------------------------------------- def proc_scaling= minX:=minY:=4095.999; max_x:=max_y:=-4095.999; - for i=1 upto cntA: xpos:=xpart(posA[i]); ypos:=ypart(posA[i]); + for i=1 upto cntA: + xpos:=xpart(posA[i]); ypos:=ypart(posA[i]); if strA[i]<>0: str_len:=nC:=nD:=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(strD[strA[i]])-1: + nA:=ASCII(pic_c(j,strD[strA[i]])); if (nA=score_u)or(nA=hat)or(nA=par_s)or(nA=par_e): if (nA=hat)and(nC<.5atom_wd): nC:=.5atom_wd; fi; if (nA=score_u)and(nD<.5atom_wd): nD:=.5atom_wd; fi; @@ -408,15 +430,17 @@ enddef; def char_use_check= for i=1 upto 128: f_char[i]:=0; endfor if (sw_numberA>0)or(sw_numberB>0): for j=ASCII("0") upto ASCII("9"): f_char[j]:=1; endfor - else: for i=1 upto cntA: if strA[i]<>0: for j=0 upto length(com_str[strA[i]])-1: - f_char[ASCII(pic_c(j,com_str[strA[i]]))]:=1; endfor fi endfor fi + else: for i=1 upto cntA: if strA[i]<>0: for j=0 upto length(strD[strA[i]])-1: + f_char[ASCII(pic_c(j,strD[strA[i]]))]:=1; endfor fi endfor fi enddef; %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% def proc_bond_atom(expr n)= f_bra:=f_end:=f_term:=rotT:=adrS:=f_lineT:=f_rotT:=f_lenT:=f_envT:=envT:=envB:=strAT:=0; stkL[0]:=bondL:=crR; lenT:=crR; sB[0]:=0; eB[0]:=1; lineT:=si; for i=0 upto 5: stkA[i]:=stkB[i]:=0; endfor - for i=n upto cntMC[0]: com:=comMC[0][i]; par:=parMC[0][i]; + %----------------------------------------------------------------------------------------------- + for i=n upto cntD[0]: + com:=comD[0][i]; par:=parD[0][i]; if com=_push: if par=1: stkL[adrS]:=bondL; stkA[incr adrS]:=adrA:=cntA; stkB[adrS]:=adrB:=cntB; elseif par=0: temp_len:=bondL; fi @@ -433,10 +457,10 @@ def proc_bond_atom(expr n)= elseif com=_jp_bond: tempB:=getB(par); sB[cntB+1]:=sB[tempB]; f_bra:=1; elseif com=0or_jp_atom: termA; sB[cntB+1]:=getA(par); f_bra:=1; elseif com=_jp_atom_abs: sB[cntB+1]:=par; f_bra:=1; temp_cntB:=cntB; - elseif com=_chg_atom: strA[getA(adrT)]:=parMC[par][1]; - elseif com=_N: strA[getA(par)]:=parMC[N][1]; - elseif com=_O: strA[getA(par)]:=parMC[O][1]; - elseif com=_S: strA[getA(par)]:=parMC[S][1]; + elseif com=_chg_atom: strA[getA(adrT)]:=parD[par][1]; + elseif com=_N: strA[getA(par)]:=parD[N][1]; + elseif com=_O: strA[getA(par)]:=parD[O][1]; + elseif com=_S: strA[getA(par)]:=parD[S][1]; elseif com=_H: ps_put(getA(par),H); elseif com=_chg_len: if par=_ring_len: bondL:=ringL; elseif par=0: if lenT<>crR: bondL:=lenT; else: if bondL<0: bondL:=1; fi fi @@ -477,7 +501,9 @@ def proc_skeleton= envT:=envB:=f_lineT:=f_rotT:=f_lenT:=f_envT:=stkM[0]:=0; lineT:=si; angA[0]:=angB[0]:=ang_br[0]:=0; posA[0]:=posB[0]:=posB[1]:=(0,0); for i=0 upto 5: stkA[i]:=stkB[i]:=0; endfor - for i=1 upto cntMC[0]: com:=comMC[0][i]; par:=parMC[0][i]; + %---------------------------------------------------------------------------------------------- + for i=1 upto cntD[0]: + com:=comD[0][i]; par:=parD[0][i]; if com=_push: if par=1: stkM[adrS]:=envB; adrS:=adrS+1; stkA[adrS]:=adrA:=cntA; stkB[adrS]:=adrB:=cntB; elseif par=0: temp_len:=bondL; fi @@ -535,27 +561,24 @@ def glu_c(expr n)= if strA[n]<>0: nB:=angT mod 180; nC:=.5str_wd[strA[n]]*atom_ else :glu:=glu+((cosd(nB)*.5atom_wd)++.5atom_wd) fi fi enddef; vardef proc_env(expr n,m,a,b)= r:=(n mod 360); - if m>=def_emb_start: parMC[m][cntB-temp_cntB-1] else: + if m>=def_emb_start: parD[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; %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -def draw_atom(expr n,p,r,s,w)= - begingroup - save dx,u,j,pairA,pairT,par_s,par_e,score_u,hat; pair pairA,pairT; - par_s=ASCII("{"); par_e=ASCII("}"); score_u=ASCII("_"); hat=ASCII("^"); - %--------------------------------------------------------------------------------------- +def draw_atom(expr n,p,r,s,WD)= if ((r mod 360)<=90+1)or((r mod 360)>=270-1): dx:=1; else: dx:=-1; fi - pairT:=p-(.5atom_wd*w*dx,.5atom_wd); u:=j:=0; - for i=0 upto length(s)-1: nB:=ASCII(pic_c(i,s)); + pairT:=p-(.5atom_wd*dx*WD,.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_wd*tbl_char_wd[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_atom_frame=1: draw_frame(pairA,nA,atom_wd,0.1pt); fi if (sw_numberA>=1)or(sw_numberB>=1): erase fill unitsquare xscaled nA yscaled atom_wd shifted pairA wpcs 0.01pt; fi addto currentpicture also atom_font[nB] @@ -563,15 +586,9 @@ def draw_atom(expr n,p,r,s,w)= pairT:=pairT+(nA*dx,0); fi endfor - endgroup enddef; %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% def draw_bond(expr n,BP,EP,ANG,LN)= - begingroup - save ww,ap,am,hpt,pA,pB,pC,pT,Ls,Le; - pair Ls,Le; - path pA,pB,pC,pT; - %-------------------------------------------------------------------------------------------- nC:=length(posA[EP]-posA[BP]); if (nC>0)and(LN<>0): ww:=wedge_wd; hpt:=.5bond_pen_wd; ap:=ANG+90; am:=ANG-90; @@ -579,6 +596,7 @@ def draw_bond(expr n,BP,EP,ANG,LN)= else: clipping(strA[BP],strA[EP],posA[BP],posA[EP],nC); fi pickup pencircle scaled bond_pen_wd; if known colorB[n]: nB:=colorB[n]; 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); @@ -610,7 +628,6 @@ def draw_bond(expr n,BP,EP,ANG,LN)= else: nB:=n; fi draw_atom(n,.5[posA[BP],posA[EP]],0,decimal(nB),1); fi fi - endgroup enddef; %------------------------------------------------------------------------------------------------- def draw_wv= nB:=3bond_pen_wd; nA:=nB/length(Le-Ls); @@ -632,7 +649,7 @@ def bz_put(expr PA,PB,PC,PD,CL)= nC:=length(Le-Ls); nA:=zebra_gap*i/nC; nD:=(zebra_gap*i+ratio_zebra_black*zebra_gap)/nC; fill nA[PB,PA]--nA[PD,PC]--nD[PD,PC]--nD[PB,PA]--cycle Cp(CL); endfor enddef; def cut_off(expr p,w,h,s)= - p intersectionpoint sqr(1.1w,1.1h) shifted (s-(.5(1.1w),.5(1.1h))); enddef; + p intersectionpoint sqr(w+.1h,1.1h) shifted (s-(.5(w+.1h),.5(1.1h))); enddef; def clipping(expr SA,SB,PA,PB,LEN)= pT:=PA--PB; nA:=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]; @@ -681,8 +698,6 @@ S_H:='(S,!,H); N_H:='(N,/H); C_HHH:='(/H,/H^60,60,H); def expand_set= save CH,NH,NO,OH,CHO,COOH,CN,SH; CH3:=C_HHH; NH:=N_H; NH2:=N_HH; NO2:=N_OO; OH:=O_H; CHO:=CO_H; COOH:=CO_OH; CN:=C_N; SH:=S_H; enddef; -%================================================================================================== -message "-- total "&decimal(def_num)&" embedded definition --"; %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% def char_size_set(expr a)(expr b)(expr c)(expr s)= for j=0 upto length(s)-1: nA:=ASCII(pic_c(j,s)); @@ -696,8 +711,8 @@ char_size_set(.7)( 1)( 0)(" ()0123456789nhj=*bdiltf"); char_size_set(.7)( 1)(.15)("pqg"); char_size_set(.7)(.8)( 0)("acekosuvxzwry"); char_size_set(.4)( 1)( 0)(".,:;'`"); -%------------------------------------------------------------------------------------------------ -def proc_char_setup(expr a)= +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +def proc_char_setup= begingroup save Z,aW,aH,fW,hW,hW,hH,fP,hP,vL,hL,PO,POh,sH,FD; pair Z[]; @@ -727,7 +742,9 @@ def POh= (hP,.25aH)..Z19..(fW,.25aH)..Z20..cycle enddef; def sH expr n= shifted (0,n) enddef; def SP(expr m,n)expr p=subpath(m*length(p),n*length(p)) of p enddef; %================================================================================================== -pickup pencircle scaled a; fP:=a; hP:=.5a; +pickup pencircle scaled char_pen_wd; +fP:=char_pen_wd; hP:=.5char_pen_wd; +%------------------------------------------------------------------------------------------ FD(" ")(); FD(".")(drawdot Z19 wpcs fP); FD(",")(drawdot Z19 wpcs fP; draw (hW+.5fP,hP)..(hW+.3fP,-fP)..(hW-.5fP,hP-2fP)); @@ -818,26 +835,11 @@ vardef fixed_l(expr n)(expr s)= s&(substring(0,n-length(s)) of blank_str) enddef vardef fdr(expr n)(expr s)=fixed_r(n)(decimal(s)) enddef; def warning(expr s)= message "% "&decimal(char_num)&fdr(3)(incr warning_cnt)&")"&s&" !!!"; enddef; def B_check(expr s)(expr t)(expr n)= - if com_str[strA[s]]=t: if bond_cnt>n: - warning(fdr(4)(s)&" ["&com_str[strA[s]]&"] has "&fdr(3)(bond_cnt)&" bonds"); fi fi + if strD[strA[s]]=t: if bond_cnt>n: + warning(fdr(4)(s)&" ["&strD[strA[s]]&"] has "&fdr(3)(bond_cnt)&" bonds"); fi fi enddef; vardef stripP(expr a)=if length(a)=4: substring (1,3) of a else: a fi enddef; %================================================================================================== -def proc_get_info= - for j=1 upto inf_num: - nA:=0; for i=0 upto length(info[j]): if pic_c(i,info[j])=":": nA:=i; fi exitif nA>0; endfor - if nA>0: - s_tag:=substring (0,nA) of info[j]; - s_var:=substring (nA+1,length(info[j])) of info[j]; - 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 STa(expr a,b)= tbl_atom_str[incr tbl_cnt]:=a; tbl_atom[tbl_cnt]:=0; tbl_atom_wt[tbl_cnt]:=b; enddef; @@ -865,6 +867,17 @@ STb("N{H_2_}")("N","H","H"); STb("S{O_3_}")("S","O","O","O"); STb("COOH")("C","O","O","H"); STb("C{H_3_}")("C","H","H","H"); STb("C{F_3_}")("C","F","F","F"); %================================================================================================== +def proc_get_info= + for j=1 upto inf_num: + nA:=0; for i=0 upto length(info[j]): if pic_c(i,info[j])=":": nA:=i; fi exitif nA>0; endfor + if nA>0: + s_tag:=substring (0,nA) of info[j]; + s_var:=substring (nA+1,length(info[j])) of info[j]; + if known scantokens("inf_"&s_tag): scantokens("inf_"&s_tag):=s_var; fi + fi + endfor +enddef; +%================================================================================================== def proc_calc_out= begingroup save warning_cnt,cal_MW,cal_MWp,knownA,cal_FM,bondC,tmp_wtp,bond_cnt,hide_H, @@ -874,6 +887,7 @@ def proc_calc_out= 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_str:=cal_FM:=""; hide_H:=warning_cnt:=cal_MW:=cal_MWp:=0; + %------------------------------------------------------------------------------------------ proc_get_info; for i=1 upto tbl_cnt: sumA[i]:=0; endfor for i=1 upto cntA: knownA:=bond_cnt:=0; @@ -882,16 +896,16 @@ def proc_calc_out= elseif lineB[j]=0: bondC[j]:=0; else: bondC[j]:=1; fi if (sB[j]=i)or(eB[j]=i): bond_cnt:=bond_cnt+bondC[j]; fi endfor Bcnt[i]:=bond_cnt; - if com_str[strA[i]]="": com_str[strA[i]]:="C"; fi - if com_str[strA[i]]="C": if bond_cnt<4: hide_H:=hide_H+(4-bond_cnt); fi fi + if strD[strA[i]]="": strD[strA[i]]:="C"; fi + if strD[strA[i]]="C": if bond_cnt<4: hide_H:=hide_H+(4-bond_cnt); fi fi B_check(i)("C")(4); B_check(i)("H")(1); B_check(i)("O")(2); B_check(i)("F")(1); B_check(i)("{Cl}")(1); B_check(i)("Br}")(1); for j=1 upto tbl_cnt: - if com_str[strA[i]]=tbl_atom_str[j]: + if strD[strA[i]]=tbl_atom_str[j]: if tbl_atom[j]=0: sumA[j]:=sumA[j]+1; else: for k=1 upto tbl_atom[j]: sumA[tbl_subst[j][k]]:=sumA[tbl_subst[j][k]]+1; endfor fi knownA:=1; fi endfor - if knownA=0: warning(" Unknown Str("&com_str[strA[i]]&") is used "&decimal(i)); fi + if knownA=0: warning(" Unknown Str("&strD[strA[i]]&") is used "&decimal(i)); fi endfor sumA[2]:=sumA[2]+hide_H; for i=1 upto tbl_cnt: @@ -924,8 +938,7 @@ enddef; %================================================================================================== def proc_checklist_out= nA:=0; message "% Molecular name = "& inf_EN; - message "% There were "&fdr(3)(warning_cnt)& - " warnings / Expanded command count= "&decimal(cntMC[0]); + message "% warnings = "&fdr(3)(warning_cnt)&" / Expanded command = "&decimal(cntD[0]); message "% width * height = " & fdr(8)(mol_wd)&" * "&fdr(8)(mol_ht); message "% Shift width * height = "& fdr(8)(minX)&" * "&fdr(8)(minY); message "% Bond length = "&fdr(3)(bond_len)&" Atom size = "&fdr(3)(atom_wd); @@ -933,15 +946,14 @@ def proc_checklist_out= nA:=0; " 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])/bond_len)&" ) ("& - fdr(10)(ypart(posA[i])/bond_len)&" ) "&fixed_l(8)(com_str[strA[i]])&" "&fdr(3)(Bcnt[i]); + fdr(10)(ypart(posA[i])/bond_len)&" ) "&fixed_l(8)(strD[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 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 + 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_cnt: if sumA[i]>=1: message "% "&fixed_l(4)(stripP(tbl_atom_str[i]))&"("&fdr(9)(tbl_atom_wt[i])& @@ -960,7 +972,7 @@ def proc_MOLfile_out= 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])/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 + fdr(10)(0)&" "&fixed_l(2)(stripP(strD[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; elseif lineB[i]=tm: nA:=3; |