arcdist[ra1_,ra1m_,ra1s_,dec1_,dec1m_,dec1s_,ra2_,ra2m_,ra2s_,dec2_,dec2m_,dec2s_]:=Module[{tra1,tdec1,tra2,tdec2},
tra1=(Pi/12)(ra1+ra1m/60+ra1s/3600);
tdec1=(Pi/180)(dec1+dec1m/60+dec1s/3600);
tra2=(Pi/12)(ra2+ra2m/60+ra2s/3600);
tdec2=(Pi/180)(dec2+dec2m/60+dec2s/3600);
N[ArcCos[Sin[tdec1] Sin[tdec2] + Cos[tdec1] Cos[tdec2] Cos[tra2-tra1]] (180/Pi)]]
angle[ra1_,ra1m_,ra1s_,dec1_,dec1m_,dec1s_,ra2_,ra2m_,ra2s_,dec2_,dec2m_,dec2s_,ra3_,ra3m_,ra3s_,dec3_,dec3m_,dec3s_]:=Module[{a,b,c},
a=(Pi/180) arcdist[ra1,ra1m,ra1s,dec1,dec1m,dec1s,ra2,ra2m,ra2s,dec2,dec2m,dec2s];
b=(Pi/180) arcdist[ra3,ra3m,ra3s,dec3,dec3m,dec3s,ra2,ra2m,ra2s,dec2,dec2m,dec2s];
c=(Pi/180) arcdist[ra1,ra1m,ra1s,dec1,dec1m,dec1s,ra3,ra3m,ra3s,dec3,dec3m,dec3s];
N[ArcCos[(Cos[c]-Cos[a] Cos[b])/(Sin[a] Sin[b])] (180/Pi)]]

(* for h.mmss data entry *)
arcdist2[ra1_,dec1_,ra2_,dec2_]:=Module[{tra1,tdec1,tra2,tdec2,x},
hmmss[x_]=IntegerPart[x]+IntegerPart[100*(x-IntegerPart[x])]/60+(Mod[100*x,1]+If[x<0,-1,0])/36;
tra1=(Pi/12) hmmss[ra1];
tdec1=(Pi/180) hmmss[dec1];
tra2=(Pi/12) hmmss[ra2];
tdec2=(Pi/180) hmmss[dec2];
N[ArcCos[Sin[tdec1] Sin[tdec2] + Cos[tdec1] Cos[tdec2] Cos[tra2-tra1]] (180/Pi)]]

angle2[ra1_,dec1_,ra2_,dec2_,ra3_,dec3_]:=Module[{a,b,c},
a=(Pi/180) arcdist2[ra1,dec1,ra2,dec2];
b=(Pi/180) arcdist2[ra3,dec3,ra2,dec2];
c=(Pi/180) arcdist2[ra1,dec1,ra3,dec3];
N[ArcCos[(Cos[c]-Cos[a] Cos[b])/(Sin[a] Sin[b])] (180/Pi)]]
