computation problem for atomic levels

forth

    Sponsored Links

    Next

  • 1. Forth Offensive
    Offensive? You don't know what offensive is. Offensive is throwing fists, bullets and bombs, not words. : bitch dyke ; I utter fail to see how these words can hurt you. <snicker> But, if it's really bugging you, I suggest you use your fundamental right to freedom of speech to protest against your fundamental right to freedom of speech. </snicker> Or, you could learn how to use a filter file. Don't have one? Write one, unless you are some kind of forth slacker. I find Elizabeth's forth philosphy 'offensive', and I'm responding to it. It's long overdue.
  • 2. Forth's seeming continuing downward spiral into obscurity
    Does "someone's" continuing obsession with microprocessor hardware have anything to do with the continuing lack of support and obscurity of this otherwise valid language? I previously had a brief nice encounter with JForth on the Amiga several years ago. It had a nice interface with the Amiga OS. But after the traitorous abandonment of the Amiga by Commodore I went the IBM clone way with Delphi. I recently looked back into how Forth was doing in the IBM PC clone world. And it looks like a barren world of dislocated people trying to find something. It is starting to look like Forth is an orphan abandoned by it's creator who is off in some kind of hardware microprocessor obsession. Leaving the rest of the world moving on to other things. Maybe I am wrong but I am quite disappointed with what I am now finding in the Forth world. Public domain Forths like Gforth and bigForth are still at the DOS command prompt interface and what can you do with that?
  • 3. Sequence detecting algorithm
    I would be interested in Forth code to / an algorithm description for searching the longest *repeating* pattern in a string; e.g. string: fgerrgflfldsAAAbAAAbAAAbAAAbAAAbkaaskasksowiorur for which the returned pattern is AAAb (or better: an offset and length into the original string). I have something by Wil Baden which goes like this: 0 VALUE seq# 0 VALUE #ustates 0 VALUE offset CREATE sequence #256 CHARS ALLOT CREATE ustates #256 CHARS ALLOT : SEARCH-SEQUENCE ( -- ) sequence seq# #256 UMIN LOCALS| sz addr | sz 1- 0 ?DO addr sz 1 /STRING addr C@ SCAN ( -- s' k' ) DUP IF TO #ustates TO offset addr sz #ustates - ( -- s' k'-sz ) offset #ustates COMPARE 0= IF UNLOOP EXIT ENDIF ELSE 2DROP ENDIF addr sz 1 /STRING TO sz TO addr LOOP 0 TO #ustates sequence TO offset ; PRIVATE This returns OFFSET (into sequence where the pattern is) and #USTATES (the length of the repeating pattern). Unfortunately, it assumes the pattern CONTINUES to repeat from a certain offset onwards, and so the pattern must be at the end: string: fgerrgflfldsAAAbAAAbAAAbAAAbAAAb ^-- offset, #ustates=4 returns AAAb. This is already quite useful, but finding a repeating pattern in the middle of a string would be better. I'm certain this is a known problem, but I don't even know how to call it so can't look it up. -marcel

computation problem for atomic levels

Postby Krishna Myneni » Mon, 19 Jul 2010 08:28:12 GMT

Below is a computation problem I'm running up against in writing a
program to list the allowed angular momentum states of atoms in the
"LS" coupling scheme. The problem can be described in purely
computational terms --- no actual knowledge of atomic physics is
needed. Some of the nimbler computational minds here might want to
take a shot at coding a solution (or maybe recognize it in terms of a
well-known problem in computer science).

Given N equivalent electrons in an atom, each with the same orbital
angular momentum quantum number, L, and spin quantum number, s = 1/2,
make a table of quantum numbers,

m_L1, m_s1, m_L2, m_s2, ... , m_LN, m_sN

which are allowed by the Pauli exclusion principle. Applied to this
problem, the principle restricts the table such that,

a)  no two electrons should have the same pair of quantum numbers,
m_L and m_s. Such entries should be removed.

b) No two rows in the table may be transformed into each other simply
by changing the electron label. Remove one of these rows.

(For those of you familiar with LS notation, you will have noted that
capital L is typically used to represent the total orbital angular
momentum, but I use it here to represent the individual electron
orbital quantum number, because lower case L is too hard to
distinguish in a text message).

