<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
<title type="text">Shiv Upadhyay</title>
<generator uri="https://github.com/jekyll/jekyll">Jekyll</generator>
<link rel="self" type="application/atom+xml" href="http://shivupa.github.io/feed.xml" />
<link rel="alternate" type="text/html" href="http://shivupa.github.io" />
<updated>2016-12-19T15:38:15+00:00</updated>
<id>http://shivupa.github.io/</id>
<author>
  <name>Shiv Upadhyay</name>
  <uri>http://shivupa.github.io/</uri>
  <email>upadhya1@duq.edu</email>
</author>


<entry>
  <title type="html"><![CDATA[Efficient Evaluation of the Boys Function]]></title>
  <link rel="alternate" type="text/html" href="http://shivupa.github.io/blog/efficient-evaluation-of-the-boys-function/" />
  <id>http://shivupa.github.io/blog/efficient-evaluation-of-the-boys-function</id>
  <published>2016-01-30T18:33:00+00:00</published>
  <updated>2016-01-30T18:33:00+00:00</updated>
  <author>
    <name>Shiv Upadhyay</name>
    <uri>http://shivupa.github.io</uri>
    <email>upadhya1@duq.edu</email>
  </author>
  <content type="html">
    &lt;p&gt;A side project that I’ve recently been working (or trying to work) on is coding a fast molecular integral library in c. An important function in the calculation of coulombic integrals is the Boys function, &lt;script type=&quot;math/tex&quot;&gt;F_n(x)&lt;/script&gt;. This function is given by:&lt;/p&gt;

&lt;script type=&quot;math/tex; mode=display&quot;&gt;F_n(x) = \int_0^1 e^{-xt^2} t^{2n} dt&lt;/script&gt;

&lt;p&gt;Evaluating this function frequently, accurately and quickly has been a focus of research for about the last half a century. I’ll present a simple example here.&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;plot1.png&quot; alt=&quot;plot1&quot; /&gt;&lt;/p&gt;

&lt;p&gt;The evaluation of the Boys function can be broken into two cases, large &lt;script type=&quot;math/tex&quot;&gt;x&lt;/script&gt; values and small &lt;script type=&quot;math/tex&quot;&gt;x&lt;/script&gt; values.
# Large &lt;script type=&quot;math/tex&quot;&gt;x&lt;/script&gt; values:&lt;/p&gt;

&lt;p&gt;For large x values the boys function can be approximated as:&lt;/p&gt;

&lt;script type=&quot;math/tex; mode=display&quot;&gt;F_n(x) = \int_0^1 e^{-xt^2} t^{2n} dt \approx \int_0^\infty e^{-xt^2} t^{2n} dt&lt;/script&gt;

&lt;p&gt;This is related to the incomplete gamma integral and can be integrated giving:
&lt;script type=&quot;math/tex&quot;&gt;F_n(x) \approx \frac{(2n-1)!!}{2^{n+1}} \sqrt{\frac{\pi}{x^{2n+1}}} \quad (x\ \mathrm{large})&lt;/script&gt;&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;plot2.png&quot; alt=&quot;plot2&quot; /&gt;&lt;/p&gt;

&lt;h1 id=&quot;small-x-values&quot;&gt;Small &lt;script type=&quot;math/tex&quot;&gt;x&lt;/script&gt; values:&lt;/h1&gt;
&lt;p&gt;To approximate the boys function for small &lt;script type=&quot;math/tex&quot;&gt;x&lt;/script&gt; values a Taylor expansion is employed:&lt;/p&gt;

&lt;script type=&quot;math/tex; mode=display&quot;&gt;F_n(x) = \sum_{k=0}^{\infty} \frac{(-x)^k}{k!(2n+2k+1)}&lt;/script&gt;

&lt;p&gt;An infinite series is impractical in application (obviously) so this is truncated to six terms to achieve reasonable accuracy in reasonable time.&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;plot3.png&quot; alt=&quot;plot3&quot; /&gt;&lt;/p&gt;

&lt;h1 id=&quot;where-does-x-become-large&quot;&gt;Where does &lt;script type=&quot;math/tex&quot;&gt;x&lt;/script&gt; become large?&lt;/h1&gt;

&lt;p&gt;&lt;img src=&quot;plot4.png&quot; alt=&quot;plot4&quot; /&gt;&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;plot4close.png&quot; alt=&quot;plot4close&quot; /&gt;&lt;/p&gt;

&lt;p&gt;This is a question which has been bothering me, but for now I sidestepped the issue by returning the lowest value calculated by the two methods.&lt;/p&gt;

&lt;h1 id=&quot;potential-speed-ups&quot;&gt;Potential speed ups&lt;/h1&gt;

