Beispiel #1
0
        private void StartField()
        {
            chart1.Invoke(new MethodInvoker(delegate() { chart1.Series[0].Points.Clear(); }));
            chart2.Invoke(new MethodInvoker(delegate() { chart2.Series[0].Points.Clear(); }));
            //       chart1.Series[0].Points.Clear(); chart2.Series[0].Points.Clear();

            CloseMe = false;
            DateTime T1;
            int Ns = Convert.ToInt32(tbNs.Text); int Nt = Convert.ToInt32(tbNt.Text);

            SU3 Field = new SU3(Ns,Nt, Convert.ToDouble(tbBeta.Text),Convert.ToDouble(tbflux.Text), checkBox1.Checked);
            for (int i = 0; i < 100000; i++)
            {
                T1 = DateTime.Now;

                //for (int or = 0; or < 5; or++) Field.Sweep(false); //SU(2) ONLY!!!
                this.Text = Field.Sweep(false).ToString();

                chart1.Invoke(new MethodInvoker(delegate() { chart1.Series[0].Points.AddY(Field.MeasureS()); }));
                chart2.Invoke(new MethodInvoker(delegate() { chart2.Series[0].Points.AddY(Field.MeasurePL()); }));

                lblTime1.Invoke(new MethodInvoker(delegate() { lblTime1.Text = Math.Round((DateTime.Now - T1).TotalMilliseconds).ToString() ; }));
                if (CloseMe) break;

               // if (cbDraw.Checked) DrawPicture(Field);

                Application.DoEvents();
            }
            CloseMe = false;
        }
Beispiel #2
0
        private void GetSample()
        {
            double Beta = Convert.ToDouble(tbBeta.Text);
            int Ns = Convert.ToInt32(tbNs.Text);
            int Nt = Convert.ToInt32(tbNt.Text);

            int Tsteps = Convert.ToInt32(tbTsteps.Text);
            int Msteps = Convert.ToInt32(tbMsteps.Text);

              //  double[] Sample = new double[N];

            SU3 Field = new SU3(Ns, Nt, Beta, Convert.ToDouble(tbflux.Text),checkBox1.Checked);
            double sum = 0, sum2 = 0, t = 0;
            int n = 0;
            int Mark = Convert.ToInt32(tbMark.Text);

            InvokeMe(() => lblProcess.Text = "Thermalizing");
            for (int i = 0; i < Tsteps; i++) { Field.Sweep(false); lblProcess.Invoke(new MethodInvoker(delegate() { lblProcess.Text = "Thermalizing " + i.ToString(); })); }
            while (true)
            {
                Field.Sweep(false); Field.Sweep(false); //Field.Sweep(false); Field.Sweep(false);
                t = Field.MeasureS();
               // Sample[n] = t;
                n++;
                sum += t; sum2 += t * t;
                InvokeMe(() => lblProcess.Text = "Measuring " + n.ToString());
                //
                if (n % Mark == 0)
                {
                    InvokeMe(() => chart2.Series[0].Points.AddY(sum / n));
                    InvokeMe(() => lblValue.Text = (sum / n).ToString());

                }
            }

            sum = sum / n;

            //finding error
            /*double sigma2=0, Sn=0, Ssample=0;
            for (int i=0;i<N;i++)
            {
                Sn = 1 / (N - 1.0) * (N*sum - Sample[i]);
                Ssample += Sn;
                sigma2 += (Sn - sum) * (Sn - sum);
                chart2.Invoke(new MethodInvoker(delegate() { chart2.Series[0].Points.AddY(Sample[i]); }));
            }
            Ssample = Ssample / N;
            sigma2 = Math.Sqrt((N-1.0)/N*sigma2);
            Ssample = sum - (N - 1f) * (Ssample - sum);
            */

            //   int k = 10;
            //   int d = N / k; sum2 = 0;
            //   for (int i = 0; i < d; i++)
            //   {
            //       sum = 0;
            //       for (int j = 0; j < k; j++) sum += Sample[i * k + j];
            //       sum /= k;
            //       chart2.Invoke(new MethodInvoker(delegate() { chart2.Series[1].Points.AddY(sum); }));
            //       sum2 = (sum2 * i + sum) / ((i + 1));
            //       chart2.Invoke(new MethodInvoker(delegate() { chart2.Series[0].Points.AddY(sum2); }));

            //   }

            // lblSampleValue.Invoke(new MethodInvoker(delegate() { lblSampleValue.Text = Ssample.ToString(); }));
            //    lblSampleError.Invoke(new MethodInvoker(delegate() { lblSampleError.Text = sigma2.ToString(); }));

            //average and dispersion
            sum2 = Math.Sqrt(sum2 / n - sum * sum);

            InvokeMe(() => lblValue.Text = sum.ToString());
            InvokeMe(() => lblError.Text = sum2.ToString());
        }