Here are the rules:

1) The quantum number L for each electron can take on the values 0, 1,
2, 3, ... All of the electrons will have the same L number.

2) The maximum number of electrons, N_max, for a given L is given by
2*(2*L + 1). Thus, for L=0, N_max = 2, L = 1, N_max = 6, and so on.

3) The value of m_L for each electron with quantum number l, goes from
m_L = -L to +L in steps of 1. Thus for an L=1 electron, m_L can take
on three values:  -1, 0, or +1

4) The value of m_s for an electron can take on two values, m_s = -1/2
or +1/2  (it is simpler to represent m_s as taking the values -1 or +1
so we don't have to deal with fractional numbers).

Example: Two L=1 equivalent electrons

There are 36 possible combinations for the set, { m_L1, m_s1, m_L2,
m_s2 }. However, only 15 of these combinations are consistent with the
Pauli exclusion principle, so the final table will have 15 entries.
With slightly different column ordering, the allowed entries

        m_L1  m_L2  m_s1  m_s2
        -1      -1       -1      +1
        -1       0       -1       -1
        -1       0       -1      +1
        -1       0      +1       -1
        -1       0      +1      +1
        -1     +1       -1       -1
        -1     +1       -1      +1
        -1     +1      +1       -1
        -1     +1      +1      +1
         0       0       -1      +1
         0     +1       -1       -1
         0     +1       -1      +1
         0     +1      +1       -1
         0     +1      +1      +1
       +1     +1       -1      +1

The code to solve this problem should allow L = 0 to a max of say, L =
4. Of course N will be constrained to the range 1 to N_max for a given
L.

For those interested in the physics/chemistry motivation behind this
problem, the following Wikipedia article might be a good place to
start:   http://www.**--****.com/ 

Cheers,
Krishna

Re: computation problem for atomic levels

Postby Paul Rubin » Mon, 19 Jul 2010 08:49:48 GMT

Krishna Myneni < XXXX@XXXXX.COM > writes:

Is the basic problem the combinatorial explosion as (for L=4) N_max=18
and there are 9 possible L values and two s values, so you end up with
18**18 combinations before removing duplicates?  Of course there are
obvious symmetries you can eliminate, but even after removing duplicates
there will still be an awful lot, so if you're trying to list all the
combinations,the output will be large whatever you do.
If you only want to count the states, that sounds like a
straightforward(?) combinatorics problem.


Re: computation problem for atomic levels

Postby Krishna Myneni » Mon, 19 Jul 2010 11:56:40 GMT



Yes, you're right about the number of combinations before excluding
those that violate the symmetry rules (Pauli exclusion principle). I'm
interested in more than the number of states after applying the
exclusion principle --- for the remaining combinations, the sum of the
m_L and sum of the m_s can be used to enumerate the distinct angular
momentum states (in the LS notation) of the atom. Perhaps we should
restrict the problem, for the present, to the range of L, 0 to 2.
Then, at most there will be 10^10 (or ten billion) combinations before
applying the symmetry rules. There should be a drastic reduction of
these combinations with the application of the exclusion principle,
but I don't have a calculation for the number of remaining states.

Cheers,
Krishna

Incidentally, I've already coded the problem for non-equivalent
electrons, which results in a larger number of allowed combinations.
But, this code will not work for up to 18 L=4 electrons. I will place
this program, which uses a Lisp-like lists library in Forth, at

ftp://ccreweb.org/software/kforth/examples/lsterms.4th

Re: computation problem for atomic levels

Postby Krishna Myneni » Mon, 19 Jul 2010 13:42:28 GMT





The Wikipedia article gives a straight-forward formula for the number
of remaining states. For the L=2 problem, there are at most 252
distinct states.

For N, L=2 electrons, the number of distinct states, N_s is given by
the following table:

N   N_s
--------
1    10
2    45
3   120
4   210
5   252
6   210
7   120
8    45
9    10
10    1
--------

Krishna



Re: computation problem for atomic levels

Postby Albert van der Horst » Mon, 19 Jul 2010 20:47:06 GMT

In article < XXXX@XXXXX.COM >,


<SNIP>

Separating over L and M is a bit of a red herring. You have 3*2
possible states for an electron.


<EXAMPLE snipped>

This is just 6 over 2 , the number of possibilities we can select
2 states out of 6 without duplicates.  6.5/2.1
This is a familiar problem, that certainly can be found on the Internet.
(Like in "enumerate all hands you can get with poker" : 52 over 5,
assuming a poker hand is 5 cards.)


Groetjes Albert


Re: computation problem for atomic levels

Postby Krishna Myneni » Mon, 19 Jul 2010 23:11:34 GMT

On Jul 18, 6:47m, Albert van der Horst < XXXX@XXXXX.COM >



>>
>>
>>
>>>>Below is a computation problem I'm running up against in writing a
>>>>program to list the allowed angular momentum states of atoms in the
>>>>"LS" coupling scheme. The problem can be described in purely
>>>>computational terms --- no actual knowledge of atomic physics is
>>>>needed. Some of the nimbler computational minds here might want to
>>>>take a shot at coding a solution (or maybe recognize it in terms of a
>>>>well-known problem in computer science).
>>
>><
>>
>>>>Here are the rules:
>>
>>>>1) The quantum number L for each electron can take on the values 0, 1,
>>>>2, 3, ... All of the electrons will have the same L number.
>>
>>>>2) The maximum number of electrons, N_max, for a given L is given by
>>>>2*(2*L + 1). Thus, for L=0, N_max = 2, L = 1, N_max = 6, and so on.
>>
>>>>3) The value of m_L for each electron with quantum number l, goes from
>>>>m_L = -L to +L in steps of 1. Thus for an L=1 electron, m_L can take
>>>>on three values: 1, 0, or +1>
>>
> >4) The value of m_s for an electron can take on two values, m_s = -1/2>
> >or +1/2 it is simpler to represent m_s as taking the values -1 or +>
>> >so we don't have to deal with fractional numbers)>
> Separating over L and M is a bit of a red herring. You have 3*>
> possible states for an electron>
>

