Hi forum users
I need a set of numbers that can differentiate uniquely between the combinations.I choose powers of 3. Starting with 1, that gives multiples of 1, 2 and 3 before I reach the next number, which is 3, with it having multiples of 3, 6, 9, etc. If I write out the combinations you can see what happens when you add them:
1 = 1 (eg. 1 Si)
2 = 1 + 1 (eg. 2 Si)
3 = 1 +
1 + 1 (e.g. 3 Si) or 3 (e.g. 1 Al) alone, and so now I have a problem, I can pick up 1 occurrence of the atom labelled 1, and two occurrences, but then one Al will give the same result as 3 Si. Since the Al atoms with their labels of 3 have multiples of 6, 9, etc, I'll never accidently find 4, 5 and/or 7/8, which I can only reach once I'm adding multiples of 1. With this set I can thus give a unique number to each possible combination of the two (but not three). I can pick any way forward, as long as you make sure that you get unique combinations every time.
Now Im stuck I want extend the assignment to 5 atoms : eg assigning a special number for other atoms like Mg,Ca, O and Na. Any one with a unique idea how can I do this. I want a code to be general so that It can be used for many things. I can assign atom name but my code wont be efficient and it will have many if statements.My assignments are shown in the code below.
[! Assign Si = 3**0 = 1, Al = 3**1 = 3 and unknown metals U = 3**2 = 9
! then we can identify pairs and triads easily without ordering
! [Si,Si] = 3**0 + 3**0 = 1 + 1 = 2
! [Si,Al] = [Al,Si] = 1 + 3 = 4
! [Al,Al] = 3 + 3 = 6
! [U,U] = 9 + 9 = 18
! [Al,U] = 3 + 9 = 12
! [Si,U] = 1 + 9 = 10
! [Si,Si,Si] = 1 + 1 + 1 = 3
! [Si,Si,Al] = 1 + 1 + 3 = 5
! [Si,Al,Al] = 1 + 3 + 3 = 7
! [Al,Al,Al] = 3 + 3 + 3 = 9
! [U,U,U] = 9 + 9 + 9 = 27
! [U,U,Si] = 9 + 9 + 1 = 19
! [U,U,Ai] = 9 + 9 + 3 = 21
! [U,Si,Si] = 9 + 1 + 1 = 11
! [U,Si,Al] = 9 + 1 + 4 = 14
! [U,Al,Al] = 9 + 3 + 3 = 15]
[do i = 1, natms
if (atmname(i) == silicon) then
id(i) = Si
elseif (atmname(i) == aluminium) then
id(i) = Al
else
id(i) = 9
endif
enddo
do i = 1, natms
do k = 1, nmetals
if (atmname(i) == metals(k)) then
do j = i, natms
if (atmname(j) == oxygen) then
bndtab(i,j) = mbonds(k)**2
bndtab(j,i) = bndtab(i,j)
endif
enddo
endif
enddo
enddo
endif
]
Then when I get the assignment correctly I want to use the code as this where I sect a correct or desired case as shown below.
[do i = 1, natms
if ((atmname(i) == oxygen) .and. (cnlist(i) .eq. 2)) then
select case ( id(blist(bindex(i))) + id(blist(bindex(i)+1)) )
case (2)
write(logfile,*)'[Si,Si] bridge'
nbo = nbo + 1
case (4)
write(logfile,*)'[Si,Al] bridge'
nbo = nbo + 1
case (6)
write(logfile,*)'[Al,Al] bridge'
nbo = nbo + 1
case (10)
write(logfile,*)'[Si,Ca/Mg] disconnect'
nnbo = nnbo + 1
case (12)
write(logfile,*)'[Al,Ca/Mg] disconnect'
nnbo = nnbo + 1
case (18)
write(logfile,*)'[Mg/Ca,Ca/Mg] disconnect'
end select
endif
]
I need a set of numbers that can differentiate uniquely between the combinations.I choose powers of 3. Starting with 1, that gives multiples of 1, 2 and 3 before I reach the next number, which is 3, with it having multiples of 3, 6, 9, etc. If I write out the combinations you can see what happens when you add them:
1 = 1 (eg. 1 Si)
2 = 1 + 1 (eg. 2 Si)
3 = 1 +
1 + 1 (e.g. 3 Si) or 3 (e.g. 1 Al) alone, and so now I have a problem, I can pick up 1 occurrence of the atom labelled 1, and two occurrences, but then one Al will give the same result as 3 Si. Since the Al atoms with their labels of 3 have multiples of 6, 9, etc, I'll never accidently find 4, 5 and/or 7/8, which I can only reach once I'm adding multiples of 1. With this set I can thus give a unique number to each possible combination of the two (but not three). I can pick any way forward, as long as you make sure that you get unique combinations every time.
Now Im stuck I want extend the assignment to 5 atoms : eg assigning a special number for other atoms like Mg,Ca, O and Na. Any one with a unique idea how can I do this. I want a code to be general so that It can be used for many things. I can assign atom name but my code wont be efficient and it will have many if statements.My assignments are shown in the code below.
[! Assign Si = 3**0 = 1, Al = 3**1 = 3 and unknown metals U = 3**2 = 9
! then we can identify pairs and triads easily without ordering
! [Si,Si] = 3**0 + 3**0 = 1 + 1 = 2
! [Si,Al] = [Al,Si] = 1 + 3 = 4
! [Al,Al] = 3 + 3 = 6
! [U,U] = 9 + 9 = 18
! [Al,U] = 3 + 9 = 12
! [Si,U] = 1 + 9 = 10
! [Si,Si,Si] = 1 + 1 + 1 = 3
! [Si,Si,Al] = 1 + 1 + 3 = 5
! [Si,Al,Al] = 1 + 3 + 3 = 7
! [Al,Al,Al] = 3 + 3 + 3 = 9
! [U,U,U] = 9 + 9 + 9 = 27
! [U,U,Si] = 9 + 9 + 1 = 19
! [U,U,Ai] = 9 + 9 + 3 = 21
! [U,Si,Si] = 9 + 1 + 1 = 11
! [U,Si,Al] = 9 + 1 + 4 = 14
! [U,Al,Al] = 9 + 3 + 3 = 15]
[do i = 1, natms
if (atmname(i) == silicon) then
id(i) = Si
elseif (atmname(i) == aluminium) then
id(i) = Al
else
id(i) = 9
endif
enddo
do i = 1, natms
do k = 1, nmetals
if (atmname(i) == metals(k)) then
do j = i, natms
if (atmname(j) == oxygen) then
bndtab(i,j) = mbonds(k)**2
bndtab(j,i) = bndtab(i,j)
endif
enddo
endif
enddo
enddo
endif
]
Then when I get the assignment correctly I want to use the code as this where I sect a correct or desired case as shown below.
[do i = 1, natms
if ((atmname(i) == oxygen) .and. (cnlist(i) .eq. 2)) then
select case ( id(blist(bindex(i))) + id(blist(bindex(i)+1)) )
case (2)
write(logfile,*)'[Si,Si] bridge'
nbo = nbo + 1
case (4)
write(logfile,*)'[Si,Al] bridge'
nbo = nbo + 1
case (6)
write(logfile,*)'[Al,Al] bridge'
nbo = nbo + 1
case (10)
write(logfile,*)'[Si,Ca/Mg] disconnect'
nnbo = nnbo + 1
case (12)
write(logfile,*)'[Al,Ca/Mg] disconnect'
nnbo = nnbo + 1
case (18)
write(logfile,*)'[Mg/Ca,Ca/Mg] disconnect'
end select
endif
]