Example #1
0
        public static Anisou[] FromCoords(List <Vector[]> ensemble, Vector[] meanconf = null, double eigvalthres = double.NegativeInfinity)
        {
            int size = ensemble[0].Length;

            Anisou[] anisous = new Anisou[size];

            HDebug.AssertNotNull(ensemble);
            System.Threading.Tasks.Parallel.For(0, size, delegate(int ai)
                                                //for(int ai=0; ai<size; ai++)
            {
                Vector mean     = meanconf[ai];
                MatrixByArr cov = new double[3, 3];
                {
                    for (int ei = 0; ei < ensemble.Count; ei++)
                    {
                        Vector vec = ensemble[ei][ai] - mean;
                        cov       += LinAlg.VVt(vec, vec);
                    }
                }
                anisous[ai] = Anisou.FromMatrix(cov, eigvalthres: eigvalthres);
            }
                                                );

            return(anisous);
        }
Example #2
0
            public static void DetermineMeanConf(List <Vector>[] ensemble, Vector[] meanconf)
            {
                int size = ensemble[0].Count;

                HDebug.AssertNotNull(ensemble);
                System.Threading.Tasks.Parallel.For(0, size, delegate(int ai)
                                                    //for(int i=0; i<size; i++)
                {
                    Vector mean = new double[3];
                    {   // mean coord of atom i
                        for (int ei = 0; ei < ensemble.Length; ei++)
                        {
                            mean += ensemble[ei][ai];
                        }
                        mean /= ensemble.Length;
                    }
                    meanconf[ai] = mean;
                }
                                                    );
            }