%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % Molecular Coding Format manual by Akira Yamaji 2021.06.13 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \documentclass[a4paper]{article} \usepackage[pdftex]{graphicx} \usepackage[pdftex]{hyperref} \usepackage{makeidx} \makeindex \hypersetup{colorlinks=true,linkcolor=blue} \makeatletter \usepackage{mcf_setup} %---------------------------------------------------------------------------- %%%%\pdfpkresolution=1200 %---------------------------------------------------------------------------- %%%%\edef\fext{pk}% **** for proof print (fast, not complete output) \edef\fext{mps}% **** for final print (it takes long time) %---------------------------------------------------------------------------- %%%%\edef\fext{png}% %%%%\edef\fext{svg}% %%%%\edef\fext{eps}% %---------------------------------------------------------------------------- \topmargin=-18mm \textheight=254mm \textwidth=168mm \oddsidemargin=0mm %%%%\oddsidemargin=7mm %%%%\evensidemargin=-7mm \unitlength=1mm% %---------------------------------------------------------------------------- \newcount \fnum% \newdimen \htman% \newdimen \wdman% \newdimen \htmans% \newbox \fbox% %---------------------------------------------------------------------------- \htman=45mm% \wdman=94mm% \htmans=42mm% \fnum=1% %---------------------------------------------------------------------------- \edef\MCFjobname{mcf_man_soc}% %---------------------------------------------------------------------------- \font\@strufont=\MCFjobname\relax% %---------------------------------------------------------------------------- \def\MCFgraph{% \ifx\fext\@pk{\@strufont\char\fnum}% \else% \edef\file@name{\MCFjobname-\z@num\fnum.\fext}% \setbox\fbox=\hbox{\@strufont\char\fnum}% \includegraphics[width=\wd\fbox,height=\ht\fbox]{\file@name}% %%%%%%\includegraphics{\file@name}% \fi% \global\advance\fnum\@ne\relax% }% %--------------------------------------------------------------------------- \def\put@char{% \begin{picture}(75,100)% \put(0,95){\bf [\NO]\EN}% \put(5,90){\small\tt FM:\fm{ }MW:\mw}% \put(5,0){\MCFgraph}% \end{picture}% }% %---------------------------------------------------------------------------- \def\INFO#1{\@for\@temp:=#1\do{\tag@var\@temp}\put@char}% %---------------------------------------------------------------------------- \begin{document} \title{\Huge\sf Molecular Coding Format manual} \author{Akira Yamaji} \date{\today} \maketitle \begin{center} Located at http://www.ctan.org/pkg/mcf2graph \end{center} \begin{center} Suggestion or request mail to: mcf2graph@gmail.com \end{center} %----------------------------------------------------------------------------- \thispagestyle{empty} \vspace{5mm}% \MCFgraph\MCFgraph\MCFgraph\MCFgraph\\ \MCFgraph\MCFgraph\MCFgraph\MCFgraph\\ \MCFgraph\MCFgraph\MCFgraph\MCFgraph\\ \MCFgraph\MCFgraph\MCFgraph\MCFgraph\\ \MCFgraph\MCFgraph\MCFgraph\MCFgraph\\ \MCFgraph\MCFgraph\MCFgraph\MCFgraph\\ \MCFgraph\MCFgraph\MCFgraph\MCFgraph %----------------------------------------------------------------------------- \twocolumn \thispagestyle{empty} \tableofcontents %----------------------------------------------------------------------------- \linethickness{0.08mm}% %---------------------------------------------------------------------------- \newpage \twocolumn \section{Introduction} Molecular Coding Format(MCF) is new linear notation represent chemical structure diagrams. This Coding is named from programing technique such as operator, array, scope, macro, adressing, etc. mcf2graph convert from MCF to pk font, PNG, SVG, EPS, MOL file. It is also able to calculate molecular weight, exact mass, molecular formula. %----------------------------------------------------------------------------- \section{MCF syntax} \subsection{Make bond} \subsubsection{Chain} \begin{verbatim} real number plus (+): counterclockwize real number minus(-): clockwize $n (0<=n<360): absolute angle <10,-30,45,-45,60,$300,$0 \end{verbatim} \MCFgraph %----------------------------------------------------------------------------- \subsubsection{Chain use !,!n} \index{"!}% \begin{verbatim} ! : take value 60 or -60 depend on current angle and environment !6 : !,!,!,!,!,! <-30,!6 \end{verbatim} \MCFgraph %----------------------------------------------------------------------------- \subsubsection{Jump to atom} \index{"@}% \begin{verbatim} @n : Jump to An ** An: atom number(-999<=n<=4095) <-30,!6,@3,0,!,@5,-30 \end{verbatim} \MCFgraph %------------------------------------ \subsubsection{Branch bond} \index{\textbackslash}% \begin{verbatim} \ : 0 <-30,!6,@3,\,! \end{verbatim} \MCFgraph %----------------------------------------------------------------------------- \subsubsection{Branch modified bond} \index{*\textbackslash}% \index{\textbackslash*}% \index{\textbackslash\textbackslash}% \index{*\textbackslash*}% \begin{verbatim} \ : 0 *\ : 0~wf \* : 0~zf \\ : 0~dm *\* : 0~wv <30,!8, @2,\,!,@4,*\,!,@6,\*,!,@8,\\,!,@10,*\*,! \end{verbatim} \MCFgraph %----------------------------------------------------------------------------- \index{\textasciicircum}% ^ \index{\textasciitilde}% ~ \index{`}% \begin{verbatim} <30,!6, \~dr,!, : 0~dr,! \`1.5,-90 : 0`1.5,-90 \^15,-60 : 0^15,-60 \end{verbatim} \MCFgraph %----------------------------------------------------------------------------- \subsubsection{Connect atom} \index{\&}% \begin{verbatim} &n : Connect to An <-30,!6,@3,\,!3,&6~bd,@9,&4~bz \end{verbatim} \MCFgraph %----------------------------------------------------------------------------- \subsubsection{Ring} \index{?}% \begin{verbatim} ?n : n membered ring(3<=n<=20) ?6 : <-120,60,60,60,60,60,&1 ?6 \end{verbatim} \MCFgraph %----------------------------------------------------------------------------- \subsubsection{Rotate current angle} \index{\textgreater}% \begin{verbatim} : change environment <-30,``1,!, /_`2^30,!2,/!2>lr,!2,/!2>rl,!) \end{verbatim} \MCFgraph %----------------------------------------------------------------------------- \subsubsection{Add group} \begin{verbatim} <30,!17,2:/_,4:/!,6:/!2, 10:/?!,14:/??!,16:/Ph^-60 \end{verbatim} \MCFgraph %----------------------------------------------------------------------------- \subsubsection{Add modified group} \begin{verbatim} ~,^,` : change type,angle,length <30,!6,{2~wf,4~zf,6^-30,8^$120}:/_ \end{verbatim} \MCFgraph %----------------------------------------------------------------------------- \begin{verbatim} ^,`,> : change angle,length,environment <-30,!7`1,3:/_`2^30,5:/!2>lr,7:/!2>rl \end{verbatim} \MCFgraph %----------------------------------------------------------------------------- \subsection{Chain environment} \subsubsection{Horizontal,vertical} \index{hz}% \index{vt}% \index{"'}% \begin{verbatim} >hz : horizontal environment (default) >vt : vertical environment ?4, {3^-90,3^-30,3^90}:/'(!3,"{hz}")>hz, {1^-60,1,1^60}:/'(!3,"{vt}")>vt \end{verbatim} \MCFgraph %----------------------------------------------------------------------------- \subsubsection{Left-right,right-left} \index{lr}% \index{rl}% \begin{verbatim} >lr : left-right environment >rl : right-left environment <-30,!6, {3^-30,3,3^30}:/'(!3,"{lr}")>lr, {5^-30,5,5^30}:/'(!3,"{rl}")>rl \end{verbatim} \MCFgraph %----------------------------------------------------------------------------- \subsubsection{Fixed rotate angle} \index{\textgreater}% \begin{verbatim} >n : rotate n <30,!4, 2:/!6>30, % 2:\,30,30,30,30,30,30 4:/!4>-45 % 4:\,-45,-45,-45,-45 \end{verbatim} \MCFgraph %----------------------------------------------------------------------------- \subsubsection{Multi rotate angle} \begin{verbatim} >'(90,-90,...) : rotate 90,-90,... <30,!6,6>'(90,-90,90,-90,90):/!5 \end{verbatim} \MCFgraph %----------------------------------------------------------------------------- \subsection{Miscellaneous} %----------------------------------------------------------------------------- \subsubsection{Abbreviated parts} \index{NH}% \index{N"!}% \index{N"!2}% \index{SO}% \index{SOO}% \begin{verbatim} NH : N,/H~nl N! : N,/_ N!2 : N,/! SO : S,//O SOO : S,//O^35,//^-35 <-30,!2,NH,!2,N!,!2,N!2,SO,!2,SOO,! \end{verbatim} \MCFgraph \index{?"!}% \index{??}% \index{??"!}% \index{N?"!}% \begin{verbatim} ?! : /_,! ?? : /_^35,/_-35 /?! : isopropyl /??! : tert-butyl /N?! : dimethylamino <30,!9`1,?!,!,??,!,2:??,4:/??,6:/??!,8:/N?! \end{verbatim} \MCFgraph %----------------------------------------------------------------------------- \subsubsection{Parts definition} \begin{verbatim} '(..) : user defined parts iBuOH:='(!,/_,!,OH); MC(<30,?6,{4,6}:/iBuOH) \end{verbatim} \MCFgraph %----------------------------------------------------------------------------- \subsubsection{Parts inline definition} \begin{verbatim} <30,!8,{2,6}:/'(!,/_,!,OH) \end{verbatim} \MCFgraph %----------------------------------------------------------------------------- \subsubsection{Move position} \index{"@()}% \begin{verbatim} @(x,y) : Move to (l*x,l*y) from origin ** l=bond length of ring <30,?6,@3,!4,//O,!,O,n_^60,@(6,1),H,p_^15 \end{verbatim} \MCFgraph %----------------------------------------------------------------------------- \subsubsection{Serial number} \index{--}% \begin{verbatim} 6--10 : 6,7,8,9,10 <30,!14,{2,6--10,14}:/_~bd`0.5 \end{verbatim} \MCFgraph \newpage %----------------------------------------------------------------------------- \subsubsection{Change color} \index{red}% \index{blue}% \index{green}% \begin{verbatim} (use with metapost only) beginfont() MC(<30,Ph,{2,5}:N,3:/NH2,4:/COOH, %--------------------- 2:red, % red A2 5:blue, % blue A5 3=green % green B3 %--------------------- ) endfont \end{verbatim} \MCFgraph %----------------------------------------------------------------------------- \subsubsection{Change font} \index{atomfont}% \begin{verbatim} (use with metapost only) beginfont() %---------------- atomfont:="cmr8"; %---------------- MC(<30,Ph,{2,5}:N,3:/NH2,4:/COOH) endfont \end{verbatim} \MCFgraph %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \section{Option parameter} %------------------------------------------------------------------------------ \subsection{Angle parameter} \index{mangle}% \begin{verbatim} mangle=0 ** default MCat(0.2,0.5)(Ph) mangle:=30; MCat(0.8,0.5)(Ph) \end{verbatim} \MCFgraph %------------------------------------------------------------------------------ \subsection{Size/Ratio parameter} %----------------------------------------------------------------------------- \subsubsection{Bond length} \index{blength}% \begin{verbatim} (fit to font size) blength=0 ** default \end{verbatim} \MCFgraph %----------------------------------------- \begin{verbatim} (ratio bond/font width) blength=0.1 ** (01) ignore msize(w,h) \end{verbatim} \MCFgraph %------------------------------------------------------------------------------ \subsubsection{Molecular size} \index{msize}% \begin{verbatim} msize=(1,1) ** default \end{verbatim} \MCFgraph %----------------------------------------------------------- \begin{verbatim} msize=(0.25,1) msize=40mm-4mm*0.25=9mm \end{verbatim} \MCFgraph %----------------------------------------------------------- \begin{verbatim} msize=(11mm,11mm) \end{verbatim} \MCFgraph %------------------------------------------------------------------------------ \subsubsection{Molecular position} \index{mposition}% \begin{verbatim} mposition=(0.5,0.5) ** default \end{verbatim} \MCFgraph %-------------------------------------------------------------- \begin{verbatim} mposition=(1,0) \end{verbatim} \MCFgraph %-------------------------------------------------------------- \begin{verbatim} mposition=(10mm,4mm) \end{verbatim} \MCFgraph %------------------------------------------------------------------------------ \subsection{Size parameter} %----------------------------------------------------------------------------- \subsubsection{Font size} \index{fsize}% \begin{verbatim} fsize=(font width,font height) ** default: (30mm,20mm) fsize=(40mm,15mm) \end{verbatim} \MCFgraph %----------------------------------------------------------------------------- \subsubsection{Font margin} \index{fmargin}% \begin{verbatim} fmargin=(margin left rigth,top bottom) ** default: (0.4mm,0.4mm) fmargin=(10mm,2mm) \end{verbatim} \MCFgraph %----------------------------------------------------------------------------- \subsubsection{Offset thickness of bond} \index{offset\_thickness}% \begin{verbatim} default: offset_thickness=0.2pt \end{verbatim} \MCFgraph %----------------------------------------------------------------------------- \subsubsection{Offset of double bond gap} \index{offset\_bond\_gap}% \begin{verbatim} default: offset_bond_gap=0.3pt \end{verbatim} \MCFgraph %----------------------------------------------------------------------------- \subsubsection{Offset of atom width} \index{offset\_atom}% \begin{verbatim} default: offset_atom=0.8pt \end{verbatim} \MCFgraph %----------------------------------------------------------------------------- \subsubsection{Offset of wedge width} \index{offset\_wedge}% \begin{verbatim} default: offset_wedge=0.4pt \end{verbatim} \MCFgraph %----------------------------------------------------------------------------- \subsubsection{Max bond length} \index{max\_blength}% \begin{verbatim} default: max_blength=10mm \end{verbatim} \MCFgraph %----------------------------------------------------------------------------- \subsection{Ratio parameter} %----------------------------------------------------------------------------- \subsubsection{Thickness/bond length} \index{ratio\_thickness\_bond}% \begin{verbatim} default: ratio_thickness_bond=0.015 \end{verbatim} \MCFgraph %----------------------------------------------------------------------------- \subsubsection{Char/bond thickness} \index{ratio\_char\_bond}% \begin{verbatim} default: ratio_char_bond=1.5 \end{verbatim} \MCFgraph %----------------------------------------------------------------------------- \subsubsection{Bond gap/bond length} \index{ratio\_bondgap\_bond}% \begin{verbatim} default: ratio_bondgap_bond= 0.15 \end{verbatim} \MCFgraph %----------------------------------------------------------------------------- \subsubsection{Atom/bond length} \index{ratio\_atom\_bond}% \begin{verbatim} default: ratio_atom_bond= 0.36 \end{verbatim} \MCFgraph %----------------------------------------------------------------------------- \subsubsection{Wedge/bond length} \index{ratio\_wedge\_bond}% \begin{verbatim} default: ratio_wedge_bond=0.12 \end{verbatim} \MCFgraph %----------------------------------------------------------------------------- \subsubsection{Font atom gap/atom length} \index{ratio\_atomgap\_atom}% \begin{verbatim} default: ratio_atomgap_atom= 0.050 \end{verbatim} \MCFgraph %----------------------------------------------------------------------------- \subsubsection{Chain/ring length} \index{ratio\_chain\_ring}% \begin{verbatim} default: ratio_chain_ring= 0.66 \end{verbatim} \MCFgraph %----------------------------------------------------------------------------- \subsubsection{Hash gap/bond length} \index{ratio\_hashgap\_bond}% \begin{verbatim} default: ratio_hashgap_bond=0.12 \end{verbatim} \MCFgraph %----------------------------------------------------------------------------- %%%%\newpage %----------------------------------------------------------------------------- \subsection{Drawing mode} %----------------------------------------------------------------------------- \subsubsection{Numbering atom} \index{sw\_numbering}% \index{Atom}% \index{Brock}% \index{Inverse}% \index{numbering\_start}% \index{numbering\_end}% \begin{verbatim} sw_numbering=Atom numbering_start:=3; numbering_end:=8; default: sw_numbering=0 : \end{verbatim} \MCFgraph \begin{picture}(5,20) \put(0,14){\makebox[9mm]{\tt Atom}} \put(0, 8){\makebox[12mm]{\tt +Brock}} \put(0, 2){\makebox[16mm]{\tt +Inverse}} \end{picture} %----------------------------------------------------------------------------- \subsubsection{Numbering bond} \index{numbering\_start}% \index{numbering\_end}% \index{Bond}% \index{Brock}% \index{Inverse}% \begin{verbatim} sw_numbering=Bond numbering_start:=3; numbering_end:=8; default: sw_numbering=0 : \end{verbatim} \MCFgraph \begin{picture}(5,20) \put(0,14){\makebox[9mm]{\tt Bond}} \put(0, 8){\makebox[12mm]{\tt +Brock}} \put(0, 2){\makebox[16mm]{\tt +Inverse}} \end{picture} %----------------------------------------------------------------------------- \subsubsection{Trimming mode} \index{sw\_trimming}% \begin{verbatim} sw_trimming:=0; ** default msize:=(1,0.7); MCat(0.2,0.3)(Ph) MCat(0.8,0.7)(Ph) \end{verbatim} \MCFgraph \begin{verbatim} sw_trimming:=1; MCat(0.2,0.3)(Ph) MCat(0.8,0.7)(Ph) \end{verbatim} \MCFgraph %----------------------------------------------------------------------------- \subsubsection{Expand mode} \index{sw\_expand}% \begin{verbatim} MCat(0, .5)(<30,Ph,4:/COOH,3:/NH2) sw_expand:=1; MCat(1, .5)(<30,Ph,4:/COOH,3:/NH2) ** default: sw_expand=0 \end{verbatim} \MCFgraph %----------------------------------------------------------------------------- \subsubsection{Abbreviate group} \index{Group}% \index{sw\_abbreviate}% \begin{verbatim} ** default: sw_abbreviate=Group \end{verbatim} \MCFgraph %----------------------------------------------------------------------------- \subsubsection{Abbreviate bond type} \index{Bond}% \index{sw\_abbreviate}% \begin{verbatim} ** default: sw_abbreviate=Bond \end{verbatim} \MCFgraph %----------------------------------------------------------------------------- \subsection{Frame} %----------------------------------------------------------------------------- \subsubsection{Font frame} \index{sw\_frame}% \index{Bothside}% \index{Inside}% \index{Outside}% \begin{verbatim} ** default:sw_frame=0 (Draw font frame) fmargin:=(5mm,2mm); sw_frame=Outside \end{verbatim} \MCFgraph \begin{verbatim} (Frame inside margin) sw_frame=Inside \end{verbatim} \MCFgraph \begin{verbatim} (Draw both frame) sw_frame=Bothside=Inside+Outside \end{verbatim} \MCFgraph %----------------------------------------------------------------------------- \subsubsection{Molecular frame} \index{Mol}% \begin{verbatim} sw_frame=Mol ** default:sw_frame=0 \end{verbatim} \MCFgraph %----------------------------------------------------------------------------- \subsubsection{Atom frame} \index{Atom}% \begin{verbatim} sw_frame=Atom ** default: sw_frame=0 MC(<30,COOH,!,COOH) \end{verbatim} \MCFgraph %----------------------------------------------------------------------------- \subsection{Parameter setting} \subsubsection{Local parameter setting} \index{beginfont()}% \index{endfont}% \begin{verbatim} beginfont() MC(Ph) endfont beginfont() %-------------------------- ratio_thickness_bond:=0.05; %-------------------------- MC(Ph) endfont beginfont() MC(Ph) endfont \end{verbatim} \MCFgraph\MCFgraph\MCFgraph %----------------------------------------------------------------------------- \subsubsection{Global parameter setting} \begin{verbatim} beginfont() MC(Ph) endfont %-------------------------- ratio_thickness_bond:=0.05; %-------------------------- beginfont() MC(Ph) endfont beginfont() MC(Ph) endfont \end{verbatim} \MCFgraph\MCFgraph\MCFgraph %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \section{Function} %----------------------------------------------------------------------------- \subsection{Function MC()} \index{MC()}% \begin{verbatim} (Draw molecule) msize=(a,b) **default (1,1) mposition=(c,d) **default (0.5,0.5) a: ratio molecular width/font width b: ratio molecular hight/font hight c: x axis position d: y axis position beginfont() MC(<30,Ph,3:/F,4:/Cl) endfont \end{verbatim} \MCFgraph %----------------------------------------------------------------------------- \subsection{Function MCat()} \index{MCat()}% \begin{verbatim} (Draw molecule at mposition) MCat(c,d)(....) : mposition:=(c,d); MC(....) c: x axis position d: y axis position defaultsize:=5bp; fsize:=(60mm,40mm); fmargin:=(3mm,3mm); blength:=0.07; sw_frame:=Outside; mangle:=0; for i=1 step -0.5 until 0: for j=0 step 0.33 until 1: MCat(j,i)(Ph,4:N) add(drawarrow((A1+A1up**aw)..A1); label(decimal(mangle), p0+(0.5w,0.5h)); ) mangle:=mangle+30; endfor endfor \end{verbatim} \MCFgraph %----------------------------------------------------------------------------- \subsection{Function check()} \index{check()}% \begin{verbatim} (immediately compile) beginfont("EN:Pyridine") MC(<30,Ph,2:N) endfont (check mcf and compile) ** check(mc) : error count beginfont("EN:Pyridine", ":<30,Ph,}2:N") % ** extra '}' if check(mc)=0: MC(scantokens(mc)) fi endfont \end{verbatim} \MCFgraph\hspace{22mm}\MCFgraph \begin{verbatim} check(mc)=0 check(mc)>=1 \end{verbatim} %=============================================================================== \newpage \subsection{Function add()} \index{add()}% \index{plus}% \index{minus}% \index{lonepair}% \index{lonepairdiam}% \index{lonepairspace}% \index{circlediam}% \index{circlepen}% \index{w}% \index{h}% \index{aw}% \index{em}% \index{p0}% \index{l}% \index{/*}% \index{**}% \index{\textgreater\textgreater}% \index{An}% \index{A[]}% \index{A[]ang}% \index{A[]up}% \index{A[]left}% \index{A[]right}% \index{A[]down}% \index{Bn}% \index{B[]}% \index{B[]s}% \index{B[]m}% \index{B[]e}% \index{B[]ang}% \index{B[]up}% \index{B[]left}% \index{B[]right}% \index{B[]down}% \index{defaultscale}% \index{labeloffset}% \begin{verbatim} (Add label to molecule) w: molecular width h: molecular height aw: atom font size em: label font size p0: origin of molecular structure l: bond length An: atom number A[m]: atom position A[m]ang: branch angle of A[m] A[m]up: dir A[m]ang A[m]left: dir A[m]ang+90 A[m]right: dir A[m]ang-90 A[m]down: dir A[m]ang+180 Bn: bond number B[m]: bond(path) B[m]s: bond start position B[m]m: bond middle position B[m]e: bond end position B[m]ang: bond angle B[m]up: dir B[m]ang B[m]left: dir B[m]ang+90 B[m]right: dir B[m]ang-90 B[m]down: dir B[m]ang+180 plus : '+' circled minus : '-' circled circlediam = 0.6aw (default) circlepen = 0.2bp (default) lonepair r: ':' rotated r lonepairdiam = 0.3aw (default) lonepairspace = 0.7aw (default) ** : scaled << : rotated a /* b : point b of a beginfont("EN:add() 1") fsize:=(70mm,40mm); sw_frame:=Bothside; max_blength:=10mm; msize:=(.91,.9); MCat(.5,.85)(<30,?6,{2,5}:O) add( defaultscale:=.8; labeloffset:=.3aw; dotlabel.lft("p0",p0); dotlabel.rt( "p0+(w,h)",p0+(w,h)); dotlabel.ulft("A1",A1); drawarrow A1..A1+__*l< input main macro %------------------------------------------------------------------------- sw_output:=Info; % aux(information) file output on > global setting %%%% sw_output:=Report; > report output %%%% sw_output:=MOL2k; > MOL file output fsize:=(60mm,40mm); % (font width,font height) > tag1:="J"; > jobname tag2:="C"; > char No tag3:="mw"; % calculated molecular weight > tag4:="fm"; % calculated molecular formula > outputformat:="png"; hppp:=vppp:=0.1; > PNG output outputtemplate:="%j-%3c.png"; > %------------------------------------------------------------------------- beginfont("EN:Ampicillin","MW:349.405") > information MC(<45,?4,-3=?5,2:N,7:S, > immediately compile 3^45:/*H,1://O^15,5:/*COOH^-18,6:??, > @4,*\^15,NH,!,//O,!,/*NH2,!,Ph) > endfont > %------------------------------------------------------------------------ beginfont("EN:Cholesterol","MW:386.65", >information %---------------------------------------- > ": <30,?6,{-4,-2}=?6,-4=?5,7=dl, ", > mc1 ": 10:/*H^180,11:/*H^-60,17:/*H^-54, ", > mc2 ": {4,12}:*/_^60, ", > mc3 ": @-1,18,/*_,-60,!3,?! ") > mc4 %---------------------------------------- > if check(mc)=0: MC(scantokens(mc)) fi > mc=mc1 - mc4 endfont > %------------------------------------------------------------------------------ beginfont("f:mcf_data_base","t:EN","v:Adenine") > from mcf_data_base.mcf if check(mc)=0: MC(scantokens(mc)) fi > select EN="Adenine" endfont > %------------------------------------------------------------------------------ beginfont("f:mcf_data_base","t:EN","v:Guanine") > from mcf_data_base.mcf if check(mc)=0: MC(scantokens(mc)) fi > select EN="Guanine" endfont %------------------------------------------------------------------------------ beginfont("f:mcf_data_base","t:EN","v:Cytosine") > from mcf_data_base.mcf if check(mc)=0: MC(scantokens(mc)) fi > select EN="Cytosine" endfont > %------------------------------------------------------------------------------ beginfont("f+:mcf_data_base","t:n","v:4") > from mcf_data_base.mcf if check(mc)=0: MC(scantokens(mc)) fi > v:4 select No.4 endfont > 'f+' keep file open %------------------------------------------------------------------------------ for i=5 upto 155: > from mcf_data_base.mcf beginfont("f+:mcf_data_base","v:*") > v:* no selection if check(mc)=0: MC(scantokens(mc)) fi > No.5 - No.155 endfont > 'f+' keep file open endfor > %------------------------------------------------------------------------------ bye \end{verbatim} %------------------------------------------------------------------------ \noindent% \newpage \subsection{Molecular data base file} \begin{verbatim} %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % molecular data base file mcf_data_base.mcf by Akira Yamaji 2021.04.18 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % tag1:var1;tag2:var2;tag3:var3 .... % first character of line '%' comment out % first character of line '+' begin MCF , end MCF %------------------------------------------------------------------------------ Cat:biological;EN:Adenine;MW:135.13 + <30,?6,3=?5,{1,3,5,9}=dl,{2,6,9}:N,5:/NH2,7:NH +------------------------------------------------------------------------------ Cat:biological;EN:Guanine;MW:151.13 + <30,?6,3=?5,{1,3,9}=dl,{2,9}:N,{6,7}:NH,5://O,1:/NH2 +------------------------------------------------------------------------------ Cat:biological;EN:Cytosine;MW:111.10 + <30,?6,{4,6}=dl,4:N,3://O,2:NH,5:/NH2 +------------------------------------------------------------------------------ Cat:biological;EN:Thymine;MW:126.11 + <30,?6,3=dl,{2,6}:NH,{1,5}://O,4:/_ +------------------------------------------------------------------------------ Cat:biological;EN:Uracil;MW:112.09 + <30,?6,6=dl,{3,5}://O,{2,4}:NH +------------------------------------------------------------------------------ Cat:biological;EN:Geraniol;MW:154.25 + <30,!8,OH,{2,6}=dr,{2,6}:/_ +------------------------------------------------------------------------------ Cat:biological;EN:Limonene;MW:136.24 + <30,?6,2=dl,2:/_,@5,*\,/_,!! +------------------------------------------------------------------------------ Cat:biological;EN:l-Menthol;MW:156.27 + <30,?6,2:/*?!,5:*/_,3:*/OH +------------------------------------------------------------------------------ Cat:biological;EN:Vanillin;MW:152.15 + <30,Ph,2:/OH,3:/O!,5:/CHO +------------------------------------------------------------------------------ Cat:biological;EN:Allicin;MW:162.28 + <-30,!!,!2,SO,!,S,!2,!! +------------------------------------------------------------------------------ Cat:biological;EN:Stearic acid;MW:284.48 + <30,!17,COOH +------------------------------------------------------------------------------ Cat:biological;EN:Linoleic acid;MW:280.45 + <30,!5,-30,-30,!,-30,-30,!7,COOH,{6,9}=dr +------------------------------------------------------------------------------ \end{verbatim} %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \noindent% \newpage \subsection{Information aux file output} \paragraph{(Insert option parameter setting)} \index{J}% \index{C}% \index{NO}% \index{MW}% \index{MI}% \index{EN}% \index{JN}% \index{FM}% \index{USE}% \index{mw}% \index{fm}% \index{mi}% \index{w}% \index{h}% \index{Info}% \index{Table}% \index{Temp}% \begin{verbatim} sw_output:=Info; %% tag1:var1;tag2:var2 sw_output:=Info+Table; %% tag1;tag2 var1;var2 sw_output:=Info+Temp; %% tag1:var1;tag2:var2 / output 'temp-info.aux' sw_output:=Info+Mcode+Temp; %% output 'temp-info.aux','temp-mc.aux' sw_output:=Font+Info+Temp; %% output font,'temp-info.aux','temp-mc.aux' \end{verbatim} \paragraph{(Command line)} \begin{verbatim} >mpost -s ahlength=1 FILENAME (sw_output=Info) >mpost -s ahlength=2 FILENAME (sw_output=Info+Table) \end{verbatim} \paragraph{(Sourse)} \begin{verbatim} beginfont("EN:Ampicillin") .... endfont beginfont("EN:Cholesterol") .... endfont beginfont("EN:Limonin") .... endfont beginfont("EN:beta-Carotene") .... endfont \end{verbatim} \paragraph{(Setting)} \begin{verbatim} tag1:="J"; tag2:="C"; tag3:="mw"; tag4:="fm"; tag5:="EN"; \end{verbatim} \paragraph{(Output)} \index{aux\_delimiter}% \begin{verbatim} (sw_output=Info) F:mcf_man_soc;C:1;mw:349.40462;fm:C16H19N3O4S;EN:Ampicillin F:mcf_man_soc;C:2;mw:386.6532;fm:C27H46O;EN:Cholesterol F:mcf_exa_soc;C:3;mw:470.5113;fm:C26H30O8;EN:Limonin F:mcf_exa_soc;C:4;mw:536.8722;fm:C40H56;EN:beta-Carotene (sw_output=Info+Table) F;C;mw;fm mcf_man_soc;1;349.40462;C16H19N3O4S;Ampicillin mcf_man_soc;2;386.6532;C27H46O;Cholesterol mcf_exa_soc;3;470.5113;C26H30O8;Limonin mcf_exa_soc;4;536.8722;C40H56;beta-Carotene (aux_delimiter="/") F:mcf_man_soc/C:1/mw:349.40462/fm:C16H19N3O4S/EN:Ampicillin F:mcf_man_soc/C:2/mw:386.6532/fm:C27H46O/EN:Cholesterol F:mcf_exa_soc/C:3/mw:470.5113/fm:C26H30O8/EN:Limonin F:mcf_exa_soc/C:4/mw:536.8722/fm:C40H56/EN:beta-Carotene \end{verbatim} \paragraph{(Tag)} \begin{verbatim} J : jobname C : char number NO : serial number EN : english name JN : japanese name FM : formula from literature data MW : molecular weight from literature data MI : monoisotopic mass from literature data USE : the use mw : molecular weight calculated mi : monoisotopic mass calculated fm : molecular formula calculated w : font width h : font height \end{verbatim} %------------------------------------------------------------------------ \noindent% \newpage \subsection{Metafont aux file output} \index{Mfont}% \paragraph{(Insert option parameter setting)} \begin{verbatim} sw_output:=Mfont; \end{verbatim} \paragraph{(Command line)} \begin{verbatim} >mpost -s ahlength=7 FILENAME (sw_output=Mfont) \end{verbatim} \paragraph{(Output)} \begin{verbatim} beginfont("Cat:biological","EN:Adenine","MW:135.13", ": <30,?6,3=?5,{1,3,5,9}=dl,{2,6,9}:N,5:/NH2,7:NH") if check(mc)=0: MC(scantokens(mc)) fi endfont beginfont("Cat:biological","EN:Guanine","MW:151.13", ": <30,?6,3=?5,{1,3,9}=dl,{2,9}:N,{6,7}:NH,5://O,1:/NH2") if check(mc)=0: MC(scantokens(mc)) fi endfont beginfont("Cat:biological","EN:Cytosine","MW:111.10", ": <30,?6,{4,6}=dl,4:N,3://O,2:NH,5:/NH2") if check(mc)=0: MC(scantokens(mc)) fi endfont beginfont("Cat:biological","EN:Thymine","MW:126.11", ": <30,?6,3=dl,{2,6}:NH,{1,5}://O,4:/_") if check(mc)=0: MC(scantokens(mc)) fi endfont beginfont("Cat:biological","EN:Adenine","MW:135.13", ": <30,?6,3=?5,{1,3,5,9}=dl,{2,6,9}:N,5:/NH2,7:NH") if check(mc)=0: MC(scantokens(mc)) fi endfont beginfont("Cat:biological","EN:Guanine","MW:151.13", ": <30,?6,3=?5,{1,3,9}=dl,{2,9}:N,{6,7}:NH,5://O,1:/NH2") if check(mc)=0: MC(scantokens(mc)) fi endfont beginfont("Cat:biological","EN:Cytosine","MW:111.10", ": <30,?6,{4,6}=dl,4:N,3://O,2:NH,5:/NH2") if check(mc)=0: MC(scantokens(mc)) fi endfont beginfont("Cat:biological","EN:Thymine","MW:126.11", ": <30,?6,3=dl,{2,6}:NH,{1,5}://O,4:/_") if check(mc)=0: MC(scantokens(mc)) fi endfont beginfont("Cat:biological","EN:Uracil","MW:112.09", ": <30,?6,6=dl,{3,5}://O,{2,4}:NH") if check(mc)=0: MC(scantokens(mc)) fi endfont beginfont("Cat:biological","EN:Geraniol","MW:154.25", ": <30,!8,OH,{2,6}=dr,{2,6}:/_") if check(mc)=0: MC(scantokens(mc)) fi endfont beginfont("Cat:biological","EN:Limonene","MW:136.24", ": <30,?6,2=dl,2:/_,@5,*\,/_,!!") if check(mc)=0: MC(scantokens(mc)) fi endfont beginfont("Cat:biological","EN:l-Menthol","MW:156.27", ": <30,?6,2:/*?!,5:*/_,3:*/OH") if check(mc)=0: MC(scantokens(mc)) fi endfont \end{verbatim} %------------------------------------------------------------------------ \noindent% \newpage \subsection{MCF aux file output} \paragraph{(Insert option parameter setting)} \index{Mcode}% \index{Temp}% \begin{verbatim} sw_output:=Mcode; sw_output:=Mcode+Temp; %% output 'temp-mc.aux' sw_output:=Info+Mcode+Temp; %% output 'temp-info.aux','temp-mc.aux' sw_output:=Font+Mcode+Temp; %% output font,'temp-mc.aux' sw_output:=Font+Info+Mcode+Temp; %% output font,'temp-info.aux','temp-mc.aux' \end{verbatim} \paragraph{(Command line)} \begin{verbatim} >mpost -s ahlength=8 FILENAME (sw_output=Mcode) \end{verbatim} \paragraph{(file name)} \begin{verbatim} sw_output=Mcode ** file name = 'jobname-nnn-EN-mc.aux' sw_output=Mcode+Temp ** file name = 'temp-mc.aux' (result) <30,?6,3=?5,{1,3,5,9}=dl,{2,6,9}:N,5:/NH2,7:NH \end{verbatim} %------------------------------------------------------------------------ \paragraph{(Lualatex example)} %----------------------------------------------------------------------- \begin{verbatim} beginfont("f:mcf_data_base","t:EN","v:Adenine") sw_output:=Mcode+Temp; endfont \end{verbatim} %----------------------------------------------------------------------- \begin{verbatim} %----------------------------------------------------------------------- \begin{mplibcode} beginfont("f:mcf_data_base","t:EN","v:Vancomycin") sw_output:=Mcode+Temp; %%%% output temp-mc.aux %%%% endfont; \end{mplibcode} %----------------------------------------------------------------------- \verbatiminput{temp-mc.aux} %----------------------------------------------------------------------- \end{verbatim} %----------------------------------------------------------------------- \begin{verbatim} (result) file name = 'temp-mc.aux' <-30,#1,!12,{1,3,12}=zf,7=wf,/H^-60,60,*/OH,60, Ph,-4:/Cl,@-3,\,O,!,Ph,@-4,\,O,!,Ph,-1^15:/Cl,@-3,\,/*OH,*/H^-60,&1, @7,&26,@$1,60,//O,60,NH,60,/*H,*/COOH^180,-60, Ph,{-2,-4}:/OH,@-1,\,Ph,-5:/OH,@-2,&4,##, {3^40,6,9,12}://O,{2,5,8,11}:NH,{1,4^180}:*/H,{7^-60,10^60,14^60}:/*H, @10,*\^-60,60,//O,!,NH2,@13,*\,NH,!,//O,!,/??!,*/H^60,!~zf,NH,!, @23,\,O,!,|,?6`.7,2:O,3^10:/!OH,{4,5}:/OH, @-1,\,O,!,|,?6`.7,6:O,{3^35,5}:/_,3^-35:/NH2,4:/OH \end{verbatim} %------------------------------------------------------------------------ \newpage \noindent% \subsection{Report output} \paragraph{(Insert option parameter setting)} \index{sw\_output}% \index{Report}% \begin{verbatim} sw_output:=Report; ** file name = 'jobname-report.aux' sw_output:=Report+Temp; ** file name = 'temp-report.aux' \end{verbatim} \paragraph{(Command line)} \begin{verbatim} >mpost -s ahlength=3 FILENAME \end{verbatim} \paragraph{(Output)} \begin{verbatim} =========================================================================== No. 3 / Name = Cytosine --------------------------------------------------------------------------- <30,?6,{4,6}=dl,4:N,3://O,2:NH,5:/NH2 --------------------------------------------------------------------------- row= 1 / length= 37 / commands= 7 {}=X = 1 / {}:X = 0 / '() = 0 / @ = 0 / & = 0 / < = 1 --------------------------------------------------------------------------- Warnings = 0 / Code= 60 Width * Height = 34.68852 * 47.4036 Shift width * height = 0 * -14.46167 Bond length = 12.75589 Atom size = 5.38914 Atom count= 9 Bond count= 9 Ring count= 1 Hide H count= 2 --------------------------------------------------------------------------- < NO. >( x axis , y axis ) A1 C ( 0 , 0 ) 3 1 A2 N ( 0.866 , -0.5 ) 3 A3 C ( 1.732 , 0 ) 4 A4 N ( 1.732 , 1 ) 3 A5 C ( 0.866 , 1.5 ) 4 A6 C ( 0 , 1 ) 3 1 A7 O ( 2.508 , -0.448 ) 2 A8 H ( 0.866 , -0.922 ) 1 A9 NH2 ( 0.866 , 2.371 ) 1 --------------------------------------------------------------------------- < NO. >< bond (sdt)> B1 1 -> 2 ( 1) 330 ( -30) 1 ( 12.76) B2 2 -> 3 ( 1) 30 ( 30) 1 ( 12.76) B3 3 -> 4 ( 1) 90 ( 90) 1 ( 12.76) B4 4 -> 5 ( 2) 150 ( 150) 1 ( 12.76) B5 5 -> 6 ( 1) 210 ( -150) 1 ( 12.76) B6 6 -> 1 ( 2) 270 ( -90) 1 ( 12.76) B7 3 -> 7 ( 2) 330 ( -30) 0.66 ( 8.42) B8 2 -> 8 ( 1) 270 ( -90) 0.36 ( 4.59) B9 5 -> 9 ( 1) 90 ( 90) 0.66 ( 8.42) --------------------------------------------------------------------------- ( atom wt )[ mi wt ] < cnt > < sum wt >[ sum mi wt ] C ( 12.0107)[ 12] * 4 48.04279[ 48] H ( 1.00793)[ 1.00783] * 5 5.03967[ 5.03914] N ( 14.0067)[ 14.00307] * 3 42.0201[ 42.0092] O ( 15.9994)[ 15.99492] * 1 15.9994[ 15.99492] Molecular Weight [Mono Isotopic] = 111.1019[ 111.04326] --------------------------------------------------------------------------- Weight Calc: 111.1019 / Input: 111.10 / weight gap= 0.00195 Fomula Calc: C4H5N3O / Input: =========================================================================== \end{verbatim}% \newpage %------------------------------------------------------------------------ \noindent% \subsection{MOL file output} \paragraph{(Insert option parameter setting)} \index{sw\_output}% \index{MOL2k}% \index{MOL3k}% \begin{verbatim} sw_output:=MOL2k; % MOL(V2000) sw_output:=MOL3k; % MOL(V3000) \end{verbatim} \paragraph{(Command line)} \begin{verbatim} >mpost -s ahlength=5 FILENAME % MOL(V2000) >mpost -s ahlength=6 FILENAME % MOL(V3000) \end{verbatim} \paragraph{(Output)} \begin{verbatim} %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -MCFtoMOL- EN:Caffeine 14 15 0 0 0 0 0 0 0 0999 V2000 0 0 0 C 0 0 0 0 0.86603 -0.5 0 N 0 0 0 0 1.73206 0 0 C 0 0 0 0 1.73206 1 0 C 0 0 0 0 0.86603 1.5 0 C 0 0 0 0 0 1 0 N 0 0 0 0 2.6831 -0.30902 0 N 0 0 0 0 3.27089 0.5 0 C 0 0 0 0 2.6831 1.30902 0 N 0 0 0 0 0.86603 -1.36383 0 C 0 0 0 0 -0.76894 1.44394 0 C 0 0 0 0 -0.76894 -0.44394 0 O 0 0 0 0 0.86603 2.36383 0 O 0 0 0 0 2.95299 2.1396 0 C 0 0 0 0 1 2 1 0 0 0 2 3 1 0 0 0 3 4 2 0 0 0 4 5 1 0 0 0 5 6 1 0 0 0 6 1 1 0 0 0 3 7 1 0 0 0 7 8 2 0 0 0 8 9 1 0 0 0 9 4 1 0 0 0 2 10 1 0 0 0 6 11 1 0 0 0 1 12 2 0 0 0 5 13 2 0 0 0 9 14 1 0 0 0 M END %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \end{verbatim}% %---------------------------------------------------------------------------- \newpage \subsection{LuaTeX file example} \index{Font}% %############################################################################ \begin{verbatim} \documentclass{article} \usepackage{luamplib}% \usepackage[T1]{fontenc}% \usepackage{textcomp}% \mplibcodeinherit{enable}% \mplibverbatim{enable}% \mplibnumbersystem{double}% \everymplib{% if unknown Ph1: input mcf2graph.mf; fi sw_output:=Font; max_blength:=4.5mm; defaultfont:="uhvr8r"; defaultsize:=8bp; defaultscale:=1; }% \begin{document} \noindent% %-------------------------------------------------------------------- \begin{mplibcode} fsize:=(50mm,50mm); beginfont("NO:1","EN:Limonin","MW:470.51", %---------------------------------------- ": <30,?6,{-3,-4}=?6, ", ": -5=?3,-2=wf,-1=wb,6=?5,-4=?6,-5=wf, ", ": {13,15,17,20}:O,{3,12,21}://O, ", ": {4~wf^60,8~zf^60,18^35,18^-35}:/_, ", ": {1^60,5^180,16^60}:/*H, ", ": @14,\*,|,?5,{1,4}=dl,3:O ") %---------------------------------------- if check(mc)=0: MC(scantokens(mc)) fi endfont \end{mplibcode}\\ %-------------------------------------------------------------------- \begin{mplibcode} fsize:=(80mm,50mm); beginfont("NO:2","EN:beta-carotene","MW:536.87", %------------------------------------------ ": <30,?6,3=dl,{3,5^35,5^-35}:/_, ", ": @4,\,|,!18,{1,3,5,7,9,11,13,15,17}=dr, ", ": {3,7,12,16}:/_, ", ": |,?6,6=dl,{6,2^35,2^-35}:/_ ") %------------------------------------------ if check(mc)=0: MC(scantokens(mc)) fi endfont \end{mplibcode}\\ %-------------------------------------------------------------------- \begin{mplibcode} fsize:=(50mm,50mm); beginfont("NO:3","EN:Gibberellin A3","MW:346.37", %------------------------------------ ": <18,?5,3=?7,5=?6[12], ", ": @8,160`1.3,&3,13=dl,6=wf,8=wb, ", ": @5,40~zf`1,O,60,//O^180,&14~zb, ", ": 2:/COOH,7://_,13:*/OH,8:/*OH, ", ": 14:*/_,{1^60,4^60}:*/H ") %------------------------------------ if check(mc)=0: MC(scantokens(mc)) fi endfont; %-------------------------------------------------------------------- \end{mplibcode}\\ \end{document} \end{verbatim}% %############################################################################ %------------------------------------------------------------------------ \newpage \subsection{LaTeX file example} %############################################################################ \index{mcf\_setup.sty}% \begin{verbatim} %-------------------------------------------------------------------- \documentclass[a4paper]{article} \usepackage{graphicx} \makeatletter% %--------------------- \usepackage{mcf_setup} %--------------------- \pagestyle{empty} %-------------------------------------------------------------------- \def\put@char{% \begin{picture}(84,42)% \put(0,38){\bf [\MOLnum]\EN{ }\small\tt/FM:\fm/MW:\mw}% \put(10,0){\font\@strufont=\File\relax% \hbox{\@strufont\char\Char}}% \end{picture}% }% \def\INFO#1{\@for\@temp:=#1\do{\tag@var\@temp}\put@char}% \makeatother %-------------------------------------------------------------------- \begin{document} \unitlength=1mm% \INFO{J:mcf_man_soc,C:141,NO:1,mw:349.40462,fm:C16H19N3O4S,EN:Ampicillin}% \INFO{J:mcf_man_soc,C:142,NO:2,mw:386.6532,fm:C27H46O,EN:Cholesterol}% \end{document} %-------------------------------------------------------------------- \end{verbatim}% %############################################################################ %------------------------------------------------------------------------ \INFO{J:mcf_man_soc,C:141,NO:1,mw:349.40462,fm:C16H19N3O4S,EN:Ampicillin}% \INFO{J:mcf_man_soc,C:142,NO:2,mw:386.6532,fm:C27H46O,EN:Cholesterol}% %------------------------------------------------------------------------ \texttt{\printindex} %------------------------------------------------------------------------ \end{document}