Example #1
0
        static double calka1(Func <double, double, double, double> func, double a, double b, double y, double t) // bierze jako zmienna funkcje
        {
            //nowa klasa zmiennych
            Zmienne zm = new Zmienne();

            //wartosci hi i fi
            double[] hi1 = new double[5]; double[] fi1 = new double[5];
            for (int zmienna1 = 0; zmienna1 < 5; zmienna1++)
            {
                hi1[zmienna1] = hi(zmienna1);
                fi1[zmienna1] = fi(zmienna1);
            }

            double nn = 1000; double cal = 0.0; double z; int n = 1; int i = 0; double x;

            z = (b - a) / 2.0;
            do
            {
                do
                {
                    x   = a + (2.0 * n - 1.0 + fi1[i]) * z / nn;
                    cal = cal + hi1[i] * func(x, y, t);
                    i++;
                }while (i < 5);
                n++;
                i = 0;
            }while (n < nn + 1);
            double calka1 = z * cal / nn;

            return(calka1);
        }
Example #2
0
        static double cfermiso(double y, double z)
        {
            //nowa klasa zmiennych
            Zmienne zm = new Zmienne();

            double cfermiso = calka1(fermiso, zm.p0, zm.p1, y, z);

            return(cfermiso);
        }
Example #3
0
        static double csinglet(double y, double z)
        {
            //nowa klasa zmiennych
            Zmienne zm = new Zmienne();

            double csinglet = calka1(singlet, zm.p0, zm.p1, y, z);

            return(csinglet);
        }
Example #4
0
        static double g(double x, double y)
        {
            //nowa klasa zmiennych
            Zmienne zm = new Zmienne();

            double g1 = zm.g0.Real;
            double g;

            g = g1 * Math.Sqrt(Math.Sin(x) * Math.Sin(x) + Math.Sin(y) * Math.Sin(y));
            return(g);
        }
Example #5
0
        static double en(double x, double y)
        {
            //nowa klasa zmiennych
            Zmienne zm = new Zmienne();

            double en;

            en = -2.0 * (Math.Cos(x) + Math.Cos(y));
            //en = -2.0 * (Math.Cos(x) + Math.Cos(y)) + 4.0 * zm.band * Math.Cos(x) * Math.Cos(y);
            return(en);
        }
Example #6
0
        static double occupancy(double z)
        {
            //nowa klasa zmiennych
            Zmienne zm = new Zmienne();

            double o = calka2(cfermiso, zm.p0, zm.p1, z);

            o = 4.0 * o / Math.Abs(zm.p2 * zm.p2);
            double occupancy = zm.bandfilling - o;

            return(occupancy);
        }
Example #7
0
        //gap
        static double gap(double z)
        {
            //nowa klasa zmiennych
            Zmienne zm = new Zmienne();

            double o = calka2(csinglet, zm.p0, zm.p1, z);

            o = 4.0 * zm.pair * o / Math.Abs(zm.p2 * zm.p2);
            double gap = 1.0 - o;

            return(gap);
        }
Example #8
0
        static double fermiso(double x, double y, double z)
        {
            //nowa klasa zmiennych
            Zmienne zm = new Zmienne();

            double x1      = en(x, y) - z;
            double x2      = g(x, y);
            double y1      = (x1 + x2) / zm.temp.Real;
            double y2      = (x1 - x2) / zm.temp.Real;
            double f1      = fermi(y1);
            double f2      = fermi(y2);
            double fermiso = f1 + f2;

            return(fermiso);
        }
Example #9
0
        static double singlet(double x, double y, double z)
        {
            //nowa klasa zmiennych
            Zmienne zm = new Zmienne();

            double dda = 1.0E-06; double s1; double yt; double s2;
            double e1 = e(x, y);
            double e2 = e1 * e1;
            double x1 = en(x, y) - zm.chem.Real;
            double x2 = g(x, y);
            double y1 = x1 + x2;
            double y2 = x1 - x2;
            double t2 = 2.0 * z;

            if (Math.Abs(y1) < dda)
            {
                s1 = 1.0 / (2.0 * t2);
            }
            else
            {
                yt = y1 / t2;
                s1 = th(yt) / (2.0 * y1);
            }
            if (Math.Abs(y2) < dda)
            {
                s2 = 1.0 / (2.0 * t2);
            }
            else
            {
                yt = y2 / t2;
                s2 = th(yt) / (2.0 * y2);
            }
            double singlet = e2 * (s1 + s2);

            return(singlet);
        }
