Example #1
0
            public static void GetEnergies(AlignData data1, IList <Vector> coords2
                                           , out double pot_rmsd, out double pot_enrg, out double pot_enrg_full, out double pot_enrg_anisou
                                           , Pdb pdb2           = null
                                           , string pdb2outpath = null
                                           )
            {
                Anisou[] anisous1;// = data1.GetAnisous();
                double[] bfactor1;
                {
                    List <Mode> modes = new List <Mode>(data1.GetModes());
                    for (int i = 0; i < 6; i++)
                    {
                        modes.RemoveAt(0);
                    }
                    bfactor1 = HBioinfo.GetBFactor(modes.ToArray(), data1.masses);
                    HDebug.Assert(data1.size == bfactor1.Length);
                    anisous1 = Anisou.FromBFactor(bfactor1, scale: 10000 * 1000);
                }
                //Trans3 trans = MinAnisou.GetTrans(data1.coords, anisous1, coords2);
                Trans3        trans        = GetTrans(data1.coords, bfactor1, coords2);
                List <Vector> coords2trans = new List <Vector>(trans.GetTransformed(coords2));

                if (pdb2 != null && pdb2outpath != null)
                {
                    data1.pdb.ToFile(pdb2outpath, coords2trans, anisous: anisous1.GetUs());
                }

                pot_rmsd        = data1.GetRmsdFrom(coords2trans);
                pot_enrg        = data1.GetEnergyFromDiag(coords2trans);
                pot_enrg_full   = data1.GetEnergyFromFull(coords2trans);
                pot_enrg_anisou = data1.GetEnergyFromAnisou(coords2trans);
            }
Example #2
0
            public static void GetEnergies(AlignData data1, IList <Vector> coords2
                                           , out double geo_rmsd, out double geo_enrg, out double geo_enrg_full, out double geo_enrg_anisou
                                           , Pdb pdb2, string pdb2outpath
                                           )
            {
                Trans3        trans        = GetTrans(data1.coords, coords2);
                List <Vector> coords2trans = new List <Vector>(trans.GetTransformed(coords2).ToArray());

                if (pdb2 != null && pdb2outpath != null)
                {
                    pdb2.ToFile(pdb2outpath, coords2);
                }

                geo_rmsd        = data1.GetRmsdFrom(coords2trans);
                geo_enrg        = data1.GetEnergyFromDiag(coords2trans);
                geo_enrg_full   = data1.GetEnergyFromFull(coords2trans);
                geo_enrg_anisou = data1.GetEnergyFromAnisou(coords2trans);
            }
Example #3
0
            //public static Trans3 GetTrans(IList<Vector> C1, Matrix[] anisou1, IList<Vector> C2)
            //{
            //    int size = C1.Count;
            //    Tuple<Vector[], double[]>[] eigs1 = new Tuple<Vector[], double[]>[size];
            //    {
            //        for(int i=0; i<size; i++)
            //        {
            //            Vector[] eigvec;
            //            double[] eigval;
            //            Debug.Verify(NumericSolver.Eig(anisou1[i], out eigvec, out eigval));
            //            {   // normalize eigval and eigvec
            //                double l;
            //                l = eigvec[0].Dist; eigvec[0] /= l; eigval[0] *= (l*l); eigval[0] = Math.Pow(eigval[0], 2); Debug.Assert(eigval[0] >= 0);
            //                l = eigvec[1].Dist; eigvec[1] /= l; eigval[1] *= (l*l); eigval[1] = Math.Pow(eigval[1], 2); Debug.Assert(eigval[1] >= 0);
            //                l = eigvec[2].Dist; eigvec[2] /= l; eigval[2] *= (l*l); eigval[2] = Math.Pow(eigval[2], 2); Debug.Assert(eigval[2] >= 0);
            //            }
            //            {
            //                eigval[0] = 1 / eigval[0];
            //                eigval[1] = 1 / eigval[1];
            //                eigval[2] = 1 / eigval[2];
            //            }
            //            eigs1[i] = new Tuple<Vector[], double[]>(eigvec, eigval);
            //        }
            //    }
            //    return GetTrans(C1, eigs1, C2);
            //}

            public static void GetEnergies(AlignData data1, IList <Vector> coords2
                                           , out double pot_rmsd, out double pot_enrg, out double pot_enrg_full, out double pot_enrg_anisou
                                           , Pdb pdb2           = null
                                           , string pdb2outpath = null
                                           )
            {
                Anisou[]      anisous1     = data1.GetAnisous();
                Trans3        trans        = GetTrans(data1.coords, anisous1, coords2);
                List <Vector> coords2trans = new List <Vector>(trans.GetTransformed(coords2));

                if (pdb2 != null && pdb2outpath != null)
                {
                    pdb2.ToFile(pdb2outpath, coords2trans);
                }
                //data1.pdb.ToFile(pdb2outpath, coords2trans, anisous: anisous1.GetUs());

                pot_rmsd        = data1.GetRmsdFrom(coords2trans);
                pot_enrg        = data1.GetEnergyFromDiag(coords2trans);
                pot_enrg_full   = data1.GetEnergyFromFull(coords2trans);
                pot_enrg_anisou = data1.GetEnergyFromAnisou(coords2trans);
            }