Ejemplo n.º 1
0
        //
        // You can use the following additional attributes as you write your tests:
        //
        // Use ClassInitialize to run code before running the first test in the class
        // [ClassInitialize()]
        // public static void MyClassInitialize(TestContext testContext) { }
        //
        // Use ClassCleanup to run code after all tests in a class have run
        // [ClassCleanup()]
        // public static void MyClassCleanup() { }
        //
        // Use TestInitialize to run code before running each test
        // [TestInitialize()]
        // public void MyTestInitialize() { }
        //
        // Use TestCleanup to run code after each test has run
        // [TestCleanup()]
        // public void MyTestCleanup() { }
        //
        #endregion

        private static ThreeJSymbol[] GenerateRandomThreeJSymbols(double j_max, int n)
        {
            int tj_max = (int)Math.Truncate(2.0 * j_max);

            ThreeJSymbol[] symbols = new ThreeJSymbol[n];
            Random         rng     = new Random(1);

            for (int i = 0; i < n; i++)
            {
                int tj1 = rng.Next(tj_max + 1);
                int tj2 = rng.Next(tj_max + 1);

                int tm1 = -tj1 + 2 * rng.Next(tj1);
                int tm2 = -tj2 + 2 * rng.Next(tj2);

                int tm3 = -(tm1 + tm2);

                int tj3_min = Math.Abs(tj1 - tj2);
                int tj3_max = tj1 + tj2;
                if (Math.Abs(tm3) > tj3_min)
                {
                    tj3_min = Math.Abs(tm3);
                }
                int tj3 = tj3_min + 2 * rng.Next((tj3_max - tj3_min) / 2);

                ThreeJSymbol symbol = new ThreeJSymbol();
                symbol.Column1 = new SpinState(tj1 / 2.0, tm1 / 2.0);
                symbol.Column2 = new SpinState(tj2 / 2.0, tm2 / 2.0);
                symbol.Column3 = new SpinState(tj3 / 2.0, tm3 / 2.0);
                symbols[i]     = symbol;
            }

            return(symbols);
        }
Ejemplo n.º 2
0
        private static ThreeJSymbol[] GenerateRandomThreeJSymbols(double j_max, int n)
        {
            int tj_max = (int) Math.Truncate(2.0 * j_max);

            ThreeJSymbol[] symbols = new ThreeJSymbol[n];
            Random rng = new Random(1);
            for (int i = 0; i < n; i++) {

                int tj1 = rng.Next(tj_max + 1);
                int tj2 = rng.Next(tj_max + 1);

                int tm1 = -tj1 + 2 * rng.Next(tj1);
                int tm2 = -tj2 + 2 * rng.Next(tj2);

                int tm3 = -(tm1 + tm2);

                int tj3_min = Math.Abs(tj1 - tj2);
                int tj3_max = tj1 + tj2;
                if (Math.Abs(tm3) > tj3_min) tj3_min = Math.Abs(tm3);
                int tj3 = tj3_min + 2 * rng.Next((tj3_max - tj3_min) / 2);

                ThreeJSymbol symbol = new ThreeJSymbol();
                symbol.Column1 = new SpinState(tj1 / 2.0, tm1 / 2.0);
                symbol.Column2 = new SpinState(tj2 / 2.0, tm2 / 2.0);
                symbol.Column3 = new SpinState(tj3 / 2.0, tm3 / 2.0);
                symbols[i] = symbol;

            }

            return (symbols);
        }