示例#1
0
            public virtual void Compute(Universe.Improper improper, Vector[] coords, ref double energy, ref Vector[] forces, ref MatrixByArr[,] hessian, double[,] pwfrc = null, double[,] pwspr = null)
            {
                double Kchi  = improper.Kpsi;
                int    n     = improper.n;
                double delta = improper.psi0;

                Compute(coords, ref energy, ref forces, ref hessian, Kchi, n, delta, pwfrc, pwspr);
            }
示例#2
0
            public void Compute(Universe.Improper improper, Vector[] coords, ref double energy, ref Vector[] forces, ref MatrixByArr[,] hessian, double[,] pwfrc = null, double[,] pwspr = null)
            {
                double Kchi = improper.Kpsi;

                Kchi = sprcstRgdbdy;
                Kchi = improper.Kpsi * scaleSpring;
                int    n     = improper.n;
                double delta = improper.psi0;

                MindyImproper.Compute(coords, ref energy, ref forces, ref hessian, Kchi, n, delta, pwfrc, pwspr);
            }
示例#3
0
            public void BuildHess4PwIntrAct(Universe.AtomPack info, Vector[] coords, out Pair <int, int>[] pwidxs, out PwIntrActInfo[] pwhessinfos)
            {
                Universe.Improper improper = (Universe.Improper)info;
                double            Kchi     = improper.Kpsi;
                int    n     = improper.n;
                double delta = improper.psi0;

                //Vector pos1 = coords[0];  // const Vector *pos1 = coords + angle->atom1;
                //Vector pos2 = coords[1];  // const Vector *pos2 = coords + angle->atom2;
                //Vector pos3 = coords[2];  // const Vector *pos3 = coords + angle->atom3;
                //double a = (pos2-pos1).Dist;
                //double b = (pos3-pos2).Dist;
                //double c = (pos3-pos1).Dist;
                //Pair<double,double> fij_kij = GetFijKij(a, b, c, Ktheta, Theta0);
                //double fij = fij_kij.first;
                //double kij = fij_kij.second;

                ///           A
                ///          /        B
                ///    a .../. c    /
                ///     \  /  / \ /
                ///      \   /  /\
                ///       \ / /   \
                ///        b ..... d
                ///
                ///   a
                ///   |\                    /
                ///   | \                 /T
                ///   |  \  ----- A ----+----
                ///   |   \           /
                ///   |    \        B
                ///   p     l     /
                ///   | \    \ /
                ///   |T  \   \
                ///   |     \  \
                ///           \ \
                ///             \\
                ///               d
                ///
                /// A = (b-a) x (c-b)
                /// B = (c-b) x (d-c)
                /// (A x B) ⊥ (Δ adp)
                /// p ∈ bc
                /// T + ∠apd = π
                ///
                /// V                   =   K0 (T - T0)^2
                /// F =           dV/dT = 2 K0 (T - T0)
                /// K = (d^2 V)/(d T^2) = 2 K0
                /// return {  dV/dl,  (d^2 V)/(d l^2)  }

                Vector a   = coords[0];
                Vector b   = coords[1];
                Vector c   = coords[2];
                Vector d   = coords[3];
                Vector A   = LinAlg.CrossProd(a - b, b - c);
                Vector B   = LinAlg.CrossProd(b - c, c - d);
                Vector AxB = LinAlg.CrossProd(A, B);
                double ad  = (a - d).Dist;
                Vector p   = Geometry.Point4LinePlaneIntersect(a, d, a + A, b, c);
                double ap  = (a - p).Dist;
                double pd  = (p - d).Dist;

                ValueTuple <double, double> fij_kij = MindyAngle.GetFijKij(ap, pd, ad, Kchi, delta, -1, +1, -1);
                double fij = fij_kij.Item1;
                double kij = fij_kij.Item2;

                HDebug.Assert(coords.Length == 4);
                pwidxs         = new Pair <int, int> [1];
                pwidxs[0]      = new Pair <int, int>(0, 3);
                pwhessinfos    = new PwIntrActInfo[1];
                pwhessinfos[0] = new PwIntrActInfo(kij, fij);
            }