Beispiel #1
0
    public void InitialiseStretches(bool suppress = false)
    {
        Connection connection;
        Stretch    stretch;

        Connection[] connections  = connectionsDict.Values.ToArray();
        int          numStretches = connections.Length;

        int[]    stretchAtomNums = new int[numStretches * 2];
        double[] stretchREqs     = new double[numStretches];
        double[] stretchKEqs     = new double[numStretches];

        for (int i = 0; i < numStretches; i++)
        {
            connection = connections[i];
            stretch    = GetStretchParameter(connection);
            if (stretch == null)
            {
                if (!suppress)
                {
                    throw new NoParameterException(typeof(Stretch), connection.atom0, connection.atom1);
                }
                continue;
            }

            stretchREqs[i]             = stretch.req;
            stretchKEqs[i]             = stretch.keq;
            stretchAtomNums[i * 2]     = connection.atom0.index;
            stretchAtomNums[i * 2 + 1] = connection.atom1.index;
        }

        Fortran.set_stretches(ref numStretches, stretchAtomNums, stretchREqs, stretchKEqs);
    }