summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/metapost
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2021-01-31 21:34:33 +0000
committerKarl Berry <karl@freefriends.org>2021-01-31 21:34:33 +0000
commitdef6b709935cf319c107fa76ee9ba14e12f1e418 (patch)
tree287d7fd6751b496fe176b867325b62f5230ccca0 /Master/texmf-dist/metapost
parent8e4455f3a4f37da421439043d53698d9eeae5df2 (diff)
mcf2graph (31jan21)
git-svn-id: svn://tug.org/texlive/trunk@57575 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/metapost')
-rw-r--r--Master/texmf-dist/metapost/mcf2graph/mcf2graph.mf516
1 files changed, 267 insertions, 249 deletions
diff --git a/Master/texmf-dist/metapost/mcf2graph/mcf2graph.mf b/Master/texmf-dist/metapost/mcf2graph/mcf2graph.mf
index 49c50f02635..af136209e34 100644
--- a/Master/texmf-dist/metapost/mcf2graph/mcf2graph.mf
+++ b/Master/texmf-dist/metapost/mcf2graph/mcf2graph.mf
@@ -1,5 +1,5 @@
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-% mcf2graph ver 4.55 Copyright (c) 2013-2021 Akira Yamaji
+% mcf2graph ver 4.56 Copyright (c) 2013-2021 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,
@@ -37,9 +37,7 @@
% Set to use plain.mp (label,arrow,atom) : mpost -s labeloffset=2 FILENAME
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
tracingstats:=1;
-message "---------------------------------------------";
-message "This is mcf2graph ver 4.55 2021.01";
-message "---------------------------------------------";
+message "* This is mcf2graph ver 4.56 2021.01";
%-------------------------------------------------------------------------------------------------
newinternal cntA,cntB,cntM,minX,minY,maxX,maxY,sftX,sftY,com,par,envT,envB,lenT,lineT,angT,rotT,
crR,nA,nB,nC,nD,nE,nF,nN,nP,nU,nP,nL,nR,nS,nW,xpos,ypos,markA,markB,saveA,saveB,bondL;
@@ -47,18 +45,16 @@ numeric save_num[],comD[][],parD[][],adrD[][],cntD[],tbl_atom[],tbl_group[][],f_
tbl_atom_wt[],tbl_atom_mi[],tbl_char_wd[],tbl_char_ht[],andA[],and_rot[],chargeA[],
com_group[][],par_group[][],cnt_group[],colorA[],colorB[],sumA[],bondC[],hideH[],
lineB[],sB[],eB[],angB[],angA[],lenB[],angX[],numS[],wdM[],htM[],wdA[],dxA[];
-string info[],save_str[],tbl_atom_str[],strD[],tag[],mpc_name[],out_file_name,out_file_aux,
- out_file_rep,out_file_mpc,aux_delimiter,atomfont,save_atomfont,save_defaultfont,temp_c,
- s_tag,s_var,cal_FM,cal_MW,cal_MW_str,cal_MI,cal_MI_str,
- inf_NO,inf_EN,inf_JN,inf_FM,inf_CAS,inf_USE,inf_EXA,inf_EXB,inf_MW;
-pair save_pair[],posA[],posM[][],msize,mposition,fsize,fmargin,save_mposition,posBs,posBe,
- temp_p;
+string info[],save_str[],tbl_atom_str[],strD[],tag[],out_file_name,out_file_aux,
+ out_file_rep,out_file_mpc,aux_delimiter,atomfont,mpfont,s_tag,s_var,
+ cal_FM,cal_MW,cal_MI,inf_NO,inf_EN,inf_JN,inf_FM,inf_CAS,inf_USE,inf_EXA,inf_EXB,inf_MW;
+pair save_pair[],posA[],posM[][],msize,mposition,fsize,fmargin,save_mposition,posBs,posBe;
picture mol_stru[],atom_picture,save_picture,temp_picture;
path arrow_path,dottedline_path,line_path,arrow_head;
%-------------------------------------------------------------------------------------------------
-char_num:=str_cnt:=tbl_cnt:=proc_end:=mangle:=sw_label_emu:=sw_calc:=sw_ext_all:=0;
+char_num:=str_cnt:=tbl_cnt:=proc_end:=mangle:=sw_calc:=sw_ext_all:=0;
sw_numberA:=sw_numberB:=sw_aux_out:=sw_expand:=sw_fframe:=sw_mframe:=sw_aframe:=sw_trimming:=0;
-sw_rep_out:=sw_mol_out:=sw_group_off:=sw_single:=sw_arrow:=0;
+sw_rep_out:=sw_mol_out:=sw_group_off:=sw_single:=sw_arrow_emu:=0;
numberA_start:=numberB_start:=1; numberA_end:=numberB_end:=4095;
%-------------------------------------------------------------------------------------------------
aux_max:=max_inf_num:=20;
@@ -69,6 +65,7 @@ if (known green)and(known ahlength):
f_MP:=1;
color color_list[];
prologues:=3;
+ mpfont:="uhvr8r";
%-----------------------------------------------------------------------------------------
atomfont:=defaultfont:="";
out_file_aux:=jobname&"-info.aux";
@@ -78,12 +75,13 @@ if (known green)and(known ahlength):
%--default ahangle=45---------------------------------------------------------------------
if ahangle=0: outputformat:="eps"; % eps format(.mps)
elseif ahangle=1: outputformat:="png"; hppp:=vppp:=0.12; % png format(600dpi)
- elseif ahangle=2: outputformat:="svg"; % svg format
- elseif ahangle=3: outputformat:="eps"; % eps format(.eps)
- %
elseif ahangle=11: outputformat:="png"; hppp:=vppp:=0.24; % png format(300dpi)
elseif ahangle=12: outputformat:="png"; hppp:=vppp:=0.10; % png format(720dpi)
elseif ahangle=13: outputformat:="png"; hppp:=vppp:=0.06; % png format(1200dpi)
+ elseif ahangle=14: outputformat:="png"; hppp:=vppp:=0.04; % png format(1800dpi)
+ elseif ahangle=15: outputformat:="png"; hppp:=vppp:=0.03; % png format(2400dpi)
+ elseif ahangle=2: outputformat:="svg"; % svg format
+ elseif ahangle=3: outputformat:="eps"; % eps format(.eps)
fi
%--default ahlength=4---------------------------------------------------------------------
if ahlength=1: sw_aux_out:=1; bboxmargin:=0; % output aux file
@@ -98,8 +96,8 @@ if (known green)and(known ahlength):
elseif bboxmargin=3: def shipit = enddef;proc_end:=1; % No image file ,first font only
fi
%--default labeloffset=3------------------------------------------------------------------
- if labeloffset=1: sw_arrow:=1; defaultfont:="uhvr8r"; % plain.mp label
- elseif labeloffset=2: sw_arrow:=1; defaultfont:=atomfont:="uhvr8r"; % plain.mp label,atom
+ if labeloffset=1: defaultfont:=mpfont; % mpost label
+ elseif labeloffset=2: defaultfont:=atomfont:=mpfont; % mpost label,atom
fi
%--default outputtemplate:="%j-%3c."&"mps"------------------------------------------------
if (outputformat="eps")and(ahangle<>3): outputtemplate:="%j-%3c."&"mps";
@@ -114,8 +112,8 @@ if (known green)and(known ahlength):
if atomfont="": atomfont:="draw"; fi % default atom font
if defaultfont="": defaultfont:="draw"; fi % default label font
%-----------------------------------------------------------------------------------------
-else: f_MP:=0;
- %------------------------------------
+else:
+ f_MP:=0;
def image = image_emu enddef;
def llcorner = llcorner_emu enddef;
def lrcorner = lrcorner_emu enddef;
@@ -126,7 +124,6 @@ else: f_MP:=0;
dotlabeldiam:=3bp;
def Cp(expr s) = enddef;
def color = transform enddef;
- sw_arrow:=0;
atomfont:="draw";
defaultfont:="draw";
mode_setup;
@@ -134,28 +131,27 @@ fi
clearit;
%--------------------------------------------------------------------------------------------------
if f_MP=1:
- if bboxmargin=0: message "output no image file";
- elseif bboxmargin=1: message "output first font only";
- elseif bboxmargin=3: message "no image,first only";
+ if bboxmargin=0: message "* output no image file";
+ elseif bboxmargin=1: message "* output first font only";
+ elseif bboxmargin=3: message "* no image,first only";
fi
- message "jobname="&jobname;
- message "numbersystem="&numbersystem;
- if ahlength=1: message "output aux file";
- message "out_file_aux="&out_file_aux;
- message "aux_delimiter="&aux_delimiter;
- elseif ahlength=2: message "output report file";
- message "out_file_rep="&out_file_rep;
- elseif ahlength=5: message "output MOL file(V2000)";
- message jobname&"-nnn-"&"inf_EN"&".mol";
- elseif ahlength=6: message "output MOL file(V3000)";
- message jobname&"-nnn-"&"inf_EN"&".mol";
+ message "* jobname="&jobname;
+ message "* numbersystem="&numbersystem;
+ if ahlength=1: message "* output aux file";
+ message "* out_file_aux="&out_file_aux;
+ message "* aux_delimiter="&aux_delimiter;
+ elseif ahlength=2: message "* output report file";
+ message "* out_file_rep="&out_file_rep;
+ elseif ahlength=5: message "* output MOL file(V2000)";
+ message "* "&jobname&"-nnn-"&"inf_EN"&".mol";
+ elseif ahlength=6: message "* output MOL file(V3000)";
+ message "* "&jobname&"-nnn-"&"inf_EN"&".mol";
fi
- message "outputformat="&outputformat;
- if outputformat="png": message "hppp="&decimal(hppp)&"/vppp="&decimal(vppp); fi
- message "outputtemplate="&outputtemplate;
- message "atomfont="&atomfont;
- message "defaultfont="&defaultfont;
- message "---------------------------------------------";
+ message "* outputformat="&outputformat;
+ if outputformat="png": message "* hppp="&decimal(hppp)&"/vppp="&decimal(vppp); fi
+ message "* outputtemplate="&outputtemplate;
+ message "* atomfont="&atomfont;
+ message "* defaultfont="&defaultfont;
fi
%--------------------------------------------------------------------------------------------------
let DIV= /; let MUL= *; let LT= <; let GT= >; let AND= &; let :: = : ; let == = =; let ef=elseif;
@@ -195,20 +191,20 @@ def def_com(expr n)(text tx)= nA:=n; forsuffixes list=tx:: list:=nA; nA:=nA+1; e
def_com(-4090)(_com,_jp_atom,_jp_absA,_jp_bond,_cyc,_cyc_sB,_cyc_eB,_set_line,_tmp_line,
_chg_len,_get_len,_ring_len,_tmp_len,_rot_ang,_adj_ang,_chg_env,_tmp_env,_set_colorA,_set_colorB,
_group_si,_set_adr,_mk_bond,_set_atom,_arg_ang,_chg_atom,_tmp_rot,_fuse,_size_atom,_numeric,
- _jump_at,_connect_at,_set_and,_chg_charge,_nop,_mark,_moff,_term,_len_s,_len_e,_len_ss,_len_ee,
- _group_s,_group_e,_rest,si,dl,dr,db,dm,tm,wf,wb,bd,bz,zf,zb,dt,wv,nl,vf,vb,nb,si_,wf_,wb_,bd_);
+ _jump_at,_connect_at,_set_and,_chg_and,_nop,_mark,_moff,_term,_len_s,_len_e,_len_ss,_len_ee,
+ _group_s,_group_e,_rest,
+ si,dl,dr,db,dm,tm,wf,wb,bd,bz,zf,zb,dt,wv,nl,vf,vb,nb,si_,dl_,dr_,dm_,wf_,wb_,zf_,zb_,wv_,bd_);
%--------------------------------------------------------------------------------------------------
def parameter_list=
- sw_rep_out,sw_numberA,sw_numberB,sw_mframe,sw_aux_out,sw_expand,sw_mol_out,sw_calc,sw_single,
- sw_ext_all,sw_aframe,sw_fframe,sw_group_off,sw_trimming,sw_arrow,sw_label_emu,
+ sw_rep_out,sw_numberA,sw_numberB,sw_mframe,sw_aux_out,sw_expand,sw_mol_out,sw_calc,
+ sw_single,sw_ext_all,sw_aframe,sw_fframe,sw_group_off,sw_trimming,sw_arrow_emu,
ratio_atom_bond,ratio_thickness_bond,ratio_char_bond,ratio_chain_ring,ratio_bondgap_bond,
ratio_zebra_black,ratio_zebragap_bond,ratio_thickness_char,ratio_wedge_bond,ratio_atomgap_atom,
lonepairdiam,lonepairspace,blength,offset_atom,offset_wedge,max_blength,offset_zebra_gap,
offset_bond_gap,thickness_fframe,thickness_mframe,thickness_aframe,offset_thickness,
numberA_start,numberA_end,numberB_start,numberB_end,defaultsize,defaultscale,labeloffset,mangle,
fsize,fmargin,msize,mposition,defaultfont,atomfont,dottedline_gap,
- Me,Et,Pr,Bu,iPr,tBu,CH3,NH,NH2,NO2,OH,CHO,COOH,CN,SH,
- !CH3,!NH2,!NO2,!OH,!CHO,!COOH,!CN,!SH
+ Me,Et,CH3,NH,NH2,NO,NO2,OH,CHO,COOH,CN,SH,!CH3,!NH2,!NO2,!OH,!CHO,!COOH,!CN,!SH
enddef;
%--------------------------------------------------------------------------------------------------
def ]]]=] ] ] enddef;
@@ -251,13 +247,14 @@ enddef;
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
def beginfont(text s)=
begingroup
- save f_beginchar,f_ext,blen,ext,add,ang_br;
+ save ',f_beginchar,f_ext,blen,ext,add,ang_br;
%------------------------------------------------------------------------------------------------
def ext=ext_to_font enddef;
def add=add_to_molecule enddef;
+ vardef '(text TXT)== read_mcf(incr parts_cnt)((_com,_mark),TXT,(_com,_rest)); parts_cnt enddef;
%------------------------------------------------------------------------------------------------
inf_NO:=inf_EN:=inf_JN:=inf_MW:=inf_FM:=inf_CAS:=inf_USE:=inf_EXA:=inf_EXB:="-";
- cal_MW:=cal_MW_str:=cal_MI:=cal_MI_str:=cal_FM:="";
+ cal_MW:=cal_MI:=cal_FM:="";
%------------------------------------------------------------------------------------------------
parts_cnt:=parts_usr_start;
parts_int:=parts_int_start;
@@ -316,8 +313,8 @@ def endfont=
endgroup;
if proc_end=1: scantokens("bye"); fi
%-----------------------------------------------------------------------------------------------
-%% message "parts_cnt (0)="& decimal(parts_cnt) &" "& decimal(parts_usr-parts_usr_start);
-%% message "parts_int (0)="& decimal(parts_int) &" "& decimal(parts_int-parts_int_start);
+%% message "* parts_cnt (0)="& decimal(parts_cnt) &" "& decimal(parts_usr-parts_usr_start);
+%% message "* parts_int (0)="& decimal(parts_int) &" "& decimal(parts_int-parts_int_start);
%-----------------------------------------------------------------------------------------------
enddef;
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@@ -479,7 +476,7 @@ vardef change_atom(expr a,b)=
ef b==_connect_at:: CP(_cyc,a)
fi
ef pair b::
- if xpart(b)==_set_and:: CP(_set_and,ypart(b)) CP(_chg_charge,a)
+ if xpart(b)==_set_and:: CP(_set_and,ypart(b)) CP(_chg_and,a)
else:: CP(_com,_group_s) CPx(a)(xpart(b),ypart(b)) CP(_com,_group_e)
fi
ef color b:: color_list[incr cntC]:=b; CPe(a)(_set_colorA,cntC)
@@ -502,30 +499,27 @@ def com_par_ex(expr f)(expr c)(expr a,b)=
enddef;
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
def puts(expr POS)(expr STR)=
+ begingroup
+ save temp_c,temp_p;
+ pair temp_p;
+ string temp_c;
temp_p:=POS;
- nB:=defaultscale*defaultsize;
- nC:=0;
- %------------------------------------------------------------------------------------------------
- for i=0 upto length(STR)-1:
- temp_c:=subc(i,STR);
- if sw_label_emu=1:
- if temp_c="_": nC:=iif(nC=-0.5,0,-0.5);
- elseif temp_c="^": nC:=iif(nC= 0.5,0, 0.5);
- else:
- if defaultfont="draw":
- draw_char(temp_c,temp_p+(0,nB*nC),nB,ratio_thickness_char*defaultscale*defaultsize,0);
- temp_p:=temp_p+(nB*tbl_char_wd[ASCII(temp_c)],0);
- else:
- temp_picture:=temp_c infont defaultfont scaled defaultscale;
- addto currentpicture also temp_picture shifted (temp_p+(0,nB*nC));
- temp_p:=temp_p+(lrcorner temp_picture-llcorner temp_picture);
- fi
- fi
- else:
- draw_char(temp_c,temp_p,nB,ratio_thickness_char*defaultscale*defaultsize,0);
- temp_p:=temp_p+(nB*tbl_char_wd[ASCII(temp_c)],0);
- fi
- endfor
+ nC:=defaultscale*defaultsize;
+ if (defaultfont="draw")or(f_MP=0):
+ for i=0 upto length(STR)-1:
+ temp_c:=subc(i,STR);
+ draw_char(temp_c,temp_p,nC,ratio_thickness_char*nC,0);
+ temp_p:=temp_p+(nC*tbl_char_wd[ASCII(temp_c)],0);
+ endfor
+ else:
+ for i=0 upto length(STR)-1:
+ temp_c:=subc(i,STR);
+ temp_picture:=temp_c infont defaultfont scaled defaultscale;
+ addto currentpicture also temp_picture shifted temp_p;
+ temp_p:=temp_p+(lrcorner temp_picture-llcorner temp_picture);
+ endfor
+ fi
+ endgroup
enddef;
%==================================================================================================
def ext_setup=
@@ -534,14 +528,14 @@ def ext_setup=
labeloffset:=3bp;
save em;
em=defaultscale*defaultsize;
- if (f_MP=0)or(sw_label_emu=1):
+ if (defaultfont="draw")or(f_MP=0):
save label,dotlabel;
def label = label_emu enddef;
def dotlabel = dotlabel_emu enddef;
else:
- defaultfont:="uhvr8r";
+ defaultfont:=mpfont;
fi
- if (sw_arrow=0)or(f_MP=0):
+ if (sw_arrow_emu=1)or(f_MP=0):
save drawarrow,drawdblarrow;
def drawarrow = drawarrow_emu enddef;
def drawdblarrow = drawdblarrow_emu enddef;
@@ -587,7 +581,7 @@ enddef;
%--------------------------------------------------------------------------------------------------
def ext_to_font(text TXT)=
begingroup
- save w,h,wd,ht,n,p,am,aw,__,**,<<,=>,/*;
+ save w,h,An,Bn,wd,ht,n,p,am,aw,__,**,<<,=>,/*;
pair __,p[];
let ** = scaled;
let << = rotated;
@@ -598,6 +592,8 @@ def ext_to_font(text TXT)=
ext_setup;
w:=xpart(fsize);
h:=ypart(fsize);
+ An:=cntA;
+ Bn:=cntB;
w0:=w-2margin_lr;
h0:=h-2margin_tb;
p0:=(margin_lr,margin_tb);
@@ -667,23 +663,20 @@ vardef lone_pair_add expr ANG=
enddef;
%--------------------------------------------------------------------------------------------------
vardef label_emu@#(expr OBJ,POS) = %% modified 'thelabel@#(expr s,z)' of plain.mp
- save oft,fx,fy,wds,sC,pA,pB,pC,pD;
+ save oft,fx,fy,wds,pA,pB,pC,pD,sC;
pair oft,oft.lft,oft.rt,oft.top,oft.bot,oft.ulft,oft.llft,oft.urt,oft.lrt,pA,pB,pC,pD;
- string sC;
wds:=0;
+ nC:=defaultscale*defaultsize;
%---------------------------------------------------------------
if string OBJ:
- for i=0 upto length(OBJ)-1:
- sC:=subc(i,OBJ);
- if not((sw_label_emu=1)and((sC="_")or(sC="^"))):
- if (defaultfont="draw")or(f_MP=0):
- wds:=wds+defaultscale*defaultsize*tbl_char_wd[ASCII(sC)];
- else:
- temp_picture:=sC infont defaultfont scaled defaultscale;
- wds:=wds+xpart(lrcorner temp_picture-llcorner temp_picture);
- fi
- fi
- endfor
+ if (defaultfont="draw")or(f_MP=0):
+ for i=0 upto length(OBJ)-1: wds:=wds+nC*tbl_char_wd[ASCII(subc(i,OBJ))]; endfor
+ else:
+ for i=0 upto length(OBJ)-1:
+ temp_picture:=subc(i,OBJ) infont defaultfont scaled defaultscale;
+ wds:=wds+xpart(lrcorner temp_picture-llcorner temp_picture);
+ endfor
+ fi
fi
%---------------------------------------------------------------
oft:= ( 0, 0); fx:=0.5; fy:=0.5;
@@ -697,7 +690,7 @@ vardef label_emu@#(expr OBJ,POS) = %% modified 'thelabel@#(expr s,z)' of plain.m
oft.lrt:= ( .7,-.7); fx.lrt:=0; fy.lrt:=1;
%---------------------------------------------------------------
if string OBJ:
- puts(POS+(labeloffset*oft@#)-(wds*fx@#,defaultscale*defaultsize*fy@#))(OBJ);
+ puts(POS+(labeloffset*oft@#)-(wds*fx@#,nC*fy@#))(OBJ);
elseif picture OBJ:
pA:=llcorner(OBJ);
pB:=urcorner(OBJ);
@@ -748,9 +741,9 @@ enddef;
def MC(text TXT)=
begingroup
save f_bra,strAT,cnt_group,temp_lenE,temp_lenF,temp_cntB,f_end,f_term,f_at,f_lineT,f_rotT,
- f_lenT,f_envT,sA,sC,factor,m_wd,m_ht,defaultsize,defaultscale;
- %-----------------------------------------------------------------------------------------------
- string sA,sC;
+ f_lenT,f_envT,sA,factor,m_wd,m_ht,temp_p,defaultsize,defaultscale;
+ string sA;
+ pair temp_p;
%-----------------------------------------------------------------------------------------------
if (sw_numberA>=1)or(sw_numberB>=1): ratio_atom_bond:=0.25; fi
if (sw_expand=1)or(sw_mol_out>=1): expand_set; fi
@@ -805,10 +798,7 @@ def MC(text TXT)=
draw_char(sA,temp_p,atom_wd,bond_pen_wd*ratio_char_bond,0);
else: sA:="";
fi
- nA:=length(strD[numS[i]]); sC:=substring(nA-3,nA-2) of strD[numS[i]];
- if (sA="+")or(sC="+"): chargeA[i]:=1; ef (sA="-")or(sC="-"): chargeA[i]:=-1;
- else: chargeA[i]:=0;
- fi
+ if sA="+": chargeA[i]:=1; elseif sA="-": chargeA[i]:=-1; else: chargeA[i]:=0; fi
endfor
%-draw bond-------------------------------------------------------------------------------------
for i=1 upto cntB: if lineB[i]<si_ : draw_bond(i); fi endfor
@@ -859,7 +849,7 @@ def MC(text TXT)=
mol_stru[cntM]:=currentpicture;
clearit;
endgroup;
- if ((sw_aux_out>=1)or(sw_rep_out=1)or(sw_mol_out>=1)or(sw_calc=1))and(f_MP=1): proc_calc; fi
+ if ((sw_aux_out>=1)or(sw_rep_out=1)or(sw_mol_out>=1)or(sw_calc=1)): proc_calc; fi
enddef;
%-------------------------------------------------------------------------------------------------
def add_group=
@@ -1000,7 +990,7 @@ def proc_bond_atom(expr a)(expr n)=
ef com=_set_colorA: colorA[getA(adrT)]:=par;
ef com=_set_colorB: colorB[getB(adrT)]:=par;
ef com=_set_and: andAT:=par;
- ef com=_chg_charge: andA[getA(par)]:=andAT; andAT:=0; if rotT<>0: and_rot[getA(par)]:=rotT; fi
+ ef com=_chg_and: andA[getA(par)]:=andAT; andAT:=0; if rotT<>0: and_rot[getA(par)]:=rotT; fi
else:
fi
endfor
@@ -1139,7 +1129,13 @@ def draw_atom(expr NUM)=
if sB="_": pB:=iif(pB=(0,0),(0,-.5atom_wd),(0,0));
elseif sB="^": pB:=iif(pB=(0,0),(0, .5atom_wd),(0,0));
elseif (sB<>"{")and(sB<>"}"):
- if (atomfont<>"draw")and(f_MP=1):
+ if (atomfont="draw")or(f_MP=0):
+ f_wd:=atom_wd*tbl_char_wd[ASCII(sB)];
+ if dx=-1: pA:=pA-(f_wd,0); fi
+ draw_char(sB,pA+pB,atom_wd,bond_pen_wd*ratio_char_bond,NUM);
+ if sw_aframe=1: draw_frame(pA+pB,f_wd,atom_wd,thickness_aframe); fi
+ if dx=1: pA:=pA+(f_wd,0); fi
+ else:
atom_picture:=sB infont atomfont;
f_wd:=(xpart(lrcorner atom_picture)-xpart(llcorner atom_picture))*r_ff;
f_ht:=(ypart(urcorner atom_picture)-ypart(llcorner atom_picture))*r_ff;
@@ -1148,12 +1144,6 @@ def draw_atom(expr NUM)=
shifted (pA+pB+(f_wd*ratio_atomgap_atom,f_ht*ratio_atomgap_atom)) Cp(colorA[NUM]);
if sw_aframe=1: draw_frame(pA+pB,f_wd,f_ht,thickness_aframe); fi
if dx=1: pA:=pA+(f_wd,0); fi
- else:
- f_wd:=atom_wd*tbl_char_wd[ASCII(sB)];
- if dx=-1: pA:=pA-(f_wd,0); fi
- draw_char(sB,pA+pB,atom_wd,bond_pen_wd*ratio_char_bond,NUM);
- if sw_aframe=1: draw_frame(pA+pB,f_wd,atom_wd,thickness_aframe); fi
- if dx=1: pA:=pA+(f_wd,0); fi
fi
wdA[NUM]:=wdA[NUM]+f_wd;
fi
@@ -1201,12 +1191,26 @@ def draw_bond(expr NUM)=
ef nL=vf: draw zA Cp(col);draw sfrt(Le,bondgap,ang-150)--Le--sfrt(Le,bondgap,ang+150) Cp(col);
ef nL=vb: draw zA Cp(col);draw sfrt(Ls,bondgap,ang-30)--Ls--sfrt(Ls,bondgap,ang+30) Cp(col);
ef nL=si_: erase draw subpath (0.15,0.85) of zA wpcs 0.8bondgap; draw zA Cp(col);
+ ef nL=dl_: erase draw subpath (0.15,0.85) of sfrt(subpath pA of zA,.5bondgap,ap) wpcs 1.8bondgap;
+ draw zA Cp(col); draw sfrt(subpath pA of zA,bondgap,ap) Cp(col);
+ ef nL=dr_: erase draw subpath (0.15,0.85) of sfrt(subpath pA of zA,.5bondgap,am) wpcs 1.8bondgap;
+ draw zA Cp(col); draw sfrt(subpath pA of zA,bondgap,am) Cp(col);
+ ef nL=dm_: erase draw subpath(0.15,0.85) of zA wpcs 1.8 bondgap;
+ draw sfrt(zA,bondgap/1.75,ap) Cp(col); draw sfrt(zA,bondgap/1.75,am) Cp(col);
ef nL=wf_: erase draw subpath (0.15,0.85) of (Ls--sfrt(Le,ww,am)) wpcs 0.8bondgap;
erase draw subpath (0.15,0.85) of (Ls--sfrt(Le,ww,ap)) wpcs 0.8bondgap;
fill Ls--sfrt(Le,ww,am)--sfrt(Le,ww,ap)--cycle Cp(col);
ef nL=wb_: erase draw subpath (0.15,0.85) of (sfrt(Ls,ww,am)--Le) wpcs 0.8bondgap;
erase draw subpath (0.15,0.85) of (sfrt(Ls,ww,ap)--Le) wpcs 0.8bondgap;
fill sfrt(Ls,ww,am)--Le--sfrt(Ls,ww,ap)--cycle Cp(col);
+ ef nL=zf_: erase draw subpath (0.15,0.85) of (Ls--sfrt(Le,ww,am)) wpcs 0.8bondgap;
+ erase draw subpath (0.15,0.85) of zA wpcs 0.8bondgap;
+ erase draw subpath (0.15,0.85) of (Ls--sfrt(Le,ww,ap)) wpcs 0.8bondgap;
+ wz_put(Ls,sfrt(Le,ww,ap),sfrt(Le,ww,am));
+ ef nL=zb_: erase draw subpath (0.15,0.85) of (sfrt(Ls,ww,am)--Le) wpcs 0.8bondgap;
+ erase draw subpath (0.15,0.85) of zA wpcs 0.8bondgap;
+ erase draw subpath (0.15,0.85) of (sfrt(Ls,ww,ap)--Le) wpcs 0.8bondgap;
+ wz_put(Le,sfrt(Ls,ww,am),sfrt(Ls,ww,ap));
ef nL=bd_: erase draw subpath(0.15,0.85) of zA wpcs 1.6bondgap;
draw zA withpen penrazor rotated ap scaled bondgap Cp(col);
ef nL=nb:
@@ -1235,114 +1239,6 @@ vardef frame_str(expr NUM)=
(posA[NUM]-(.5nA+iif((dxA[NUM]=-1)and(wdA[NUM]>atom_wd),nB-nA,0),.5nA))
enddef;
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-vardef STa(expr ATOM,WT,MI)=
- str_cnt:=str_cnt+1; parts_cnt:=parts_cnt+1; tbl_cnt:=tbl_cnt+1;
- comD[parts_cnt][1]:=_set_atom; parD[parts_cnt][1]:=str_cnt; cntD[parts_cnt]:=1;
- strD[str_cnt]:=tbl_atom_str[tbl_cnt]:=ATOM;
- tbl_atom[tbl_cnt]:=0;
- tbl_atom_wt[tbl_cnt]:=WT; tbl_atom_mi[tbl_cnt]:=MI;
- parts_cnt
-enddef;
-%-------------------------------------------------------------------------------------------------
-vardef STb(expr ATOM)(text TXT)=
- str_cnt:=str_cnt+1; parts_cnt:=parts_cnt+1; tbl_cnt:=tbl_cnt+1;
- comD[parts_cnt][1]:=_set_atom; parD[parts_cnt][1]:=str_cnt; cntD[parts_cnt]:=1;
- strD[str_cnt]:=tbl_atom_str[tbl_cnt]:=ATOM;
- tbl_atom[tbl_cnt]:=0;
- for list=TXT:
- tbl_atom[tbl_cnt]:=tbl_atom[tbl_cnt]+1;
- tbl_group[tbl_cnt][tbl_atom[tbl_cnt]]:=list-parts_emb_start;
- endfor
- parts_cnt
-enddef;
-%=================================================================================================
-parts_int:=parts_emi_start;
-parts_cnt:=parts_emb_start;
-%-------------------------------------------------------------------------------------------------
-C:= STa("C" ,12.0107, 12.0000000); H:= STa("H" , 1.00794, 1.00782503223);
-Al:=STa("{Al}",26.9815, 26.98153853); As:=STa("{As}",74.9216, 74.92159457);
-B:= STa("B" ,10.811, 11.00930536); Br:=STa("{Br}",79.904, 78.9183376);
-Ca:=STa("{Ca}",40.078, 39.962590863); Cl:=STa("{Cl}",35.453, 34.968852);
-Co:=STa("{Co}",58.933194, 58.93319429); Cr:=STa("{Cr}",51.9961, 51.94050623);
-Cu:=STa("{Cu}",63.546, 62.92959772); D:= STa("D" ,2.012, 2.01410177812);
-F:= STa("F" ,18.9984, 18.99840316273); Fe:=STa("{Fe}",55.845, 55.93493633);
-Hg:=STa("{Hg}",200.59, 201.97064340); I:= STa("I" ,126.90447,126.9044719);
-K:= STa("K" ,39.0983, 38.9637064864); Li:=STa("{Li}",6.941, 7.0160034366);
-Mg:=STa("{Mg}",24.305, 23.985041697); Mn:=STa("{Mn}",54.938044, 54.93804391);
-Na:=STa("{Na}",22.98977, 22.9897692820); Ni:=STa("{Ni}",58.693, 57.93534241);
-N:= STa("N" ,14.0067, 14.00307400443); O:= STa("O" ,15.9994, 15.99491461957);
-P:= STa("P" ,30.973762, 30.97376199842); S:= STa("S" ,32.065, 31.9720711744);
-Se:=STa("{Se}",78.971, 79.9165218); Si:=STa("{Si}",28.0855, 27.97692653465);
-Sn:=STa("{Sn}",118.71, 119.90220163); Ti:=STa("{Ti}",47.867, 47.94794198);
-U:= STa("U", 238.0289, 238.05079); Zn:=STa("{Zn}",65.409, 63.92914201);
-tbl_atom_end:=tbl_cnt;
-%-------------------------------------------------------------------------------------------------
-CH3:=STb("C{H_3_}")(C,H,H,H); CH2:=STb("C{H_3_}")(C,H,H); CN:=STb("CN")(C,N); OH:=STb("OH")(O,H);
-COOH:=STb("COOH")(C,O,O,H); SH:= STb("SH")(S,H); CHO:=STb("CHO")(C,H,O);
-NO2:=STb("N{O_2_}")(N,O,O); NH2:=STb("N{H_2_}")(N,H,H);
-ONa:=STb("O{Na}")(O,Na); SO3Na:=STb("S{O_3_}{Na}")(S,O,O,O,Na);
-%-------------------------------------------------------------------------------------------------
-str_plus:=str_cnt;
-N[1]:=STb("{N^+^}")(N); H[1]:=STb("{H^+^}")(H); Na[1]:=STb("{Na^+^}")(Na); K[1]:=STb("{K^+^}")(K);
-NH3[1]:= STb("{N^+^}{H_3_}")(N,H,H,H); NH4[1]:= STb("{N^+^}{H_4_}")(N,H,H,H,H);
-S[1]:= STb("{S^+^}")(S);
-str_minus:=str_cnt;
-O[-1]:=STb("{O^-^}")(O); COO[-1]:=STb("COO^-^")(C,O,O); SO3[-1]:=STb("S{O_3_}^-^")(S,O,O,O);
-Cl[-1]:=STb("{Cl^-^}")(Cl); Br[-1]:=STb("{Br^-^}")(Br); I[-1]:=STb("{I^-^}")(I);
-%-------------------------------------------------------------------------------------------------
-str_minus_end:=str_cnt;
-tbl_group_end:=tbl_cnt;
-parts_atom_end:=parts_cnt;
-%=================================================================================================
-for i==3 upto 20: ?[i]:='(|<<,(_get_len,_ring_len),<((-180 DIV i)-90)
- for j==2 upto i:: ,(360 DIV i) endfor,(_cyc_sB,1-i),>>|); endfor
-Ph:=Ph1:='(?6,-2=dl,-4=dl,-6=dl); Ph2:='(?6,-1=dl,-3=dl,-5=dl);
-!:=!1:='((_mk_bond,_arg_ang)); !!:='(!~db); !!!:='(!~tm);
-for i==2 upto 20: ![i]:='(|<<,(_get_len,_tmp_len),! for j==2 upto i::,! endfor ,>>|); endfor
-Me:='(); Et:='(!); Pr:='(!,!); Bu:='(!,!,!); iPr:=?!:='(/_,!); tBu:=??!:='(/_,/_^60,60);
-%-------------------------------------------------------------------------------------------------
-NH:='(N,/H~nl); N!:='(N,/_); N!2:='(N,/!); SO:='(S,//O); SOO:='(S,//O^-35,//O^35);
-O!:='(O,!); O!2:='(O,!,!); O!3:='(O,!,!,!); O!?!:='(O,!,?!); O!??!:='(O,!,??!);
-S!:='(S,!); S!2:='(S,!,!); S!3:='(S,!,!,!); S!?!:='(S,!,?!); S!??!:='(S,!,??!);
-%-------------------------------------------------------------------------------------------------
-COO:='(//O,!,O); COO!:='(COO,!); COO!2:='(COO,!,!); COO!??:='(COO,!,?!); COO!3:='(COO,!,!,!);
-CO!:='(//O,!); CO!2:='(//O,!,!); CO!3:='(//O,!,!,!); OCO!:='(O,!,//O,!);
-N?!:='(N!,!); N?!2:='(N!,!,!); NH!:='(NH,!); NH!2:='(NH,!,!); NH!3:='(NH,!,!,!);
-NH!?!:='(NH,!,?!); NHCO!:='(NH,!,//O,!); CONH2:='(//O,!,NH2); ??:='(/_^35,/_^-35);
-%-------------------------------------------------------------------------------------------------
-!OH:='(!,OH); !SH:='(!,SH); !NH2:='(!,NH2); !CO!:='(!,//O,!); !CO!2:='(!,CO!2); !CO!3:='(!,CO!3);
-!O!:='(!,O!); !O!2:='(!,O!2); !O!3:='(!,O!3);
-!S!:='(!,S!); !S!2:='(!,S!2); !S!3:='(!,S!3);
-!NH!:='(!,NH!); !NH!2:='(!,NH!2); !NH!3:='(!,NH!3);
-!COOH:='(!,COOH); !COO!:='(!,COO!); !COO!2:='(!,COO!2);
-!CH3:='(!,CH3); !CN:='(!,CN); !?!:='(!,?!); !??!:='(!,??!);
-!CHO:='(!,CHO); !NO2:='(!,NO2); !Cl:='(!,Cl); !Br:='(!,Br); !F:='(!,F);
-!?3:='(!,?3); !?4:='(!,?4); !?5:='(!,?5); !?6:='(!,?6); !?7:='(!,?7); !?8:='(!,?8); !Ph:='(!,Ph);
-%-------------------------------------------------------------------------------------------------
-CF2:='(/F,60,F); CCl2:='(/Cl,60,Cl); CBr2:='(/Br,60,Br);
-CF3:='(/F,/F^60,60,F); CCl3:='(/Cl,/Cl^60,60,Cl); CBr3:='(/Br,/Br^60,60,Br);
-%-------------------------------------------------------------------------------------------------
-lr:='(60 for i==1 upto 10:: ,-60,60 endfor); rl:='(-60,lr);
-for i=4,5,6: for j=2 upto i-2: ?[i][j]:='((_fuse,i),(j,0)); endfor endfor
-for i=5,6,7,8: for j=11 upto 15: ?[i][j]:='((_fuse,i),(j,0)); endfor endfor
-%-------------------------------------------------------------------------------------------------
-R:='("R"); R1:='("{R^1^}"); R2:='("{R^2^}"); R3:='("{R^3^}"); R4:='("R^4^"); R5:='("{R^5^}");
-R6:='("R6"); R7:='("{R^7^}"); R8:='("{R^8^}"); R9:='("{R^9^}"); R10:='("R^10^"); R11:='("{R^11^}");
-%-------------------------------------------------------------------------------------------------
-xCH3:='(/H,/H^60,60,H); xNH:='(N,/H); xNH2:='(N,/H,60,H); xNO2:='(N,//O,60~dm,O); xOH:='(O,!,H);
-xCHO:='(//O,!,H); xCOOH:='(//O,!,O,!,H); xCN:='(!~tm,N); xSH:='(S,!,H);
-%=================================================================================================
-init_par(parameter_list);
-%-------------------------------------------------------------------------------------------------
-%%%%message "parts_emb =" & decimal(parts_emb_start) &" => " & decimal(parts_cnt);
-%%%%message "parts_emi =" & decimal(parts_emi_start) &" => " & decimal(parts_int);
-%-------------------------------------------------------------------------------------------------
-def expand_set=
- CH3:=xCH3; NH:=xNH; NH2:=xNH2; NO2:=xNO2; OH:=xOH; CHO:=xCHO; COOH:=xCOOH; CN:=xCN; SH:=xSH;
- !CH3:='(!,CH3); !OH:='(!,OH); !NH2:='(!,NH2); !CHO:='(!,CHO); !COOH:='(!,COOH); !CN:='(!,CN);
- !SH:='(!,SH); !NO2:='(!,NO2);
-enddef;
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
def char_size_set(expr WD)(expr HT)(expr STR)=
for j=0 upto length(STR)-1:
nA:=ASCII(subc(j,STR)); tbl_char_wd[nA]:=WD; tbl_char_ht[nA]:=HT;
@@ -1352,9 +1248,9 @@ enddef;
char_size_set( 1)( 1)("CGHMNOQW");
char_size_set( .9)( 1)("ABDFIJKPRSTUVXY/><#\%@");
char_size_set( .8)( 1)("ELZ&");
-char_size_set( .7)( 1)(" ()[]0123456789nh=tfg?~");
+char_size_set( .7)( 1)(" ()[]0123456789nh=tfg?~^");
char_size_set( .7)( .9)("$");
-char_size_set( .7)( .7)("-+*");
+char_size_set( .7)( .7)("-+*_");
char_size_set(.45)(.95)("l");
char_size_set(.75)( .8)("opq");
char_size_set( .8)( .8)("e");
@@ -1363,7 +1259,7 @@ char_size_set( .7)( .8)("abdcksuvrxyz");
char_size_set(.35)( .9)("i");
char_size_set( .5)( .9)("j");
char_size_set(.35)( 1)("!|");
-char_size_set( .4)( 1)(".,:;'`^");
+char_size_set( .4)( 1)(".,:;'`");
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
def draw_char(expr CHR,POS,WD,PEN,NUM)=
begingroup
@@ -1496,6 +1392,8 @@ ef sC="~": dw (hP,.8aH)..(.3aW,.9aH)..(.6aW,.7aH)..(fW,.8aH);
ef sC="&": cdw Z21..(hW,.35aH)..(.25aW,.75aH)..(hW,.fH)..(.75aW,.75fH)..(hP,.3aH)..(hW,.hP)..Z10;
ef sC="@": cdw sbp(0,.7)zO; dwv (fW,hH)--(fW,0);
dw (fW,.45aH)..(.7aW,.75aH)..(.3aW,.45aH)..(.7aW,.15aH)..cycle;
+ef sC="_": dwh Z01--Z04;
+ef sC="^": dwv (hP,.6aH)..(.5aW,.7aH)..(fW,.6aH);
else:
fi
endgroup
@@ -1515,16 +1413,23 @@ def warning_bond(expr a)=
enddef;
%-------------------------------------------------------------------------------------------------
vardef cut_paren(expr ATOM)=
- if length(ATOM)=4: substring (1,3) of ATOM
- elseif length(ATOM)=6: substring (1,2) of ATOM
- else: ATOM
- fi
+ save temp_c,temp_s;
+ string temp_c,temp_s;
+ temp_s:="";
+ if (length(ATOM)>=4)and(ATOM<>"COOH"):
+ for i=0 upto length(ATOM)-1:
+ temp_c:=subc(i,ATOM);
+ if (temp_c<>"{")and(temp_c<>"}")and(temp_c<>"_")and(temp_c<>"^"): temp_s:=temp_s&temp_c; fi
+ endfor
+ temp_s
+ else: ATOM
+ fi
enddef;
%=================================================================================================
def proc_calc=
begingroup
- save warning_cnt,MWp,knownA,bondC,tmp_wtp,bond_cnt,hideH_cnt;
- hideH_cnt:=warning_cnt:=num_MW:=num_MI:=MWp:=tbl_atom_max:=0;
+ save warning_cnt,knownA,bondC,tmp_wtp,bond_cnt,hideH_cnt;
+ hideH_cnt:=warning_cnt:=num_MW:=num_MI:=cen_MW:=cen_MI:=tbl_atom_max:=0;
nE:=parts_emb_start;
for i=1 upto tbl_atom_end: sumA[i]:=0; endfor
for i=1 upto cntA:
@@ -1582,8 +1487,10 @@ def proc_calc=
for i=1 upto tbl_atom_max:
if sumA[i]>=1:
nA:=tbl_atom_wt[i]/100*sumA[i];
- MWp:=MWp+nA;
- if (MWp<40)and(nA<40):
+ nB:=tbl_atom_mi[i]/100*sumA[i];
+ cen_MW:=cen_MW+nA;
+ cen_MI:=cen_MI+nB;
+ if (cen_MW<40)and(cen_MI<40):
num_MW:= num_MW+tbl_atom_wt[i]*sumA[i];
num_MI:= num_MI+tbl_atom_mi[i]*sumA[i];
fi
@@ -1591,8 +1498,10 @@ def proc_calc=
fi
endfor
%-------------------------------------------------------------------------------------
- cal_MI:=substring (0,10) of decimal(num_MI);
- cal_MW:=substring (0,8) of decimal(num_MW);
+ if cen_MW<40: cal_MW:=substring (0,8) of decimal(num_MW);
+ else: num_MW:=cen_MW; cal_MW:=fdr(6)(cen_MW)&"*100"; fi
+ if cen_MI<40: cal_MI:=substring (0,10) of decimal(num_MI);
+ else: num_MI:=cen_MI; cal_MI:=fdr(8)(cen_MI)&"*100"; fi
if sw_aux_out>=1: proc_auxfile_out; fi
if sw_rep_out=1: proc_report_out; fi
if sw_mol_out>=1: proc_mol_out; fi
@@ -1655,49 +1564,44 @@ def proc_report_out=
printf " Atom count="&fdr(3)(cntA)&" Bond count="&fdr(3)(cntB)&
" Ring count="&fdr(3)(cntB-cntA+1)&" Hide H count="&fdr(3)(hideH_cnt);
printf "------------------------------------------------------------------";
- printf "< NO. >( x axis , y axis )< atom(s) ><bond><hideH><chg>";
+ printf "< NO. ><atom(s) >( x axis , y axis )<bond><hideH><chg>";
for i=1 upto cntA:
- printf " A"&fdl(4)(i)&" ("&fdr(10)(round_auto(xpart(posA[i])/blen))&" , "&
- fdr(10)(round_auto(ypart(posA[i])/blen))&" ) "&
- fixed_l(12)(strD[numS[i]])&" "&fdr(3)(Bcnt[i])
- &iif(hideH[i]>0,fdr(6)(hideH[i])," ")
+ printf " A"&fdl(6)(i)&fixed_l(8)(cut_paren(strD[numS[i]]))&
+ " ("&fdr(10)(round_auto(xpart(posA[i])/blen))&" , "&
+ fdr(10)(round_auto(ypart(posA[i])/blen))&" ) "&fdr(4)(Bcnt[i])&
+ iif(hideH[i]>0,fdr(6)(hideH[i])," ")
if chargeA[i]<>0: &fdr(4)(chargeA[i]) fi;
endfor
printf "------------------------------------------------------------------";
- printf "< NO. >< bond (sdt)><angle + ( +- )><length ( pt )>";
+ printf "< NO. >< bond (sdt)><angle +( +- )><length ( pt )>";
for i=1 upto cntB:
nC:=lenB[i]; if nC=_size_atom: nC:=ratio_atom_bond; elseif nC<0: nC:=-nC; fi
if lineB[i]<>0:
nB:=angB[i]; if nB>180: nB:=nB-360; fi
printf " B"&fdl(4)(i)&fdr(3)(sB[i])&" -> "&fdr(3)(eB[i])&
- " ("&fdr(3)(bondC[i]-si+1)&")"&fdr(9)(round_auto(angB[i]))&
+ " ("&fdr(3)(bondC[i])&")"&fdr(8)(round_auto(angB[i]))&
" ("&fdr(6)(round_auto(nB))&")"&fdr(8)(nC)&" ("&fdr(8)(round_auto(nC*blen))&")";
fi
endfor
printf "------------------------------------------------------------------";
printf "<atom>( atom wt )[ mi wt ] < cnt > < sum wt >[ sum mi wt ]";
- if MWp<=40: cal_MW_str:=cal_MW; cal_MI_str:=cal_MI;
- else: cal_MW_str:=fdr(10)(MWp)&" * 100"; cal_MI_str:=fdr(10)(MIp)&" * 100";
- fi
for i=1 upto tbl_atom_max:
if sumA[i]>=1:
nA:=tbl_atom_wt[i]/100*sumA[i]; nB:=tbl_atom_mi[i]/100*sumA[i];
printf " "&
fixed_l(5)(cut_paren(tbl_atom_str[i]))&
- "("&fdr(9)(tbl_atom_wt[i])&")"&"["&fdr(9)(tbl_atom_mi[i])&"]"&
- " * "&fdr(4)(sumA[i])&" = "
- if nA<40: &fdr(12)(tbl_atom_wt[i]*sumA[i])&"["&fdr(12)(tbl_atom_mi[i]*sumA[i])&"]";
- else: &fdr(12)(nA)&" * 100"&"["&fdr(12)(nA)&" * 100"&"]";
+ "("&fdr(9)(tbl_atom_wt[i])&")"&"["&fdr(9)(tbl_atom_mi[i])&"]"&" * "&fdr(4)(sumA[i])
+ if nA<40: &fdr(15)(tbl_atom_wt[i]*sumA[i])&"["&fdr(12)(tbl_atom_mi[i]*sumA[i])&"]";
+ else: &fdr(11)(nA)&"*100"&"["&fdr(9)(nB)&"*100"&"]";
fi
fi
endfor
- printf " Molecular Weight [Mono Isotopic] = "&
- fixed_r(12)(cal_MW_str)&"["&fixed_r(12)(cal_MI_str)&"]";
+ printf " Molecular Weight [Mono Isotopic] = "&fixed_r(12)(cal_MW)&"["&fixed_r(12)(cal_MI)&"]";
printf "------------------------------------------------------------------";
- printf " Weight Calc: " &cal_MW_str &" / Input: "
- if inf_MW<>"": &inf_MW &" / weight gap= " &decimal(num_MW-scantokens(inf_MW)) fi;
+ printf " Weight Calc: " &cal_MW &" / Input: "
+ if inf_MW<>"-": &inf_MW &" / weight gap= " &decimal(num_MW-scantokens(inf_MW)) fi;
printf " Fomula Calc: "&cal_FM&" / Input: "
- if inf_FM<>"": &inf_FM&" / "& iif(inf_FM=cal_FM,"MACTCH","NOT MACTCH") fi;
+ if inf_FM<>"-": &inf_FM&" / "& iif(inf_FM=cal_FM,"MACTCH","NOT MACTCH") fi;
printf "==================================================================";
enddef;
%=================================================================================================
@@ -1761,7 +1665,7 @@ def proc_vtk=
printf "M END";
enddef;
%-------------------------------------------------------------------------------------------------
-vardef fit_zero(expr n)=if n<=9: "00" elseif n<=99: "0" fi &decimal(n) enddef;
+vardef fit_zero(expr n)=if n<=9: "00" elseif n<=99: "0" else: "" fi &decimal(n) enddef;
%-------------------------------------------------------------------------------------------------
def proc_bond_class(expr n)=
if (n=dl)or(n=dr)or(n=dm): nA:=2;
@@ -1772,4 +1676,118 @@ def proc_bond_class(expr n)=
else: nA:=1; nB:=0;
fi
enddef;
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+vardef STa(expr ATOM,WT,MI)=
+ str_cnt:=str_cnt+1; tbl_cnt:=tbl_cnt+1; parts_cnt:=parts_cnt+1;
+ comD[parts_cnt][1]:=_set_atom; parD[parts_cnt][1]:=str_cnt; cntD[parts_cnt]:=1;
+ strD[str_cnt]:=tbl_atom_str[tbl_cnt]:=ATOM;
+ tbl_atom[tbl_cnt]:=0;
+ tbl_atom_wt[tbl_cnt]:=WT; tbl_atom_mi[tbl_cnt]:=MI;
+ parts_cnt
+enddef;
+%-------------------------------------------------------------------------------------------------
+vardef STb(expr ATOM)(text TXT)=
+ str_cnt:=str_cnt+1; tbl_cnt:=tbl_cnt+1; parts_cnt:=parts_cnt+1;
+ comD[parts_cnt][1]:=_set_atom; parD[parts_cnt][1]:=str_cnt; cntD[parts_cnt]:=1;
+ strD[str_cnt]:=tbl_atom_str[tbl_cnt]:=ATOM;
+ tbl_atom[tbl_cnt]:=0;
+ for list=TXT:
+ tbl_atom[tbl_cnt]:=tbl_atom[tbl_cnt]+1;
+ tbl_group[tbl_cnt][tbl_atom[tbl_cnt]]:=list-parts_emb_start;
+ endfor
+ parts_cnt
+enddef;
+%=================================================================================================
+parts_int:=parts_emi_start;
+parts_cnt:=parts_emb_start;
+%-------------------------------------------------------------------------------------------------
+C:= STa("C" ,12.0107, 12.0000000); H:= STa("H" , 1.00794, 1.00782503223);
+D:= STa("D" ,2.012, 2.01410177812); Ag:=STa("{Ag}",107.868, 106.905095);
+Al:=STa("{Al}",26.9815, 26.98153853); As:=STa("{As}",74.9216, 74.92159457);
+B:= STa("B" ,10.811, 11.00930536); Ba:=STa("{Ba}",137.33, 136.905816);
+Bi:=STa("{Bi}",208.9804, 208.980338); Br:=STa("{Br}",79.904, 78.9183376);
+Ca:=STa("{Ca}",40.078, 39.962590863); Cd:=STa("{Cd}",112.41, 110.904182);
+Cl:=STa("{Cl}",35.453, 34.968852); Co:=STa("{Co}",58.933194, 58.93319429);
+Cr:=STa("{Cr}",51.9961, 51.94050623); Cu:=STa("{Cu}",63.546, 62.92959772);
+F:= STa("F" ,18.9984, 18.99840316273); Fe:=STa("{Fe}",55.845, 55.93493633);
+Hg:=STa("{Hg}",200.59, 201.97064340); I:= STa("I" ,126.90447,126.9044719);
+K:= STa("K" ,39.0983, 38.9637064864); Li:=STa("{Li}",6.941, 7.0160034366);
+Mg:=STa("{Mg}",24.305, 23.985041697); Mn:=STa("{Mn}",54.938044, 54.93804391);
+N:= STa("N" ,14.0067, 14.00307400443); Na:=STa("{Na}",22.98977, 22.9897692820);
+Ni:=STa("{Ni}",58.693, 57.93534241); O:= STa("O" ,15.9994, 15.99491461957);
+P:= STa("P" ,30.973762, 30.97376199842); Pb:= STa("Pb" ,207.2, 205.974455);
+Pd:=STa("Pd" ,106.4, 107.905075);
+S:= STa("S" ,32.065, 31.9720711744); Sb:= STa("Sb" ,121.75, 0.0);
+Se:=STa("{Se}",78.971, 79.9165218); Si:=STa("{Si}",28.0855, 27.97692653465);
+Sn:=STa("{Sn}",118.71, 119.90220163); Ti:=STa("{Ti}",47.867, 47.94794198);
+U:= STa("U", 238.0289, 238.05079); V:= STa("V", 50.9415, 0.0);
+W:= STa("W", 183.85, 181.948225); Zn:=STa("{Zn}",65.409, 63.92914201);
+tbl_atom_end:=tbl_cnt;
+%-------------------------------------------------------------------------------------------------
+CH3:=STb("C{H_3_}")(C,H,H,H); CH2:=STb("C{H_3_}")(C,H,H); CN:=STb("CN")(C,N); OH:=STb("OH")(O,H);
+COOH:=STb("COOH")(C,O,O,H); SH:= STb("SH")(S,H); CHO:=STb("CHO")(C,H,O);
+NO:=STb("NO")(N,O); NO2:=STb("N{O_2_}")(N,O,O); NH2:=STb("N{H_2_}")(N,H,H);
+SO2H:=STb("S{O_2_}H")(S,O,O,H); SO3H:=STb("S{O_3_}H")(S,O,O,O,H);
+ONa:=STb("O{Na}")(O,Na); SO3Na:=STb("S{O_3_}{Na}")(S,O,O,O,Na);
+%-------------------------------------------------------------------------------------------------
+str_plus:=str_cnt;
+N[1]:=STb("{N^+^}")(N); H[1]:=STb("{H^+^}")(H); Na[1]:=STb("{Na^+^}")(Na); K[1]:=STb("{K^+^}")(K);
+NH3[1]:= STb("{N^+^}{H_3_}")(N,H,H,H); NH4[1]:= STb("{N^+^}{H_4_}")(N,H,H,H,H);
+S[1]:= STb("{S^+^}")(S);
+str_minus:=str_cnt;
+O[-1]:=STb("{O^-^}")(O); COO[-1]:=STb("COO^-^")(C,O,O); SO3[-1]:=STb("S{O_3_}^-^")(S,O,O,O);
+Cl[-1]:=STb("{Cl^-^}")(Cl); Br[-1]:=STb("{Br^-^}")(Br); I[-1]:=STb("{I^-^}")(I);
+%-------------------------------------------------------------------------------------------------
+str_minus_end:=str_cnt;
+tbl_group_end:=tbl_cnt;
+parts_atom_end:=parts_cnt;
+%=================================================================================================
+for i==3 upto 20: ?[i]:='(|<<,(_get_len,_ring_len),<((-180 DIV i)-90)
+ for j==2 upto i:: ,(360 DIV i) endfor,(_cyc_sB,1-i),>>|); endfor
+Ph:=Ph1:='(?6,-2=dl,-4=dl,-6=dl); Ph2:='(?6,-1=dl,-3=dl,-5=dl);
+!:=!1:='((_mk_bond,_arg_ang)); !!:='(!~db); !!!:='(!~tm);
+for i==2 upto 20: ![i]:='(|<<,(_get_len,_tmp_len),! for j==2 upto i::,! endfor ,>>|); endfor
+Me:='(); Et:='(!); iPr:=?!:='(/_,!); tBu:=??!:='(/_,/_^60,60); !?!:='(!,?!); !??!:='(!,??!);
+%-------------------------------------------------------------------------------------------------
+NH:='(N,/H~nl); N!:='(N,/_); N!2:='(N,/!); SO:='(S,//O); SOO:='(S,//O^-35,//O^35);
+O!:='(O,!); O!2:='(O,!,!); O!3:='(O,!,!,!); O!?!:='(O,!,?!); O!??!:='(O,!,??!);
+S!:='(S,!); S!2:='(S,!,!); S!3:='(S,!,!,!); S!?!:='(S,!,?!); S!??!:='(S,!,??!);
+%-------------------------------------------------------------------------------------------------
+COO:='(//O,!,O); COO!:='(COO,!); COO!2:='(COO,!,!); COO!??:='(COO,!,?!); COO!3:='(COO,!,!,!);
+CO!:='(//O,!); CO!2:='(//O,!,!); CO!3:='(//O,!,!,!); OCO!:='(O,!,//O,!);
+N?!:='(N!,!); N?!2:='(N!,!,!); NH!:='(NH,!); NH!2:='(NH,!,!); NH!3:='(NH,!,!,!);
+NH!?!:='(NH,!,?!); NHCO!:='(NH,!,//O,!); CONH2:='(//O,!,NH2); ??:='(/_^35,/_^-35);
+%-------------------------------------------------------------------------------------------------
+!OH:='(!,OH); !SH:='(!,SH); !NH2:='(!,NH2); !CO!:='(!,//O,!); !CO!2:='(!,CO!2); !CO!3:='(!,CO!3);
+!O!:='(!,O!); !O!2:='(!,O!2); !O!3:='(!,O!3); !S!:='(!,S!); !S!2:='(!,S!2); !S!3:='(!,S!3);
+!NH!:='(!,NH!); !NH!2:='(!,NH!2); !NH!3:='(!,NH!3);
+!COOH:='(!,COOH); !COO!:='(!,COO!); !COO!2:='(!,COO!2); !CH3:='(!,CH3); !CN:='(!,CN);
+!CHO:='(!,CHO); !NO2:='(!,NO2); !Cl:='(!,Cl); !Br:='(!,Br); !F:='(!,F);
+!?3:='(!,?3); !?4:='(!,?4); !?5:='(!,?5); !?6:='(!,?6); !?7:='(!,?7); !?8:='(!,?8); !Ph:='(!,Ph);
+%-------------------------------------------------------------------------------------------------
+CF2:='(/F,60,F); CCl2:='(/Cl,60,Cl); CBr2:='(/Br,60,Br);
+CF3:='(/F,/F^60,60,F); CCl3:='(/Cl,/Cl^60,60,Cl); CBr3:='(/Br,/Br^60,60,Br);
+%-------------------------------------------------------------------------------------------------
+lr:='(60 for i==1 upto 10:: ,-60,60 endfor); rl:='(-60,lr);
+for i=4,5,6: for j=2 upto i-2: ?[i][j]:='((_fuse,i),(j,0)); endfor endfor
+for i=5,6,7,8: for j=11 upto 15: ?[i][j]:='((_fuse,i),(j,0)); endfor endfor
+%-------------------------------------------------------------------------------------------------
+R:='("R"); R1:='("{R^1^}"); R2:='("{R^2^}"); R3:='("{R^3^}"); R4:='("R^4^"); R5:='("{R^5^}");
+R6:='("R6"); R7:='("{R^7^}"); R8:='("{R^8^}"); R9:='("{R^9^}"); R10:='("R^10^"); R11:='("{R^11^}");
+%-------------------------------------------------------------------------------------------------
+xCH3:='(/H,/H^60,60,H); xNH:='(N,/H); xNH2:='(N,/H,60,H); xNO2:='(N,//O,60~dm,O); xNO:='(N,!~dm,O);
+xSO2H:='(S,//O,!,O,!,H); xSO3H:='(S,//O^35,//O^-35,!,O,!,H); xCOO:='(//O,!,O);
+xOH:='(O,!,H); xCHO:='(//O,!,H); xCOOH:='(//O,!,O,!,H); xCN:='(!~tm,N); xSH:='(S,!,H);
+%=================================================================================================
+init_par(parameter_list);
+%-------------------------------------------------------------------------------------------------
+%%%%message "parts_emb =" & decimal(parts_emb_start) &" => " & decimal(parts_cnt);
+%%%%message "parts_emi =" & decimal(parts_emi_start) &" => " & decimal(parts_int);
+%-------------------------------------------------------------------------------------------------
+def expand_set=
+ CH3:=xCH3; NH:=xNH; NH2:=xNH2; NO:=xNO; NO2:=xNO2; OH:=xOH; CHO:=xCHO; COOH:=xCOOH; CN:=xCN;
+ SH:=xSH; SO2H:=xSO2H; SO3H:=xSO3H; COO[-1]:=xCOO;
+ !CH3:='(!,CH3); !OH:='(!,OH); !NH2:='(!,NH2); !CHO:='(!,CHO); !COOH:='(!,COOH); !CN:='(!,CN);
+ !SH:='(!,SH); !NO2:='(!,NO2);
+enddef;
%-------------------------------------------------------------------------------------------------