tag:blogger.com,1999:blog-82850295676067352092024-03-13T05:02:52.531+01:00CM-toolsTools and Solutions for Computer ModellingUnknownnoreply@blogger.comBlogger5125tag:blogger.com,1999:blog-8285029567606735209.post-64680806293427517192017-03-02T12:24:00.000+01:002017-03-02T12:26:52.387+01:00Exchange to IMAP GatewayI am one of this users that is still using client mail like Thunderbird. Do not get me wrong, I use and like Gmail, but I still need more control over my mail in few cases. Anyway, from time to time the University Exchange server is updated/reconfigured and I loose access to the provided IMAP access. Since this became recurrent event and the suggested solutions from the support team were somewhat random guesses I looked for alternative solution.<br>
<br>
Here is what I am using right now, while I can not access my mail box after the last upgrade.<br>
<br>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhYqsoeAAEjsR4CqGrhyphenhyphenD85tCQM5jYqV9naAwTdg3W6RqQn9-tycrYzhXbKLhrOmEOcbwWD3vkG55vU13N3E1gxd_hEErBz7WfUJJsoytGi3yXbfqCcW5PCdEh3gOFUvHnrAw6OL1CI_cQl/s1600/UU-exchange2IMAP.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="250" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhYqsoeAAEjsR4CqGrhyphenhyphenD85tCQM5jYqV9naAwTdg3W6RqQn9-tycrYzhXbKLhrOmEOcbwWD3vkG55vU13N3E1gxd_hEErBz7WfUJJsoytGi3yXbfqCcW5PCdEh3gOFUvHnrAw6OL1CI_cQl/s320/UU-exchange2IMAP.png" width="320"></a></div>
<br>
<a href="http://cm-tools.blogspot.com/2017/03/exchange-to-imap.html#more">Read more »</a>Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-8285029567606735209.post-86407805236875731012017-01-14T13:08:00.000+01:002017-02-15T14:03:00.623+01:00Discrete histogram<span style="background-color: white;"><span style="font-family: "verdana" , "helvetica" , "arial" , sans-serif;"><span style="font-size: 13.3333px;">The usual </span></span></span><a href="https://en.wikipedia.org/wiki/Histogram" rel="nofollow" style="background-color: white; color: #551a8b; font-family: Verdana, Helvetica, Arial, sans-serif; font-size: 13.3333px; text-decoration: none;" target="_blank">histogram </a><span style="background-color: white;"><span style="font-family: "verdana" , "helvetica" , "arial" , sans-serif;"><span style="font-size: 13.3333px;">is a graphical representation of the distribution of numerical data. It also implies that you have regular intervals for the resulting distribution. What happens if you are looking for distribution over discrete elements, like day of the week, month, or any possible word...</span></span></span><br>
<span style="background-color: white;"><span style="font-family: "verdana" , "helvetica" , "arial" , sans-serif;"><span style="font-size: 13.3333px;"><br></span></span></span>
Here is an example. <br>
<ul>
<li>How many coins are gold or silver?</li>
<li>How many coins from each country we have?</li>
<li>... year?</li>
</ul>
<div style="background-color: white;">
<div style="direction: ltr; font-family: verdana, helvetica, arial, sans-serif; font-size: 13.3333px; margin-bottom: 0pt; margin-left: 0in; margin-top: 0pt; word-break: normal;">
<span style="font-family: "courier new" , "courier" , monospace; font-size: small;"></span></div>
<div style="direction: ltr; margin-bottom: 0pt; margin-left: 0in; margin-top: 0pt; word-break: normal;">
<span style="font-family: "courier new" , "courier" , monospace;"> gold 1 1986 USA American Eagle</span><br>
<span style="font-family: "courier new" , "courier" , monospace;"> gold 1 1908 Austria-Hungary Franz Josef 100 Korona</span><br>
<span style="font-family: "courier new" , "courier" , monospace;"> silver 10 1981 USA ingot</span><br>
<span style="font-family: "courier new" , "courier" , monospace;"> gold 1 1984 Switzerland ingot</span><br>
<span style="font-family: "courier new" , "courier" , monospace;"> gold 1 1979 RSA Krugerrand</span><br>
<span style="font-family: "courier new" , "courier" , monospace;"> gold 0.5 1981 RSA Krugerrand</span><br>
<span style="font-family: "courier new" , "courier" , monospace;"> gold 0.1 1986 PRC Panda</span><br>
<span style="font-family: "courier new" , "courier" , monospace;"> silver 1 1986 USA Liberty dollar</span><br>
<span style="font-family: "courier new" , "courier" , monospace;"> gold 0.25 1986 USA Liberty 5-dollar piece</span><br>
<span style="font-family: "courier new" , "courier" , monospace;"> silver 0.5 1986 USA Liberty 50-cent piece</span><br>
<span style="font-family: "courier new" , "courier" , monospace;"> silver 1 1987 USA Constitution dollar</span><br>
<span style="font-family: "courier new" , "courier" , monospace;"> gold 0.25 1987 USA Constitution 5-dollar piece</span><br>
<span style="font-family: "courier new" , "courier" , monospace;"> gold 1 1988 Canada Maple Leaf</span></div>
</div>
<div style="background-color: white; font-family: Verdana, Helvetica, Arial, sans-serif; font-size: 13.3333px;">
</div><a href="http://cm-tools.blogspot.com/2017/02/discrete-histogram.html#more">Read more »</a>Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-8285029567606735209.post-62402902102451061452016-09-04T12:43:00.000+02:002017-02-15T13:45:36.417+01:00Extracting Frequency data from a Gaussian 09 calculationThis small awk script was inspired by the <a href="http://verahill.blogspot.se/2013/09/514-extracting-frequency-data-from.html" target="_blank">Python solution</a> I found on this excellent blog [ <a href="http://verahill.blogspot.se/" target="_blank">Lindqvist - a blog about Linux and Science. Mostly.</a> ] You can find my solution in the comments section of the blog.<br />
<br />
So, I would like to extract/collect the results from a Gaussian09 harmonic frequency calculation.<br />
Since collecting the rest of the data from the Gaussian output is pretty much identical I have done it anyway.<br />
<br />
<div style="background-color: white; font-family: Verdana, Helvetica, Arial, sans-serif; font-size: 13.3333px;">
<div class="sites-codeblock sites-codesnippet-block" style="background-color: #efefef; border: 1px solid rgb(211, 211, 211); line-height: 1; padding: 0.5em 0px 0.5em 1em;">
<span style="color: #666666; font-family: "trebuchet ms" , "trebuchet" , "verdana" , sans-serif; font-size: 12px; line-height: 16.8px; text-align: justify;"><code style="color: #006000;">#!/bin/awk -f</code></span><br />
<br style="color: #666666; font-family: "Trebuchet MS", Trebuchet, Verdana, sans-serif; font-size: 12px; line-height: 16.8px; text-align: justify;" />
<span style="font-family: "trebuchet ms" , "trebuchet" , "verdana" , sans-serif; font-size: 12px; line-height: 16.8px; text-align: justify;"><code style="color: #006000;"><span style="color: red;">/Frequencies/</span><span style="color: #666666;"> { for (i=3;i<=NF; i++) { im++; freq[im ]=$i } }</span></code></span><br />
<span style="font-family: "trebuchet ms" , "trebuchet" , "verdana" , sans-serif; font-size: 12px; line-height: 16.8px; text-align: justify;"><code style="color: #006000;"><span style="color: red;">/Frc consts/</span><span style="color: #666666;"> { for (i=NF;i>=4; i--) fc[im-(NF-i)]=$i }</span></code></span><br />
<span style="font-family: "trebuchet ms" , "trebuchet" , "verdana" , sans-serif; font-size: 12px; line-height: 16.8px; text-align: justify;"><code style="color: #006000;"><span style="color: red;">/IR Inten/</span><span style="color: #666666;"> { for (i=NF;i>=4; i--) ir[im-(NF-i)]=$i }</span></code></span><br />
<br style="color: #666666; font-family: "Trebuchet MS", Trebuchet, Verdana, sans-serif; font-size: 12px; line-height: 16.8px; text-align: justify;" />
<span style="font-family: "trebuchet ms" , "trebuchet" , "verdana" , sans-serif; font-size: 12px; line-height: 16.8px; text-align: justify;"><code style="color: #006000;"><span style="color: red;">END</span><span style="color: #666666;"> { for (i=1;i<=im;i++) print freq[i],fc[i],ir[i] }</span></code></span></div>
</div>
<div style="background-color: white; font-family: Verdana, Helvetica, Arial, sans-serif; font-size: 13.3333px;">
<br /></div>
This will print the collected values in three columns, identical to the Python script.Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-8285029567606735209.post-8744118448149564422016-05-11T04:30:00.000+02:002017-02-15T13:43:14.158+01:00OCTAVE: read/write VASP POSCAR, CHGCAR<div style="background-color: white; font-family: Arial, Verdana, sans-serif; font-size: 13.3333px;">
<div>
<div>
<div>
Here you can find several functions that will help you to read and write <a href="https://www.vasp.at/" rel="nofollow" style="color: #551a8b; outline: none;" target="_blank">VASP</a> POSCAR and CHCAR files in <a href="http://www.gnu.org/software/octave/" rel="nofollow" style="color: #551a8b; outline: none;" target="_blank">Octave</a>. The files are commented and fairly easy to understand. Current version of the <code style="color: #006000;">read_POSCAR</code> handles the old and the new POSCAR format (the new format contains labels for the species). All gathered information is stored in one object "Structure". This makes extremely easy the addition of any new properties. Note hat it <code style="color: #006000;">read_CHGCAR</code> reads only the total density. If you need the difference, please change the code or the data.<br>
<br></div>
Test example:</div>
<div class="sites-codeblock sites-codesnippet-block" style="background-color: #efefef; border: 1px solid rgb(211, 211, 211); line-height: 1; padding: 0.5em 0px 0.5em 1em;">
<code style="color: #006000;">#!/usr/bin/octave -q</code><br>
<br>
<code style="color: #006000;"># Read CHGCAR file</code><br>
<code style="color: #006000;">Struct = read_CHGCAR("CHGCAR");</code><br>
<br>
<code style="color: #006000;"># Print all gathered values</code><br>
<code style="color: #006000;">Struct</code><br>
<br>
<code style="color: #006000;"># Do something</code><br>
<code style="color: #006000;"># Struct.Dens=circshift(Struct.Dens,[0 0 20]);</code><br>
<br>
<code style="color: #006000;"># Write the new Density</code><br>
<code style="color: #006000;">write_CHGCAR("CHGCAR-new",Struct);</code></div>
<br>
</div></div><a href="http://cm-tools.blogspot.com/2016/05/octave-readwrite-vasp-poscar-chgcar.html#more">Read more »</a>Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-8285029567606735209.post-36155692017890162462016-04-21T10:34:00.000+02:002017-02-15T13:50:04.183+01:00VASP CHGCAR difference and 2D plane cut through itThis post content is a <a href="https://sites.google.com/site/toawkornot/case-studies/-multiple-files---vasp-chgcar-difference" target="_blank">copy</a> from my awk workshop "<a href="https://sites.google.com/site/toawkornot/case-studies" target="_blank">Case studies</a>" section.<br>
<br>
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjdGGPEZlVYMGMOymw5-IUExdDVhL0g5iSlvOqBzXtrzrjWrmb3FrqkM2W1fV3jTTG7sMlTHmRkzwnxbZfMRacI519ogPySzhLpF7-5szjLhP0QNwzwoaR-YkoGERG7SKWggxouONfk79BU/s1600/Fig_06.png" imageanchor="1" style="clear: right; float: right; margin-bottom: 1em; margin-left: 1em;"><img border="0" height="107" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjdGGPEZlVYMGMOymw5-IUExdDVhL0g5iSlvOqBzXtrzrjWrmb3FrqkM2W1fV3jTTG7sMlTHmRkzwnxbZfMRacI519ogPySzhLpF7-5szjLhP0QNwzwoaR-YkoGERG7SKWggxouONfk79BU/s200/Fig_06.png" width="200"></a>From time to time, I need to calculate electron charge difference that is tabulated on a regular 3D grid. Common examples in my field will be Gaussian <a href="http://paulbourke.net/dataformats/cube/">.cube</a> files or VASP <a href="http://cms.mpi.univie.ac.at/vasp/vasp/CHGCAR_file.html" target="_blank">CHGCAR</a> files. One can find some scripts, tools and programs that can do this in one way or another. In my case, again, I need something slightly different and... Well, doing it with awk is so simple that I never use other tools but the one I will mention here. With small changes I am able to subtract 6 files at the same time, and since the files tend to be large, I keep them compressed.<br>
<a href="http://cm-tools.blogspot.com/2017/02/vasp-chgcar-difference-and-2d-plane-cut.html#more">Read more »</a>Unknownnoreply@blogger.com0