Beispiel #3
0
        private void button10_Click(object sender, EventArgs e)
        {
            double beta = 10;
            SU3 Field = new SU3(int.Parse(tbNs.Text), int.Parse(tbNt.Text), beta, 0, true);//4х2 field beta=6 flux=0
            for (int i = 0; i < 10; i++) Field.Sweep(false);
            Dirac Dt = new Dirac(Field);
            Complex res = Complex.Zero;

            for (int n = 0; n < Dirac.N; n++)
                for (byte alpha = 0; alpha < 4; alpha++)
                    for (byte a = 0; a < 3; a++)
                    {
                        DateTime t = DateTime.Now;
                        Dirac D = new Dirac(Field);

                        D.phi[n, alpha, a] = Complex.One;
                        //double philen = Dirac.V1hermV2(D.phi, D.phi).Module();

                        D.Prepare();
                        for (int i = 0; i < 5; i++)
                        {
                            D.Iter();
                            //Vector phinew = D.MulD(D.x);
                            //double r = 0;// D.V1hermV2(phinew, phinew).Module(); //D.V1hermV2(D.ri, D.ri).Module();
                            //Text = "i = " + i.ToString() + "    philen=" + philen.ToString() + "  =?  " + r.ToString() + "     " + (DateTime.Now - t).ToString();
                            //t = DateTime.Now;
                        }
                        res += D.x[n, alpha, a];
                        Text = n.ToString() + " " + (res / new Complex((n + 1) * 12, 0)).ToString();
                        Application.DoEvents();
                        if (CloseMe) break;
                    }
            Text = (res / new Complex(Dirac.N, 0)).ToString();

            //for (int exp = 0; exp < 1; exp++)
            //{
            //    double beta = 6;// 1 + 10 * exp;
            //    SU3 Field = new SU3(4, 2, beta, 0, true);//4х2 field beta=6 flux=0
            //    for (int i = 0; i < 10; i++) Field.Sweep(false);

            //    DateTime t = DateTime.Now;

            //    int K = 100;
            //    Vector[] chi = new Vector[K];
            //    Complex tr = new Complex();
            //    for (int k = 0; k < K; k++)
            //    {
            //        Dirac D = new Dirac(Field);
            //        chi[k] = new Vector(Dirac.N, rand.Next());
            //        chi[k].FillGaussRandom();
            //        D.phi = chi[k];
            //        //double philen = Dirac.V1hermV2(D.phi, D.phi).Module();
            //        D.Prepare();
            //        for (int i = 0; i < 4; i++)
            //        {
            //            D.Iter();
            //            //Vector v = D.MulD(D.x);
            //            //Text = Dirac.V1hermV2(D.ri, D.ri).ToString();//"Dx = " + Dirac.V1hermV2(v, v).Module() + "   phi = " + philen.ToString();
            //            //Application.DoEvents();
            //        }
            //        tr += Dirac.V1hermV2(D.phi, D.x);
            //        Text = beta.ToString() + " " + k.ToString();

            //        Application.DoEvents();
            //    }

            //    tr *= new Complex(1 / (double)K / (4 * 4 * 4 * 2 * 12 * 2), 0);
            //    Text = tr.ToString();
            //    chart1.Series[0].Points.AddXY(beta, tr.x);

            //}
        }