&lt;p&gt;&lt;img src=&quot;plot5.png&quot; alt=&quot;plot5&quot; /&gt;&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;I’m calculating both expressions each time which is really bad&lt;/li&gt;
  &lt;li&gt;I’m not implementing any recursion formulas&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The later point is critical what I should be doing is calculating the Boys function at a very high order &lt;script type=&quot;math/tex&quot;&gt;n&lt;/script&gt; on a grid of &lt;script type=&quot;math/tex&quot;&gt;x&lt;/script&gt; points and using a downward recursion formula (upwards recursion is numerical unstable at smal &lt;script type=&quot;math/tex&quot;&gt;x&lt;/script&gt; values).&lt;/p&gt;

&lt;h1 id=&quot;references&quot;&gt;References&lt;/h1&gt;

&lt;ol&gt;
  &lt;li&gt;&lt;a href=&quot;http://www.wiley.com/WileyCDA/WileyTitle/productCd-1118531477.html&quot;&gt;Molecular Electronic-Structure Theory&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;http://link.springer.com/article/10.1007/s10910-005-9023-3&quot;&gt;Evaluation of the Boys Function using Analytical Relations&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;http://onlinelibrary.wiley.com/doi/10.1002/jcc.23935/abstract&quot;&gt;A rigorous and optimized strategy for the evaluation of the Boys function kernel in molecular electronic structure theory&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;http://onlinelibrary.wiley.com/doi/10.1002/(SICI)1097-461X(1996)59:3%3C209::AID-QUA4%3E3.0.CO;2-1/full?2-1/full&quot;&gt;ACE algorithm for the rapid evaluation of the electron-repulsion integral over Gaussian-type orbitals&lt;/a&gt;&lt;/li&gt;
&lt;/ol&gt;

    &lt;p&gt;&lt;a href=&quot;http://shivupa.github.io/blog/efficient-evaluation-of-the-boys-function/&quot;&gt;Efficient Evaluation of the Boys Function&lt;/a&gt; was originally published by Shiv Upadhyay at &lt;a href=&quot;http://shivupa.github.io&quot;&gt;Shiv Upadhyay&lt;/a&gt; on January 30, 2016.&lt;/p&gt;
  </content>
</entry>


<entry>
  <title type="html"><![CDATA[Setting Up Onedrive Academic on OSX]]></title>
  <link rel="alternate" type="text/html" href="http://shivupa.github.io/blog/setting-up-onedrive-academic-on-osx/" />
  <id>http://shivupa.github.io/blog/setting-up-onedrive-academic-on-osx</id>
  <published>2016-01-10T23:14:37+00:00</published>
  <updated>2016-01-10T23:14:37+00:00</updated>
  <author>
    <name>Shiv Upadhyay</name>
    <uri>http://shivupa.github.io</uri>
    <email>upadhya1@duq.edu</email>
  </author>
  <content type="html">
    &lt;p&gt;According to the web portal for my OneDrive, I was supposed to be getting 1 TB of storage, but when I logged into the OneDrive app on OSX I found myself sitting with 15 GB of storage.&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;Amount.png&quot; alt=&quot;Total&quot; /&gt;&lt;/p&gt;

&lt;p&gt;When I looked at the app, it turns out I was logged into a personal account that was created using my academic email.&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;Personal.png&quot; alt=&quot;Personal Account&quot; /&gt;&lt;/p&gt;

&lt;p&gt;It turns out the fix for this is easy simply type &lt;code class=&quot;highlighter-rouge&quot;&gt;defaults write com.microsoft.OneDrive-mac EnableAddAccounts -bool True&lt;/code&gt; into a terminal window and you will be able to log into a business account in OneDrive. (Apparently academic accounts are business accounts).&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;Wrong.png&quot; alt=&quot;Personal Account&quot; /&gt;&lt;/p&gt;

&lt;p&gt;This will allow you to log into the academic account and places another cloud on the menu bar.&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;Academic.png&quot; alt=&quot;Personal Account&quot; /&gt;&lt;/p&gt;

    &lt;p&gt;&lt;a href=&quot;http://shivupa.github.io/blog/setting-up-onedrive-academic-on-osx/&quot;&gt;Setting Up Onedrive Academic on OSX&lt;/a&gt; was originally published by Shiv Upadhyay at &lt;a href=&quot;http://shivupa.github.io&quot;&gt;Shiv Upadhyay&lt;/a&gt; on January 10, 2016.&lt;/p&gt;
  </content>
</entry>


<entry>
  <title type="html"><![CDATA[Making Publication Quality Images With VMD]]></title>
  <link rel="alternate" type="text/html" href="http://shivupa.github.io/blog/making-publication-quality-images-with-vmd/" />
  <id>http://shivupa.github.io/blog/making-publication-quality-images-with-vmd</id>
  <published>2016-01-10T14:42:38+00:00</published>
  <updated>2016-01-10T14:42:38+00:00</updated>
  <author>
    <name>Shiv Upadhyay</name>
    <uri>http://shivupa.github.io</uri>
    <email>upadhya1@duq.edu</email>
  </author>
  <content type="html">
    &lt;p&gt;I am a bit obsessive when it comes to the quality of images I produce. I have two preferences when it comes to an image:&lt;/p&gt;

