public void StartSimulate(float fBeta, int iItera, int iEnergyStep, int iStopStep)
    {
        if (m_bSimulating)
        {
            return;
        }
        m_eSimType    = ESimulateType.Fixed;
        m_iEnergyStep = iEnergyStep;
        m_iStopStep   = iStopStep;
        m_iIter       = iItera;
        m_fBeta       = fBeta;
        CmpShader.SetInt("iIteration", iItera);
        CmpShader.SetFloat("fBeta", fBeta);

        m_bSimulating = true;

        if (0 == m_iStep)
        {
            m_pFloatBuffer = new ComputeBuffer(2, 4);
            m_pFloatBuffer.SetData(new [] { 0.0f, 0.0f });
            CmpShader.SetBuffer(m_iKernelGetEnergyOut, "FloatDataBuffer", m_pFloatBuffer);
            if (-1 != m_iKernelSumUsing)
            {
                CmpShader.Dispatch(m_iKernelSumUsing, m_iSiteNumber[2] / m_iSumDiv, m_iSiteNumber[2] / m_iSumDiv, 1);
            }
            CmpShader.Dispatch(m_iKernelGetEnergyOut, 1, 1, 1);
            m_pFloatBuffer.Release();
        }

        if (null != m_txStartButton)
        {
            m_txStartButton.text = "Pause Simulation";
        }
    }
    public void StartSimulateUsingCycle(Vector2 vBeta, int iTotalStep, int iSkip, int iStable, int iItera)
    {
        if (m_iTargetStep > 1)
        {
            m_bSimulating = true;
            return;
        }

        if (iTotalStep < 2)
        {
            CManager.ShowMessage("Step must be >= 2 !");
            return;
        }
        if (iSkip < 0)
        {
            CManager.ShowMessage("Skip Step must be >= 0 !");
            return;
        }
        if (iStable < 1)
        {
            CManager.ShowMessage("Stable Step must be >= 1 !");
            return;
        }
        m_eSimType    = ESimulateType.Cycle;
        m_iStepNow    = 0;
        m_iTargetStep = iTotalStep;
        m_iSkipStep   = iSkip;
        m_iStableStep = iStable;
        m_iStableTick = 0;
        m_iIter       = iItera;
        CmpShader.SetInt("iIteration", iItera);
        m_v3Beta = new Vector3(vBeta.x, vBeta.y, (vBeta.y - vBeta.x) / iTotalStep);
        m_lstEnergyList.Clear();
        CmpShader.Dispatch(m_iKernelResetEnergyHistory, 1, 1, 1);

        m_pFloatBuffer = new ComputeBuffer(2, 4);
        m_pFloatBuffer.SetData(new [] { 0.0f, 0.0f });
        CmpShader.SetBuffer(m_iKernelGetEnergyOut, "FloatDataBuffer", m_pFloatBuffer);
        if (-1 != m_iKernelSumUsing)
        {
            CmpShader.Dispatch(m_iKernelSumUsing, m_iSiteNumber[2] / m_iSumDiv, m_iSiteNumber[2] / m_iSumDiv, 1);
        }
        CmpShader.Dispatch(m_iKernelGetEnergyOut, 1, 1, 1);
        m_pFloatBuffer.Release();

        m_bSimulating = true;
        if (null != m_txStartButton)
        {
            m_txStartButton.text = "Pause Simulation";
        }
    }