public static float Rmsd(float[,] mol1, float[,] mol2, bool flag) { float rmsd; MultRes res = Optimization.TransMultMatrix(mol1, mol2); Qcp qcp = new Qcp(res.mult, res.val, mol1.GetLength(0)); rmsd = (float)qcp.CalcRmsd(); if (flag) { qcp.CalcRotMatrix(); float[,] rot = new float[3, 3]; /*for (int i = 0; i < 3; i++) * for (int j = 0; j < 3; j++) * rot[i, j] = (float)qcp.rot[i, j];*/ rot[0, 0] = (float)qcp.rot00; rot[0, 1] = (float)qcp.rot01; rot[0, 2] = (float)qcp.rot02; rot[1, 0] = (float)qcp.rot10; rot[1, 1] = (float)qcp.rot11; rot[1, 2] = (float)qcp.rot12; rot[2, 0] = (float)qcp.rot20; rot[2, 1] = (float)qcp.rot21; rot[2, 2] = (float)qcp.rot22; float [,] posMolRot = Optimization.MultMatrixTrans(mol2, rot); // posMolRot = TransMultMatrix(rot,mol2); } return(rmsd); //return MultMatrixTrans(tmp, U); }
public static float [,] TransMatrix(float [,] mol1, float [,] mol2) { MultRes res = Optimization.TransMultMatrix(mol1, mol2); Qcp qcp = new Qcp(res.mult, res.val, mol1.GetLength(0)); if (!qcp.CalcRotMatrix()) { return(null); } float[,] rot = new float[3, 3]; rot[0, 0] = (float)qcp.rot00; rot[0, 1] = (float)qcp.rot01; rot[0, 2] = (float)qcp.rot02; rot[1, 0] = (float)qcp.rot10; rot[1, 1] = (float)qcp.rot11; rot[1, 2] = (float)qcp.rot12; rot[2, 0] = (float)qcp.rot20; rot[2, 1] = (float)qcp.rot21; rot[2, 2] = (float)qcp.rot22; /*for (int i = 0; i < 3; i++) * for (int j = 0; j < 3; j++) * rot[i,j] = (float)qcp.rot[i,j];*/ return(rot); }