summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Master/texmf-dist/doc/metapost/mcf2graph/CHANGELOG7
-rw-r--r--Master/texmf-dist/doc/metapost/mcf2graph/README2
-rw-r--r--Master/texmf-dist/doc/metapost/mcf2graph/mcf_exa_soc.mf8
-rw-r--r--Master/texmf-dist/doc/metapost/mcf2graph/mcf_example.pdfbin246507 -> 246539 bytes
-rw-r--r--Master/texmf-dist/doc/metapost/mcf2graph/mcf_man_soc.mf14
-rw-r--r--Master/texmf-dist/doc/metapost/mcf2graph/mcf_manual.pdfbin423710 -> 424900 bytes
-rw-r--r--Master/texmf-dist/doc/metapost/mcf2graph/mcf_manual.tex48
-rw-r--r--Master/texmf-dist/doc/metapost/mcf2graph/mcf_mplib_exa.pdfbin122121 -> 122124 bytes
-rw-r--r--Master/texmf-dist/doc/metapost/mcf2graph/mcf_mplib_exa.tex6
-rw-r--r--Master/texmf-dist/metapost/mcf2graph/mcf2graph.mf493
10 files changed, 305 insertions, 273 deletions
diff --git a/Master/texmf-dist/doc/metapost/mcf2graph/CHANGELOG b/Master/texmf-dist/doc/metapost/mcf2graph/CHANGELOG
index 9c09903a52f..14416e27018 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-14
+ Changelog of mcf2graph software package by Akira Yamaji 2016-10-19
*******************************************************************************
+[ver. 4.00 / 2016-10-19]
+ -change solid mode parameter
+ 1:solid ratio,2:solid length
+ -update MCF syntax manual
+
[ver. 3.99 / 2016-10-14]
-miner update
-update MCF syntax manual
diff --git a/Master/texmf-dist/doc/metapost/mcf2graph/README b/Master/texmf-dist/doc/metapost/mcf2graph/README
index 8e6448d57bc..f15f95db01b 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 : 3.99 2016-10-14
+ version : 4.00 2016-10-19
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 95bb5c69b2a..a226e61c5d9 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.12
+% Molecular Coding Format for mcf_example.tex by Akira Yamaji 2016.10.19
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-input mcf2graph.mf; %%% it must be version 3.98 or later
+input mcf2graph.mf; %%% it must be version 4.00 or later
%-------------------------------------------------------------------------
font_wd#:=33mm#;
font_ht#:=24mm#;
@@ -15,8 +15,8 @@ var3:="cal_FM"; tag3:="cFM";
var4:="cal_MW"; tag4:="cMW";
%%%% outputtemplate:="%3c-%j.png";
%%%% sw_auxfix:=1;
-%%%% var3:="len_x"; tag3:="Lx";
-%%%% var4:="len_y"; tag4:="Ly";
+%%%% var3:="mol_wd"; tag3:="mWD";
+%%%% var4:="mol_ht"; tag4:="mHT";
%%%% var5:="cal_MW"; tag5:="cMW";
%%%% var6:="cal_FM"; tag6:="cFM";
%%%% var7:="inf_USE"; tag7:="USE";
diff --git a/Master/texmf-dist/doc/metapost/mcf2graph/mcf_example.pdf b/Master/texmf-dist/doc/metapost/mcf2graph/mcf_example.pdf
index 44b8054eb16..344ff649809 100644
--- a/Master/texmf-dist/doc/metapost/mcf2graph/mcf_example.pdf
+++ b/Master/texmf-dist/doc/metapost/mcf2graph/mcf_example.pdf
Binary files differ
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 c87fb0ac718..ac215938a39 100644
--- a/Master/texmf-dist/doc/metapost/mcf2graph/mcf_man_soc.mf
+++ b/Master/texmf-dist/doc/metapost/mcf2graph/mcf_man_soc.mf
@@ -1,18 +1,18 @@
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-% Molecular Coding Format file for mcf_manual.tex by Akira.Yamaji 2016.10.13
+% Molecular Coding Format file for mcf_manual.tex by Akira.Yamaji 2016.10.19
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-input mcf2graph.mf; %% it must be version 3.98 or later
+input mcf2graph.mf; %% it must be version 4.00 or later
%------------------------------------------------------------------------
sw_auxout:=0;
sw_mol_frame:=0;
sw_expand:=0;
sw_start_vector:=0;
+sw_solid:=2;
%%%%%sw_checklist:=1;
%***********************************************************************
font_wd#:=35mm#;
font_ht#:=25mm#;
bond_len#:=6mm#;
-sw_solid:=1;
%***********************************************************************
beginfont("EN:Glycine")
MCf(<30,NH2,!0,!,COOH)
@@ -691,12 +691,16 @@ beginfont("EN:Switwch numberingB")
endfont
%***********************************************************************
beginfont("EN:Switwch Solid ratio")
+ font_wd#:=70mm#;
font_ht#:=20mm#;
bond_len#:=8mm#;
- MCd(1,1)(0,.5)(Ph,4:/Me)
+ MCd(1,1)(0,.5)(Ph)
sw_solid:=1;
+ ratio_bond_width:=0.1;
+ MCd(1,1)(.55,.5)(Ph)
+ sw_solid:=2;
bond_len#:=6mm#;
- MCd(1,1)(1,.5)(Ph,4:/Me)
+ MCd(1,1)(1,.5)(Ph)
endfont
%***********************************************************************
beginfont("EN:Switwch Expand")
diff --git a/Master/texmf-dist/doc/metapost/mcf2graph/mcf_manual.pdf b/Master/texmf-dist/doc/metapost/mcf2graph/mcf_manual.pdf
index d2a37baa124..3a928ca1b33 100644
--- a/Master/texmf-dist/doc/metapost/mcf2graph/mcf_manual.pdf
+++ b/Master/texmf-dist/doc/metapost/mcf2graph/mcf_manual.pdf
Binary files differ
diff --git a/Master/texmf-dist/doc/metapost/mcf2graph/mcf_manual.tex b/Master/texmf-dist/doc/metapost/mcf2graph/mcf_manual.tex
index cb9ea163a93..8f4e56a582c 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.13
+% Molecular Coding Format manual by Akira Yamaji 2016.10.19
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\documentclass[a4paper]{article}
%%%%\usepackage{graphicx}
@@ -711,21 +711,25 @@ pk font,PNG,SVG,EPS or MDL MOL file(V2000).\\
%-----------------------------------------------------------------------------
\subsubsection{Solid mode}
\begin{verbatim}
- MCd(1,1)(0,.5)(Ph,4:/Me)
- sw_solid:=1;
- bond_len#:=6mm#;
- MCd(1,1)(1,.5)(Ph,4:/Me)
+ sw_solid=1 :
+ ratio_bond_width=0.1
+ font_width=70mm
+ (bond_len#=70mm*0.1=7mm)
+ ** ignore bond_len#
+
+ sw_solid=2 :
+ bond_len#=6mm#
+ ** ignore ratio_bond_width
\end{verbatim}
\MCFstructure\\
\makebox[5mm]{}%
-\makebox[30mm]{\tt 0 :default}%
-\makebox[30mm]{\tt 1}%
+\makebox[25mm]{\tt 0 :default}%
+\makebox[25mm]{\tt 1}%
+\makebox[20mm]{\tt 2}%
%-----------------------------------------------------------------------------
\subsubsection{Expand mode}
\begin{verbatim}
- MCd(1,.5)(0,0.5)(<30,Ph,4:/COOH,3:/NH2)
- sw_expand:=1;
- MCd(1,.5)(1,0.5)(<30,Ph,4:/COOH,3:/NH2)
+ default: sw_expand=0
\end{verbatim}
\MCFstructure\\
\makebox[5mm]{}%
@@ -734,9 +738,7 @@ pk font,PNG,SVG,EPS or MDL MOL file(V2000).\\
%-----------------------------------------------------------------------------
\subsubsection{Substituent off mode}
\begin{verbatim}
- MCd(1,.5)( 0,0.5)(<30,Ph,4:/Cl,3:/F)
- sw_subst_off:=1;
- MCd(1,.5)( 1,0.5)(<30,Ph,4:/Cl,3:/F)
+ default: sw_subst_off=0
\end{verbatim}
\MCFstructure\\
\makebox[5mm]{}%
@@ -745,9 +747,7 @@ pk font,PNG,SVG,EPS or MDL MOL file(V2000).\\
%-----------------------------------------------------------------------------
\subsubsection{Single bond mode}
\begin{verbatim}
- MCd(1,.5)( 0,0.5)(<30,Ph,4:/Cl,3:/F)
- sw_bond_single:=1;
- MCd(1,.5)( 1,0.5)(<30,Ph,4:/Cl,3:/F)
+ default: sw_bond_single=0
\end{verbatim}
\MCFstructure\\
\makebox[5mm]{}%
@@ -758,9 +758,7 @@ pk font,PNG,SVG,EPS or MDL MOL file(V2000).\\
%-----------------------------------------------------------------------------
\subsubsection{Start vector}
\begin{verbatim}
- MCf(<30,Ph,4:/Cl,3:/F)
- sw_start_vector:=1;
- MCf(<30,Ph,4:/Cl,3:/F)
+ default: sw_start_vector=0
\end{verbatim}
\MCFstructure\\
\makebox[5mm]{}%
@@ -839,21 +837,21 @@ pk font,PNG,SVG,EPS or MDL MOL file(V2000).\\
%-----------------------------------------------------------------------------
\subsection{Local setting}
\begin{verbatim}
- beginfont() MCd(1,.4)(0,.5)(Ph) endfont
+ beginfont() MCf(Ph) endfont
beginfont()
ratio_thickness_bond:=0.05;
- MCd(1,.4)(0.5,.5)(Ph)
+ MCf(Ph)
endfont
- beginfont() MCd(1,.4)(1,.5)(Ph) endfont
+ beginfont() MCf(Ph) endfont
\end{verbatim}
\MCFstructure
%-----------------------------------------------------------------------------
\subsection{Global setting}
\begin{verbatim}
ratio_thickness_bond:=0.05;
- beginfont() MCd(1,.4)( 0,.5)(Ph) endfont
- beginfont() MCd(1,.4)(.5,.5)(Ph) endfont
- beginfont() MCd(1,.4)( 1,.5)(Ph) endfont
+ beginfont() MCf(Ph) endfont
+ beginfont() MCf(Ph) endfont
+ beginfont() MCf(Ph) endfont
\end{verbatim}
\MCFstructure
%-----------------------------------------------------------------------------
diff --git a/Master/texmf-dist/doc/metapost/mcf2graph/mcf_mplib_exa.pdf b/Master/texmf-dist/doc/metapost/mcf2graph/mcf_mplib_exa.pdf
index cac18e1243e..58823d3eb6f 100644
--- a/Master/texmf-dist/doc/metapost/mcf2graph/mcf_mplib_exa.pdf
+++ b/Master/texmf-dist/doc/metapost/mcf2graph/mcf_mplib_exa.pdf
Binary files differ
diff --git a/Master/texmf-dist/doc/metapost/mcf2graph/mcf_mplib_exa.tex b/Master/texmf-dist/doc/metapost/mcf2graph/mcf_mplib_exa.tex
index c69c8f8077b..28c3da998fa 100644
--- a/Master/texmf-dist/doc/metapost/mcf2graph/mcf_mplib_exa.tex
+++ b/Master/texmf-dist/doc/metapost/mcf2graph/mcf_mplib_exa.tex
@@ -1,7 +1,7 @@
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-% Example of MCF typest with LuaLaTeX(luamplib) by A.Yamaji 2016.10.12
+% Example of MCF typest with LuaLaTeX(luamplib) by A.Yamaji 2016.10.19
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-%%% mcf2graph.mf it must be version 3.99 or later
+%%% mcf2graph.mf it must be version 4.00 or later
\documentclass{article}
%------------------------------------------------------------------------------
\usepackage{luamplib}%
@@ -11,7 +11,7 @@
input mcf2graph.mf;
mp_log_name:="temp-info.aux";
sw_auxout:=1;
- var3:="len_x"; tag3:="Lx";
+ var3:="mol_wd"; tag3:="Lx";
var4:="cal_MW"; tag4:="cMW";
var5:="cal_FM"; tag5:="cFM";
fi}%
diff --git a/Master/texmf-dist/metapost/mcf2graph/mcf2graph.mf b/Master/texmf-dist/metapost/mcf2graph/mcf2graph.mf
index 10fdeaad35a..2a0146315ab 100644
--- a/Master/texmf-dist/metapost/mcf2graph/mcf2graph.mf
+++ b/Master/texmf-dist/metapost/mcf2graph/mcf2graph.mf
@@ -1,5 +1,5 @@
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-% mcf2graph ver 3.99 Copyright (c) 2013-2016 Akira Yamaji
+% mcf2graph ver 4.00 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,17 +30,16 @@
% Set output checklist : mpost -s ahlength=2 FILENAME
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
tracingstats:=1;
-message " This is mcf2graph ver 3.9 2016.10";
+message " This is mcf2graph ver 4.0 2016.10";
%-------------------------------------------------------------------------------------------------
-pair posB[],posA[],pairT,Ls,Le,pairA;
-numeric angB[],angA[],br_ang[],sB[],eB[],f_FON[],atom_w[],atom_h[],atom_d[],strA[],stkB[],stkA[],
- stkL[],stkM[],strW[],lineB[],lenB[],ps_com[],ps_adr[],op_com[][],op_par[][],op_cnt[],
- comMC[][],parMC[][],stock_p[],cntMC[],colorA[],colorB[],tblN[],tblB[][],wtA[],sumA[],
+newinternal nA,nB,nC,nD,nE,nF,cntA,cntB,minX,minY,sftX,sftY;
+pair posB[],posA[];
+numeric angB[],angA[],br_ang[],sB[],eB[],f_char[],char_w[],char_h[],char_d[],strA[],str_wd[],
+ lineB[],lenB[],ps_com[],ps_adr[],op_com[][],op_par[][],op_cnt[],
+ comMC[][],parMC[][],cntMC[],tblN[],tblB[][],tblWt[],colorA[],colorB[],stock_para[],
CH[],NH[],NO[],SO[],CCl[],CF[],CBr[],?[],![],Ph[];
-path pA,pB,pC,pT;
-string info[],tblA[],com_str[],var[],tag[],cal_FM,mp_log_name,inf_NO,inf_MW,inf_EN,inf_JN,inf_FM,
- inf_CAS,inf_USE,inf_EXA,inf_EXB,inf_str,cal_MW_str,aux_delimiter,s_tag,s_var;
-picture atom_font[],chem_structure,temp_picture;
+string info[],tblA[],com_str[],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;
@@ -48,7 +47,7 @@ sw_MOLout:=sw_subst_off:=sw_bond_single:=sw_auxfix:=sw_clip:=0;
numberA_start:=numberB_start:=1; numberA_end:=numberB_end:=4095; aux_max:=20;
aux_delimiter:=";"; var1:="jobname"; tag1:="F"; var2:="char_num"; tag2:="C";
for i=3 upto aux_max: var[i]:=tag[i]:=""; endfor
-%-------------------------------------------------------------------------------------------------
+%=================================================================================================
if known green: f_MP:=1;
color color_list[];
mp_log_name:=jobname&"-info.aux";
@@ -60,7 +59,7 @@ if known green: f_MP:=1;
elseif ahangle=3: sw_MOLout:=1; def shipit = enddef; % MDL Molefile on
fi
outputtemplate:="%j-%3c."&outputformat;
- def beginchar(expr a,b,c,d)= beginfig(char_num) w:=b*pt; h:=c*pt; enddef;
+ 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 mp_log_name enddef;
def # = enddef;
@@ -77,12 +76,12 @@ let DIV= /; let MUL= *; let LT= <; let GT= >; let AND= &; let :: = : ; let == =
primarydef a SUB b = a-b enddef;
?3:=?20:=Ph:=Ph1:=Ph2:=hz:=0; vt:=1;
first_def_number:=500; user_def_number:=2500; ab_def_number:=3000;
-margin_left_right:=margin_top_bottom:=0.4mm; ratio_chain_ring:= 0.66; ratio_atom_bond:=0.36;
-ratio_thickness_bond:=0.015; offset_atom#:=0.8pt#;
-ratio_char_bond:=1.5; ratio_bondgap_bond:=0.15; ratio_zebragap_bond:=0.12;
-ratio_zebra_black:=0.4; ratio_wedge_bond:=0.12; ratio_atomgap_atom:=.050;
-offset_thickness#:=0.2pt#; offset_bond_gap#:=0.3pt#; offset_zebra_gap#:=0.1pt#;
-offset_wedge#:=0.4pt#; thickness_font_frame#:=0.2pt#;
+margin_left_right:=margin_top_bottom:=0.4mm; ratio_bond_width:=0.1;
+ratio_chain_ring:= 0.66; ratio_atom_bond:=0.36; ratio_thickness_bond:=0.015;
+ratio_char_bond:=1.5; ratio_bondgap_bond:=0.15; ratio_zebragap_bond:=0.12;
+ratio_zebra_black:=0.4; ratio_wedge_bond:=0.12; ratio_atomgap_atom:=.050;
+offset_thickness#:=0.2pt#; offset_bond_gap#:=0.3pt#; offset_zebra_gap#:=0.1pt#;
+offset_atom#:=0.8pt#; offset_wedge#:=0.4pt#; thickness_font_frame#:=0.2pt#;
max_bond_length#:=10mm; bond_len#:=8mm#;
par_s=ASCII("{"); par_e=ASCII("}"); score_u=ASCII("_"); hat=ASCII("^");
max_inf_num:=12; for i:=1 upto max_inf_num: info[i]:=":"; endfor
@@ -98,57 +97,40 @@ def parameter_list=
sw_start_vector,sw_atom_frame,sw_font_frame,sw_subst_off,sw_bond_single,sw_clip,
margin_left_right,margin_top_bottom,ratio_atom_bond,ratio_thickness_bond,ratio_char_bond,
ratio_chain_ring,max_bond_width,ratio_bondgap_bond,ratio_zebra_black,ratio_zebragap_bond,
- ratio_wedge_bond,ratio_atomgap_atom,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
+ ratio_wedge_bond,ratio_atomgap_atom,ratio_bond_width,
+ 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;
%-------------------------------------------------------------------------------------------------
-nA:=0; for list=parameter_list: stock_p[incr nA]:=list; endfor
+nA:=0; for list=parameter_list: stock_para[incr nA]:=list; endfor
def store_par(text t)=
- nA:=0; for list=t: if stock_p[incr nA]<>list: stock_p[nA]:=list; fi endfor enddef;
+ nA:=0; for list=t: if stock_para[incr nA]<>list: stock_para[nA]:=list; fi endfor enddef;
def restore_par(text t)= nA:=0;
- forsuffixes list=t: if list<>stock_p[incr nA]: list:=stock_p[nA]; fi endfor enddef;
-%-------------------------------------------------------------------------------------------------
+ forsuffixes list=t: if list<>stock_para[incr nA]: list:=stock_para[nA]; fi endfor enddef;
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
def beginfont(text s)=
- inf_EN:=inf_JN:=inf_FM:=inf_CAS:=inf_USE:=inf_EXA:=inf_EXB:=""; inf_MW:="0";
- len_x:=len_y:=cntA:=inf_num:=f_beginchar:=0;
- store_par(parameter_list);
- save_wd#:=font_wd#; save_ht#:=font_ht#;
- for list=s:
- inf_num:=inf_num+1; info[inf_num]:=list;
- nA:=0; for i=0 upto length(list): if pic_c(i,list)=":": nA:=i; fi exitif nA>0; endfor
- if nA>0:
- s_tag:=substring (0,nA) of list; s_var:=substring (nA+1,length(list)) of list;
- if s_tag="NO": inf_NO:=s_var; elseif s_tag="MW": inf_MW:=s_var;
- elseif s_tag="EN": inf_EN:=s_var; elseif s_tag="JN": inf_JN:=s_var;
- elseif s_tag="FM": inf_FM:=s_var; elseif s_tag="CAS": inf_CAS:=s_var;
- elseif s_tag="USE": inf_USE:=s_var; elseif s_tag="EXA": inf_EXA:=s_var;
- elseif s_tag="EXB": inf_EXB:=s_var; fi
- fi
- endfor
- clearit;
+ store_par(parameter_list); save_wd#:=font_wd#; save_ht#:=font_ht#;
+ f_beginchar:=inf_num:=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=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_auxout=1)or(sw_checklist=1)or(sw_MOLout=1): mol_check; fi
- if sw_auxout=1: auxfile_out; fi
- if sw_checklist=1: checklist_out; fi
- if sw_MOLout=1: MOLfileout; 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;
restore_par(parameter_list); font_wd#:=save_wd#; font_ht#:=save_ht#;
if proc_end=1: scantokens("bye"); fi
enddef;
%-------------------------------------------------------------------------------------------------
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));
- if f_FON[nA]=1: atom_w[nA]#:=atom_wd#*a; atom_h[nA]#:=atom_wd#*b; atom_d[nA]#:=atom_wd#*c;
- define_pixels(atom_w[nA],atom_h[nA],atom_d[nA]); fi
+ if f_char[nA]=1: char_w[nA]#:=atom_wd#*a; char_h[nA]#:=atom_wd#*b; char_d[nA]#:=atom_wd#*c;
+ define_pixels(char_w[nA],char_h[nA],char_d[nA]); fi
endfor
enddef;
%-------------------------------------------------------------------------------------------------
@@ -171,41 +153,39 @@ def mol_size_setup=
enddef;
%-------------------------------------------------------------------------------------------------
def mol_scaling=
-min_x:=min_y:= 4095.999; max_x:=max_y:=-4095.999;
-for i=1 upto cntA: xpos:=xpart(posA[i]); ypos:=ypart(posA[i]);
- if strA[i]<>0: str_len:=nC:=num_d:=0;
- for j=0 upto length(com_str[strA[i]])-1:
- nA:=ASCII(pic_c(j,com_str[strA[i]]));
- 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(num_d<.5atom_wd): num_d:=.5atom_wd; fi;
- else: str_len:=str_len+atom_w[nA]; fi
- endfor
- str_ang:=(br_ang[i] mod 360); num_f:=str_len;
- if (str_ang<=91)or(str_ang>=269): num_f:=0; else: str_len:=0; fi
- if (xpos-num_f+.5atom_wd)<min_x: min_x:=xpos-num_f+.5atom_wd;
- elseif (xpos+str_len-.5atom_wd)>max_x: max_x:=xpos+str_len-.5atom_wd; fi
- if (ypos-num_d-.5atom_wd)<min_y: min_y:=ypos-num_d-.5atom_wd;
- elseif (ypos+nC+.5atom_wd)>max_y: max_y:=ypos+nC+.5atom_wd; fi
- else: if xpos<min_x: min_x:=xpos; elseif xpos>max_x: max_x:=xpos; fi
- if ypos<min_y: min_y:=ypos; elseif ypos>max_y: max_y:=ypos; fi fi
- endfor
- len_x:=max_x-min_x; len_y:=max_y-min_y;
-enddef;
-%-------------------------------------------------------------------------------------------------
-def mol_resize(expr WD,HT)=
- if (len_y/len_x)>(font_ht/font_wd): factor:=(font_ht*HT-2margin_top_bottom)/len_y;
- else: factor:=(font_wd*WD-2margin_left_right)/len_x; fi
+ begingroup
+ save xpos,ypos,str_len,max_x,max_y;
+ 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(com_str[strA[i]])-1:
+ nA:=ASCII(pic_c(j,com_str[strA[i]]));
+ if (nA=score_u)or(nA=hat)or(nA=par_s)or(nA=par_e):
+ if (nA=hat)and(nC<.5atom_wd): nC:=.5atom_wd; fi;
+ if (nA=score_u)and(nD<.5atom_wd): nD:=.5atom_wd; fi;
+ else: str_len:=str_len+char_w[nA]; fi
+ endfor
+ str_ang:=(br_ang[i] mod 360); nF:=str_len;
+ if (str_ang<=91)or(str_ang>=269): nF:=0; else: str_len:=0; fi
+ if (xpos-nF+.5atom_wd)<minX: minX:=xpos-nF+.5atom_wd;
+ elseif (xpos+str_len-.5atom_wd)>max_x: max_x:=xpos+str_len-.5atom_wd; fi
+ if (ypos-nD-.5atom_wd)<minY: minY:=ypos-nD-.5atom_wd;
+ elseif (ypos+nC+.5atom_wd)>max_y: max_y:=ypos+nC+.5atom_wd; fi
+ else: if xpos<minX: minX:=xpos; elseif xpos>max_x: max_x:=xpos; fi
+ if ypos<minY: minY:=ypos; elseif ypos>max_y: max_y:=ypos; fi fi
+ endfor
+ mol_wd:=max_x-minX; mol_ht:=max_y-minY;
+ endgroup
enddef;
%-------------------------------------------------------------------------------------------------
-for i=1 upto 128: f_FON[i]:=0; endfor asc0:=ASCII("0"); asc9:=ASCII("9");
+for i=1 upto 128: f_char[i]:=0; endfor asc0:=ASCII("0"); asc9:=ASCII("9");
def char_use_check=
- for i=1 upto 128: if f_FON[i]<>0: f_FON[i]:=0; fi endfor
- if (sw_numberA>=1)or(sw_numberB>=1): for j=asc0 upto asc9: f_FON[j]:=1; endfor
+ for i=1 upto 128: if f_char[i]<>0: f_char[i]:=0; fi endfor
+ if (sw_numberA>=1)or(sw_numberB>=1): for j=asc0 upto asc9: 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_FON[ASCII(pic_c(j,com_str[strA[i]]))]:=1; endfor fi endfor fi
+ f_char[ASCII(pic_c(j,com_str[strA[i]]))]:=1; endfor fi endfor fi
enddef;
-%-------------------------------------------------------------------------------------------------
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
def set_def_MC=
save /,*,//,/*,*/,**,~,~~,^,^^,`,'`,{,},<,>,>>,:>,&,&#,:,=,\,\\,*\,\*,@,$,#,|,||,
d,w,z,inside_def_MC;
@@ -232,8 +212,10 @@ enddef;
%-------------------------------------------------------------------------------------------------
def PM(expr a,b,c)= comMC[a][incr cntMC[a]]:=b; parMC[a][cntMC[a]]:=c; enddef;
vardef '(text s)= ''(incr mc_num)(s); mc_num enddef;
-def ''(expr k)(text s)= begingroup
- if unknown inside_def_MC:: set_def_MC fi cntMC[k]:=0;
+def ''(expr k)(text s)=
+ begingroup
+ if unknown inside_def_MC:: set_def_MC fi
+ cntMC[k]:=0;
for list==s::
if known list::
if pair list:: PM(k,xpart(list),ypart(list))
@@ -242,11 +224,11 @@ def ''(expr k)(text s)= begingroup
for i==1 upto cntMC[list]:: PM(k,comMC[list][i],parMC[list][i]) endfor
else:: PM(k,_mk_bond,list) fi
elseif string list:: com_str[incr str_cnt]:=list; PM(k,_set_atom,str_cnt)
- if pic_c(0,list)=="{":: strW[str_cnt]:=1.7; else:: strW[str_cnt]:=1; fi fi fi
+ if pic_c(0,list)=="{":: str_wd[str_cnt]:=1.7; else:: str_wd[str_cnt]:=1; fi fi fi
endfor
endgroup
enddef;
-%-------------------------------------------------------------------------------------------------
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
def !?(expr a)(expr b) =
PB(_jp_bond,a) PB(_get_len,a) PB(_push,0)
PB(_chg_len,_ring_len) for i==1 upto b-2:: PB(_mk_bond,360 DIV b) endfor PB(_pop,0)
@@ -277,14 +259,13 @@ def fuse_large(expr a)(expr b)(expr c) =
PB(_mk_bond,360 DIV 7+((c-8) DIV 2.5)) PB(_mk_bond,360 DIV 7+((c-8) DIV 2.5))
PB(_pop,0) if a>=1:: PB(_cyc_eB,0) else:: PB(_cyc_eB,list) fi
elseif b==8::
- PB(_jp_bond,a) PB(_push,0) PB(_chg_len,c DIV 10) PB(_mk_bond,(360 DIV 8)-(c-8))
- PB(_mk_bond,(360 DIV 8)+((c-8) DIV 3)) PB(_mk_bond,(360 DIV 8)+((c-8) DIV 3))
- PB(_mk_bond,(360 DIV 8)+((c-8) DIV 3)) PB(_mk_bond,(360 DIV 8)+((c-8) DIV 3))
- PB(_mk_bond,(360 DIV 8)+((c-8) DIV 3))
+ PB(_jp_bond,a) PB(_push,0) PB(_chg_len,c DIV 10) PB(_mk_bond,45-(c-8))
+ PB(_mk_bond,45+((c-8) DIV 3)) PB(_mk_bond,45+((c-8) DIV 3)) PB(_mk_bond,45+((c-8) DIV 3))
+ PB(_mk_bond,45+((c-8) DIV 3)) PB(_mk_bond,45+((c-8) DIV 3))
PB(_pop,0) if a>=1:: PB(_cyc_eB,0) else:: PB(_cyc_eB,list) fi
fi
enddef;
-%-------------------------------------------------------------------------------------------------
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
def PB(expr a,b)= cntBS:=cntBS+1; comMC[ab_num][cntBS]:=a; parMC[ab_num][cntBS]:=b; enddef;
def $$(text t)(expr e) =
begingroup save cntBS; cntBS:=0; ab_num:=ab_num+1;
@@ -310,27 +291,20 @@ enddef;
def PA(expr a,b)= cntAS:=cntAS+1; comMC[ab_num][cntAS]:=a; parMC[ab_num][cntAS]:=b; enddef;
def PAs(text t)= for list==t:: PA(xpart(list),ypart(list)) endfor enddef;
def @@(text t)(expr s)=
- begingroup save cntAS,xs,ys; cntAS:=0; ab_num:=ab_num+1;
+ begingroup
+ save cntAS,xs,ys; cntAS:=0; ab_num:=ab_num+1;
if known s:: if numeric s::
if (s>=H)and(s<=U)::
for list==t::
if s==N:: PA(_N,list) elseif s==O:: PA(_O,list) elseif s==S:: PA(_S,list)
- else:: PA(_set_adr,list) PA(_chg_atom,s) fi
- endfor
- elseif s==NH::
- for list==t::
- if numeric list:: PAs((_N,list),~~no,'`_size_a,(_H,list))
- elseif pair list:: PAs(list) fi
- endfor
- elseif s==SOO::
- for list==t::
- PAs((_S,list),(_set_adr,list),^^35,~~dm,(_set_psA,O),^^-35,~~dm,(_set_psA,O))
- endfor
- elseif s==SO::
- for list==t::
- if numeric list:: PAs((_S,list),(_set_adr,list),~~dm,(_set_psA,O))
- elseif pair list:: PAs(list) fi
- endfor
+ else:: PA(_set_adr,list) PA(_chg_atom,s) fi endfor
+ elseif s==NH:: for list==t:: if numeric list:: PAs((_N,list),~~no,'`_size_a,(_H,list))
+ elseif pair list:: PAs(list) fi endfor
+ elseif s==SOO:: for list==t:: PAs((_S,list),(_set_adr,list),
+ ^^35,~~dm,(_set_psA,O),^^-35,~~dm,(_set_psA,O)) endfor
+ elseif s==SO:: for list==t::
+ if numeric list:: PAs((_S,list),(_set_adr,list),~~dm,(_set_psA,O))
+ elseif pair list:: PAs(list) fi endfor
fi
elseif pair s:: xs:=xpart(s); ys:=ypart(s); PA(_set_clr,1)
for list==t::
@@ -370,37 +344,39 @@ def ps_get(expr n)=
endfor
proc_bond_atom(cntC+1); if cntP>cntPS: ps_get(cntPS+1); fi
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)=
mc_num:=user_def_number; ab_num:=ab_def_number; crR:=-ratio_chain_ring;
- adrA:=adrB:=cntA:=cntB:=adrS:=cntPS:=angA[0]:=angB[0]:=br_ang[0]:=sB[0]:=cntC:=cntP:=0;
- stkA[0]:=stkB[0]:=stkL[0]:=stkM[0]:=strAT:=f_lineT:=f_lenT:=f_envT:=f_rotT:=0;
- eB[0]:=1; com_str[0]:=""; lineT:=si; str_cnt:=2000; posA[0]:=posB[0]:=posB[1]:=(0,0);
+ cntA:=cntB:=cntPS:=cntC:=cntP:=0; com_str[0]:=""; str_cnt:=2000;
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
- ''(0)(s,(_term,0)); proc_bond_atom(1); cntA_skeleton:=cntA; cntB_skeleton:=cntB;
+ ''(0)(s,(_term,0)); proc_bond_atom(1); cntA_skeleton:=cntA; cntB_skeleton:=cntB;
if cntP>0: ps_get(1); fi
define_pixels(font_wd,font_ht,thickness_font_frame);
char_use_check;
- if sw_solid>=1: mol_size_setup; proc_skeleton; mol_scaling;
+ if sw_solid=1: bond_len#:=font_wd#*ratio_bond_width;
+ mol_size_setup; proc_skeleton; mol_scaling;
+ elseif sw_solid=2: mol_size_setup; proc_skeleton; mol_scaling;
else:
- bond_len#:=0.025font_wd#; mol_size_setup;
- for i=1 upto 6:
- proc_skeleton; mol_scaling; mol_resize(RW,RH); exitif factor=1;
+ bond_len#:=3mm#; mol_size_setup;
+ for i=1 upto 6: proc_skeleton; mol_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; fi
+ exitif factor=1;
bond_len#:=bond_len#*factor; mol_size_setup;
endfor
if bond_len#>max_bond_length#:
bond_len#:=max_bond_length#; mol_size_setup; proc_skeleton; mol_scaling; fi
fi
- char_font_setup;
+ char_font_setup(char_pen_wd);
if sw_subst_off=1: cntA:=cntA_skeleton; cntB:=cntB_skeleton; fi
%----------------------------------------------------------------------------------------
if f_beginchar=0:
- if sw_clip=1: font_wd#:=font_wd#*((len_x+2margin_left_right)/font_wd);
- font_ht#:=font_ht#*((len_y+2margin_top_bottom)/font_ht); fi
+ 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
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
@@ -412,13 +388,13 @@ def MCd(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],br_ang[i],com_str[strA[i]],strW[strA[i]]); fi
+ else: draw_atom(i,posA[i],br_ang[i],com_str[strA[i]],str_wd[strA[i]]); fi
endfor
- sft_X:=margin_left_right-min_x+(w-len_x-2margin_left_right)*FW;
- sft_Y:=margin_top_bottom-min_y+(h-len_y-2margin_top_bottom)*FH;
- if sw_mol_frame=1: AUX(sft_X,sft_Y)(draw_frame(len_x,len_y,(min_x,min_y),0.2pt);) fi
- if sw_start_vector=1: AUX(sft_X,sft_Y)(start_vector) fi
- addto chem_structure also currentpicture shifted (sft_X,sft_Y);
+ 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
+ addto chem_structure also currentpicture shifted (sftX,sftY);
clearit;
enddef;
%------------------------------------------------------------------------------------------------
@@ -433,11 +409,16 @@ def start_vector= draw (posA[1] shifted (-1mm,0))--(posA[1] shifted (-4mm,0))
withpen penrazor rotated 90 scaled .8mm;
fill (posA[1] shifted (-2mm,-1mm))--posA[1]--(posA[1] shifted (-2mm,1mm))--cycle;
enddef;
-%------------------------------------------------------------------------------------------------
-def proc_bond_atom(expr n)=
- f_bra:=f_end:=f_term:=rotT:=adrS:=f_lineT:=f_rotT:=f_lenT:=f_envT:=envT:=env:=0;
- stkL[0]:=bondL:=crR; lenT:=crR; for i=1 upto 5: stkA[i]:=stkB[i]:=0; endfor
- for i=n upto cntMC[0]: com:= comMC[0][i]; par:=parMC[0][i];
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+def proc_bond_atom(expr n)=
+ begingroup
+ save com,par,adrA,adrB,f_bra,f_end,f_term,rotT,adrS,f_lineT,f_rotT,f_lenT,f_envT,envT,env,
+ lenT,strAT,stkA,stkB,stkL,bondL,temp_len,lineT;
+ numeric stkB[],stkA[],stkL[];
+ f_bra:=f_end:=f_term:=rotT:=adrS:=f_lineT:=f_rotT:=f_lenT:=f_envT:=envT:=env:=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];
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
@@ -483,6 +464,7 @@ def proc_bond_atom(expr n)=
elseif com=_set_colorB: colorB[getB(adrT)]:=par;
fi
endfor
+ endgroup
enddef;
%-------------------------------------------------------------------------------------------------
def add_atom=
@@ -494,8 +476,14 @@ def add_atom=
enddef;
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
def proc_skeleton=
- envT:=env:=f_lineT:=f_rotT:=f_lenT:=f_envT:=0; for i=1 upto 5: stkA[i]:=stkB[i]:=0; endfor
- adrA:=adrB:=cntA:=cntB:=angT:=adrS:=f_end:=f_bra:=rotT:=f_term:=0;
+ begingroup
+ save com,par,adrA,adrB,cntA,cntB,angT,adrS,env,envT,rotT,lineT,
+ f_end,f_bra,rotT,f_term,f_lineT,f_rotT,f_lenT,f_envT,stkA,stkB,stkM;
+ numeric stkB[],stkA[],stkM[];
+ adrA:=adrB:=cntA:=cntB:=angT:=adrS:=f_end:=f_bra:=rotT:=f_term:=0;
+ envT:=env:=f_lineT:=f_rotT:=f_lenT:=f_envT:=stkM[0]:=0; lineT:=si;
+ angA[0]:=angB[0]:=br_ang[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];
if com=_push: if par=1: stkM[adrS]:=env; adrS:=adrS+1; stkA[adrS]:=adrA:=cntA;
stkB[adrS]:=adrB:=cntB;
@@ -524,6 +512,7 @@ def proc_skeleton=
elseif com=_stack_reset: stkA[adrS+1]:=0;
fi
endfor
+ endgroup
enddef;
%-------------------------------------------------------------------------------------------------
vardef getA(expr n)=
@@ -536,17 +525,17 @@ def termA= if f_term=0: if f_bra=0: strA[incr cntA]:=strAT; strAT:=0;
def termB=
if f_term=0: if f_bra=0: br_ang[incr cntA]:=angT; else: f_bra:=0; fi f_term:=1; fi enddef;
def proc_cyc(expr n)= add_bond(angle(posA[n]-posB[cntB+1])-angT); enddef;
-def glu_c(expr n)= if strA[n]<>0: nB:=angT mod 180; nC:=.5strW[strA[n]]*atom_wd;
+def glu_c(expr n)= if strA[n]<>0: nB:=angT mod 180; nC:=.5str_wd[strA[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;
%-------------------------------------------------------------------------------------------------
def add_bond(expr m)=
- cntB:=cntB+1; if m=_arg_ang: tn:=proc_env(angT,env,60,-60); else: tn:=m; fi
+ cntB:=cntB+1; if m=_arg_ang: nA:=proc_env(angT,env,60,-60); else: nA:=m; fi
if f_bra=0: adrT:=cntA:=cntA+1; posA[cntA]:=posB[cntB]; angA[cntA]:=angT;
- if tn>=0: br_ang[cntA]:=angT+tn/2-90; else: br_ang[cntA]:=angT+tn/2+90; fi
+ if nA>=0: br_ang[cntA]:=angT+nA/2-90; else: br_ang[cntA]:=angT+nA/2+90; fi
else: f_bra:=0; fi
- angB[cntB]:=angT:=(angT+tn) mod 360;
+ angB[cntB]:=angT:=(angT+nA) mod 360;
if f_end=0: if lenB[cntB]=_size_a: posB[cntB+1]:=sfB(posB[cntB],atom_wd,angT);
else: nA:=lenB[cntB];glu:=0; if nA<0: nA:=-nA; glu_c(adrT);glu_c(cntA+1); fi
posB[cntB+1]:=sfB(posB[cntB],nA*bond_len+glu,angT); fi
@@ -554,8 +543,7 @@ def add_bond(expr m)=
else: f_end:=0; f_term:=1; fi
enddef;
%-------------------------------------------------------------------------------------------------
-vardef proc_env(expr n,m,a,b)=
- r:=(n mod 360);
+vardef proc_env(expr n,m,a,b)= r:=(n mod 360);
if m>=first_def_number: parMC[m][cntB-temp_cntB-1] else:
if m=hz:if r=0:a elseif r<=90:b elseif r<=180:a elseif r<270:b else:a fi
elseif m=vt:if r=0:b elseif r<90:a elseif r<=180:b elseif r<=271:a else:b fi
@@ -564,6 +552,8 @@ enddef;
%-------------------------------------------------------------------------------------------------
def pic_c(expr i,s)= substring(i,i+1) of s enddef;
def draw_atom(expr n,p,r,s,w)=
+ begingroup
+ save dx,u,j,pairA,pairT; pair pairA,pairT;
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));
@@ -572,94 +562,98 @@ def draw_atom(expr n,p,r,s,w)=
if nB=score_u: if u=0: u:=-.5; else:u:=0; fi;
elseif nB=hat: if u=0: u:= .5; else:u:=0; fi;
elseif (nB<>par_s)and(nB<>par_e):
- nA:=atom_w[nB]; pairA:=pairT+(.5*((dx-1)*nA),u*atom_wd);
+ nA:=char_w[nB]; pairA:=pairT+(.5*((dx-1)*nA),u*atom_wd);
if sw_atom_frame=1: draw_frame(nA,atom_wd,pairA,0.1pt); fi
if (sw_numberA>=1)or(sw_numberB>=1):
erase fill unitsquare xscaled nA yscaled atom_wd shifted pairA wpcs 0.01pt; fi
- addto currentpicture also atom_font[nB] shifted (pairA-(0,atom_d[nB])) Cp(colorA[n]);
+ addto currentpicture also atom_font[nB] shifted (pairA-(0,char_d[nB])) Cp(colorA[n]);
pairT:=pairT+(nA*dx,0); fi endfor
+ endgroup
enddef;
-%-------------------------------------------------------------------------------------------------
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
def wpcs expr n= withpen pencircle scaled n enddef;
def wpss expr n= withpen pensquare scaled n enddef;
def sqr(expr WD,HT)= ((0,0)--(WD,0)--(WD,HT)--(0,HT)--cycle) enddef;
def sfB(expr p,l,r)= p shifted ((l,0) rotated r) enddef;
-def wz_put(expr PA,PB,PD,CL)= save nA,nC,nD; nC:=length(Le-Ls);
+def wz_put(expr PA,PB,PD,CL)= nC:=length(Le-Ls);
for i=0 upto nC/zebra_gap:
nA:=zebra_gap*i/nC; nD:=(zebra_gap*i+ratio_zebra_black*zebra_gap)/nC;
if nD>((nC-zebra_gap)/nC): nD:=1; fi
fill nA[PB,PA]--nA[PD,PA]--nD[PD,PA]--nD[PB,PA]--cycle Cp(CL); endfor enddef;
-def bz_put(expr PA,PB,PC,PD,CL)= save nA,nC,nD; nC:=length(Le-Ls);
+def bz_put(expr PA,PB,PC,PD,CL)= nC:=length(Le-Ls);
for i=0 upto nC/zebra_gap:
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;
def clipping(expr SA,SB,PA,PB,LEN)=
- pT:=PA--PB; tn:=0.6atom_wd/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*strW[SB],atom_wd,PB);
- pA:=Ls--Le; pB:=Ls--tn[PB,PA]; pC:=0.1[PA,PB]--Le;
- elseif SB=0: Ls:= cut_off(pT,atom_wd*strW[SA],atom_wd,PA); Le:=PB;
- pA:=Ls--Le; pB:=tn[PA,PB]--Le; pC:=Ls--(0.1)[PB,PA];
- else: Ls:=cut_off(pT,atom_wd*strW[SA],atom_wd,PA); Le:=cut_off(pT,atom_wd*strW[SB],atom_wd,PB);
- pB:=tn[PA,PB]--tn[PB,PA]; pC:=pA:=Ls--Le; fi
+ elseif SA=0: Ls:=PA; Le:=cut_off(pT,atom_wd*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;
+ 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);
+ pB:=nA[PA,PB]--nA[PB,PA]; pC:=pA:=Ls--Le; fi
enddef;
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-def draw_wv=
- nB:=3bond_pen_wd; nA:=nB/length(Le-Ls);
+def draw_wv= nB:=3bond_pen_wd; nA:=nB/length(Le-Ls);
draw Le for i=1 upto 1/nA: if odd(i): ..controls(((i-.5)*nA)[sfB(Le,nB,ap),sfB(Ls,nB,ap)])
else: ..controls(((i-.5)*nA)[sfB(Le,nB,am),sfB(Ls,nB,am)]) fi ..(i*nA)[Le,Ls] endfor ..Ls;
enddef;
%-------------------------------------------------------------------------------------------------
def draw_bond(expr n,BP,EP,ANG,LN)=
-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
- 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);
- elseif LN=dm:draw sfB(pB,bondgap/1.75,ap) Cp(nB); draw sfB(pB,bondgap/1.75,am) Cp(nB);
- elseif LN=tm:draw pA Cp(nB);draw sfB(pA,bondgap,ap) Cp(nB); draw sfB(pA,bondgap,am) Cp(nB);
- elseif LN=wf:fill Ls--sfB(Le,ww,am)--sfB(Le,ww,ap)--cycle;
- elseif LN=wb:fill sfB(Ls,ww,am)--Le--sfB(Ls,ww,ap)--cycle;
- elseif LN=bd:draw pA withpen penrazor rotated ap scaled bondgap Cp(nB);
- elseif LN=bz:bz_put(sfB(Ls,ww,ap),sfB(Le,ww,ap),sfB(Ls,ww,am),sfB(Le,ww,am),nB);
- elseif LN=zf:wz_put(Ls,sfB(Le,ww,ap),sfB(Le,ww,am),nB);
- elseif LN=zb:wz_put(Le,sfB(Ls,ww,am),sfB(Ls,ww,ap),nB);
- elseif LN=dt:for i=0 step .75zebra_gap/length(Le-Ls) until 1: drawdot i[Ls,Le]; endfor
- elseif LN=wv:draw_wv;
- elseif LN=vf:draw pA Cp(nB);draw sfB(Le,bondgap,ANG-150)--Le--sfB(Le,bondgap,ANG+150) Cp(nB);
- elseif LN=vb:draw pA Cp(nB);draw sfB(Ls,bondgap,ANG-30)--Ls--sfB(Ls,bondgap,ANG+30) Cp(nB);
- elseif LN=si_:erase draw 0.15[Ls,Le]--0.85[Ls,Le] wpcs .75bondgap; draw pA Cp(nB);
- elseif LN=wf_:erase fill sfB(0.15[Ls,Le],.5ww,ap)--sfB(0.15[Ls,Le],.5ww,am)--
- sfB(0.85[Ls,Le],1.25ww,am)--sfB(0.85[Ls,Le],1.25ww,ap)--cycle;
- fill Ls--sfB(Le,ww,am)--sfB(Le,ww,ap)--cycle;
- elseif LN=wb_:erase fill sfB(0.15[Ls,Le],1.25ww,ap)--sfB(0.15[Ls,Le],1.25ww,am)--
- sfB(0.85[Ls,Le],.5ww,am)--sfB(0.85[Ls,Le],.5ww,ap)--cycle;
- fill sfB(Ls,ww,am)--Le--sfB(Ls,ww,ap)--cycle;
- elseif LN=bd_:erase draw 0.15[Ls,Le]--0.85[Ls,Le] wpcs 1.5bondgap;
- draw pA withpen penrazor rotated ap scaled bondgap Cp(nB);
+ 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;
+ if sw_numberB>=1: clipping(0,0,posA[BP],posA[EP],nC);
+ else: clipping(strA[BP],strA[EP],posA[BP],posA[EP],nC); fi
+ pickup pencircle scaled 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);
+ elseif LN=dm:draw sfB(pB,bondgap/1.75,ap) Cp(nB); draw sfB(pB,bondgap/1.75,am) Cp(nB);
+ elseif LN=tm:draw pA Cp(nB);draw sfB(pA,bondgap,ap) Cp(nB); draw sfB(pA,bondgap,am) Cp(nB);
+ elseif LN=wf:fill Ls--sfB(Le,ww,am)--sfB(Le,ww,ap)--cycle;
+ elseif LN=wb:fill sfB(Ls,ww,am)--Le--sfB(Ls,ww,ap)--cycle;
+ elseif LN=bd:draw pA withpen penrazor rotated ap scaled bondgap Cp(nB);
+ elseif LN=bz:bz_put(sfB(Ls,ww,ap),sfB(Le,ww,ap),sfB(Ls,ww,am),sfB(Le,ww,am),nB);
+ elseif LN=zf:wz_put(Ls,sfB(Le,ww,ap),sfB(Le,ww,am),nB);
+ elseif LN=zb:wz_put(Le,sfB(Ls,ww,am),sfB(Ls,ww,ap),nB);
+ elseif LN=dt:for i=0 step .75zebra_gap/length(Le-Ls) until 1: drawdot i[Ls,Le]; endfor
+ elseif LN=wv:draw_wv;
+ elseif LN=vf:draw pA Cp(nB);draw sfB(Le,bondgap,ANG-150)--Le--sfB(Le,bondgap,ANG+150) Cp(nB);
+ elseif LN=vb:draw pA Cp(nB);draw sfB(Ls,bondgap,ANG-30)--Ls--sfB(Ls,bondgap,ANG+30) Cp(nB);
+ elseif LN=si_:erase draw 0.15[Ls,Le]--0.85[Ls,Le] wpcs .75bondgap; draw pA Cp(nB);
+ elseif LN=wf_:erase fill sfB(0.15[Ls,Le],.5ww,ap)--sfB(0.15[Ls,Le],.5ww,am)--
+ sfB(0.85[Ls,Le],1.25ww,am)--sfB(0.85[Ls,Le],1.25ww,ap)--cycle;
+ fill Ls--sfB(Le,ww,am)--sfB(Le,ww,ap)--cycle;
+ elseif LN=wb_:erase fill sfB(0.15[Ls,Le],1.25ww,ap)--sfB(0.15[Ls,Le],1.25ww,am)--
+ sfB(0.85[Ls,Le],.5ww,am)--sfB(0.85[Ls,Le],.5ww,ap)--cycle;
+ fill sfB(Ls,ww,am)--Le--sfB(Ls,ww,ap)--cycle;
+ elseif LN=bd_:erase draw 0.15[Ls,Le]--0.85[Ls,Le] wpcs 1.5bondgap;
+ draw pA withpen penrazor rotated ap scaled bondgap Cp(nB);
+ fi
+ if (sw_numberB>=1)and(n>=numberB_start)and(n<=numberB_end):
+ if sw_numberB=2: nB:=n-numberB_start+1;
+ elseif sw_numberB=3: if numberB_end<cntB: nB:=numberB_end-n+1; else: nB:=cntB-n+1; fi
+ else: nB:=n; fi
+ draw_atom(n,.5[posA[BP],posA[EP]],0,decimal(nB),1); fi
fi
- if (sw_numberB>=1)and(n>=numberB_start)and(n<=numberB_end):
- if sw_numberB=2: nB:=n-numberB_start+1;
- elseif sw_numberB=3: if numberB_end<cntB: nB:=numberB_end-n+1; else: nB:=cntB-n+1; fi
- else: nB:=n; fi
- draw_atom(n,.5[posA[BP],posA[EP]],0,decimal(nB),1); fi
-fi
+ endgroup
enddef;
%-------------------------------------------------------------------------------------------------
vardef fit_zero(expr n)=if n<=9: "00" elseif n<=99: "0" fi enddef;
%-------------------------------------------------------------------------------------------------
def auxtag_out=
- for i=1 upto aux_max: exitif tag[i]="";
- if i=1: printf tag[1] else: &aux_delimiter&tag[i] fi
+ for i=1 upto aux_max: exitif tag[i]=""; if i=1: printf tag[1] else: &aux_delimiter&tag[i] fi
endfor
enddef;
+%-------------------------------------------------------------------------------------------------
def auxfile_out=
for i=1 upto aux_max: exitif tag[i]="";
if i=1: printf "" else: &aux_delimiter fi if sw_auxfix=0: &tag[i]&":" fi &
@@ -700,11 +694,11 @@ 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;
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;
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
def SP(expr a,b)expr p=subpath(a*length(p),b*length(p)) of p enddef;
def vL= withpen penrazor scaled fP enddef;
def hL= withpen penrazor rotated 90 scaled fP enddef;
@@ -713,20 +707,20 @@ def PO= z10..(.8aW,fH)..tension 1.5..(.2aW,fH)..z09..(.2aW,hP)..tension 1.5..(.8
enddef;
def POh= (hP,.25aH)..z19..(fW,.25aH)..(hW,hH)..cycle enddef;
def FD(expr c)(text s)=
-if f_FON[ASCII(c)]=1:
- aW:=atom_w[ASCII(c)]*(1-ratio_atomgap_atom*2);
- aH:=atom_h[ASCII(c)]*(1-ratio_atomgap_atom*2);
+if f_char[ASCII(c)]=1:
+ aW:=char_w[ASCII(c)]*(1-ratio_atomgap_atom*2);
+ aH:=char_h[ASCII(c)]*(1-ratio_atomgap_atom*2);
fW:=aW-hP; hW:=.5aW; fH:=aH-hP; hH:=.5aH;
z01=( 0,hP); z02=(hP, 0); z03=(hP,hP); z05=(aW,hP); z07=(fW, 0); z08=( 0,hH); z09=(hP,hH);
z10=(fW,hH); z12=( 0,fH); z13=(hP,fH); z14=(hW,fH); z16=(aW,fH); z18=(hP,aH); z19=(hW,hP);
s;
atom_font[ASCII(c)]:=
currentpicture shifted (ratio_atomgap_atom*atom_wd,ratio_atomgap_atom*atom_wd);
- clearxy; save x,y; clearit; fi
+ clearxy; save x,y; clearit;
+fi
enddef;
-%-------------------------------------------------------------------------------------------------
-def char_font_setup=
-pickup pencircle scaled char_pen_wd; fP:=char_pen_wd; hP:=.5char_pen_wd;
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+def char_font_setup(expr a)= pickup pencircle scaled a; fP:=a; hP:=.5a;
FD(" ")();
FD(".")(drawdot z19 wpcs fP);
FD(",")(drawdot z19 wpcs fP; draw (hW+.5fP,hP)..(hW+.3fP,-fP)..(hW-.5fP,hP-2fP));
@@ -809,51 +803,79 @@ FD("x")(draw z18--z07 vL scaled 1.4; draw (fW,aH)--z02 vL scaled 1.4);
FD("y")(draw z18--(hW,hH) vL scaled 1.4; draw (fW,aH)--z02 vL scaled 1.4);
FD("z")(draw z12--z16 hL;draw (1.4hP,fP)--(aW-1.4hP,aH-fP) vL scaled 1.4; draw z01--z05 hL);
enddef;
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
def blank_str:= " " enddef;
def fixed_r(expr n)(expr s)= (substring(0,n-length(s)) of blank_str)&s enddef;
def fixed_l(expr n)(expr s)= s&(substring(0,n-length(s)) of blank_str) enddef;
def 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 nA>n:
- warning(fdr(4)(s)&" ["&com_str[strA[s]]&"] has "&fdr(3)(nA)&" bonds"); fi fi
+ 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
enddef;
vardef stripP(expr a)=if length(a)=4: substring (1,3) of a else: a fi enddef;
-def STa(expr a,b)= tblA[incr tbl_cnt]:=a; tblN[tbl_cnt]:=0; wtA[tbl_cnt]:=b; enddef;
-def STb(expr a)(text s)= tblA[incr tbl_cnt]:=a; tblN[tbl_cnt]:=0;
- for list=s: tblN[tbl_cnt]:=tblN[tbl_cnt]+1;
- for j=1 upto tbl_max: if list=tblA[j]: tblB[tbl_cnt][tblN[tbl_cnt]]:=j; fi endfor
+%===================================================================================================
+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;
-%-------------------------------------------------------------------------------------------------
-tbl_cnt:=0;
+%--------------------------------------------------------------------------------------------------
+def STa(expr a,b)= tblA[incr awt_tbl_cnt]:=a; tblN[awt_tbl_cnt]:=0; tblWt[awt_tbl_cnt]:=b; enddef;
+def STb(expr a)(text s)= tblA[incr awt_tbl_cnt]:=a; tblN[awt_tbl_cnt]:=0;
+ for list=s: tblN[awt_tbl_cnt]:=tblN[awt_tbl_cnt]+1;
+ for j=1 upto awt_tbl_cnt: if list=tblA[j]: tblB[awt_tbl_cnt][tblN[awt_tbl_cnt]]:=j; fi endfor
+ endfor
+enddef;
+%--------------------------------------------------------------------------------------------------
+awt_tbl_cnt:=0;
+def set_atom_wt_tbl=
STa("C",12.0107); STa("H",1.00794); STa("{Al}",26.9815); STa("{As}",74.9236); STa("B",10.811);
STa("{Br}",79.904); STa("{Ca}",40.078); STa("{Cl}",35.453); STa("{Cu}",63.546); STa("D",2.012);
STa("F",18.9984); STa("{Fe}",55.845); STa("{Hg}",200.59); STa("I",126.90447); STa("K",39.0983);
STa("{Li}",6.941); STa("{Mg}",24.305); STa("N",14.0067); STa("{Na}",22.98977); STa("{Ni}",58.693);
STa("O",15.9994); STa("P",30.973761); STa("S",32.065); STa("{Si}",28.0855); STa("{Sn}",118.71);
STa("{Ti}",47.867); STa("{Zn}",65.409);
-tbl_max:=tbl_cnt;;
+%--------------------------------------------------------------------------------------------------
STb("{H_2_}")("H","H"); STb("OH")("O","H"); STb("O{Na}")("O","{Na}"); STb("CN")("C","N");
-STb("CHO")("C","H","O"); STb("N{O_2_}")("N","O","O"); STb("N{H_2_}")("N","H","H");
+STb("SH")("S","H"); STb("CHO")("C","H","O"); STb("N{O_2_}")("N","O","O");
+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 mol_check=
- hide_H:=warning_cnt:=cal_MW:=cal_MWp:=0; cal_FM:="";
- for i=1 upto tbl_max: sumA[i]:=0; endfor
- for i=1 upto cntA: knownA:=nA:=0;
+enddef;
+%===================================================================================================
+def proc_calc_out=
+ begingroup
+ save warning_cnt,cal_MW,cal_MWp,knownA,cal_FM,bondC,tmp_wtp,bond_cnt,hide_H,
+ inf_NO,inf_EN,inf_JN,inf_FM,inf_CAS,inf_USE,inf_EXA,inf_EXB,inf_MW;
+ numeric sumA[],bondC[];
+ string cal_FM,cal_MW_str,sumA,s_tag,s_var,
+ 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;
+ if awt_tbl_cnt=0: set_atom_wt_tbl fi
+ proc_get_info;
+ for i=1 upto awt_tbl_cnt: sumA[i]:=0; endfor
+ for i=1 upto cntA: knownA:=bond_cnt:=0;
for j=1 upto cntB: if (lineB[j]=dl)or(lineB[j]=dr)or(lineB[j]=dm): bondC[j]:=2;
elseif (lineB[j]=tm): bondC[j]:=3; elseif lineB[j]=nl: bondC[j]:=0;
elseif lineB[j]=0: bondC[j]:=0; else: bondC[j]:=1; fi
- if (sB[j]=i)or(eB[j]=i): nA:=nA+bondC[j]; fi endfor
- Bcnt[i]:=nA;
+ 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 nA<4: hide_H:=hide_H+(4-nA); fi fi
+ if com_str[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:
+ for j=1 upto awt_tbl_cnt:
if com_str[strA[i]]=tblA[j]:
if tblN[j]=0: sumA[j]:=sumA[j]+1;
else: for k=1 upto tblN[j]: sumA[tblB[j][k]]:=sumA[tblB[j][k]]+1; endfor fi
@@ -861,23 +883,26 @@ def mol_check=
if knownA=0: warning(" Unknown Str("&com_str[strA[i]]&") is used "&decimal(i)); fi
endfor
sumA[2]:=sumA[2]+hide_H;
- for i=1 upto tbl_max:
+ for i=1 upto awt_tbl_cnt:
if sumA[i]>=1:
- tmp_wtp:=(wtA[i]/100)*sumA[i];
- if (tmp_wtp<=40)and(cal_MWp<=40): cal_MW:=cal_MW+(wtA[i]*sumA[i]);
+ tmp_wtp:=(tblWt[i]/100)*sumA[i];
+ if (tmp_wtp<=40)and(cal_MWp<=40): cal_MW:=cal_MW+(tblWt[i]*sumA[i]);
else: cal_MWp:=cal_MWp+tmp_wtp; fi
cal_FM:=cal_FM&stripP(tblA[i]) if sumA[i]>=2: &decimal(sumA[i]) fi;
fi
endfor
+ if sw_auxout=1: auxfile_out; fi
+ if sw_checklist=1: checklist_out; fi
+ if sw_MOLout=1: MOLfileout; fi
+ endgroup
enddef;
-%------------------------------------------------------------------------------------------------
-def checklist_out=
- nA:=0; cal_MW_str:="";
+%==================================================================================================
+def checklist_out= nA:=0;
message "% Molecular name = "& inf_EN;
message "% There were "&fdr(3)(warning_cnt)&
" warnings / Expanded command count= "&decimal(cntMC[0]);
- message "% width * height = " & fdr(8)(max_x-min_x)&" * "&fdr(8)(max_y-min_y);
- message "% Shift width * height = "& fdr(8)(min_x)&" * "&fdr(8)(min_y);
+ message "% 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);
message "% Atom count="&fdr(3)(cntA)&" Bond count="&fdr(3)(cntB)&
" Ring count="&fdr(3)(cntB-cntA+1)&" Hide H ="&fdr(3)(hide_H);
@@ -892,18 +917,18 @@ def checklist_out=
message "%Fomula / Molecular weight ---------------------------------------";
if cal_MWp<=40: cal_MW_str:=fdr(10)(cal_MW);
else: cal_MW_str:=fdr(10)(cal_MWp)&" * 100"; fi
- for i=1 upto tbl_max:
+ for i=1 upto awt_tbl_cnt:
if sumA[i]>=1:
- message "% "&fixed_l(4)(stripP(tblA[i]))&"("&fdr(9)(wtA[i])&") * "&fdr(6)(sumA[i])&" = "
- if tmp_wtp<=40: &fdr(12)(wtA[i]*sumA[i]); else: &fdr(12)(tmp_wtp)&" * 100"; fi fi
+ message "% "&fixed_l(4)(stripP(tblA[i]))&"("&fdr(9)(tblWt[i])&") * "&fdr(6)(sumA[i])&" = "
+ if tmp_wtp<=40: &fdr(12)(tblWt[i]*sumA[i]); else: &fdr(12)(tmp_wtp)&" * 100"; fi fi
endfor
message "% Weight Calc: " &cal_MW_str &" / Input: "
- if scantokens(inf_MW)>0: &inf_MW &" / weight gap= " &decimal(cal_MW-scantokens(inf_MW)) fi;
+ if inf_MW<>"": &inf_MW &" / weight gap= " &decimal(cal_MW-scantokens(inf_MW)) fi;
message "% Fomula Calc: "&cal_FM&" / Input: "
- if inf_FM<>"":&inf_FM&" / "& if inf_FM=cal_FM: "MACTCH" else: "NOT MACTCH" fi fi;
+ if inf_FM<>"": &inf_FM&" / "& if inf_FM=cal_FM: "MACTCH" else: "NOT MACTCH" fi fi;
message "%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%";
enddef;
-%------------------------------------------------------------------------------------------------
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
def MOLfileout=
mp_log_name:=jobname&"-"&fit_zero(char_num)&decimal(char_num)&"-"&inf_EN&".mol";
printf ""; printf " -MCFtoMOL- "&fixed_l(20)(info[1]); printf "";
@@ -919,4 +944,4 @@ def MOLfileout=
printf fdr(3)(sB[i])&fdr(3)(eB[i])&fdr(3)(nA)&fdr(3)(nB)&" 0 0"; fi endfor
printf "M END";
enddef;
-%-----------------------------------------------------------------------------------------------
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%