&lt;ol&gt;
  &lt;li&gt;I always try to use vector images(SVG)&lt;/li&gt;
  &lt;li&gt;If I can’t use a vector, I use a 4k resolution (PNG)&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Rendering an image from VMD falls into the second category, but without setting it up correctly just rendering at 4k doesn’t look very great. Proper rendering in VMD requires the use of a ray tracing engine. Ray tracing is essentially a method that simulates the path of light in a scene and the interactions of these paths with the materials in the scene. I’ll provide an example here of rendering a water molecule.&lt;/p&gt;

&lt;p&gt;Steps:&lt;/p&gt;

&lt;ol&gt;
  &lt;li&gt;Load a PDB and set the axes off and the background to white
&lt;img src=&quot;Step1.png&quot; alt=&quot;Step 1&quot; title=&quot;Step1&quot; /&gt;&lt;/li&gt;
  &lt;li&gt;Choose the orthographic view
&lt;img src=&quot;Step2.png&quot; alt=&quot;Step 2&quot; title=&quot;Step2&quot; /&gt;&lt;/li&gt;
  &lt;li&gt;Navigate to the “Display Settings” options
&lt;img src=&quot;Step3.png&quot; alt=&quot;Step 3&quot; title=&quot;Step3&quot; /&gt;&lt;/li&gt;
  &lt;li&gt;Turn “Shadows” and “Ambient Occlusion” on
&lt;img src=&quot;Step4.png&quot; alt=&quot;Step 4&quot; title=&quot;Step4&quot; /&gt;&lt;/li&gt;
  &lt;li&gt;Navigate to the “Materials” options
&lt;img src=&quot;Step5.png&quot; alt=&quot;Step 5&quot; title=&quot;Step5&quot; /&gt;&lt;/li&gt;
  &lt;li&gt;Duplicate a material so you can modify the settings. Here I duplicated and modified the “AOChalky” material
&lt;img src=&quot;Step6.png&quot; alt=&quot;Step 6&quot; title=&quot;Step6&quot; /&gt;&lt;/li&gt;
  &lt;li&gt;Navigate to the “Render” options
&lt;img src=&quot;Step7.png&quot; alt=&quot;Step 7&quot; title=&quot;Step7&quot; /&gt;&lt;/li&gt;
  &lt;li&gt;Select the tachyon ray tracing option
&lt;img src=&quot;Step8.png&quot; alt=&quot;Step 8&quot; title=&quot;Step8&quot; /&gt;&lt;/li&gt;
  &lt;li&gt;Resize the display window using the console because you can make it bigger than the size of your screen this way. This may cause the view window to go blank. Don’t panic that’s fine. Render using the tachyon setting. This may take some time.
&lt;img src=&quot;Step9.png&quot; alt=&quot;Step 9&quot; title=&quot;Step9&quot; /&gt;&lt;/li&gt;
  &lt;li&gt;Save the visualization state for future renders
&lt;img src=&quot;Step10.png&quot; alt=&quot;Step 10&quot; title=&quot;Step10&quot; /&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;You can see the fruits of the render below. This took about ten minutes start to finish but resulted in a fairly polished product. If I were actually using this render for anything serious I would fix the “washed out” look that it currently has.&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;waterquickrender.png&quot; alt=&quot;Water Quick Render&quot; title=&quot;Water Quick Render&quot; /&gt;&lt;/p&gt;

&lt;p&gt;Here are a few of my better renders:&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;WaterCluster.png&quot; alt=&quot;Water Cluster&quot; title=&quot;Water Cluster&quot; /&gt;&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;WaterDimer.png&quot; alt=&quot;Water Dimer&quot; title=&quot;Water Dimer&quot; /&gt;&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;wateroverlay.png&quot; alt=&quot;Water Overlay&quot; title=&quot;Water Overlay&quot; /&gt;&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;H2O_density.png&quot; alt=&quot;Water Density&quot; title=&quot;Water Density&quot; /&gt;&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;solvation.png&quot; alt=&quot;Solvation&quot; title=&quot;Solvation&quot; /&gt;&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;folding.png&quot; alt=&quot;Folding&quot; title=&quot;Folding&quot; /&gt;&lt;/p&gt;

    &lt;p&gt;&lt;a href=&quot;http://shivupa.github.io/blog/making-publication-quality-images-with-vmd/&quot;&gt;Making Publication Quality Images With VMD&lt;/a&gt; was originally published by Shiv Upadhyay at &lt;a href=&quot;http://shivupa.github.io&quot;&gt;Shiv Upadhyay&lt;/a&gt; on January 10, 2016.&lt;/p&gt;
  </content>
