(* ::Package:: *) PICNtrans::usage = "PICNtrans does not transform the whole molecular skeleton into a plane and is thus suited for molecules with triple bonds in arbitrary orientations: -CC-, -CN, NN. Input: Table t of the atomic coordinates, connection table connc of triple bonded atoms with the target atom at first position, cnj its length, rpo, rpi the radii of the \[Pi] clouds above and below their plane. If different atoms, then rpno={a,b,c,...}, rpni={a,b,c,...}. The tables tpno, tpnu, tpnv, tpnw contain the coordinates of the 4 half filled \[Pi] clouds each of the triple bonded atoms on exit. For an example see EthylCyanoacetate.nb" P=3; c={0,0,0,0,0}; k=1; Do[(c = connc[[k]]; (* Target 1 *) v = Table[Join[t[[c[[i]]]], {1}], {i, 1, P}]; x2 = t[[c[[2]],1]]; y2 = t[[c[[2]],2]]; z2 = t[[c[[2]],3]]; Q = {{1, 0, 0, 0}, {0, 1, 0, 0}, {0, 0, 1, 0}, {-x2, -y2, -z2, 1}}; p = v.Q; p = Table[Take[p[[i]], 3], {i, 1, P}]; T1 = ArcTan[p[[1,3]]/p[[1,2]]]; U = p; T = RotationMatrix[T1, {1, 0, 0}]; p = U.T; T2 = ArcTan[p[[1,2]]/p[[1,1]]]; U = p; T = RotationMatrix[T2, {0, 0, 1}]; p = U.T; T3 = ArcTan[p[[3,3]]/p[[3,2]]]; U = p; T = RotationMatrix[T3, {1, 0, 0}]; p = U.T; mk = ml = mm = mn = p; mk[[1,3]] = rpno[[k]]; ml[[1,3]] = -rpni[[k]]; mm[[1,2]] = rpno[[k]]; mn[[1,2]] = -rpni[[k]]; U = p; U1 = mk; U2 = ml; U3 = mm; U4 = mn; T = RotationMatrix[-T3, {1, 0, 0}]; p = U.T; mk = U1.T; ml = U2.T; mm = U3.T; mn = U4.T; U = p; U1 = mk; U2 = ml; U3 = mm; U4 = mn; T = RotationMatrix[-T2, {0, 0, 1}]; p = U.T; mk = U1.T; ml = U2.T; mm = U3.T; mn = U4.T; U = p; U1 = mk; U2 = ml; U3 = mm; U4 = mn; T = RotationMatrix[-T1, {1, 0, 0}]; p = U.T; mk = U1.T; ml = U2.T; mm = U3.T; mn = U4.T; Clear[v, v1, v2,v3,v4]; v = Table[Join[p[[i]], {1}], {i, 1, P}]; v1 = Table[Join[mk[[i]], {1}], {i, 1, P}]; v2 = Table[Join[ml[[i]], {1}], {i, 1, P}]; v3 = Table[Join[mm[[i]], {1}], {i, 1, P}]; v4 = Table[Join[mn[[i]], {1}], {i, 1, P}]; Q = {{1, 0, 0, 0}, {0, 1, 0, 0}, {0, 0, 1, 0}, {x2, y2, z2, 1}}; p = v.Q; mk = v1.Q; ml = v2.Q; mm = v3.Q; mn = v4.Q; p = Table[Take[p[[i]], 3], {i, 1, P}]; mk = Table[Take[mk[[i]], 3], {i, 1, P}]; ml = Table[Take[ml[[i]], 3], {i, 1, P}]; mm = Table[Take[mm[[i]], 3], {i, 1, P}]; mn = Table[Take[mn[[i]], 3], {i, 1, P}]; tpno[[k]] = mk[[1]]; tpnu[[k]] = ml[[1]]; tpnv[[k]] = mm[[1]]; tpnw[[k]] = mn[[1]]), {k, cnj}];