summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/metapost
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2018-06-03 21:16:34 +0000
committerKarl Berry <karl@freefriends.org>2018-06-03 21:16:34 +0000
commit318121054ebb87dd1e2d6759d77c51847b6e2ce1 (patch)
tree44e91e79f0159b7f5de1b60fdebdbef599c27ca3 /Master/texmf-dist/metapost
parent5c227fc8809abf53bc5c149d0cf083f8025d08d9 (diff)
mcf2graph (3jun18)
git-svn-id: svn://tug.org/texlive/trunk@47911 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/metapost')
-rw-r--r--Master/texmf-dist/metapost/mcf2graph/mcf2graph.mf568
1 files changed, 316 insertions, 252 deletions
diff --git a/Master/texmf-dist/metapost/mcf2graph/mcf2graph.mf b/Master/texmf-dist/metapost/mcf2graph/mcf2graph.mf
index 875b4e32b1a..f553da1e7dc 100644
--- a/Master/texmf-dist/metapost/mcf2graph/mcf2graph.mf
+++ b/Master/texmf-dist/metapost/mcf2graph/mcf2graph.mf
@@ -1,5 +1,5 @@
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-% mcf2graph ver 4.31 Copyright (c) 2013-2018 Akira Yamaji
+% mcf2graph ver 4.32 Copyright (c) 2013-2018 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,
@@ -17,7 +17,7 @@
% OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% mcf2graph is METAFONT/METAPOST macro package convert
-% Molecular Coding Format(MCF) to font(pk)/eps/sgv/png/mdl molfile(V2000)
+% Molecular Coding Format(MCF) to font(pk)/eps/sgv/png/mdl molfile
%----------------------------------------------------------------------------------------------
% This package is located at : http://www.ctan.org/pkg/mcf2graph
% Suggestion or request mail to : mcf2graph@gmail.com
@@ -25,25 +25,26 @@
% Set output no image file : mpost -s ahangle=0 FILENAME
% Set outputformat to "png" : mpost -s ahangle=1 FILENAME
% Set outputformat to "svg" : mpost -s ahangle=2 FILENAME
-% Set outputformat to MDL Molfile : mpost -s ahangle=3 FILENAME
+% Set outputformat to MOL(V2000) : mpost -s ahangle=3 FILENAME
+% Set outputformat to MOL(V3000) : mpost -s ahangle=4 FILENAME
% Set make first font only : mpost -s ahlength=1 FILENAME
% Set output report : mpost -s ahlength=2 FILENAME
% Set to use plain.mp label,arrow : mpost -s ahlength=3 FILENAME
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
tracingstats:=1;
-message " This is mcf2graph ver 4.3 2018.04";
+message " This is mcf2graph ver 4.3 2018.06";
%-------------------------------------------------------------------------------------------------
newinternal nA,nB,nC,nD,nE,nF,char_num,str_cnt,sub_usr,sub_int,tbl_cnt;
numeric save_para[],comD[][],parD[][],cntD[],tbl_str_wd[],tbl_atom[],tbl_subst[][],tbl_atom_wt[],
- tbl_atom_mi[],tbl_char_wd[],tbl_char_ht[];
+ tbl_atom_mi[],tbl_char_wd[],tbl_char_ht[],chgA[];
string tbl_atom_str[],strD[],var[],tag[],mp_log_name,aux_delimiter,atomfont,
save_atomfont,save_defaultfont;
picture mol_stru[];
path arrow_path,arrow_head;
%-------------------------------------------------------------------------------------------------
char_num:=str_cnt:=proc_end:=sw_label_emu:=0;
-sw_numberA:=sw_numberB:=sw_mol_frame:=sw_auxout:=sw_solid:=sw_expand:=sw_font_frame:=sw_clip:=0;
-sw_atom_frame:=sw_report:=sw_MOLout:=sw_subst_off:=sw_bond_single:=sw_auxfix:=sw_arrow:=0;
+sw_numberA:=sw_numberB:=sw_mol_frame:=sw_aux_out:=sw_solid:=sw_expand:=sw_font_frame:=sw_clip:=0;
+sw_atom_frame:=sw_report:=sw_mol_out:=sw_subst_off:=sw_bond_single:=sw_auxfix:=sw_arrow:=0;
numberA_start:=numberB_start:=1; numberA_end:=numberB_end:=4095; aux_max:=max_inf_num:=20;
aux_delimiter:=";"; var1:="jobname"; tag1:="F"; var2:="char_num"; tag2:="C";
for i=3 upto aux_max: var[i]:=tag[i]:=""; endfor
@@ -60,8 +61,9 @@ if (known green)and(known ahlength):
fi
if ahangle=0: def shipit = enddef; % No image file
elseif ahangle=1: outputformat:="png"; hppp:=vppp:=0.1; % PNG format
- elseif ahangle=2: outputformat:="svg"; % SVG format
- elseif ahangle=3: sw_MOLout:=1; def shipit = enddef; % MDL Molefile on
+ elseif ahangle=2: outputformat:="svg"; prologues:=3; % SVG format
+ elseif ahangle=3: sw_mol_out:=1; def shipit = enddef; % output MOL V2000
+ elseif ahangle=4: sw_mol_out:=2; def shipit = enddef; % output MOL V3000
fi
outputtemplate:="%j-%3c."&outputformat;
def beginchar(expr a,b,c,d)= beginfig(a) w:=b*pt; h:=c*pt; enddef;
@@ -77,7 +79,6 @@ else: f_MP:=0;
def Cp(expr s) = enddef;
def color = transform enddef;
def printf expr s= message s enddef;
- %-----------------------------------------------------------------------
sw_arrow:=0;
dotlabeldiam:=3bp;
%-----------------------------------------------------------------------
@@ -88,11 +89,12 @@ fi
clearit;
for i=0 upto 20: mol_stru[i]:=nullpicture; endfor
%--------------------------------------------------------------------------------------------------
-let DIV= /; let MUL= *; let LT= <; let GT= >; let AND= &; let :: = : ; let == = =;
+let DIV= /; let MUL= *; let LT= <; let GT= >; let AND= &; let :: = : ; let == = =; let ef=elseif;
%--------------------------------------------------------------------------------------------------
?3:=?20:=Ph:=Ph1:=Ph2:=hz:=0; vt:=1;
-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;
+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_thickness_char:=0.1;
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:=0.050;
offset_thickness:=0.2pt; offset_bond_gap:=0.3pt; offset_zebra_gap:=0.1pt;
@@ -121,10 +123,10 @@ def_com(-4000)(_term,_jp_atom,_jp_atom_abs,_jp_bond,_cyc,_cyc_sB,_cyc_eB,_set_li
def_com(1)(si,dl,dr,db,dm,tm,wf,wb,bd,bz,zf,zb,dt,wv,nl,vf,vb,si_,wf_,wb_,bd_);
%--------------------------------------------------------------------------------------------------
def parameter_list=
- sw_report,sw_numberA,sw_numberB,sw_mol_frame,sw_auxout,sw_solid,sw_expand,sw_MOLout,
+ sw_report,sw_numberA,sw_numberB,sw_mol_frame,sw_aux_out,sw_solid,sw_expand,sw_mol_out,
sw_atom_frame,sw_font_frame,sw_subst_off,sw_bond_single,sw_clip,sw_arrow,sw_label_emu,
margin_left_right,margin_top_bottom,ratio_atom_bond,ratio_thickness_bond,ratio_char_bond,
- ratio_chain_ring,ratio_bondgap_bond,ratio_zebra_black,ratio_zebragap_bond,
+ ratio_chain_ring,ratio_bondgap_bond,ratio_zebra_black,ratio_zebragap_bond,ratio_thickness_char,
ratio_wedge_bond,ratio_atomgap_atom,ratio_bond_width,font_wd,font_ht,
bond_len,offset_atom,offset_wedge,max_bond_length,offset_zebra_gap,offset_bond_gap,
thickness_font_frame,offset_thickness,numberA_start,numberA_end,numberB_start,numberB_end,
@@ -396,7 +398,7 @@ def ext_puts(expr a)(expr STR)=
elseif sA="^": if nC= 0.5: nC:=0; else: nC:= 0.5; fi
else:
if defaultfont="draw":
- draw_char(sA,cp+(0,nB*nC),nB,0.35*ratio_char_bond*bp,0);
+ draw_char(sA,cp+(0,nB*nC),nB,ratio_thickness_char*defaultscale*defaultsize,0);
cp:=cp+(nB*tbl_char_wd[nA],0);
else:
pC:=sA infont defaultfont scaled defaultscale;
@@ -404,8 +406,9 @@ def ext_puts(expr a)(expr STR)=
cp:=cp+(lrcorner pC-llcorner pC);
fi
fi
- else: draw_char(sA,cp,nB,0.35*ratio_char_bond*bp,0);
- cp:=cp+(nB*tbl_char_wd[nA],0);
+ else:
+ draw_char(sA,cp,nB,ratio_thickness_char*defaultscale*defaultsize,0);
+ cp:=cp+(nB*tbl_char_wd[nA],0);
fi
endfor
endgroup;
@@ -499,7 +502,7 @@ def MCd(expr RW,RH)(expr FW,FH)(text TX)=
begingroup
save com,par,adrA,adrB,f_bra,envT,envB,lenT,lineT,strAT,stkA,stkB,stkL,stkM,cntP,bondL,temp_len,
temp_cntB,f_end,f_term,rotT,adrS,f_at,f_lineT,f_rotT,f_lenT,f_envT,angT,tempB,tempA,
- glu,xpos,ypos,str_len,max_x,max_y,par_s,par_e,score_u,hat,f_char,ps_adr,ps_com,
+ glu,xpos,ypos,str_len,max_x,max_y,par_s,par_e,score_u,hat,f_char,ps_adr,ps_com,sA,
op_com,op_par,op_cnt,crR,colorA,colorB,PA,PO,PP,PX;
%-----------------------------------------------------------------------------------------------
def PA= sub_add enddef;
@@ -509,9 +512,10 @@ def MCd(expr RW,RH)(expr FW,FH)(text TX)=
%-----------------------------------------------------------------------------------------------
numeric stkB[],stkA[],stkL[],stkM[],f_char[],ps_adr[],ps_com[],colorA[],colorB[],
op_com[][],op_par[][],op_cnt[];
+ string sA;
%-----------------------------------------------------------------------------------------------
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
+ if (sw_expand=1)or(sw_mol_out>=1): expand_set; fi
sub_usr:=sub_usr_start;
sub_int:=sub_int_start;
par_s:=ASCII("{"); par_e:=ASCII("}"); score_u:=ASCII("_"); hat:=ASCII("^");
@@ -540,6 +544,8 @@ def MCd(expr RW,RH)(expr FW,FH)(text TX)=
for i=1 upto cntB: if lineB[i]>=si_: draw_bond(i,sB[i],eB[i],angB[i],lineB[i]); fi endfor
%-----------------------------------------------------------------------------------------------
for i=1 upto cntA:
+ sA:=substring(3,4) of strD[numS[i]];
+ if sA="+": chgA[i]:=1; ef sA="-": chgA[i]:=-1; else: chgA[i]:=0; fi
if (sw_numberA>=1)and(i>=numberA_start)and(i<=numberA_end):
if sw_numberA=2: nA:=i-numberA_start+1;
elseif sw_numberA=3: if numberA_end<cntA: nA:=numberA_end-i+1; else: nA:=cntA-i+1; fi
@@ -561,7 +567,7 @@ def MCd(expr RW,RH)(expr FW,FH)(text TX)=
addto mol_stru[cntM] also currentpicture;
clearit;
endgroup;
- if ((sw_auxout=1)or(sw_report=1)or(sw_MOLout=1))and(f_MP=1): proc_calc_out; fi
+ if ((sw_aux_out=1)or(sw_report=1)or(sw_mol_out>=1))and(f_MP=1): proc_calc_out; fi
%-----------------------------------------------------------------------------------------------
%%%% message "count of usr ="& decimal(sub_usr) &" "& decimal(sub_usr-sub_usr_start);
%%%% message "count of int ="& decimal(sub_int) &" "& decimal(sub_int-sub_int_start);
@@ -657,58 +663,58 @@ def proc_bond_atom(expr n)=
for i=0 upto 5: stkA[i]:=stkB[i]:=0; endfor
%-----------------------------------------------------------------------------------------------
for i=n upto cntD[0]:
- com:=comD[0][i]; par:=parD[0][i];
- if com=_push:
+ nC:=comD[0][i]; par:=parD[0][i];
+ if nC=_push:
if par=1: stkL[adrS]:=bondL; stkA[incr adrS]:=adrA:=cntA; stkB[adrS]:=adrB:=cntB;
elseif par=0: temp_len:=bondL;
elseif par=2: stkA[adrS+1]:=cntA; stkB[adrS+1]:=cntB;
fi
- elseif com=_pop: if par=1: adrA:=stkA[decr adrS]; adrB:=stkB[adrS]; bondL:=stkL[adrS];
- elseif par=0: bondL:=temp_len;
- elseif par=2: stkA[adrS+1]:=0;
+ ef nC=_pop: if par=1: adrA:=stkA[decr adrS]; adrB:=stkB[adrS]; bondL:=stkL[adrS];
+ ef par=0: bondL:=temp_len;
+ ef par=2: stkA[adrS+1]:=0;
fi
- elseif com=_mk_bond: if (par=0)and(rotT<>0): rotT:=0; fi add_atom;
- elseif com=_set_adr: adrT:=par;
- elseif com=_set_atom: strAT:=par;
- elseif com=_postA: ps_put;
- elseif com=_postB: lineT:=dm; ps_put;
- elseif com=_postC: lineT:=wf; ps_put;
- elseif com=_postD: lineT:=zf; ps_put;
- elseif com=_postE: lineT:=nl; ps_put;
- elseif com=_postF: lineT:=0; ps_put;
- elseif com=_postG: lineT:=wv; ps_put;
- elseif com=_postH: lineT:=nl; lenT:=_size_a; ps_put;
- elseif com=_jp_bond: termA; tempB:=getB(par); check_adrB(tempB); sB[cntB+1]:=sB[tempB]; f_bra:=1;
- elseif com=_jp_atom: termA; tempA:=getA(par); check_adrA(tempA); sB[cntB+1]:=tempA; f_bra:=1;
- elseif com=_jp_atom_abs: sB[cntB+1]:=par; f_bra:=1; temp_cntB:=cntB;
- elseif com=_chg_atom: numS[getA(adrT)]:=parD[par][1];
- elseif com=_N: numS[getA(par)]:=parD[N][1];
- elseif com=_O: numS[getA(par)]:=parD[O][1];
- elseif com=_S: numS[getA(par)]:=parD[S][1];
- elseif com=_chg_len: if par=_ring_len: bondL:=ringL;
- elseif par=0: if lenT<>crR: bondL:=lenT; else: if bondL<0: bondL:=1; fi fi
+ ef nC=_mk_bond: if (par=0)and(rotT<>0): rotT:=0; fi add_atom;
+ ef nC=_set_adr: adrT:=par;
+ ef nC=_set_atom: strAT:=par;
+ ef nC=_postA: ps_put;
+ ef nC=_postB: lineT:=dm; ps_put;
+ ef nC=_postC: lineT:=wf; ps_put;
+ ef nC=_postD: lineT:=zf; ps_put;
+ ef nC=_postE: lineT:=nl; ps_put;
+ ef nC=_postF: lineT:=0; ps_put;
+ ef nC=_postG: lineT:=wv; ps_put;
+ ef nC=_postH: lineT:=nl; lenT:=_size_a; ps_put;
+ ef nC=_jp_bond: termA; tempB:=getB(par); check_adrB(tempB); sB[cntB+1]:=sB[tempB]; f_bra:=1;
+ ef nC=_jp_atom: termA; tempA:=getA(par); check_adrA(tempA); sB[cntB+1]:=tempA; f_bra:=1;
+ ef nC=_jp_atom_abs: sB[cntB+1]:=par; f_bra:=1; temp_cntB:=cntB;
+ ef nC=_chg_atom: numS[getA(adrT)]:=parD[par][1];
+ ef nC=_N: numS[getA(par)]:=parD[N][1];
+ ef nC=_O: numS[getA(par)]:=parD[O][1];
+ ef nC=_S: numS[getA(par)]:=parD[S][1];
+ ef nC=_chg_len: if par=_ring_len: bondL:=ringL;
+ ef par=0: if lenT<>crR: bondL:=lenT; else: if bondL<0: bondL:=1; fi fi
else: bondL:=par; fi
- elseif com=_get_len: if par=0: if bondL=crR: bondL:=lenT; fi else: ringL:=lenB[getB(par)]; fi
- elseif com=_tmp_len: lenT:=par;
- elseif com=_set_line: lineB[getB(adrT)]:=par;
- elseif com=_dl: lineB[getB(par)]:=dl;
- elseif com=_mb: lineB[getB(-1)]:=par;
- elseif (com=_chg_line)or(com=_tmp_line): lineT:=par;
- elseif com=_tmp_rot: rotT:=par;
- elseif com=_cyc: f_end:=getA(par); check_adrA(f_end); add_atom;
- elseif com=_cyc_eB: f_end:=eB[getB(par)]; add_atom;
- elseif com=_cyc_sB: f_end:=sB[getB(par)]; add_atom;
- elseif com=_chg_env: envB:=par;
- elseif com=_tmp_env: envT:=par;
- elseif com=_set_clr:
+ ef nC=_get_len: if par=0: if bondL=crR: bondL:=lenT; fi else: ringL:=lenB[getB(par)]; fi
+ ef nC=_tmp_len: lenT:=par;
+ ef nC=_set_line: lineB[getB(adrT)]:=par;
+ ef nC=_dl: lineB[getB(par)]:=dl;
+ ef nC=_mb: lineB[getB(-1)]:=par;
+ ef (nC=_chg_line)or(nC=_tmp_line): lineT:=par;
+ ef nC=_tmp_rot: rotT:=par;
+ ef nC=_cyc: f_end:=getA(par); check_adrA(f_end); add_atom;
+ ef nC=_cyc_eB: f_end:=eB[getB(par)]; add_atom;
+ ef nC=_cyc_sB: f_end:=sB[getB(par)]; add_atom;
+ ef nC=_chg_env: envB:=par;
+ ef nC=_tmp_env: envT:=par;
+ ef nC=_set_clr:
f_at:=par;
if par=1: if lineT<>si: f_lineT:=1; fi if rotT<>0: f_rotT:=1; fi
if lenT<>crR: f_lenT:=1; fi if envT<>hz: f_envT:=1; fi
- elseif par=0: f_lineT:=f_rotT:=f_lenT:=f_envT:=rotT:=envT:=0; lineT:=si; lenT:=crR;
+ ef par=0: f_lineT:=f_rotT:=f_lenT:=f_envT:=rotT:=envT:=0; lineT:=si; lenT:=crR;
fi
- elseif com=_term: termA;
- elseif com=_set_colorA: colorA[getA(adrT)]:=par;
- elseif com=_set_colorB: colorB[getB(adrT)]:=par;
+ ef nC=_term: termA;
+ ef nC=_set_colorA: colorA[getA(adrT)]:=par;
+ ef nC=_set_colorB: colorB[getB(adrT)]:=par;
fi
endfor
enddef;
@@ -734,36 +740,35 @@ def proc_skeleton=
for i=0 upto 5: stkA[i]:=stkB[i]:=0; endfor
%----------------------------------------------------------------------------------------------
for i=1 upto cntD[0]:
- com:=comD[0][i]; par:=parD[0][i];
- if com=_push: if par=1: stkM[adrS]:=envB; adrS:=adrS+1; stkA[adrS]:=adrA:=cntA;
+ nC:=comD[0][i]; par:=parD[0][i];
+ if nC=_push: if par=1: stkM[adrS]:=envB; adrS:=adrS+1; stkA[adrS]:=adrA:=cntA;
stkB[adrS]:=adrB:=cntB;
- elseif par=0: temp_len:=bondL;
- elseif par=2: stkA[adrS+1]:=cntA; stkB[adrS+1]:=cntB;
+ ef par=0: temp_len:=bondL;
+ ef par=2: stkA[adrS+1]:=cntA; stkB[adrS+1]:=cntB;
fi
- elseif com=_pop: if par=1: adrA:=stkA[decr adrS]; adrB:=stkB[adrS]; envB:=stkM[adrS];
- elseif par=0: temp_len:=bondL;
- elseif par=2: stkA[adrS+1]:=0;
+ ef nC=_pop: if par=1: adrA:=stkA[decr adrS]; adrB:=stkB[adrS]; envB:=stkM[adrS];
+ ef par=0: temp_len:=bondL;
+ ef par=2: stkA[adrS+1]:=0;
fi
- elseif com=_jp_bond: termB; tempB:=getB(par); posBs:=posA[sB[tempB]];
+ ef nC=_jp_bond: termB; tempB:=getB(par); posBs:=posA[sB[tempB]];
angT:=angB[tempB]; f_bra:=1; rotT:=0;
- elseif com=_jp_atom: termB; adrT:=getA(par); posBs:=posA[adrT];
+ ef nC=_jp_atom: termB; adrT:=getA(par); posBs:=posA[adrT];
angT:=ang_br[adrT]; f_bra:=1; rotT:=0;
- elseif com=_jp_atom_abs: adrT:=par; posBs:=posA[adrT];
+ ef nC=_jp_atom_abs: adrT:=par; posBs:=posA[adrT];
angT:=ang_br[adrT]; f_bra:=1; rotT:=0; temp_cntB:=cntB;
- elseif com=_adj_ang: if (angT<40)or(angT>320): angT:=0; elseif angT<140: angT:=90;
- elseif angT<220: angT:=180; else: angT:=270; fi
- elseif com=_mk_bond: if (par=0)and(rotT<>0):par:=rotT; rotT:=0; fi add_bond(par);
- elseif com=_rot_ang: angT:=(angT+par) mod 360;
- elseif com=_tmp_rot: rotT:=par;
- elseif (com>=_postA)and(com<=_postH): rotT:=0;
- elseif com=_chg_env: envB:=par;
- elseif com=_tmp_env: envT:=par;
- elseif com=_set_clr: f_at:=par; if par=0: lineT:=si; lenT:=crR; rotT:=envT:=0; fi
- elseif com=_cyc: f_end:=1; proc_cyc(getA(par));
- elseif com=_cyc_sB: f_end:=1; proc_cyc(sB[getB(par)]);
- elseif com=_cyc_eB: f_end:=1; proc_cyc(eB[getB(par)]);
- elseif com=_term: termB;
-%%%%%%%%% elseif com=_stack_reset: stkA[adrS+1]:=0;
+ ef nC=_adj_ang: if (angT<40)or(angT>320): angT:=0; ef angT<140: angT:=90;
+ ef angT<220: angT:=180; else: angT:=270; fi
+ ef nC=_mk_bond: if (par=0)and(rotT<>0):par:=rotT; rotT:=0; fi add_bond(par);
+ ef nC=_rot_ang: angT:=(angT+par) mod 360;
+ ef nC=_tmp_rot: rotT:=par;
+ ef (nC>=_postA)and(nC<=_postH): rotT:=0;
+ ef nC=_chg_env: envB:=par;
+ ef nC=_tmp_env: envT:=par;
+ ef nC=_set_clr: f_at:=par; if par=0: lineT:=si; lenT:=crR; rotT:=envT:=0; fi
+ ef nC=_cyc: f_end:=1; proc_cyc(getA(par));
+ ef nC=_cyc_sB: f_end:=1; proc_cyc(sB[getB(par)]);
+ ef nC=_cyc_eB: f_end:=1; proc_cyc(eB[getB(par)]);
+ ef nC=_term: termB;
fi
endfor
enddef;
@@ -790,11 +795,11 @@ def add_bond(expr m)=
enddef;
%==================================================================================================
vardef getA(expr n)=
- if n>=0: stkA[adrS+1]+n elseif n>=-999: cntA+n+1 else: stkA[adrS]+n+4095 fi
+ if n>=0: stkA[adrS+1]+n ef n>=-999: cntA+n+1 else: stkA[adrS]+n+4095 fi
enddef;
%--------------------------------------------------------------------------------------------------
vardef getB(expr n)=
- if n>=1: stkB[adrS+1]+n elseif n=0: tempB elseif n>=-999: cntB+n+1 else: stkB[adrS]+n+4095 fi
+ if n>=1: stkB[adrS+1]+n ef n=0: tempB ef n>=-999: cntB+n+1 else: stkB[adrS]+n+4095 fi
enddef;
%--------------------------------------------------------------------------------------------------
def termA= if f_term=0: if f_bra=0: numS[incr cntA]:=strAT; strAT:=0;
@@ -809,9 +814,9 @@ def glu_c(expr n)= if numS[n]<>0: nB:=angT mod 180; nC:=.5tbl_str_wd[numS[n]]*at
%--------------------------------------------------------------------------------------------------
vardef proc_env(expr n,m,a,b)= r:=(n mod 360);
if m>=sub_emb_start: parD[m][cntB-temp_cntB] else:
- if m=hz:if r=0:a elseif r<=90:b elseif r<=180:a elseif r<270:b else:a fi
- elseif m=vt:if r=0:b elseif r<90:a elseif r<=180:b elseif r<=271:a else:b fi
- elseif (m>=-180)and(m<=180): m fi fi
+ if m=hz:if r=0:a ef r<=90:b ef r<=180:a ef r<270:b else:a fi
+ ef m=vt:if r=0:b ef r<90:a ef r<=180:b ef r<=271:a else:b fi
+ ef (m>=-180)and(m<=180): m fi fi
enddef;
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
def draw_atom(expr NUM,POS,ANG,STR,WD)=
@@ -829,9 +834,9 @@ def draw_atom(expr NUM,POS,ANG,STR,WD)=
if dx<0: if nB=par_s: k:=i+1; nC:=1; forever: exitif pic_c(i+(incr nC),STR)="}";endfor fi
if nC>0: sB:=pic_c(k+(decr nC),STR); nB:=ASCII(sB); fi
fi
- if nB=score_u: if nE=0: nE:=-.5; else: nE:=0; fi;
- elseif nB=hat: if nE=0: nE:= .5; else: nE:=0; fi;
- elseif (nB<>par_s)and(nB<>par_e):
+ if nB=score_u: if nE=0: nE:=-.5; else: nE:=0; fi;
+ ef nB=hat: if nE=0: nE:= .5; else: nE:=0; fi;
+ ef (nB<>par_s)and(nB<>par_e):
nA:=atom_wd*tbl_char_wd[nB];
if (atomfont<>"draw")and(f_MP=1):
pC:=sB infont atomfont scaled (atom_wd/atomfontsize);
@@ -863,52 +868,53 @@ enddef;
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
def draw_bond(expr NN,BP,EP,ANG,LN)=
begingroup
- save ww,ap,am,hpt,Ls,Le,pA,pB,pC,pT;
+ save ww,ap,am,hpt,Ls,Le,pA,pB,pC,pT,nL,nC;
pair Ls,Le;
path pA,pB,pC,pT;
%----------------------------------------------------------------------------------------------
+ nL:=LN;
nC:=length(posA[EP]-posA[BP]);
- if (nC>0)and(LN<>0):
+ if (nC>0)and(nL<>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(numS[BP],numS[EP],posA[BP],posA[EP],nC); fi
pickup pencircle scaled bond_pen_wd;
if known colorB[NN]: nB:=colorB[NN]; 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=db:if ((ANG-ang_br[BP]) mod 360)<=180: nA:=ap; else: nA:=am; fi
+ if (nL=si)or(sw_bond_single=1): draw pA Cp(nB);
+ ef nL=dl: draw pA Cp(nB); draw sfB(pC,bondgap,ap) Cp(nB);
+ ef nL=dr: draw pA Cp(nB); draw sfB(pC,bondgap,am) Cp(nB);
+ ef nL=dm: draw sfB(pB,bondgap/1.75,ap) Cp(nB); draw sfB(pB,bondgap/1.75,am) Cp(nB);
+ ef nL=db: if ((ANG-ang_br[BP]) mod 360)<=180: nA:=ap; else: nA:=am; fi
draw pA Cp(nB); draw sfB(pC,bondgap,nA) 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:nB:=3bond_pen_wd; nA:=nB/length(Le-Ls);
+ ef nL=tm: draw pA Cp(nB);draw sfB(pA,bondgap,ap) Cp(nB); draw sfB(pA,bondgap,am) Cp(nB);
+ ef nL=wf: fill Ls--sfB(Le,ww,am)--sfB(Le,ww,ap)--cycle;
+ ef nL=wb: fill sfB(Ls,ww,am)--Le--sfB(Ls,ww,ap)--cycle;
+ ef nL=bd: draw pA withpen penrazor rotated ap scaled bondgap Cp(nB);
+ ef nL=bz: bz_put(sfB(Ls,ww,ap),sfB(Le,ww,ap),sfB(Ls,ww,am),sfB(Le,ww,am),nB);
+ ef nL=zf: wz_put(Ls,sfB(Le,ww,ap),sfB(Le,ww,am),nB);
+ ef nL=zb: wz_put(Le,sfB(Ls,ww,am),sfB(Ls,ww,ap),nB);
+ ef nL=dt: for i=0 step .75zebra_gap/length(Le-Ls) until 1: drawdot i[Ls,Le]; endfor
+ ef nL=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;
- 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 0.8bondgap; draw pA Cp(nB);
- elseif LN=wf_:erase fill sfB(0.15[Ls,Le],.5ww,ap)--sfB(0.15[Ls,Le],.5ww,am)--
+ ef nL=vf: draw pA Cp(nB);draw sfB(Le,bondgap,ANG-150)--Le--sfB(Le,bondgap,ANG+150) Cp(nB);
+ ef nL=vb: draw pA Cp(nB);draw sfB(Ls,bondgap,ANG-30)--Ls--sfB(Ls,bondgap,ANG+30) Cp(nB);
+ ef nL=si_: erase draw 0.15[Ls,Le]--0.85[Ls,Le] wpcs 0.8bondgap; draw pA Cp(nB);
+ ef nL=wf_: erase fill sfB(0.15[Ls,Le],.5ww,ap)--sfB(0.15[Ls,Le],.5ww,am)--
sfB(0.85[Ls,Le],1.3ww,am)--sfB(0.85[Ls,Le],1.3ww,ap)--cycle;
fill Ls--sfB(Le,ww,am)--sfB(Le,ww,ap)--cycle;
- elseif LN=wb_:erase fill sfB(0.15[Ls,Le],1.3ww,ap)--sfB(0.15[Ls,Le],1.3ww,am)--
+ ef nL=wb_: erase fill sfB(0.15[Ls,Le],1.3ww,ap)--sfB(0.15[Ls,Le],1.3ww,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.6bondgap;
+ ef nL=bd_: erase draw 0.15[Ls,Le]--0.85[Ls,Le] wpcs 1.6bondgap;
draw pA withpen penrazor rotated ap scaled bondgap Cp(nB);
fi
if (sw_numberB>=1)and(NN>=numberB_start)and(NN<=numberB_end):
if sw_numberB=2: nB:=NN-numberB_start+1;
- elseif sw_numberB=3: if numberB_end<cntB: nB:=numberB_end-NN+1; else: nB:=cntB-NN+1; fi
+ ef sw_numberB=3: if numberB_end<cntB: nB:=numberB_end-NN+1; else: nB:=cntB-NN+1; fi
else: nB:=NN; fi
draw_atom(NN,.5[posA[BP],posA[EP]],0,decimal(nB),1); fi
fi
@@ -933,9 +939,9 @@ def cut_off(expr p,w,h,s)=
def clipping(expr SA,SB,PA,PB,LEN)=
pT:=PA--PB; nA:=0.6atom_wd/LEN;
if (SA=0)and(SB=0): Ls:=PA; Le:=PB; pA:=pB:=pT; pC:=0.1[PA,PB]--0.1[PB,PA];
- elseif SA=0: Ls:=PA; Le:=cut_off(pT,atom_wd*tbl_str_wd[SB],atom_wd,PB);
+ ef SA=0: Ls:=PA; Le:=cut_off(pT,atom_wd*tbl_str_wd[SB],atom_wd,PB);
pA:=Ls--Le; pB:=Ls--nA[PB,PA]; pC:=0.1[PA,PB]--Le;
- elseif SB=0: Ls:= cut_off(pT,atom_wd*tbl_str_wd[SA],atom_wd,PA); Le:=PB;
+ ef SB=0: Ls:= cut_off(pT,atom_wd*tbl_str_wd[SA],atom_wd,PA); Le:=PB;
pA:=Ls--Le; pB:=nA[PA,PB]--Le; pC:=Ls--(0.1)[PB,PA];
else: Ls:=cut_off(pT,atom_wd*tbl_str_wd[SA],atom_wd,PA);
Le:=cut_off(pT,atom_wd*tbl_str_wd[SB],atom_wd,PB);
@@ -956,7 +962,11 @@ Me:='(); Et:='(!); Pr:=!x2:='(!,!); Bu:=!x3:='(!,!,!);
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
%=================================================================================================
-H :='("H");C:='("C");N:='("N");O:='("O");F:='("F");S:='("S");P:='("P");I:='("I");
+H :='("H");C:='("C");N:='("N");O:='("O");S:='("S");P:='("P");
+H[1]:='("{H^+^}");H[-1]:='("{H^-^}");C[1]:='("{C^+^}");C[-1]:='("{C^-^}");
+O[1]:='("{O^+^}");O[-1]:='("{O^-^}");N[1]:='("{N^+^}");N[-1]:='("{N^-^}");
+S[1]:='("{S^+^}");S[-1]:='("{S^-^}");P[1]:='("{P^+^}");P[-1]:='("{P^-^}");
+F:='("F");I:='("I");
Si:='("{Si}");Al:='("{Al}");Mg:='("{Mg}");Zn:='("{Zn}");As:='("{As}");Cu:='("{Cu}");
Ag:='("{Ag}");Au:='("{Au}");Sn:='("{Sn}");Cl:='("{Cl}");Br:='("{Br}");Li:='("{Li}");
Na:='("{Na}");Ca:='("{Ca}");Hg:='("{Hg}");Ni:='("{Ni}");Ti:='("{Ti}");U:='("U");
@@ -965,8 +975,8 @@ R:='("R"); R1:='("{R^1^}"); R2:='("{R^2^}"); R3:='("{R^3^}"); R4:='("R^4^"); R5:
%-------------------------------------------------------------------------------------------------
CHO:='("CHO"); OH:='("OH"); COOH:='("COOH"); CH2:='("C{H_2_}"); CH3:='("C{H_3_}"); CN:='("CN");
NH2:='("N{H_2_}"); NO2:='("N{O_2_}"); SH:='("SH"); SO3:='("S{O_3_}"); NH:='(N,(_postE,H));
-NMe:=N!:='(N,/Me); iPr:=Me!:='(/Me,60); tBu:='(/Me,/Me^60,60); SO:='(S,//O);
-SOO :='(S,//O^-35,//O^35);
+NMe:=N!:='(N,/Me); iPr:=Me!:='(/Me,60); tBu:='(/Me,/Me^60,60);
+SO:='(S,//O); SOO :='(S,//O^-35,//O^35);
OMe:=O!:='(O,!); OEt:=O!2:='(O,!x2); OPr:=O!3:='(O,!x3); OiPr:=OMe!:='(O,!,iPr);
SMe:=S!:='(S,!); SEt:=S!2:='(S,!x2); SPr:=S!3:='(S,!x3); SiPr:=SMe!:='(S,!,iPr);
COO:='(//O,!,O); COOMe:=COO!:='(COO,!); COOEt:=COO!2:='(COO,!x2); COOiPr:=COOMe!:='(COO,!,iPr);
@@ -996,19 +1006,22 @@ def char_size_set(expr a)(expr b)(expr s)=
enddef;
%---------------------------------------------------------------
char_size_set( 1)( 1)("CGHMNOQ");
-char_size_set(.9)( 1)("ABDEFIJKLPRSTUVWXYZ-+/><m");
-char_size_set(.7)( 1)(" ()[]0123456789nhj=_bdtfgpq");
-char_size_set(.7)(.7)("*");
-char_size_set(.5)( 1)("il");
-char_size_set(.7)(.8)("acekosuvxzwry");
+char_size_set(.9)( 1)("ABDEFIJKLPRSTUVWXYZ/><m");
+char_size_set(.7)( 1)(" ()[]0123456789nhj=_tfgpq");
+char_size_set(.7)(.7)("-+*");
+char_size_set(.45)(.95)("l");
+char_size_set(.75)(.8)("o");
+char_size_set(.8)(.8)("e");
+char_size_set(.7)(.8)("abdcksuvxzwry");
+char_size_set(.35)(.9)("i");
char_size_set(.4)( 1)(".,:;'`^");
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-def draw_char(expr c,POS,WD,PEN,NUM)=
-save Z,aW,aH,fW,fH,hW,hW,hH,fP,hP,pathO,pathOh,ef,pos,ppcs,sbp,dw,dwh,dwv,cdw;
+def draw_char(expr CHR,POS,WD,PEN,NUM)=
+save Z,aW,aH,fW,fH,hW,hW,hH,fP,hP,pathO,pathOh,pos,dw,dwh,dwv,cdw,ppcs,sbp;
path pathO,pathOh;
+string sC;
pair Z[],pos;
%-------------------------------------------------------------------------------------------------
-let ef=elseif;
def ppcs expr n= pickup pencircle scaled n enddef;
def sbp(expr m,n)expr p=subpath(m*length(p),n*length(p)) of p enddef;
def dw expr p = draw (p) shifted pos Cp(colorA[NUM]) enddef;
@@ -1018,9 +1031,9 @@ def dwvs (expr n)expr p=
def dwh expr p=draw (p) withpen penrazor rotated 90 scaled fP shifted pos Cp(colorA[NUM]) enddef;
def cdw expr p=cutdraw (p) shifted pos Cp(colorA[NUM]) enddef;
%-------------------------------------------------------------------------------------------------
-fP:=PEN; hP:=0.5fP;
-aW:=WD*tbl_char_wd[ASCII(c)]*(1-2ratio_atomgap_atom);
-aH:=WD*tbl_char_ht[ASCII(c)]*(1-2ratio_atomgap_atom);
+sC:=CHR; fP:=PEN; hP:=0.5fP;
+aW:=WD*tbl_char_wd[ASCII(sC)]*(1-2ratio_atomgap_atom);
+aH:=WD*tbl_char_ht[ASCII(sC)]*(1-2ratio_atomgap_atom);
pos:=POS+(WD*ratio_atomgap_atom,WD*ratio_atomgap_atom);
fW:=aW-hP; hW:=.5aW; fH:=aH-hP; hH:=.5aH;
Z01:=( 0,hP); Z02:=(hP, 0); Z03:=(hP,hP); Z04:=(aW,hP); Z05:=(fW, 0); Z06:=(hW,aH); Z07:=(hW, 0);
@@ -1030,91 +1043,91 @@ pathO:=Z10..(.8aW,fH)..tension 1.5..(.2aW,fH)..Z09..(.2aW,hP)..tension 1.5..(.8a
pathOh:=(hP,.25aH)..Z19..(fW,.25aH)..Z20..cycle;
%-------------------------------------------------------------------------------------------------
ppcs fP;
-if c="A": dwvs(1.14) Z02--Z06--Z05; dw .33[Z02,Z06]--.33[Z05,Z06];
-ef c="B": dw Z13--Z14{right}..(.9fH,.75aH)..{left}Z20--Z09--Z20{right}..(.9fH,.25aH)..
- {left}Z19--Z03; dwv Z02--Z18;
-ef c="C": cdw sbp(.05,.95)pathO;
-ef c="D": dw Z13--Z14..Z10..Z19--Z03; dwv Z02--Z18;
-ef c="E": pickup pensquare scaled fP; dw Z21--Z03--Z13--(fW,fH); dw Z09--Z10;
-ef c="F": dwh Z12--Z16; dwh (0,.45aH)--(fW,.45aH); dw Z02--Z13;
-ef c="G": cdw sbp(.06,.97)pathO; dwh bot Z20-- bot Z17;
-ef c="H": dwv Z02--Z18; dw Z09--Z10; dwv Z05--Z15;
-ef c="I": dwv Z19--Z14; dwh (hW-fP,hP)--(hW+fP,hP); dwh (hW-fP,fH)--(hW+fP,fH);
-ef c="J": cdw Z09..(hP,.4aH){down}..{right}Z19{right}..{up}(fW,.4aH)..Z15;
-ef c="K": cdw Z02--Z18; cdw .5[.45[Z02,Z18],Z16]--Z05; cdw .45[Z02,Z18]--Z16;
-ef c="L": dwh Z04--Z01; dwv Z02--Z18;
-ef c="M": dwv Z02--Z18; dwvs(1.14) Z18--Z19--Z15; dwv Z15--Z05;
-ef c="N": dwv Z02--Z18; dwv Z05--Z15; dwvs(1.4) (1.4hP,aH)--(aW-1.4hP,0);
-ef c="O": dw pathO;
-ef c="P": dwv Z02--Z18; dw Z13--(.3aW,fH){right}..(fW,.7aH)..{left}(.3aW,.44aH)..(hP,.44aH);
-ef c="Q": dw pathO; dw (.6aW,.4aH)--Z05;
-ef c="R": dwv Z02--Z18; dw Z13--(.3aW,fH){right}..(fW,.7aH)..{left}(.3aW,.44aH)..(hP,.44aH);
- cdw Z05{up}..{left}(hW,.44aH);
-ef c="S": cdw sbp(.05,.45)pathO; cdw sbp(.55,.95)pathO; dw (fW,.3aH){up}..{up}(hP,.7aH);
-ef c="T": dwh Z12--Z16; dwv .5[Z12,Z16]--Z07;
-ef c="U": cdw Z18..Z09{down}..{right}Z19{right}..{up}Z10..Z15;
-ef c="V": dwvs(1.2) Z18--Z07--Z15;
-ef c="W": dwvs(1.08) Z18--(.25aW,0)--Z06--(.75aW,0)--Z15;
-ef c="X": dwvs(1.4) Z18..Z05; dwvs(1.4) Z02..Z15;
-ef c="Y": dwvs(1.2) Z18--Z20--Z15; dwv Z20--Z07;
-ef c="Z": dwh Z12--Z16; dwvs(1.4) (1.4hP,fP)--(aW-1.4hP,aH-fP); dwh Z01--Z04;
-ef c="a": dw Z19..Z10..Z14..Z09..cycle; dwv Z05--Z15;
-ef c="b": dw Z19..Z10..Z11..Z09..cycle; dwv Z02--(hP,1.2aH)
-ef c="c": cdw sbp(.06,.94)Z10..Z14..Z09..Z19..cycle;
-ef c="d": dw Z19..Z10..Z11..Z09..cycle; dwv Z05--(fW,1.2aH);
-ef c="e": cdw sbp(0,.92)Z10..Z14..Z09..Z19..cycle; dw Z10--Z09;
-ef c="f": cdw (hW,0)--(hW,.75aH){up}..(.75aW,fH)..{down}(fW,.8aH); dwh Z08--Z17;
-ef c="g": dw Z19..Z10..Z11..Z09..cycle; cdw (Z15--Z21..(hW,0)..(.1aW,fP)) shifted (0,-.3aH);
-ef c="h": dw Z02..(hP,.3aH){up}..(hW,.7fH)..{down}(fW,.3aH)..Z05; dwv (hP,.3aH)--Z18;
-ef c="i": dwv Z07--(hW,.63aH); ppcs 1.4fP; dw Z14;
-ef c="j": dwv Z19--(hW,.63aH); dw Z19..(.25aW,-hP)..Z01; ppcs 1.4fP; dw Z14;
-ef c="k": dwv Z02--Z18; cdw .5[.45[Z02,Z18],Z16]--Z05; cdw .45[Z02,Z18]--Z16;
-ef c="l": dwv Z07--Z06; dwh Z14--Z13; dwh Z19--Z21;
-ef c="m": cdw Z02..(hP,.3aH){up}..(.28aW,.7fH)..{down}(hW,.3aH)..Z07;
- cdw (hW,.3aH){up}..(.7aW,.7aH-hP)..{down}(fW,.3aH)..Z05; dwv (hP,.3aH)--(hP,.7aH);
-ef c="n": cdw Z02..(hP,.3aH){up}..(hW,.7fH)..{down}(fW,.3aH)..Z05; dwv (hP,.3aH)--(hP,.7aH);
-ef c="o": dw Z19..Z10..Z14..Z09..cycle;
-ef c="p": dw Z19..Z10..Z11..Z09..cycle; dwv (hP,.7aH)--(hP,-.3aH);
-ef c="q": dw Z19..Z10..Z11..Z09..cycle; dwv (fW,.7aH)--(fW,-.3aH);
-ef c="r": cdw (sbp(.35,.72)Z19..Z10..Z14..Z09..cycle) shifted(0,-fP); dwv Z02--Z18;
-ef c="s": cdw sbp(.05,.45)pathO; cdw sbp(.55,.95)pathO; dw (fW,.3aH){up}..{up}(hP,.7aH);
-ef c="t": dwv Z07--Z06; dwh (0,.66aH)--(aW,.66aH);
-ef c="u": cdw Z18..(hP,.55aH){down}..Z19..(fW,.55aH){up}..Z15; dwv Z15--Z05;
-ef c="v": dwv Z18--Z07--Z15;
-ef c="w": dwv Z18--(.25aW,0)--Z06--(.75aW,0)--Z15;
-ef c="x": dwvs(1.4) Z18--Z05; dwvs(1.4) Z15--Z02;
-ef c="y": dwvs(1.4) (Z18--Z20) shifted (0,-.3aH); dwvs(1.4) (Z15--Z02) shifted (0,-.3aH);
-ef c="z": dwh Z12--Z16; dwvs(1.4) (1.4hP,fP)--(aW-1.4hP,aH-fP); dwh Z01--Z04;
-ef c="0": dw Z09...Z14...Z10...Z19...cycle;
-ef c="1": dwv Z07--Z06--(hW-hP,fH)--(hW-hP,aH-2.5hP);
-ef c="2": cdw sbp(0,.71)(hP,1.3hP)--(fW,.55aH)..Z14..(hP,.5aH)..(hW,.27aH); dwh Z04--Z01;
-ef c="3": cdw sbp(0,.77)pathOh; cdw sbp(.23,.95)pathOh shifted (0,.5aH-hP); dwh (.3aW,hH)--Z20;
-ef c="4": dwh (0,.3aH)--(aW,.3aH); dwv (.7aW,0)--(.7aW,aH)--(1.2hP,.3aH+hP);
-ef c="5": dwh Z12--Z16; dwv Z13--(hP,.49aH);
- cdw (.5hP,.15aH)..(.65aW,1.3hP)..(fW,.3aH)..(hW,.6aH)..(.6hP,.53aH);
-ef c="6": dw Z19..(fW,.5fW)..(hW,fW)..(hP,.5fW)..cycle; cdw (hP,.4aH)--Z06;
-ef c="7": dwh (0,.fH)--Z16; dwvs(1.2) (aW-1.2hP,aH-fP)--(.4aW,0);
-ef c="8": dw pathOh; dw (hP,.75aH)...Z14...(fW,.75aH)...Z20...cycle;
-ef c="9": dw (Z19..(fW,.5fW)..(hW,fW)..(hP,.5fW)..cycle) shifted (0,.32aH); cdw (fW,.6aH)--Z07;
-ef c=" ":
-ef c=".": ppcs 1.4fP; dw Z19;
-ef c=",": dw (hW+.5fP,hP)..(hW+.3fP,-fP)..(hW-.5fP,hP-2fP); ppcs 1.4fP; dw Z19;
-ef c="'": dw (hW+.5fP,fH)..(hW+.3fP,fH-fP)..(hW-.5fP,fH-2fP); ppcs 1.4fP; dw Z14;
-ef c="`": dw (hW-.5fP,fH-2fP)..(hW-.3fP,fH-fP)..(hW+.5fP,fH); ppcs 1.4fP; dw (hW,fH-2fP);
-ef c=":": ppcs 1.4fP; dw (hW,.2aH); dw (hW,.8aH);
-ef c=";": dw (hW+hP,.2aH)..(hW-hP,.2aH-2fP); ppcs 1.4fP; dw (hW,.2aH); dw (hW,.8aH);
-ef c="(": dw Z19...Z09...Z14;
-ef c=")": dw Z19...Z10...Z14;
-ef c="[": dwv Z07--Z06; dwh Z14--(fW,fH); dwh Z19--Z21;
-ef c="]": dwv Z07--Z06; dwh Z14--Z13; dwh Z03--Z19;
-ef c="<": cdw Z01--Z17--Z12;
-ef c=">": cdw Z16--Z08--Z04;
-ef c="-": dwh Z09--Z10;
-ef c="_": dwh Z03--Z21;
-ef c="=": dwh (hP,.3aH)--(fW,.3aH); dwh (hP,.6aH)--(fW,.6aH);
-ef c="/": dw (fW,fH)..Z01;
-ef c="+": dwv Z19--Z14; dwh Z09--Z10;
-ef c="*": dw Z19--Z14; dw Z09--Z10; dw (fW,fH)--Z01; dw Z13--Z21;
+if sC="A": dwvs(1.14) Z02--Z06--Z05; dw .33[Z02,Z06]--.33[Z05,Z06];
+ef sC="B": dw Z13--Z14{right}..(.9fH,.75aH)..{left}Z20--Z09--Z20{right}..(.9fH,.25aH)..
+ {left}Z19--Z03; dwv Z02--Z18;
+ef sC="C": cdw sbp(.05,.95)pathO;
+ef sC="D": dw Z13--Z14..Z10..Z19--Z03; dwv Z02--Z18;
+ef sC="E": pickup pensquare scaled fP; dw Z21--Z03--Z13--(fW,fH); dw Z09--Z10;
+ef sC="F": dwh Z12--Z16; dwh (0,.45aH)--(fW,.45aH); dw Z02--Z13;
+ef sC="G": cdw sbp(.06,.97)pathO; dwh bot Z20-- bot Z17;
+ef sC="H": dwv Z02--Z18; dw Z09--Z10; dwv Z05--Z15;
+ef sC="I": dwv Z19--Z14; dwh (hW-fP,hP)--(hW+fP,hP); dwh (hW-fP,fH)--(hW+fP,fH);
+ef sC="J": cdw Z09..(hP,.4aH){down}..{right}Z19{right}..{up}(fW,.4aH)..Z15;
+ef sC="K": cdw Z02--Z18; cdw .5[.45[Z02,Z18],Z16]--Z05; cdw .45[Z02,Z18]--Z16;
+ef sC="L": dwh Z04--Z01; dwv Z02--Z18;
+ef sC="M": dwv Z02--Z18; dwvs(1.14) Z18--Z19--Z15; dwv Z15--Z05;
+ef sC="N": dwv Z02--Z18; dwv Z05--Z15; dwvs(1.4) (1.4hP,aH)--(aW-1.4hP,0);
+ef sC="O": dw pathO;
+ef sC="P": dwv Z02--Z18; dw Z13--(.3aW,fH){right}..(fW,.7aH)..{left}(.3aW,.44aH)..(hP,.44aH);
+ef sC="Q": dw pathO; dw (.6aW,.4aH)--Z05;
+ef sC="R": dwv Z02--Z18; dw Z13--(.3aW,fH){right}..(fW,.7aH)..{left}(.3aW,.44aH)..(hP,.44aH);
+ cdw Z05{up}..{left}(hW,.44aH);
+ef sC="S": cdw sbp(.05,.45)pathO; cdw sbp(.55,.95)pathO; dw (fW,.3aH){up}..{up}(hP,.7aH);
+ef sC="T": dwh Z12--Z16; dwv .5[Z12,Z16]--Z07;
+ef sC="U": cdw Z18..Z09{down}..{right}Z19{right}..{up}Z10..Z15;
+ef sC="V": dwvs(1.2) Z18--Z07--Z15;
+ef sC="W": dwvs(1.08) Z18--(.25aW,0)--Z06--(.75aW,0)--Z15;
+ef sC="X": dwvs(1.4) Z18..Z05; dwvs(1.4) Z02..Z15;
+ef sC="Y": dwvs(1.2) Z18--Z20--Z15; dwv Z20--Z07;
+ef sC="Z": dwh Z12--Z16; dwvs(1.4) (1.4hP,fP)--(aW-1.4hP,aH-fP); dwh Z01--Z04;
+ef sC="a": dw Z19..Z10..Z14..Z09..cycle; dwv Z05--Z15;
+ef sC="b": dw Z19..Z10..Z11..Z09..cycle; dwv Z02--(hP,1.3aH)
+ef sC="c": cdw sbp(.06,.94)Z10..Z14..Z09..Z19..cycle;
+ef sC="d": dw Z19..Z10..Z11..Z09..cycle; dwv Z05--(fW,1.3aH);
+ef sC="e": cdw sbp(0,.92)Z10..Z14..Z09..Z19..cycle; dw Z10--Z09;
+ef sC="f": cdw (hW,0)--(hW,.75aH){up}..(.75aW,fH)..{down}(fW,.8aH); dwh Z08--Z17;
+ef sC="g": dw Z19..Z10..Z11..Z09..cycle; cdw (Z15--Z21..(hW,0)..(.1aW,fP)) shifted (0,-.3aH);
+ef sC="h": cdw Z02..(hP,.3aH){up}..(hW,.7fH)..{down}(fW,.3aH)..Z05; dwv (hP,.3aH)--Z18;
+ef sC="i": dwv Z07--(hW,.7aH); ppcs 1.4fP; dw Z14;
+ef sC="j": dwv Z19--(hW,.63aH); dw Z19..(.25aW,-hP)..Z01; ppcs 1.4fP; dw Z14;
+ef sC="k": dwv Z02--Z18; cdw .5[.45[Z02,Z18],Z16]--Z05; cdw .45[Z02,Z18]--Z16;
+ef sC="l": dwv Z07--Z06; dwh Z14--Z13; dwh Z19--Z21;
+ef sC="m": cdw Z02..(hP,.3aH){up}..(.28aW,.7fH)..{down}(hW,.3aH)..Z07;
+ cdw (hW,.3aH){up}..(.7aW,.7aH-hP)..{down}(fW,.3aH)..Z05; dwv (hP,.3aH)--(hP,.7aH);
+ef sC="n": cdw Z02{up}..(hW,.8fH)..{down}(fW,.5aH)..Z05; dwv (hP,.4aH)--(hP,.8aH);
+ef sC="o": dw Z19..Z10..Z14..Z09..cycle;
+ef sC="p": dw Z19..Z10..Z11..Z09..cycle; dwv (hP,.7aH)--(hP,-.3aH);
+ef sC="q": dw Z19..Z10..Z11..Z09..cycle; dwv (fW,.7aH)--(fW,-.3aH);
+ef sC="r": cdw (sbp(.35,.72)Z19..Z10..Z14..Z09..cycle) shifted(0,-fP); dwv Z02--Z18;
+ef sC="s": cdw sbp(.05,.45)pathO; cdw sbp(.55,.95)pathO; dw (fW,.3aH){up}..{up}(hP,.7aH);
+ef sC="t": dwv Z07--Z06; dwh (0,.66aH)--(aW,.66aH);
+ef sC="u": cdw Z18..(hP,.55aH){down}..Z19..(fW,.55aH){up}..Z15; dwv Z15--Z05;
+ef sC="v": dwv Z18--Z07--Z15;
+ef sC="w": dwv Z18--(.25aW,0)--Z06--(.75aW,0)--Z15;
+ef sC="x": dwvs(1.4) Z18--Z05; dwvs(1.4) Z15--Z02;
+ef sC="y": dwvs(1.4) (Z18--Z20) shifted (0,-.3aH); dwvs(1.4) (Z15--Z02) shifted (0,-.3aH);
+ef sC="z": dwh Z12--Z16; dwvs(1.4) (1.4hP,fP)--(aW-1.4hP,aH-fP); dwh Z01--Z04;
+ef sC="0": dw Z09...Z14...Z10...Z19...cycle;
+ef sC="1": dwv Z07--Z06--(hW-hP,fH)--(hW-hP,aH-2.5hP);
+ef sC="2": cdw sbp(0,.71)(hP,1.3hP)--(fW,.55aH)..Z14..(hP,.5aH)..(hW,.27aH); dwh Z04--Z01;
+ef sC="3": cdw sbp(0,.77)pathOh; cdw sbp(.23,.95)pathOh shifted (0,.5aH-hP); dwh (.3aW,hH)--Z20;
+ef sC="4": dwh (0,.3aH)--(aW,.3aH); dwv (.7aW,0)--(.7aW,aH)--(1.2hP,.3aH+hP);
+ef sC="5": dwh Z12--Z16; dwv Z13--(hP,.49aH); cdw (.5hP,.15aH)..(.65aW,1.3hP)..(fW,.3aH)..
+ (hW,.6aH)..(.6hP,.53aH);
+ef sC="6": dw Z19..(fW,.5fW)..(hW,fW)..(hP,.5fW)..cycle; cdw (hP,.4aH)--Z06;
+ef sC="7": dwh (0,.fH)--Z16; dwvs(1.2) (aW-1.2hP,aH-fP)--(.4aW,0);
+ef sC="8": dw pathOh; dw (hP,.75aH)...Z14...(fW,.75aH)...Z20...cycle;
+ef sC="9": dw (Z19..(fW,.5fW)..(hW,fW)..(hP,.5fW)..cycle) shifted (0,.32aH); cdw (fW,.6aH)--Z07;
+ef sC=" ":
+ef sC=".": ppcs 1.4fP; dw Z19;
+ef sC=",": dw (hW+.5fP,hP)..(hW+.3fP,-fP)..(hW-.5fP,hP-2fP); ppcs 1.4fP; dw Z19;
+ef sC="'": dw (hW+.5fP,fH)..(hW+.3fP,fH-fP)..(hW-.5fP,fH-2fP); ppcs 1.4fP; dw Z14;
+ef sC="`": dw (hW-.5fP,fH-2fP)..(hW-.3fP,fH-fP)..(hW+.5fP,fH); ppcs 1.4fP; dw (hW,fH-2fP);
+ef sC=":": ppcs 1.4fP; dw (hW,.2aH); dw (hW,.8aH);
+ef sC=";": dw (hW+hP,.2aH)..(hW-hP,.2aH-2fP); ppcs 1.4fP; dw (hW,.2aH); dw (hW,.8aH);
+ef sC="(": dw Z19...Z09...Z14;
+ef sC=")": dw Z19...Z10...Z14;
+ef sC="[": dwv Z07--Z06; dwh Z14--(fW,fH); dwh Z19--Z21;
+ef sC="]": dwv Z07--Z06; dwh Z14--Z13; dwh Z03--Z19;
+ef sC="<": cdw Z01--Z17--Z12;
+ef sC=">": cdw Z16--Z08--Z04;
+ef sC="-": dwh Z09--Z10;
+ef sC="_": dwh Z03--Z21;
+ef sC="=": dwh (hP,.3aH)--(fW,.3aH); dwh (hP,.6aH)--(fW,.6aH);
+ef sC="/": dw (fW,fH)..Z01;
+ef sC="+": dwv Z19--Z14; dwh Z09--Z10;
+ef sC="*": dw Z19--Z14; dw Z09--Z10; dw (fW,fH)--Z01; dw Z13--Z21;
else:
fi
enddef;
@@ -1131,7 +1144,12 @@ def bond_check(expr a)(text s)=
warning("A"&decimal(a)&" ( "&fixed_l(8)(strD[numS[a]])&") has"&fdr(2)(bond_cnt)&" bonds");
fi
enddef;
-vardef stripP(expr a)=if length(a)=4: substring (1,3) of a else: a fi enddef;
+vardef stripP(expr a)=
+ if length(a)=4: substring (1,3) of a
+ elseif length(a)=6: substring (1,2) of a
+ else: a
+ fi
+enddef;
%==================================================================================================
def STa(expr a,b,c)=
tbl_atom_str[incr tbl_cnt]:=a; tbl_atom[tbl_cnt]:=0;
@@ -1158,9 +1176,13 @@ STa("F" ,18.9984, 18.99840316273); STa("{Fe}",55.845, 55.93493633);
STa("{Hg}",200.59, 201.97064340); STa("I" ,126.90447,126.9044719);
STa("K" ,39.0983, 38.9637064864); STa("{Li}",6.941, 7.0160034366);
STa("{Mg}",24.305, 23.985041697); STa("{Mn}",54.938044, 54.93804391);
-STa("N" ,14.0067, 14.00307400443); STa("{Na}",22.98977, 22.9897692820);
-STa("{Ni}",58.693, 57.93534241); STa("O" ,15.9994, 15.99491461957);
-STa("P" ,30.973762, 30.97376199842); STa("S" ,32.065, 31.9720711744);
+STa("N" ,14.0067, 14.00307400443); STa("{N^+^}",14.0067, 14.00307400443);
+STa("{N^-^}",14.0067, 14.00307400443);
+STa("{Na}",22.98977, 22.9897692820); STa("{Ni}",58.693, 57.93534241);
+STa("O" ,15.9994, 15.99491461957); STa("{O^-^}",15.9994, 15.99491461957);
+STa("{O^p^}",15.9994, 15.99491461957); STa("P" ,30.973762, 30.97376199842);
+STa("S" ,32.065, 31.9720711744); STa("{S^p^}",32.065, 31.9720711744);
+STa("{S^m^}",32.065, 31.9720711744);
STa("{Se}",78.971, 79.9165218); STa("{Si}",28.0855, 27.97692653465);
STa("{Sn}",118.71, 119.90220163); STa("{Ti}",47.867, 47.94794198);
STa("{Zn}",65.409, 63.92914201);
@@ -1190,10 +1212,10 @@ def proc_calc_out=
for i=1 upto cntA:
knownA:=bond_cnt:=0;
for j=1 upto cntB:
- if (lineB[j]>=dl)and(lineB[j]<=dm): bondC[j]:=2;
- elseif lineB[j]=tm: bondC[j]:=3;
- elseif (lineB[j]=vf)or(lineB[j]=vb): bondC[j]:=0;
- else: bondC[j]:=1;
+ if (lineB[j]>=dl)and(lineB[j]<=dm): bondC[j]:=2;
+ ef lineB[j]=tm: bondC[j]:=3;
+ ef (lineB[j]=vf)or(lineB[j]=vb): bondC[j]:=0;
+ else: bondC[j]:=1;
fi
if (sB[j]=i)or(eB[j]=i): bond_cnt:=bond_cnt+bondC[j]; fi
endfor
@@ -1202,19 +1224,19 @@ def proc_calc_out=
if (strD[numS[i]]="C")and(bond_cnt<4):
hideH[i]:=4-bond_cnt; cnt_hide_H:=cnt_hide_H+hideH[i]; else: hideH[i]:=0;
fi
- if strD[numS[i]]="C": bond_check(i)(1,2,3,4);
- elseif strD[numS[i]]="N": bond_check(i)(3,5);
- elseif strD[numS[i]]="H": bond_check(i)(1);
- elseif strD[numS[i]]="O": bond_check(i)(2);
- elseif strD[numS[i]]="S": bond_check(i)(2,4,6);
- elseif strD[numS[i]]="P": bond_check(i)(5);
- elseif strD[numS[i]]="OH": bond_check(i)(1);
- elseif strD[numS[i]]="COOH": bond_check(i)(1);
- elseif strD[numS[i]]="CN": bond_check(i)(1);
- elseif strD[numS[i]]="N{H_2_}": bond_check(i)(1);
- elseif strD[numS[i]]="F": bond_check(i)(1);
- elseif strD[numS[i]]="{Cl}": bond_check(i)(1);
- elseif strD[numS[i]]="{Br}": bond_check(i)(1);
+ if strD[numS[i]]="C": bond_check(i)(1,2,3,4);
+ ef strD[numS[i]]="N": bond_check(i)(3,5);
+ ef strD[numS[i]]="H": bond_check(i)(1);
+ ef strD[numS[i]]="O": bond_check(i)(2);
+ ef strD[numS[i]]="S": bond_check(i)(2,4,6);
+ ef strD[numS[i]]="P": bond_check(i)(5);
+ ef strD[numS[i]]="OH": bond_check(i)(1);
+ ef strD[numS[i]]="COOH": bond_check(i)(1);
+ ef strD[numS[i]]="CN": bond_check(i)(1);
+ ef strD[numS[i]]="N{H_2_}": bond_check(i)(1);
+ ef strD[numS[i]]="F": bond_check(i)(1);
+ ef strD[numS[i]]="{Cl}": bond_check(i)(1);
+ ef strD[numS[i]]="{Br}": bond_check(i)(1);
fi
for j=1 upto tbl_cnt:
if strD[numS[i]]=tbl_atom_str[j]:
@@ -1234,9 +1256,9 @@ def proc_calc_out=
endfor
cal_MI:=substring (0,10) of decimal(MI_num);
cal_MW:=substring (0,8) of decimal(MW_num);
- if sw_auxout=1: proc_auxfile_out; fi
+ if sw_aux_out=1: proc_auxfile_out; fi
if sw_report=1: proc_report_out; fi
- if sw_MOLout=1: proc_MOLfile_out; fi
+ if sw_mol_out>=1: proc_mol_out; fi
endgroup
enddef;
%==================================================================================================
@@ -1270,11 +1292,13 @@ def proc_report_out=
message " Atom count="&fdr(3)(cntA)&" Bond count="&fdr(3)(cntB)&
" Ring count="&fdr(3)(cntB-cntA+1)&" Hide H count="&fdr(3)(cnt_hide_H);
message "------------------------------------------------------------------";
- message "< NO. >( x axis , y axis )< atom >< bond >< hide_H >";
+ message "< NO. >( x axis , y axis )< atom >< bond >< hideH >< chg >";
for i=1 upto cntA:
message " A"&fdl(4)(i)&" ("&fdr(10)(round_auto(xpart(posA[i])/bond_len))&" , "&
fdr(10)(round_auto(ypart(posA[i])/bond_len))&" ) "&fixed_l(8)(strD[numS[i]])&
- " "&fdr(3)(Bcnt[i]) if hideH[i]>0: &fdr(8)(hideH[i]) fi;
+ " "&fdr(3)(Bcnt[i])
+ if hideH[i]>0: &fdr(8)(hideH[i]) else: &" " fi
+ if chgA[i]<>0: &fdr(8)(chgA[i]) fi;
endfor
message "------------------------------------------------------------------";
message "< NO. >< bond (sdt)><angle + ( +- )><length ( pt )>";
@@ -1314,20 +1338,60 @@ def proc_report_out=
message "==================================================================";
enddef;
%==================================================================================================
-def proc_MOLfile_out=
+def proc_mol_out=
+ save chg_cnt,chg_atm,chg_chg;
+ numeric chg_atm,chg_chg;
+ chg_cnt:=0;
+ %-V2000------------------------------------------------------------------------------------------
+ if sw_mol_out=1:
mp_log_name:=jobname&"-"&fit_zero(char_num)&decimal(char_num)&"-"&inf_EN&".mol";
printf ""; printf " -MCFtoMOL- "&fixed_l(20)(info[1]); printf "";
printf fdr(3)(cntA)&fdr(3)(cntB)&" 0 0 0 0 0 0 0 0999 V2000";
- for i=1 upto cntA: printf fdr(10)(xpart(posA[i])/bond_len)& fdr(10)(ypart(posA[i])/bond_len)&
- fdr(10)(0)&" "&fixed_l(2)(stripP(strD[numS[i]]))&" 0 0 0 0"; endfor
+ for i=1 upto cntA:
+ printf fdr(10)(xpart(posA[i])/bond_len)& fdr(10)(ypart(posA[i])/bond_len)&
+ fdr(10)(0)&" "&fixed_l(2)(stripP(strD[numS[i]]))&" 0 0 0 0";
+ if chgA[i]<>0: chg_atm[incr chg_cnt]:=i; chg_chg[chg_cnt]:=chgA[i]; fi
+ endfor
for i=1 upto cntB: if lineB[i]<>0:
if (lineB[i]=dl)or(lineB[i]=dr)or(lineB[i]=dm): nA:=2;
- elseif lineB[i]=tm: nA:=3;
- elseif (lineB[i]=wf)or(lineB[i]=zb)or(lineB[i]=bd): nB:=1;
- elseif (lineB[i]=zf)or(lineB[i]=wb)or(lineB[i]=dt): nB:=6;
- elseif lineB[i]=wv: nB:=4; else: nA:=1; nB:=0; fi
- printf fdr(3)(sB[i])&fdr(3)(eB[i])&fdr(3)(nA)&fdr(3)(nB)&" 0 0"; fi endfor
+ ef lineB[i]=tm: nA:=3;
+ ef (lineB[i]=wf)or(lineB[i]=zb)or(lineB[i]=bd): nB:=1;
+ ef (lineB[i]=zf)or(lineB[i]=wb)or(lineB[i]=dt): nB:=6;
+ ef lineB[i]=wv: nB:=4; else: nA:=1; nB:=0; fi
+ printf fdr(3)(sB[i])&fdr(3)(eB[i])&fdr(3)(nA)&fdr(3)(nB)&" 0 0";
+ fi
+ endfor
+ if chg_cnt>0:
+ printf "M CHG"&fdr(3)(chg_cnt)
+ for i=1 upto chg_cnt: &fdr(4)(chg_atm[i])&fdr(4)(chg_chg[i]) endfor;
+ fi
printf "M END";
+ %-V3000-----------------------------------------------------------------------------------------
+ elseif sw_mol_out=2:
+ mp_log_name:=jobname&"-"&fit_zero(char_num)&decimal(char_num)&"-"&inf_EN&".mol";
+ printf ""; printf " -MCFtoMOL- "&fixed_l(20)(info[1]); printf "";
+ printf " 0 0 0 0 0 999 V3000";
+ printf "M V30 BEGIN CTAB";
+ printf "M V30 COUNTS "&decimal(cntA)&" "&decimal(cntB)&" 0 0 0";
+ printf "M V30 BEGIN ATOM";
+ for i=1 upto cntA:
+ printf "M V30 "&decimal(i)&" "&stripP(strD[numS[i]])&" "&
+ decimal(xpart(posA[i])/bond_len)&" "&decimal(ypart(posA[i])/bond_len)&" 0 0"
+ if chgA[i]<>0: &" CHG="&decimal(chgA[i]) fi;
+ endfor
+ printf "M V30 END ATOM";
+ printf "M V30 BEGIN BOND";
+ for i=1 upto cntB: if lineB[i]<>0:
+ if (lineB[i]=dl)or(lineB[i]=dr)or(lineB[i]=dm): nA:=2;
+ ef lineB[i]=tm: nA:=3;
+ ef (lineB[i]=wf)or(lineB[i]=zb)or(lineB[i]=bd): nB:=1;
+ ef (lineB[i]=zf)or(lineB[i]=wb)or(lineB[i]=dt): nB:=6;
+ ef lineB[i]=wv: nB:=4; else: nA:=1; nB:=0; fi
+ printf "M V30 "&decimal(i)&" "&decimal(nA)&" "&decimal(sB[i])&" "&decimal(eB[i]); fi endfor
+ printf "M V30 END BOND";
+ printf "M V30 END CTAB";
+ printf "M END";
+ fi
enddef;
%-------------------------------------------------------------------------------------------------
vardef fit_zero(expr n)=if n<=9: "00" elseif n<=99: "0" fi enddef;