diff options
author | Karl Berry <karl@freefriends.org> | 2016-11-03 21:17:00 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2016-11-03 21:17:00 +0000 |
commit | b60ca9e4d571bb8eaf715f6c8e21a0053d59e1a7 (patch) | |
tree | 5e661575f5e6bb09aedac88d5decb7dd46e39e37 | |
parent | 7115c2809a8f244352ff9f750f30fb0d8335eabb (diff) |
mcf2graph (3nov16)
git-svn-id: svn://tug.org/texlive/trunk@42429 c570f23f-e606-0410-a88d-b1316a301751
-rw-r--r-- | Master/texmf-dist/doc/metapost/mcf2graph/CHANGELOG | 8 | ||||
-rw-r--r-- | Master/texmf-dist/doc/metapost/mcf2graph/README | 2 | ||||
-rw-r--r-- | Master/texmf-dist/doc/metapost/mcf2graph/mcf_example.pdf | bin | 246561 -> 246691 bytes | |||
-rw-r--r-- | Master/texmf-dist/doc/metapost/mcf2graph/mcf_man_soc.mf | 49 | ||||
-rw-r--r-- | Master/texmf-dist/doc/metapost/mcf2graph/mcf_manual.pdf | bin | 433700 -> 434503 bytes | |||
-rw-r--r-- | Master/texmf-dist/doc/metapost/mcf2graph/mcf_manual.tex | 104 | ||||
-rw-r--r-- | Master/texmf-dist/doc/metapost/mcf2graph/mcf_mplib_exa.pdf | bin | 122138 -> 122460 bytes | |||
-rw-r--r-- | Master/texmf-dist/metapost/mcf2graph/mcf2graph.mf | 162 |
8 files changed, 176 insertions, 149 deletions
diff --git a/Master/texmf-dist/doc/metapost/mcf2graph/CHANGELOG b/Master/texmf-dist/doc/metapost/mcf2graph/CHANGELOG index b4cbb0de331..3e8ed27e034 100644 --- a/Master/texmf-dist/doc/metapost/mcf2graph/CHANGELOG +++ b/Master/texmf-dist/doc/metapost/mcf2graph/CHANGELOG @@ -1,8 +1,12 @@ ******************************************************************************* - Changelog of mcf2graph software package by Akira Yamaji 2016-10-30 + Changelog of mcf2graph software package by Akira Yamaji 2016-11-03 ******************************************************************************* +[ver. 4.03 / 2016-11-03] + -miner update + -update MCF syntax manual + [ver. 4.02 / 2016-10-30] - -add finction EXT(),ext() + -add function EXT(),ext() -delete option parameter sw_start_vector -update MCF syntax manual diff --git a/Master/texmf-dist/doc/metapost/mcf2graph/README b/Master/texmf-dist/doc/metapost/mcf2graph/README index b144de7a905..6ff2a8d950d 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.02 2016-10-30 + version : 4.03 2016-11-03 E-mail : mcf2graph@gmail.com Located at : http://www.ctan.org/pkg/mcf2graph ******************************************************************************** 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 6dcbe03b339..6ddc85e06cd 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 8e32a79bc39..183e980b6bb 100644 --- a/Master/texmf-dist/doc/metapost/mcf2graph/mcf_man_soc.mf +++ b/Master/texmf-dist/doc/metapost/mcf2graph/mcf_man_soc.mf @@ -1,7 +1,7 @@ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -% Molecular Coding Format file for mcf_manual.tex by Akira.Yamaji 2016.10.30 +% Molecular Coding Format file for mcf_manual.tex by Akira.Yamaji 2016.11.03 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -input mcf2graph.mf; %% it must be version 4.02 or later +input mcf2graph.mf; %% it must be version 4.03 or later %------------------------------------------------------------------------ sw_auxout:=0; sw_mol_frame:=0; @@ -689,6 +689,19 @@ beginfont("EN:Switwch numberingB") sw_numberB:=3; MCd(1,1)(.5,.1)(<30,!9) endfont %*********************************************************************** +beginfont("EN:Switwch clipping") + font_ht#:=15mm#; + sw_mol_frame:=1; + MCf(<30,Ph,4:/Cl,3:/F) +endfont +%----------------------------------------------------------------------- +beginfont("EN:Switwch clipping") + font_ht#:=15mm#; + sw_mol_frame:=1; + sw_clip:=1; + MCf(<30,Ph,4:/Cl,3:/F) +endfont +%*********************************************************************** beginfont("EN:Switwch Solid ratio=0") font_ht#:=18mm#; bond_len#:=8mm#; @@ -709,6 +722,14 @@ beginfont("EN:Switwch Solid ratio=2") sw_solid:=2; MCf(<30,Ph) endfont +%----------------------------------------------------------------------- +beginfont("EN:sw_clip=1") + font_ht#:=18mm#; + bond_len#:=10mm#; + sw_solid:=2; + sw_clip:=1; + MCf(<30,Ph) +endfont %*********************************************************************** beginfont("EN:Switwch Expand") font_ht#:=20mm#; @@ -731,13 +752,6 @@ beginfont("EN:Switwch bondtype off") MCd(1,1)(.85, .5)(<30,Ph,4:/Cl,3:/F) endfont %*********************************************************************** -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#; margin_left_right:=5mm; @@ -772,19 +786,6 @@ beginfont("EN:Switwch atom frame") MCf(<30,Ph,1:/Cl,4:/COOH,3:/OH) endfont %*********************************************************************** -beginfont("EN:Switwch clipping") - font_ht#:=15mm#; - sw_mol_frame:=1; - MCf(<30,Ph,4:/Cl,3:/F) -endfont -%----------------------------------------------------------------------- -beginfont("EN:Switwch clipping") - font_ht#:=15mm#; - sw_mol_frame:=1; - sw_clip:=1; - MCf(<30,Ph,4:/Cl,3:/F) -endfont -%*********************************************************************** beginfont("EN:MCd()") font_ht#:=20mm#; sw_font_frame:=1; @@ -819,7 +820,7 @@ beginfont("EN:ext()") 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);) + draw_vector(p6,a6-180,l);) endfont %*********************************************************************** beginfont("EN:Local setting 1") @@ -840,12 +841,12 @@ beginfont("EN:Local setting 3") 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 +ratio_thickness_bond:=0.05; beginfont("EN:Local setting 2") font_wd#:=15mm#; font_ht#:=12mm#; 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 2275403c8c1..6716e87e87c 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 ee720dc7eca..9629c6e4744 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.30 +% Molecular Coding Format manual by Akira Yamaji 2016.11.03 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \documentclass[a4paper]{article} %%%%\usepackage{graphicx} @@ -24,7 +24,7 @@ \htman=45mm% \wdman=94mm% \htmans=42mm% -\fontnum=20% +\fontnum=21% \tempnum=1% %---------------------------------------------------------------------------- \font\@strufont=mcf_man_soc\relax% @@ -70,11 +70,11 @@ %----------------------------------------------------------------------------- \vspace{10mm} {\@strufont% -\makebox[10mm]{}\char0\raisebox{10mm}{\char1}\char2\raisebox{10mm}{\char3}\\ -\makebox[10mm]{}\char4\raisebox{10mm}{\char5}\char6\raisebox{10mm}{\char7}\\ -\makebox[10mm]{}\char8\raisebox{10mm}{\char9}\char10\raisebox{10mm}{\char11}\\ -\makebox[10mm]{}\char12\raisebox{10mm}{\char13}\char14\raisebox{10mm}{\char15}\\ -\makebox[10mm]{}\char16\raisebox{10mm}{\char17}\char18\raisebox{10mm}{\char19}\\} +\makebox[10mm]{}\char1 \raisebox{10mm}{\char2 }\char3 \raisebox{10mm}{\char4}\\ +\makebox[10mm]{}\char5 \raisebox{10mm}{\char6 }\char7 \raisebox{10mm}{\char8}\\ +\makebox[10mm]{}\char9 \raisebox{10mm}{\char10}\char11\raisebox{10mm}{\char12}\\ +\makebox[10mm]{}\char13\raisebox{10mm}{\char14}\char15\raisebox{10mm}{\char16}\\ +\makebox[10mm]{}\char17\raisebox{10mm}{\char18}\char19\raisebox{10mm}{\char20}\\} %----------------------------------------------------------------------------- \twocolumn \tableofcontents @@ -709,26 +709,49 @@ pk font,PNG,SVG,EPS or MDL MOL file(V2000).\\ \put(0, 2){\makebox[5mm]{\tt 3}} \end{picture} %----------------------------------------------------------------------------- +\subsubsection{Clipping mode} +\begin{verbatim} + sw_clip:=0; + MCf(<30,Ph,4:/Cl,3:/F) + ** default: sw_clip=0 +\end{verbatim} +\MCFstructure +\begin{verbatim} + sw_clip:=1; + MCf(<30,Ph,4:/Cl,3:/F) +\end{verbatim} +\MCFstructure +%----------------------------------------------------------------------------- \subsubsection{Solid mode} \begin{verbatim} - (sw_solid=0 : fit to font size) - ** default + (fit to font size) + sw_solid=0 ** default \end{verbatim} \MCFstructure %----------------------------------------- \begin{verbatim} - (sw_solid=1 : solid ratio bond/font width) - ratio_bond_width=0.1 - font_width=60mm - (bond_len#=60mm#*0.1=6mm#) - ** ignore bond_len# + (solid ratio bond/font width) + sw_solid:=1; + ratio_bond_width=0.1 + font_width=60mm + (bond_len#=60mm#*0.1=6mm#) + ** ignore bond_len# \end{verbatim} \MCFstructure %----------------------------------------- \begin{verbatim} - (sw_solid=2 : solid bond length) - bond_len#=10mm# - ** ignore ratio_bond_width + (solid bond length) + sw_solid:=2; + bond_len#=10mm# + ** ignore ratio_bond_width +\end{verbatim} +\MCFstructure +%----------------------------------------- +\begin{verbatim} + (solid bond length,clipping) + sw_solid:=2; + sw_clip:=1; + bond_len#=10mm# \end{verbatim} \MCFstructure %----------------------------------------------------------------------------- @@ -759,34 +782,25 @@ pk font,PNG,SVG,EPS or MDL MOL file(V2000).\\ \makebox[30mm]{\tt 0 :default}% \makebox[30mm]{\tt 1}% %----------------------------------------------------------------------------- -\newpage \subsection{Frame} %----------------------------------------------------------------------------- \subsubsection{Font frame} \begin{verbatim} - (No font frame) + (Draw 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) + sw_font_frame=2 \end{verbatim} \MCFstructure \begin{verbatim} (Draw both frame) - sw_font_frame:=3; - MCf(<30,Ph,4:/Cl,3:/F) + sw_font_frame=3 \end{verbatim} \MCFstructure %----------------------------------------------------------------------------- @@ -805,23 +819,6 @@ pk font,PNG,SVG,EPS or MDL MOL file(V2000).\\ ** default: sw_atom_frame=0 \end{verbatim} \MCFstructure -%----------------------------------------------------------------------------- -\subsection{Clipping font} -\begin{verbatim} - beginfont() - 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 -\end{verbatim} -\MCFstructure %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \section{Function} \subsection{Function MCd()} @@ -891,6 +888,7 @@ pk font,PNG,SVG,EPS or MDL MOL file(V2000).\\ ht: molecular height p0: origin of molecular structure n: atom number + l: bond length p[m]: atom position of A[m] a[m]: branch angle of A[m] (1<=m<=atom count) @@ -901,7 +899,7 @@ pk font,PNG,SVG,EPS or MDL MOL file(V2000).\\ MCf(<30,Ph,3:/F,4:/Cl) ext(draw p0--(p0+(wd,0)) --(p0+(wd,ht); - draw_vector(p6,a6-180,8mm); + draw_vector(p6,a6-180,l); ) endfont \end{verbatim} @@ -920,14 +918,14 @@ pk font,PNG,SVG,EPS or MDL MOL file(V2000).\\ %----------------------------------------------------------------------------- \subsection{Global parameter setting} \begin{verbatim} - ratio_thickness_bond:=0.05; beginfont() MCf(Ph) endfont + ratio_thickness_bond:=0.05; beginfont() MCf(Ph) endfont beginfont() MCf(Ph) endfont \end{verbatim} \MCFstructure\MCFstructure\MCFstructure %----------------------------------------------------------------------------- -\section{Output infomation} +\section{Output information} %----------------------------------------------------------------------------- \subsection{Output molecular information} \begin{verbatim} @@ -1333,14 +1331,14 @@ M END %-------------------------------------------------------------------- \begin{document} \unitlength=1mm% -\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:114,NO:1,cMW:349.40462,cFM:C16H19N3O4S,EN:Ampicillin}% +\INFO{F:mcf_man_soc,C:115,NO:2,cMW:386.6532,cFM:C27H46O,EN:Cholesterol}% \end{document} %-------------------------------------------------------------------- \end{verbatim}% %############################################################################ %------------------------------------------------------------------------ -\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}% +\INFO{F:mcf_man_soc,C:114,NO:1,cMW:349.40462,cFM:C16H19N3O4S,EN:Ampicillin}% +\INFO{F:mcf_man_soc,C:115,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 8d127fc8104..29a70504ea3 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 60b82397391..668964031b3 100644 --- a/Master/texmf-dist/metapost/mcf2graph/mcf2graph.mf +++ b/Master/texmf-dist/metapost/mcf2graph/mcf2graph.mf @@ -1,5 +1,5 @@ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -% mcf2graph ver 4.02 Copyright (c) 2013-2016 Akira Yamaji +% mcf2graph ver 4.03 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,20 +30,18 @@ % Set output checklist : mpost -s ahlength=2 FILENAME %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% tracingstats:=1; -message " This is mcf2graph ver 4.0 2016.10"; +message " This is mcf2graph ver 4.0 2016.11"; %------------------------------------------------------------------------------------------------- -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[], - comD[][],parD[][],cntD[]; -string info[],tbl_atom_str[],strD[],var[],tag[],mp_log_name,aux_delimiter; +newinternal nA,nB,nC,nD,nE,nF,def_num,def_int,tbl_cnt; +numeric save_para[],comD[][],parD[][],cntD[],tbl_str_wd[],tbl_atom[],tbl_subst[][],tbl_atom_wt[], + tbl_char_wd[],tbl_char_ht[],tbl_char_dp[]; +string tbl_atom_str[],strD[],var[],tag[],mp_log_name,aux_delimiter; picture atom_font[],chem_structure; %------------------------------------------------------------------------------------------------- -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; +char_num:=str_cnt:=proc_end:=0; +sw_numberA:=sw_numberB:=sw_mol_frame:=sw_auxout:=sw_solid:=sw_expand:=sw_font_frame:=0; +sw_atom_frame:=sw_checklist:=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:=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 %================================================================================================= @@ -81,8 +79,7 @@ ratio_char_bond:=1.5; ratio_bondgap_bond:=0.15; ratio_zebragap_bond:=0. ratio_zebra_black:=0.4; ratio_wedge_bond:=0.12; ratio_atomgap_atom:=0.050; offset_thickness#:=0.2pt#; offset_bond_gap#:=0.3pt#; offset_zebra_gap#:=0.1pt#; offset_atom#:=0.8pt#; offset_wedge#:=0.4pt#; thickness_font_frame#:=0.2pt#; -max_bond_length#:=10mm; bond_len#:=8mm#; -max_inf_num:=12; for i:=1 upto max_inf_num: info[i]:=":"; endfor +max_bond_length#:=10mm; bond_len#:=8mm#; font_wd#:=30mm#; font_ht#:=20mm#; %-------------------------------------------------------------------------------------------------- def_emb_start:=500; % 500 => 2499 for embedded definition (max 2000) def_usr_start:=2500; % 2500 => 2999 for user definition (max 500) @@ -90,9 +87,10 @@ 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, - _dl,_N,_O,_S,_H,_tmp_line,_chg_len,_get_len,_ring_len,_tmp_len,_rot_ang,_set_ang,_adj_ang,_chg_env, - _tmp_env,_set_colorA,_set_colorB,_postA,_postB,_postC,_postD,_postE,_postF,_set_psA,_stack_reset, - _set_clr,_set_adr,_mk_bond,_set_atom,_arg_ang,_chg_atom,_tmp_rot,_fuse,_push,_pop,_size_a); + _dl,_N,_O,_S,_H,_tmp_line,_chg_len,_get_len,_ring_len,_tmp_len,_rot_ang,_set_ang,_adj_ang, + _chg_env,_tmp_env,_set_colorA,_set_colorB,_postA,_postB,_postC,_postD,_postE,_postF,_set_psA, + _stack_reset,_set_clr,_set_adr,_mk_bond,_set_atom,_arg_ang,_chg_atom,_tmp_rot,_fuse,_push, + _pop,_size_a); def_com(1)(si,dl,dr,dm,tm,wf,wb,bd,bz,zf,zb,dt,no,ar,vf,vb,wv,nl,si_,wf_,wb_,bd_); %-------------------------------------------------------------------------------------------------- def parameter_list= @@ -100,7 +98,7 @@ def parameter_list= 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, + 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 enddef; @@ -114,19 +112,31 @@ def restore_par(text t)= nA:=0; 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#; + store_par(parameter_list); + begingroup + save cntA,cntB,cntM,minX,minY,f_beginchar,numS, + posB,posA,posM,lineB,sB,eB,angB,angA,lenB,ang_br,info; + numeric lineB[],sB[],eB[],angB[],angA[],lenB[],ang_br[],numS[]; + pair posB[],posA[],posM[]; + string info[]; + %------------------------------------------------------------------------------------------------ + for i:=1 upto max_inf_num: info[i]:=":"; endfor f_beginchar:=inf_num:=cntM:=0; for list=s: info[incr inf_num]:=list; endfor + char_num:=char_num+1; enddef; -%-------------------------------------------------------------------------------------------------- +%================================================================================================== def endfont= 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; + currentpicture:=chem_structure; + chem_structure:=nullpicture; + endchar; clearit; - restore_par(parameter_list); font_wd#:=save_wd#; font_ht#:=save_ht#; + endgroup; + restore_par(parameter_list); if proc_end=1: scantokens("bye"); fi enddef; %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% @@ -171,7 +181,7 @@ def ''(expr k)(text s)= 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 + if pic_c(0,list)=="{":: tbl_str_wd[str_cnt]:=1.6; else:: tbl_str_wd[str_cnt]:=1; fi fi fi endfor @@ -277,7 +287,7 @@ enddef; %-------------------------------------------------------------------------------------------------- def ext(text s)= begingroup - save wd,ht,n,a,p; numeric a[]; pair p[]; wd:=mol_wd; ht:=mol_ht; + save wd,ht,n,a,l,p; numeric a[]; pair p[]; wd:=mol_wd; ht:=mol_ht; l:=bond_len; 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; @@ -292,19 +302,15 @@ def MCd(expr RW,RH)(expr FW,FH)(text TX)= 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; %----------------------------------------------------------------------------------------------- + numeric stkB[],stkA[],stkL[],stkM[],f_char[],ps_adr[],ps_com[],colorA[],colorB[], + op_com[][],op_par[][],op_cnt[]; + %----------------------------------------------------------------------------------------------- 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; @@ -336,8 +342,10 @@ def MCd(expr RW,RH)(expr FW,FH)(text TX)= font_ht#:=font_ht#*((mol_ht+2margin_top_bottom)/font_ht); fi beginchar(char_num,font_wd#,font_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 cntB: if lineB[i]>=si_: draw_bond(i,sB[i],eB[i],angB[i],lineB[i]); fi endfor + %----------------------------------------------------------------------------------------------- for i=1 upto cntA: if (sw_numberA>=1)and(i>=numberA_start)and(i<=numberA_end): if sw_numberA=2: nA:=i-numberA_start+1; @@ -346,15 +354,16 @@ def MCd(expr RW,RH)(expr FW,FH)(text TX)= 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],strD[strA[i]],str_wd[strA[i]]); fi + else: draw_atom(i,posA[i],ang_br[i],strD[numS[i]],tbl_str_wd[numS[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; 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; % <=added ";" + endgroup; enddef; %------------------------------------------------------------------------------------------------- def ps_put(expr n,p)= @@ -407,9 +416,9 @@ 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]); - if strA[i]<>0: str_len:=nC:=nD:=0; - for j=0 upto length(strD[strA[i]])-1: - nA:=ASCII(pic_c(j,strD[strA[i]])); + if numS[i]<>0: str_len:=nC:=nD:=0; + for j=0 upto length(strD[numS[i]])-1: + nA:=ASCII(pic_c(j,strD[numS[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; @@ -430,8 +439,8 @@ 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(strD[strA[i]])-1: - f_char[ASCII(pic_c(j,strD[strA[i]]))]:=1; endfor fi endfor fi + else: for i=1 upto cntA: if numS[i]<>0: for j=0 upto length(strD[numS[i]])-1: + f_char[ASCII(pic_c(j,strD[numS[i]]))]:=1; endfor fi endfor fi enddef; %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% def proc_bond_atom(expr n)= @@ -457,10 +466,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)]:=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=_chg_atom: numS[getA(adrT)]:=parD[par][1]; + elseif com=_N: numS[getA(par)]:=parD[N][1]; + elseif com=_O: numS[getA(par)]:=parD[O][1]; + elseif com=_S: numS[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 @@ -491,7 +500,7 @@ enddef; def add_atom= lineB[incr cntB]:=lineT; lineT:=si; if lenT=crR: lenB[cntB]:=bondL; else: lenB[cntB]:=lenT; lenT:=crR; fi - if f_bra=0: cntA:=cntA+1; sB[cntB]:=cntA; strA[cntA]:=strAT; strAT:=0; + if f_bra=0: cntA:=cntA+1; sB[cntB]:=cntA; numS[cntA]:=strAT; strAT:=0; if f_MP=1: colorA[cntA]:=colorB[cntA]:=0; fi else: f_bra:=0; fi if f_end=0: eB[cntB]:=cntA+1; f_term:=0; else: eB[cntB]:=f_end; f_end:=0; f_term:=1; fi enddef; @@ -551,12 +560,12 @@ vardef getA(expr n)= vardef getB(expr n)= if n>=1: stkB[adrS+1]+n elseif n=0: tempB elseif n>=-999: cntB+n+1 else: stkB[adrS]+n+4095 fi enddef; -def termA= if f_term=0: if f_bra=0: strA[incr cntA]:=strAT; strAT:=0; +def termA= if f_term=0: if f_bra=0: numS[incr cntA]:=strAT; strAT:=0; if f_MP=1: colorA[cntA]:=0; fi else: f_bra:=0; fi f_term:=1; fi enddef; def termB= if f_term=0: if f_bra=0: ang_br[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:=.5str_wd[strA[n]]*atom_wd; +def glu_c(expr n)= if numS[n]<>0: nB:=angT mod 180; nC:=.5tbl_str_wd[numS[n]]*atom_wd; if (nB<45)or(nB>135):glu:=glu+((sind(nB)*nC)++nC); else :glu:=glu+((cosd(nB)*.5atom_wd)++.5atom_wd) fi fi enddef; @@ -568,32 +577,45 @@ vardef proc_env(expr n,m,a,b)= r:=(n mod 360); enddef; %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% def draw_atom(expr n,p,r,s,WD)= + begingroup + save pA,pT,dx; + pair pA,pT; + %---------------------------------------------------------------------------------------------- if ((r mod 360)<=90+1)or((r mod 360)>=270-1): dx:=1; else: dx:=-1; fi - pairT:=p-(.5atom_wd*dx*WD,.5atom_wd); u:=j:=0; + pT:=p-(.5atom_wd*dx*WD,.5atom_wd); + nE:=nC:=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; + if dx<0: if nB=par_s:k:=i+1; nC:=1; forever:exitif pic_c(i+(incr nC),s)="}";endfor fi + if nC>0: nB:=ASCII(pic_c(k+(decr nC),s)); fi + fi + if nB=score_u: if nE=0: nE:=-.5; else: nE:=0; fi; + elseif nB=hat: if nE=0: nE:= .5; else: nE:=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(pairA,nA,atom_wd,0.1pt); fi + nA:=atom_wd*tbl_char_wd[nB]; + pA:=pT+(.5*((dx-1)*nA),nE*atom_wd); + if sw_atom_frame=1: draw_frame(pA,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 + erase fill unitsquare xscaled nA yscaled atom_wd shifted pA wpcs 0.01pt; fi addto currentpicture also atom_font[nB] - shifted (pairA-(0,atom_wd*tbl_char_dp[nB])) Cp(colorA[n]); - pairT:=pairT+(nA*dx,0); + shifted (pA-(0,atom_wd*tbl_char_dp[nB])) Cp(colorA[n]); + pT:=pT+(nA*dx,0); fi endfor + endgroup enddef; %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% def draw_bond(expr n,BP,EP,ANG,LN)= + begingroup + save ww,ap,am,hpt,Ls,Le,pA,pB,pC,pT; + 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; if sw_numberB>=1: clipping(0,0,posA[BP],posA[EP],nC); - else: clipping(strA[BP],strA[EP],posA[BP],posA[EP],nC); fi + else: clipping(numS[BP],numS[EP],posA[BP],posA[EP],nC); fi pickup pencircle scaled bond_pen_wd; if known colorB[n]: nB:=colorB[n]; fi %--------------------------------------------------------------------------------------------- @@ -628,6 +650,7 @@ 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); @@ -653,12 +676,12 @@ def cut_off(expr p,w,h,s)= 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]; - elseif SA=0: Ls:=PA; Le:=cut_off(pT,atom_wd*str_wd[SB],atom_wd,PB); + elseif SA=0: Ls:=PA; Le:=cut_off(pT,atom_wd*tbl_str_wd[SB],atom_wd,PB); pA:=Ls--Le; pB:=Ls--nA[PB,PA]; pC:=0.1[PA,PB]--Le; - elseif SB=0: Ls:= cut_off(pT,atom_wd*str_wd[SA],atom_wd,PA); Le:=PB; + elseif SB=0: Ls:= cut_off(pT,atom_wd*tbl_str_wd[SA],atom_wd,PA); Le:=PB; pA:=Ls--Le; pB:=nA[PA,PB]--Le; pC:=Ls--(0.1)[PB,PA]; - else: Ls:=cut_off(pT,atom_wd*str_wd[SA],atom_wd,PA); - Le:=cut_off(pT,atom_wd*str_wd[SB],atom_wd,PB); + else: Ls:=cut_off(pT,atom_wd*tbl_str_wd[SA],atom_wd,PA); + Le:=cut_off(pT,atom_wd*tbl_str_wd[SB],atom_wd,PB); pB:=nA[PA,PB]--nA[PB,PA]; pC:=pA:=Ls--Le; fi enddef; %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% @@ -695,7 +718,8 @@ CCl3:='(/Cl,/Cl^60,60,Cl);CBr3:='(/Br,/Br^60,60,Br);O_H:='(O,!,H);CO_H:='(//O,!, CO_OH:='(//O,!,O,!,H); C_N:='(!~tm,N); N_HH:='(N,/H,60,H); N_OO:='(N,//O,60~dm,O); 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; +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; %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% @@ -835,8 +859,8 @@ 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 strD[strA[s]]=t: if bond_cnt>n: - warning(fdr(4)(s)&" ["&strD[strA[s]]&"] has "&fdr(3)(bond_cnt)&" bonds"); fi fi + if strD[numS[s]]=t: if bond_cnt>n: + warning(fdr(4)(s)&" ["&strD[numS[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; %================================================================================================== @@ -896,16 +920,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 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 + if strD[numS[i]]="": strD[numS[i]]:="C"; fi + if strD[numS[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 strD[strA[i]]=tbl_atom_str[j]: + if strD[numS[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("&strD[strA[i]]&") is used "&decimal(i)); fi + if knownA=0: warning(" Unknown Str("&strD[numS[i]]&") is used "&decimal(i)); fi endfor sumA[2]:=sumA[2]+hide_H; for i=1 upto tbl_cnt: @@ -946,7 +970,7 @@ 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)(strD[strA[i]])&" "&fdr(3)(Bcnt[i]); + fdr(10)(ypart(posA[i])/bond_len)&" ) "&fixed_l(8)(strD[numS[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])& @@ -972,7 +996,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(strD[strA[i]]))&" 0 0 0 0"; endfor + fdr(10)(0)&" "&fixed_l(2)(stripP(strD[numS[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; |