The problem, as posed, is not simply to count the number of states
allowed by the exclusion principle, but to explicitly list the quantum
numbers for each of these states. The end application, determining the
LS coupled states, requires coupling the angular momenta of the
electrons in an order that is consistent with the relative strengths
of the magnetic interactions (spin-orbit, spin-spin) in the atom. LS
coupling relies on having a final list of the sum of the m_L  and m_s
values for each table entry (allowed state). The separation according
to "m"s is necessary to accomplish this.
>
> This is just 6 over 2 , the number of possibilities we can selec>
> 2 states out of 6 without duplicates. .5/2.1

I don't understand your notation, but yes, that would count the
states. That's only a small part of the problem, however.>

> This is a familiar problem, that certainly can be found on the Interne>.
> (Like in "enumerate all hands you can get with poker" : 52 over >,
> assuming a poker hand is 5 cards>)
>

It may be possible there's a card analogy here. But it's not clear to
me yet whether the exclusion principle would be consistent with such
an analogy (I'm a lousy player at cards!).>

>>
>>
> Groetjes Albe>t
>>
> >-
> >-
> Albert van der Horst, UTRECHT,THE NETHERLAN>S
> Economic growth -- being exponential -- ultimately falter>.
> albert@spe&ar&c.xs4all.nl &=n http://www.**--****.com/ 


Krishna

Re: computation problem for atomic levels

Postby jacko » Tue, 20 Jul 2010 21:47:45 GMT

n 18 July, 00:28, Krishna Myneni < XXXX@XXXXX.COM > wrote:
> so we don't have to deal with fractional numbers).> >> > Example: Two L=1 equivalent electrons> >> > There are 36 possible combinations for the set, { m_L1, m_s1, m_L2,> > m_s2 }. However, only 15 of these combinations are consistent with the> > Pauli exclusion principle, so the final table will have 15 entries.> > With slightly different column ordering, the allowed entries> >> > m_L1 _L2 _s1 gt;_s2
> -1 1>-1 1
> > -1 0 -1 > -1
> -1 0>-1 1
> > -1 0 1 > -1
> -1 0>1 1
> > -1 +1 -1 > -1
> -1 +1>-1 1
> gt;-1 +1 1 > -1
> -1 +1>1 1
> > 0 -1 gt;>+1
> +1 -1 -1
> +1 -1 gt;1
> +1 1 -1
> +1 1 > >
>
> The code to solve this problem>should allow L = 0 to a max of say, L =
> 4. Of course N will be co>strained to the range 1 to N_max for a given
> L. >> >> For thos> interested in the physics/chemistry motivation behind this
> problem, the following Wikipedia article might be a good place to
> start: ttp://en.wikipedia.org/wiki/Term_symbol
>
> Cheers,
> Krishna

Sounds like chemistry spdf orbital notation, probly because it is. A
simple enumaration bucket algorithm can be constructed by moving a
left most bucketed electron in a limited bucket one bucket right, if
that bucket has capacity, and recurse right. An initial left fill
would be needed.

Re: computation problem for atomic levels

Postby jacko » Wed, 21 Jul 2010 19:02:34 GMT

As soon as more than half the electrons are over the centre point end
as symetric.

The unique electron priority order will give unique sets of data, so
single entry double buckets for the s layer.

Re: computation problem for atomic levels

Postby Krishna Myneni » Mon, 26 Jul 2010 22:45:04 GMT

n Jul 19, 7:47m, jacko < XXXX@XXXXX.COM > wrote:
>> >> >> > > -1 1>gt;-1 1
> > > >1 0 -1 >1> > > -1 0 gt;gt;-1 1
> > > >1 0 1 -1> > > -1>gt;+1 -1 -1
> > -1 > > +1 1 -1
> > > -1 +1 1>gt;1
> > gt;gt;0 -1 1
> > gt;gt; +1 -1 -1
> > +1 -1 1
> > +1 1 > >> > gt;> >+1 +1 -1 1
>
> > The code to solve this problem shoul> >llow L = 0 to a max of say, L =
> > 4. Of course N will be constrai>e> to the range 1 to N_max for a given
> > L.
>
> > F>r>those inte>e>ted in the>ph>sics/chemistry motivation behind this
> > problem, the following Wikipedia article might be a good place to
> > start: ttp://en.wikipedia.org/wiki/Term_symbol
>
> > Cheers,
> > Krishna
>
> Sounds like chemistry spdf orbital notation, ...

The notation is spectroscopic notation, originating from the
classification of spectral lines --- "s" for sharp, "p" for principal,
and "d" for diffuse. The greater the orbital angular momentum of the> electron (L=2 for "d"), the greater the number of unequal energy
levels, >nd, given the resolution of the spectrometers at the time,
the lines i>volving these levels appeared to be smeared.

> ... A simple enuma>ation bucket algorithm can be constructed by moving a
> left most bucketed electron in a limited bucket one bucket right, if
> that bucket has capacity, and recurse right. An initial left fill

I'm not familiar with your terms. Can you give an example, say for the
simple case of two equivalent p (L=1) electrons?

Krishna

Similar Threads:

1.computation problem for atomic levels

2.Withdrawn SRFI 53: Syntactic computations with computation-rules

3.c is a low-level language or neither low level nor high level language

hi!
   I have a doubt that 'c' is low level language or neither low level
nor high level language.please give me details.
with regards,
vinod

4.Discriminant computation problem

Just learning Ada and I came across this little issue. I can't perform a
computation on a discriminant. Suppose I want to create a bit vector type
that uses an array of Integers as its underlying storage type (just an
example). I want the user to provide the length of the bit vector in bits,
but I need to define the upper bound on the Integer array in Integer'Size
units.

type Int_Array is array (Positive range <>) of Integer;

type Bit_Vector (Max_Bit_Size : Positive) is
record
 Series : Int_Array (Positive'First .. Max_Bit_Size/Integer'Size);
end record;

The compiler error gnat produces: "discriminant in constraint must appear
alone". Is there something I'm doing wrong, or is the above simply not
possible?

I can solve this either by breaking the encapsulation of my type so that the
user must perform the computation ahead of time (not preferable), or by
creating a special function which computes the real upper bound. So the
user would have to instantiate:

bv : Bit_Vector(Real_Upper_Bound(1024)); --1024 bits

Instead of:

bv : Bit_Vector(1024); --1024 bits

Does anyone have a better answer?

5.4 level to 2 level round robin arbiter

hi everyone,
I already have code for a 4 level round robin arbiter (taken from a
Wishbone bus example), but I wish to reduce it to a 2 level round robin
arbiter. I am not that familiar with vhdl, and more familiar with
verilog, so was wondering if anyone could help me reduce the code to a
2-level arbiter. It should be easy, but some parts are confusing me.
Thanks! The code is pasted below:

----------------------------------------------------------------------
-- Load the IEEE 1164 library and make it visible.
----------------------------------------------------------------------

library ieee;
use ieee.std_logic_1164.all;


----------------------------------------------------------------------
-- Entity declaration.
----------------------------------------------------------------------

entity ARB0001a is
    port(
            CLK:        in  std_logic;
            COMCYC:     out std_logic;
            CYC3:       in  std_logic;
            CYC2:       in  std_logic;
            CYC1:       in  std_logic;
            CYC0:       in  std_logic;
            GNT:        out std_logic_vector( 1 downto 0 );
            GNT3:       out std_logic;
            GNT2:       out std_logic;
            GNT1:       out std_logic;
            GNT0:       out std_logic;
            RST:        in  std_logic
         );

end entity ARB0001a;


----------------------------------------------------------------------
-- Architecture definition.
----------------------------------------------------------------------

architecture ARB0001a1 of ARB0001a is


    ------------------------------------------------------------------
    -- Define internal signals.
    ------------------------------------------------------------------

    signal  BEG:        std_logic;
    signal  EDGE:       std_logic;
    signal  LGNT:       std_logic_vector( 1 downto 0 );
    signal  LGNT0:      std_logic;
    signal  LGNT1:      std_logic;
    signal  LGNT2:      std_logic;
    signal  LGNT3:      std_logic;
    signal  LCOMCYC:    std_logic;
    signal  LASMAS:     std_logic;
    signal  LMAS0:      std_logic;
    signal  LMAS1:      std_logic;

begin

    ------------------------------------------------------------------
    -- Arbitration logic (registered output).
    ------------------------------------------------------------------

    ARBITER_REGISTERS: process( CLK )
    begin

        if( rising_edge( CLK ) ) then

            LGNT0 <= ( not(RST) and not(LCOMCYC) and not(LMAS1) and
not(LMAS0) and not(CYC3) and not(CYC2) and not(CYC1) and     CYC0  )
                  or ( not(RST) and not(LCOMCYC) and not(LMAS1) and
LMAS0  and not(CYC3) and not(CYC2)               and     CYC0  )
                  or ( not(RST) and not(LCOMCYC) and     LMAS1  and
not(LMAS0) and not(CYC3)                             and     CYC0  )
                  or ( not(RST) and not(LCOMCYC) and     LMAS1  and
LMAS0                                            and     CYC0  )
                  or ( not(RST) and     LCOMCYC  and LGNT0 );

            LGNT1 <= ( not(RST) and not(LCOMCYC) and not(LMAS1) and
not(LMAS0)                             and     CYC1                )
                  or ( not(RST) and not(LCOMCYC) and not(LMAS1) and
LMAS0  and not(CYC3) and not(CYC2) and     CYC1  and not(CYC0) )
                  or ( not(RST) and not(LCOMCYC) and     LMAS1  and
not(LMAS0) and not(CYC3)               and     CYC1  and not(CYC0) )
                  or ( not(RST) and not(LCOMCYC) and     LMAS1  and
LMAS0                              and     CYC1  and not(CYC0) )
                  or ( not(RST) and     LCOMCYC  and LGNT1 );

            LGNT2 <= ( not(RST) and not(LCOMCYC) and not(LMAS1) and
not(LMAS0)               and     CYC2  and not(CYC1)               )
                  or ( not(RST) and not(LCOMCYC) and not(LMAS1) and
LMAS0                and     CYC2                              )
                  or ( not(RST) and not(LCOMCYC) and     LMAS1  and
not(LMAS0) and not(CYC3) and     CYC2  and not(CYC1) and not(CYC0) )
                  or ( not(RST) and not(LCOMCYC) and     LMAS1  and
LMAS0                and     CYC2  and not(CYC1) and not(CYC0) )
                  or ( not(RST) and     LCOMCYC  and LGNT2 );

            LGNT3 <= ( not(RST) and not(LCOMCYC) and not(LMAS1) and
not(LMAS0) and     CYC3  and not(CYC2) and not(CYC1)               )
                  or ( not(RST) and not(LCOMCYC) and not(LMAS1) and
LMAS0  and     CYC3  and not(CYC2)                             )
                  or ( not(RST) and not(LCOMCYC) and     LMAS1  and
not(LMAS0) and     CYC3                                            )
                  or ( not(RST) and not(LCOMCYC) and     LMAS1  and
LMAS0  and     CYC3  and not(CYC2) and not(CYC1) and not(CYC0) )
                  or ( not(RST) and     LCOMCYC  and LGNT3 );

        end if;

    end process ARBITER_REGISTERS;


    ------------------------------------------------------------------
    -- LASMAS state machine.
    ------------------------------------------------------------------

    BEG_LOGIC: process( CYC3, CYC2, CYC1, CYC0, LCOMCYC )
    begin

        BEG <= ( CYC3 or CYC2 or CYC1 or CYC0 ) and not( LCOMCYC );

    end process BEG_LOGIC;


    LASMAS_STATE_MACHINE: process( CLK )
    begin

        if( rising_edge( CLK ) ) then

            LASMAS <= ( BEG and not( EDGE ) and not( LASMAS ) );

            EDGE   <= ( BEG and not( EDGE ) and      LASMAS   )
                   or ( BEG and      EDGE   and not( LASMAS ) );

        end if;

    end process LASMAS_STATE_MACHINE;


    ------------------------------------------------------------------
    -- COMCYC logic.
    ------------------------------------------------------------------

    COMCYC_LOGIC: process( CYC3, CYC2, CYC1, CYC0, LGNT3, LGNT2, LGNT1,
LGNT0 )
    begin

        LCOMCYC <= ( CYC3 and LGNT3 )
                or ( CYC2 and LGNT2 )
                or ( CYC1 and LGNT1 )
                or ( CYC0 and LGNT0 );

    end process COMCYC_LOGIC;


    ------------------------------------------------------------------
    -- Encoder logic.
    ------------------------------------------------------------------

    ENCODER_LOGIC: process( LGNT3, LGNT2, LGNT1, LGNT0 )
    begin

        LGNT(1) <=   LGNT3 or LGNT2;
        LGNT(0) <=   LGNT3 or LGNT1;

    end process ENCODER_LOGIC;


    ------------------------------------------------------------------
    -- LMAS register.
    ------------------------------------------------------------------

    LMAS_REGISTER: process( CLK )
    begin

        if( rising_edge( CLK ) ) then

            if( RST = '1' ) then
                LMAS1 <= '0';
                LMAS0 <= '0';
            elsif( LASMAS = '1' ) then
                LMAS1 <= LGNT(1);
                LMAS0 <= LGNT(0);
            else
                LMAS1 <= LMAS1;
                LMAS0 <= LMAS0;
            end if;

        end if;

    end process LMAS_REGISTER;


    ------------------------------------------------------------------
    -- Make local signals visible outside of the entity.
    ------------------------------------------------------------------

    MAKE_VISIBLE: process( LCOMCYC, LGNT, LGNT0, LGNT1, LGNT2, LGNT3 )
    begin

        COMCYC <= LCOMCYC;
        GNT(1) <= LGNT(1);
        GNT(0) <= LGNT(0);
        GNT3   <= LGNT3;
        GNT2   <= LGNT2;
        GNT1   <= LGNT1;
        GNT0   <= LGNT0;

    end process MAKE_VISIBLE;

end architecture ARB0001a1;

6. System-level Verification vs Module-level verification

7. Poscript level 2 issues vs level 3?

8. Level 2 or Level 3?



Return to forth

 

Who is online

Users browsing this forum: No registered users and 17 guest