Beispiel #4
0
        private void GetData()
        {
            var l = new List<int>(new int[]{1,2,3});
            //l.Where(

            DateTime T, Tfull; double Chi = 0;
            double BetaStart = Convert.ToDouble(tbBS.Text);
            double BetaEnd = Convert.ToDouble(tbBE.Text);
            double BetaStep = Convert.ToDouble(tbBSt.Text);

            int Tsteps = Convert.ToInt16(tbTsteps.Text);
            int Msteps = Convert.ToInt16(tbMsteps.Text);
            for (double b = BetaStart; b <= BetaEnd; b = b + BetaStep)
            {
                SU3 Field = new SU3(Convert.ToInt32(tbNs.Text), Convert.ToInt32(tbNt.Text), b,Convert.ToDouble(tbflux.Text), checkBox1.Checked);
                double PL = 0, PL2 = 0, PLt; Chi = 0;
                int n = 0;
                Tfull = DateTime.Now;
                InvokeMe(() => Text = "1");
                InvokeMe(() => lblProcess.Text = "Thermalizing");
                for (int i = 0; i < Tsteps; i++)
                {
                    //T = DateTime.Now;
                    Field.Sweep(false);
                    InvokeMe(() => lblProcess.Text = "Thermalizing " + i.ToString());
                   // lblTime1.Invoke(new MethodInvoker(delegate() { lblTime1.Text = (DateTime.Now - T).TotalMilliseconds.ToString(); }));
                }

                //chart2.Invoke(new MethodInvoker(delegate() { chart2.Series[0].Points.AddXY(b, 0); }));
                for (int i = 0; i < Msteps; i++)
                {

                    Field.Sweep(false);
                    //  for (int or = 0; or < 5; or++) Field.Sweep(false);
                    if (rbS.Checked) PLt = Field.MeasureS(); else PLt = Field.MeasurePL();
                    PL += PLt; n++;
                   PL2 += PLt * PLt;

                    Chi = PL2 / n - (PL / n) * (PL / n);
                   // chart2.Invoke(new MethodInvoker(delegate() { chart2.Series[0].Points.Last().YValues = new double[1] { Chi }; }));
                    InvokeMe(() => chart1.Series[0].Points.Add(Chi));
                    InvokeMe(() => chart2.Series[0].Points.Add(PLt));
                    InvokeMe(() => lblProcess.Text = "Measuring " + i.ToString());

                }

               // Chi = PL2 / n - (PL / n) * (PL / n);
               // chart2.Invoke(new MethodInvoker(delegate() { chart2.Series[0].Points.Last().YValues = new double[1] { Chi }; }));

              //  chart2.Invoke(new MethodInvoker(delegate() { chart2.Series[0].Points.AddXY(b, PL/n); }));
                double t = (DateTime.Now - Tfull).TotalMilliseconds * (BetaEnd - b) / BetaStep;
                InvokeMe(() => lblRemain.Text = (DateTime.Now.AddMilliseconds(t)).ToString());
                InvokeMe(() => chart2.Update());

            }
        }
Beispiel #5
0
        private void button14_Click(object sender, EventArgs e)
        {
            double beta = 6;
            SU3 Field = new SU3(int.Parse(tbNs.Text), int.Parse(tbNt.Text), beta, 0, true);//4х2 field beta=6 flux=0
            DateTime t = DateTime.Now;
            for (int i = 0; i < 4; i++)
            {
                Field.Sweep(false);
                MessageBox.Show(Field.MeasureS().ToString());

                Text = (DateTime.Now - t).TotalMilliseconds.ToString(); Application.DoEvents();
            }
        }