(* Rotation of general triangle into xy plane with one point, O atom, at 0rigine by translation, one leg on x-axis O - C atoms; example: COH in Vitamine A    ES 8.3.2013 *)
Clear[T1,U,T,P,p];
P=2;
p={{0.8910058089999993`,-1.2609385707599998`,2.215514762399999`},
{-1.3556894324000002`,-1.02001740302`,-0.6789785517999993`}};

(* rotate p1 around x-axis until the z-comp = 0 *)

T1=-ArcTan[p[[1,3]]/p[[1,2]]]

U=p;

T=Table[0,{3},{3}];
T[[1,1]]=1.0;
T[[2,2]]=T[[3,3]]=Cos[T1];
T[[2,3]]=Sin[T1];
T[[3,2]]=-T[[2,3]];
MatrixForm[T]

p=U.T

(* Rotate p1 around z-axis to make y-comp to 0 *)

Clear[T1,T1,U,V,T];
T1=ArcTan[p[[1,2]]/p[[1,1]]]

U=p;

T=Table[0,{3},{3}];
T[[1,1]]=T[[2,2]]=Cos[T1];
T[[1,2]]=-Sin[T1];
T[[2,1]]=-T[[1,2]];
T[[3,3]]=1;
MatrixForm[T]

p=U.T

(* rotate p2 around x-axis to make z-comp = 0 *)

Clear[T1,T1,U,V,T];
T1=-ArcTan[p[[2,3]]/p[[2,2]]]

U=p;

T=Table[0,{3},{3}];
T[[1,1]]=1.0;
T[[2,2]]=T[[3,3]]=Cos[T1];
T[[2,3]]=Sin[T1];
T[[3,2]]=-T[[2,3]];
MatrixForm[T]

p=U.T

c1=20; c2=21; c3=51;
v2={0,0,0};
u2={0.2557`,0.255`,0.255`,0.2557`,0.255`,0.2557`,0.2547`,0.2547`,0.2557`,0.2547`,0.2557`,0.2557`,0.2547`,0.2557`,0.2557`,0.2557`,0.2557`,0.2547`,0.2557`,0.255`,0.178`,0.5693`,0.5693`,0.5693`,0.5693`,0.5693`,0.5693`,0.5693`,0.5693`,0.5693`,0.5693`,0.5693`,0.5693`,0.5693`,0.5693`,0.5693`,0.5693`,0.5693`,0.5693`,0.5693`,0.5693`,0.5693`,0.5693`,0.5693`,0.5693`,0.5693`,0.5693`,0.5693`,0.5693`,0.5693`,0.5241`};
Plota = Graphics3D[{Opacity[0.5],Sphere[p[[1]],u2[[c1]]],Sphere[p[[2]],u2[[c3]]],Sphere[v2,u2[[c2]]]}];
Plotc=Graphics3D[{Tube[{p[[1]],v2},0.02],Tube[{p[[1]],p[[2]]},0.02],Tube[{p[[2]],v2},0.02]}];

Plotb0=Graphics3D[Text[c3,p[[2]],{1,0}]];
Plotb1=Graphics3D[Text[c1,p[[1]],{1,0}]];
Plotb2=Graphics3D[Text[c2,{0,0,0},{1,0}]];
Show[Plota,Plotb0,Plotb1,Plotb2,Plotc,{Axes->Automatic,AxesLabel->{xl,yl,zl},AspectRatio->Automatic,Boxed->False,PlotRange->Automatic, SphericalRegion->True}]

(* now add O lone pairs perpendicular to COH plane and retransform into molecular skeleton *)