Example #10
0
        static void Main(string[] args)
        {
            //inicjalizacja nowej klasy zmiennych
            Zmienne a = new Zmienne();

            double st = 0.002; int nstep = 20; double dd = 1.0E-06; double zdd = 1.0E-06; double dr = 0.001; // parametry
            //Complex temp; Complex chem; double pair; Complex g0; double band; double bandfilling; double p0; double p1; double p2; //zmienne
            double gap; int occupancy;

            /*  gap is the singlet Tc equation,
             *      e(x,y) is the singlet order parameter function,
             *      en(x,y) is the dispersion function,
             *      g(x,y) is the spin-orbit coupling function absolute value,
             *      g0 is the spin-orbit coupling rate,
             *  temp=Tc, must take temp>0,
             *  pair is the pair potential,
             *      bandfilling is the band filling,
             *      chem is the chemical potential,
             *      band=t2/temp is the ratio of the next nearest and the nearest-neighbor hopping terms.*/

            double pi = Math.Acos(-1.0);

            a.p0 = 0.0;
            a.p1 = pi;
            a.p2 = 2.0 * pi;

            a.pair = 1.0; a.g0 = 0.0; a.bandfilling = 1.2;                            // przypisywanie wartosci startowych
            double xt = 1.0E-06; double yt = 2.01; double xc = 0.0; double yc = 10.0; // jakies zmienne xy

            //szukanie miejsc zerowych
            Complex chp = 0.0;

            a.chem = chp;
            a.temp = zbrent(Program.gap, xt, yt, zdd);
            a.chem = zbrent(Program.occupancy, xc, yc, zdd);

            while (Math.Abs(a.chem.Real - chp.Real) > dd) //petla na szukanie miejsc zerowych
            {
                chp    = a.chem.Real;
                a.temp = zbrent(Program.gap, xt, yt, zdd);
                a.chem = zbrent(Program.occupancy, xc, yc, zdd);
            }

            chp = a.chem;
            Complex t0 = a.temp;
            double  o0 = a.g0.Real;
            double  o1 = (a.temp / t0).Real;
            double  o2 = a.temp.Real;
            double  o3 = a.chem.Real;

            //zapis do pliku
            string zapis = o0 + "\t" + o1 + "\t" + o2 + "\t" + o3;
            //petla na znalezienie nieuzywanej nazwy pliku
            String lokacjadanych = "";
            int    numerdanych   = 0;

            for (int l = 0; l < 1000; l++)
            {
                String nazwadanych = @"Dane" + l + ".txt";
                if (!File.Exists(nazwadanych))
                {
                    lokacjadanych = nazwadanych;
                    numerdanych   = l;
                    break;
                }
            }
            using (StreamWriter file = new StreamWriter(lokacjadanych, true))
            {
                file.WriteLine("{0}", zapis);
                Console.WriteLine("{0}", zapis);
            }

            a.g0   = 0.23999999;
            a.chem = 0.42988643;

            //petla
            int n = 1;

            do
            {
                a.g0   = a.g0 + st;
                a.temp = zbrent(Program.gap, xt, yt, zdd);
                a.chem = zbrent(Program.occupancy, xc, yc, zdd);
                while (Math.Abs(a.chem.Real - chp.Real) > dd)
                {
                    chp    = a.chem;
                    a.temp = zbrent(Program.gap, xt, yt, zdd);
                    a.chem = zbrent(Program.occupancy, xc, yc, zdd);
                }
                chp = a.chem;
                o0  = a.g0.Real;
                o1  = (a.temp / t0).Real;
                o2  = a.temp.Real;
                o3  = a.chem.Real;

                //zapis do pliku
                zapis = o0 + "\t" + o1 + "\t" + o2 + "\t" + o3;
                using (StreamWriter file = new StreamWriter(lokacjadanych, true))
                {
                    file.WriteLine("{0}", zapis);
                    Console.WriteLine("{0}", zapis);
                }
            } while (o1 > dr);
        }