Su | Mo | Tu | We | Th | Fr | Sa |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | 5 | 6 | |
7 | 8 | 9 | 10 | 11 | 12 | 13 |
14 | 15 | 16 | 17 | 18 | 19 | 20 |
21 | 22 | 23 | 24 | 25 | 26 | 27 |
28 | 29 |
I amused myself today at lunch time writing a Donald Trump speech generator. The generation method analyzes a real Donald Trump speach and computes the probabilities of its word patterns. It then assembles a possible collection of words using selections based on the observed probabilities of the original speech with a random number generator to make choices where there are alternatives.
The resulting 'Markov Chain' approach to text generation was described a while back by Kernighan (and others no doubt). The resulting text has the general style characteristics of its input, but lacks some of the original logic.
But it is an interesting diversion and a nice reminder of the ease with which miniature 'programs' can be shared using webservers, php, and similar 'technologies'.
Here is the address of our Donald Trump speech generator if you would like to give it a go:
http://www.themolecularuniverse.com/TrumpSpeech/
If you are a political speechwriter or aspiring candidate and you find this page helpful, please do not forget this site when you assume power!
Here is a short video looking at the shape selective properties of the zeolite mordenite for the production of 2,6-Diisopropylnaphthalene (2,6-DIPN) as opposed to 2,7-Diisopropylnaphthalene (2,7-DIPN).
The blue (2,6-DIPN) isomer has a molecular shape which fits the zeolite channel better than the yellow (2,7-DIPN) isomer. The computed energy barriers for the migration of the (2,7-DIPN) isomer are higher than the barriers for the (2,6-DIPN) isomer.
So, once a isomerization has been catalyzed by the zeolite, the (2,6-DIPN) isomer can escape from the zeolite, whereas a (2,7-DIPN) isomer is retained by the catalyst and likely to undergo further isomerization reactions.
Here is a patent on this topic: https://www.google.com/patents/US5017735
I was intrigued recently by the Floyd-Warshall algorithm for shortest path evaluation. Here is a short test script which computes the shortest path between vertices in a graph based on two cubes. (From a chemical perspective this might be two cubane molecules bonded by a carbon-carbon bridge, which I think might be called '1-(cuban-1-yl)cubane').
I thought that I would share the script here. I configured it so that it reads its list of bonds for the 'molecule' based on the tail end of the script file (so that there is only one file to execute).
#!/bin/sh awk 'function printdistmatrix (k){ printf "\nITERATION: %3d\n\n", k printf " " for(i1=1;i1<=natoms;i1++){ printf "%3d", i1 } printf "\n" printf " " for(i1=1;i1<=natoms;i1++){ printf "---", i1 } printf "\n" for(i1=1;i1<=natoms;i1++){ printf "%3d|", i1 for(j1=1;j1<=natoms;j1++){ printf "%3d", dist[i1,j1] } printf "\n" } } BEGIN{ # input is the bond section from a sci file - the indices are adjusted to start at 1 dt=0 natoms=0 while(getline<ARGV[1]>0){ if(match($0,"BONDS-LIST")){ dt++ continue; } if(dt != 2)continue; if(match($0,"END"))break; nbonds++ ib[nbonds,1]=$1+1 ib[nbonds,2]=$2+1 if($1>natoms)natoms=$1 if($2>natoms)natoms=$2 } natoms++ print "THERE ARE " natoms " ATOMS" print "THERE ARE " nbonds " BONDS" # initialize the distance matrix for(i=1;i<=natoms;i++){ for(j=1;j<=natoms;j++){ dist[i,j]=99 } } # initialize atom-atom distances to zero for(i=1;i<=natoms;i++){ dist[i,i]=0 } # set distances between bonded atoms to 1 for(i=1;i<=nbonds;i++){ dist[ib[i,1],ib[i,2]]=1 dist[ib[i,2],ib[i,1]]=1 nextatom[ib[i,1],ib[i,2]]=ib[i,2] nextatom[ib[i,2],ib[i,1]]=ib[i,1] } # this is the Floyd-Warshall algorithm for(k=1;k<=natoms;k++){ printdistmatrix(k) for(i=1;i<=natoms;i++){ for(j=1;j<=natoms;j++){ if(dist[i,j]>(dist[i,k]+dist[k,j])){ dist[i,j]=dist[i,k]+dist[k,j] nextatom[i,j]=nextatom[i,k] } } } } istart=9 iend=3 print "\nTHE DISTANCE BETWEEN ISTART " istart " AND IEND " iend " IS " dist[istart,iend] "\n" print "CONNECTION: " istart while(istart!=iend){ istart=nextatom[istart,iend] print "CONNECTION: " istart } }' $0 exit # bond data follow BONDS-LIST 1 0 0 0 2 1 0 0 3 2 0 0 4 2 0 0 5 1 0 0 6 0 0 0 7 3 0 0 3 0 0 0 7 6 0 0 6 5 0 0 5 4 0 0 7 4 0 0 9 8 0 0 10 9 0 0 11 10 0 0 12 10 0 0 13 9 0 0 14 8 0 0 15 11 0 0 11 8 0 0 15 14 0 0 14 13 0 0 13 12 0 0 15 12 0 0 12 6 0 0 END 6______2 10_____11 /\ /\ /\ /\ / \5 / \ /14\_/__\_____7/____-/----\3 9/___//12 /13 \ /\1 / \ / \ / \ / \ / 15\/___\/16 8\____\/4 With a start of 9 and and end of 3 a shortest path is: 9-10-11-13-7-1-2-3