</entry>


<entry>
  <title type="html"><![CDATA[Modifying CASINO's dmc.hist Plotting]]></title>
  <link rel="alternate" type="text/html" href="http://shivupa.github.io/blog/modifying-casinos-dmc-hist-plotting/" />
  <id>http://shivupa.github.io/blog/modifying-casinos-dmc-hist-plotting</id>
  <published>2016-01-10T04:59:02+00:00</published>
  <updated>2016-01-10T04:59:02+00:00</updated>
  <author>
    <name>Shiv Upadhyay</name>
    <uri>http://shivupa.github.io</uri>
    <email>upadhya1@duq.edu</email>
  </author>
  <content type="html">
    &lt;p&gt;CASINO is distributed with a means of visualizing the results of a Diffusion Monte Carlo run using the command: &lt;code class=&quot;highlighter-rouge&quot;&gt;graphdmc&lt;/code&gt;. This is obviously useful. However when I was trying to use this, I ran into some problems. The data I was attempting to plot was from a QMC of a water molecule using a trial wave function generated by Gaussian 09 using the Hartree-Fock method. The run had 1 million statistics collecting steps and a target population of 1000. The problem I encountered occured when the command was run; gnuplot would open a term window and hang most likely a result of the number of points being plotted (1 million steps for each of the 4 lines plotted).&lt;/p&gt;

&lt;p&gt;#The Solution:
I decided if gnuplot saved an image instead of attempting to draw to screen then this would solve the problem. I modified the original command and output a vector image (SVG).  Using inkscape, I then rendered to a 600 dpi png.&lt;br /&gt;
Modified Code is unavailable in compliance with the legal agreement with CASINO. &lt;br /&gt;
&lt;img src=&quot;CASINOPLOTTING/OriginalModified/output.png&quot; alt=&quot;Modified Plot&quot; /&gt;&lt;/p&gt;

&lt;p&gt;#The Solution (part 2):
The plot was acceptable, but I like to do things myself so I wrote a python program to do the same thing. I also included a legend and modified the plot titles. I like consistency so this will match the style of the other plots in my presentations, etc. In retrospect, the \(\tau\) by itself as the x-axis label isn’t incredibly informative so I may change that to Imaginary time steps or something along those lines.&lt;br /&gt;
Once again, the python code is available on my github &lt;a href=&quot;https://github.com/shivupa/CASINO_PLOTTING&quot;&gt;here&lt;/a&gt;.&lt;br /&gt;
&lt;img src=&quot;CASINOPLOTTING/Python/output.png&quot; alt=&quot;Modified Plot&quot; /&gt;&lt;/p&gt;

    &lt;p&gt;&lt;a href=&quot;http://shivupa.github.io/blog/modifying-casinos-dmc-hist-plotting/&quot;&gt;Modifying CASINO's dmc.hist Plotting&lt;/a&gt; was originally published by Shiv Upadhyay at &lt;a href=&quot;http://shivupa.github.io&quot;&gt;Shiv Upadhyay&lt;/a&gt; on January 10, 2016.&lt;/p&gt;
  </content>
</entry>


<entry>
  <title type="html"><![CDATA[A New Dawn]]></title>
  <link rel="alternate" type="text/html" href="http://shivupa.github.io/blog/a-new-site/" />
  <id>http://shivupa.github.io/blog/a-new-site</id>
  <published>2016-01-08T15:53:27+00:00</published>
  <updated>2016-01-08T15:53:27+00:00</updated>
  <author>
    <name>Shiv Upadhyay</name>
    <uri>http://shivupa.github.io</uri>
    <email>upadhya1@duq.edu</email>
  </author>
  <content type="html">
    &lt;h2 id=&quot;the-launch-of-shivupagithubioshivupagithubio&quot;&gt;The launch of &lt;a href=&quot;shivupa.github.io&quot;&gt;shivupa.github.io&lt;/a&gt;&lt;/h2&gt;

&lt;p&gt;Today marks the launch of this site. Forgoing the renewal of expensive hosting, I’ve chosen to move my digital footprint to Github! I aim to use this site as a web resume, but also as a blog featuring content related to computational chemistry.&lt;/p&gt;


    &lt;p&gt;&lt;a href=&quot;http://shivupa.github.io/blog/a-new-site/&quot;&gt;A New Dawn&lt;/a&gt; was originally published by Shiv Upadhyay at &lt;a href=&quot;http://shivupa.github.io&quot;&gt;Shiv Upadhyay&lt;/a&gt; on January 08, 2016.&lt;/p&gt;
  </content>
</entry>

</feed>