Files: Periodic Table – Electron Configurations | Matlab Examples

Matlab Tutorials | Examples

Practice 11:

Files: Periodic Table – Electron Configurations

You are given a file named “PeriodicTable.txt”. The format of the file is as follows:

The third column of this file, electron configuration, gives the arrangement of the electrons in various atomic orbitals around the nucleus. For simplicity, the configuration gives a noble gas symbol (in square brackets) plus the orbitals that need to be added on top of it.

Write a MATLAB program that does the following jobs:

  1. Reads the entire periodic table file into variable(s).
    1. A pop-up file selection dialog box should be displayed for choosing the TXT file to be read from.
    2. You should check for errors that might occur while opening the file. If the filer dialog box is cancelled, stop the program. If there is any error while opening the file, an explanation describing the nature of the error should be printed into the command window, and the program should be terminated.
    3. The first line of the file is a header line, and should be skipped.
    4. You can decide to read the file into any kind of variable—matrix, record structure array, cell array.
    5. You should assume that number of lines in the file changes as more elements are added; so you should not assume a fixed number of lines in the file, but rather read the file until end-of-file.
  2. Expand the electron configurations of all atoms, and determine the atomic number for each by adding up the electron counts in all s, p, d, and f atomic orbitals. Note that atomic number of an element is NOT equal to its sequence in our list, as some elements are omitted from the given file.
  3. In your list of chemical elements, add a string field to describe the group of the element. For elements that belong to the groups Alkali Metals, Alkali Earth Metals, Halogens, and Noble Gases, change their group value to “A”, “E”, “H”, and “N”, respectively; for all others, leave this value as blank.
    1. Noble gases have six electrons in outermost p-orbital (except Helium, which you should include as an exceptional noble gas).
    2. Alkali metals follow noble gases in atomic number.
    3. Alkali earth metals follow alkali metals in atomic number.
    4. Halogens come just before noble gases in atomic number. Note that Hydrogen is an exception to this rule; it is not a Halogen.

4. From
Earth Metals, Halogens, Noble Gases into four separate files in your MATLAB work folder. Four fields should be written into the output file in tabular format: Symbol, element name, atomic number, and expanded electron configuration. Files should be named as follows (no need to ask for their names):

your list of elements, write those that belong to the groups Alkali Metals, Alkali

Group

File name

Alkali Metals

Group1A.txt

Alkali Earth Metals

Group2A.txt

Halogens

Group7A.txt

Noble Gases

Group8A.txt

The file Group1A.txt should be laid out exactly as follows. The other individual raw data files (Group2A.txt, Group7A.txt, Group8A.txt) should have similar format as Group1A.txt.

 

Files:https://drive.google.com/open?id=1lLHt_BW1z3f2XNUuMncKpTPKGbj86LGF

Solutions:

 

One thought on “Files: Periodic Table – Electron Configurations | Matlab Examples

Leave a Reply

Your email address will not be published. Required fields are marked *