(* Fe+++ ion  + 6 Cl- in Oh 02.02.12/15.07.2013 *)
Clear[k1,k2,k3,k4,k5,k6,sig1,sig2,sig3,sig4,sig5,c,z,R1,R2,R3,R4,R5,R6,R7,S5,S6,S2,S3,S4];
c = {k1 -> 0.98, k2 -> 0.98, k3 -> 1.15, k4 -> 2.6, k5 -> 0.98, k6 -> 1.05, k7-> 6.5 ,sig1 -> 0.3, 
sig2 -> 0.302, sig3 -> 0.302, sig4 -> 0.302, sig5 -> 0.302, sig6 -> 0.302}; z=26.; z1=17.0;

(* Fe He+Ne shell *)
T = 2.25*k1/R1^2+9.*k2/R2^2 /. c;
ad = Sqrt[3./8.]; sq2=Sqrt[2];
Vee=3.0*sig1/R1+12.*sig2/R2+16/(R1+R2)+24*ad/(R1+R2) /. c;
Vne=-3.0*z/R1-8.*z/(R1+R2);
S2 = R2*4^(1/3);

(* Fe Ar shell *)
T = T + 9.*k3/R3^2 /. c;
Vee = Vee+12.*sig3/R3+80./(S2+R3)+24.*ad/(S2+R3) /. c;
Vne = Vne-8.45*z/(S2+R3);
S3 = R3*4^(1/3);

(* Fe+++ shell octahedron, full with 5/6 charge each*)
T = T + (5.*9./8)*k4/R4^2 /. c;
Vee = Vee+(90.+12*(5/6)^2/sq2+1.5*(5/6)^2)/(S3+R4) /. c;
Vne = Vne - 6.0*z/(S3+R4) /. c;
S4 = R4*6^(1/3);

(* Cl- He+Ne shell *)
Tf = 2.25*k5/R5^2+9.*k6/R6^2 /. c;
Veef=3.0*sig5/R5+12*sig2/R6+16/(R5+R6)+24*ad/(R5+R6) /. c;
Vnef=-3.0*z1/R5-7.5*z1/(R5+R6) /. c;
S5 = R6*1.587401052 /. c;

(* Cl- Ar shell *)
Tf = Tf + 9.*k7/R7^2 /. c;
Veef = Veef+12.*sig6/R7+80/(S5+R7)+24.*ad/(S5+R7) /. c;
Vnef = Vnef-8.45*z/(S5+R7) /. c;
S6 = R7*1.587401052 /. c;

T=T+6*Tf;
Vee=Vee+6*Veef;
Vne=Vne+6*Vnef;

(* Fe+++/6 Cl- *)
Vnn = (6*z*z1 + 12*z1*z1/sq2+1.5*z1*z1)/(S6+S4);
Vee = Vee+(6*23*18 + 12*18*18/sq2 + 1.5*18*18)/(S6+S4);
Vne = Vne -(6*z*18+6*z1*23+24*z1*18/sq2+3*z1*18)/(S6+S4);

func = T + Vnn + Vne + Vee;

t = FindMinimum[func, {R1,0.05052}, {R2,0.16}, {R3,0.4178}, {R4,1.171},
    {R5,0.0812},{R6,0.30885},{R7,1.65},{Method -> "Newton"}, {MaxIterations -> 500}]

N[Vne /. c /. t[[2]],10]
N[Vnn /. c /. t[[2]],10]
N[Vee /. c /. t[[2]],10]
N[-(Vee+Vne+Vnn)/T /. c /. t[[2]],10]
N[(S2+R3) /. c /. t[[2]],10]
N[(S3+R4) /. c /. t[[2]],10]
N[(S4) /. c /. t[[2]],10]
d = S4+S6 /. c /. t[[2]]
N[0.529177*(S4+S6) /. c /. t[[2]],10]

(* xy plane *)
plot2=Graphics[{Circle[{0,0},R1],
      Circle[{0,0},S2],Circle[{0,0},S3],
      Circle[{0,0},S4],Circle[{d,0},R5],
      Circle[{d,0},S5],Circle[{d,0},S6],
      Circle[{-d,0},R5],
      Circle[{-d,0},S5],Circle[{-d,0},S6],
      Circle[{0,d},R5],
      Circle[{0,d},S5],Circle[{0,d},S6],Circle[{0,-d},R5],
      Circle[{0,-d},S5],Circle[{0,-d},S6]
    (*  Disk[{x[[3]],y[[3]]},0.08], Disk[{x[[8]],y[[8]]},0.08], 
      Disk[{x[[13]],y[[13]]},0.08], Disk[{x[[18]],y[[18]]},0.08], 
      Disk[{0,0},0.08], {Thickness[0.006],
        Line[{{0,0},{S4+S6,0}}],
        Line[{{0,0},{-S4-S6,0}}] }*)} ] /. t[[2]] /. c;

Show[plot2,{AspectRatio -> Automatic,Axes -> True,
    GridLines -> Automatic, PlotRange -> {{-8,8},{-8,8}}, 
    Frame -> True}]