Beispiel #1
0
        private void ReadFploInfo(StreamReader reader, WannierData retval)
        {
            Fplo8Data data = new Fplo8Data();

            int count = 0;

            while (reader.EndOfStream == false)
            {
                string line = reader.ReadLine();

                if (line.StartsWith("lattice vectors"))
                {
                    data.ReadLatticeVectors(reader, data);
                }
                if (line.StartsWith("Number of sites :"))
                {
                    count = int.Parse(line.Substring(line.Length - 3));
                }
                if (line.StartsWith("No.  Element WPS"))
                {
                    data.ReadAtomSites(reader, data, count);
                }
            }

            data.FindAtoms(retval);
        }
Beispiel #2
0
        internal void ReadLatticeVectors(System.IO.StreamReader reader, Fplo8Data data)
        {
            for (int i = 0; i < 3; i++)
            {
                string line = reader.ReadLine().Trim();

                if (line.StartsWith(string.Format("a{0}", i + 1)) == false)
                {
                    throw new InvalidDataException("Could not read lattice vectors.");
                }

                string[] text = line.Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);

                int len = text.Length;
                lattice[i] = Vector3.Parse(text[len - 3], text[len - 2], text[len - 1]);
            }

            Matrix A = new Matrix(3, 3,
                                  lattice[0].X, lattice[0].Y, lattice[0].Z,
                                  lattice[1].X, lattice[1].Y, lattice[1].Z,
                                  lattice[2].X, lattice[2].Y, lattice[2].Z);

            Matrix G = A.Invert().Transpose();

            for (int i = 0; i < 3; i++)
            {
                reciprocal[i] = new Vector3(G[i, 0].x, G[i, 1].x, G[i, 2].x);
            }
        }
Beispiel #3
0
        internal void ReadAtomSites(System.IO.StreamReader reader, Fplo8Data data, int count)
        {
            if (count == 0)
            {
                throw new ArgumentException("Number of sites can't be zero.");
            }

            for (int i = 0; i < count; i++)
            {
                string line = reader.ReadLine().Trim();

                string[] text = line.Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);

                Atom a = new Atom();
                a.Element = text[1];

                int len = text.Length;
                a.Position = Vector3.Parse(text[len - 3], text[len - 2], text[len - 1]);

                sites.Add(a);
            }
        }
Beispiel #4
0
        private void ReadFploInfo(StreamReader reader, WannierData retval)
        {
            Fplo8Data data = new Fplo8Data();

            int count = 0;

            while (reader.EndOfStream == false)
            {
                string line = reader.ReadLine();

                if (line.StartsWith("lattice vectors"))
                {
                    data.ReadLatticeVectors(reader, data);
                }
                if (line.StartsWith("Number of sites :"))
                {
                    count = int.Parse(line.Substring(line.Length - 3));
                }
                if (line.StartsWith("No.  Element WPS"))
                {
                    data.ReadAtomSites(reader, data, count);
                }
            }

            data.FindAtoms(retval);
        }
Beispiel #5
0
        internal void ReadLatticeVectors(System.IO.StreamReader reader, Fplo8Data data)
        {
            for (int i = 0; i < 3; i++)
            {
                string line = reader.ReadLine().Trim();

                if (line.StartsWith(string.Format("a{0}", i + 1)) == false)
                    throw new InvalidDataException("Could not read lattice vectors.");

                string[] text = line.Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);

                int len = text.Length;
                lattice[i] = Vector3.Parse(text[len - 3], text[len - 2], text[len - 1]);
            }

            Matrix A = new Matrix(3, 3,
                lattice[0].X, lattice[0].Y, lattice[0].Z,
                lattice[1].X, lattice[1].Y, lattice[1].Z,
                lattice[2].X, lattice[2].Y, lattice[2].Z);

            Matrix G = A.Invert().Transpose();

            for (int i = 0; i < 3; i++)
                reciprocal[i] = new Vector3(G[i, 0].x, G[i, 1].x, G[i, 2].x);
        }
Beispiel #6
0
        internal void ReadAtomSites(System.IO.StreamReader reader, Fplo8Data data, int count)
        {
            if (count == 0)
                throw new ArgumentException("Number of sites can't be zero.");

            for (int i = 0; i < count; i++)
            {
                string line = reader.ReadLine().Trim();

                string[] text = line.Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);

                Atom a = new Atom();
                a.Element = text[1];

                int len = text.Length;
                a.Position = Vector3.Parse(text[len - 3], text[len - 2], text[len - 1]);

                sites.Add(a);
            }
        }