<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>http://micro.stanford.edu/mediawiki/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Alank2</id>
	<title>Micro and Nano Mechanics Group - User contributions [en]</title>
	<link rel="self" type="application/atom+xml" href="http://micro.stanford.edu/mediawiki/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Alank2"/>
	<link rel="alternate" type="text/html" href="http://micro.stanford.edu/wiki/Special:Contributions/Alank2"/>
	<updated>2026-07-06T01:40:21Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.39.7</generator>
	<entry>
		<id>http://micro.stanford.edu/mediawiki/index.php?title=Computational_XRD&amp;diff=6146</id>
		<title>Computational XRD</title>
		<link rel="alternate" type="text/html" href="http://micro.stanford.edu/mediawiki/index.php?title=Computational_XRD&amp;diff=6146"/>
		<updated>2015-08-23T21:57:52Z</updated>

		<summary type="html">&lt;p&gt;Alank2: /* Making Nanoparticles */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;P ALIGN=&amp;quot;CENTER&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;FONT SIZE=&amp;quot;+3&amp;quot; color=&amp;quot;darkred&amp;quot;&amp;gt;&amp;lt;STRONG&amp;gt;&lt;br /&gt;
Computational XRD&amp;lt;/STRONG&amp;gt;&amp;lt;/font&amp;gt;&amp;lt;/P&amp;gt;&lt;br /&gt;
&amp;lt;DIV&amp;gt;&lt;br /&gt;
&amp;lt;P ALIGN=&amp;quot;CENTER&amp;quot;&amp;gt;&amp;lt;STRONG&amp;gt; &amp;lt;/STRONG&amp;gt;&amp;lt;/P&amp;gt;&lt;br /&gt;
&amp;lt;/DIV&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Making Nanoparticles===&lt;br /&gt;
&lt;br /&gt;
Here we give an example of how to generate nanoparticles with different dislocations. One may have to play around a bit with the directories to make sure that the files get opened and written to the correct places. A python version of the MD++ code is necessary. The relevant python files are:&lt;br /&gt;
generate_particles.py&lt;br /&gt;
XRDsetup.py&lt;br /&gt;
&lt;br /&gt;
and these can be run with the command:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
bin/eam generate_particles.py&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;Notable Parameters&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# flag = 0 is no dislocations&lt;br /&gt;
# flag = 1 is only one dislocation&lt;br /&gt;
# flag = 2 is multiple randomly generated dislocations&lt;br /&gt;
flag = 0 &lt;br /&gt;
start = 40    # Radius of the nanoparticle&lt;br /&gt;
numDisls = 6  # if flag == 2, the number of dislocations&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This generates a series of .cn, .cfg, and a file of atomic positions which will be read by the C++ code to calculate the Intensity.&lt;br /&gt;
&lt;br /&gt;
===Intensity Calculation in C++===&lt;br /&gt;
&lt;br /&gt;
First, make sure the required libraries are installed. The GSL and C++11 packages are required (the GSL library is for easily making histograms). The required files are the previous file of atomic positions written by generate_particles.py and the following C++ file which can be run as:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
g++ -o XRD.exe XRD.cpp -lgsl -lgslcblas -lm -std=c++11&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
followed simply by &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
./XRD.exe&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Parameters&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
flag = 0 &lt;br /&gt;
Radius = 40   &lt;br /&gt;
&lt;br /&gt;
wavelength = 0.67 # the wavelength of the incident monochromatic X-ray beam&lt;br /&gt;
&lt;br /&gt;
num_bins = 25000   # the number of bins in the histogram per division&lt;br /&gt;
                   # the background noise is quite dependent on this&lt;br /&gt;
                   # parameter so don&#039;t make it too small&lt;br /&gt;
&lt;br /&gt;
N = 10000          # the number of Intensity points to calculate&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
I plan to run several different sizes and compare the time taken for this calculation for a fixed num_bins, divs, and N to access the scalability. Currently the code is highly un-optimized (completely serial) and still runs very fast. A 4 nm nanoparticle calculation takes ~30 seconds with this code.&lt;br /&gt;
&lt;br /&gt;
===Plotting and Interpolating===&lt;br /&gt;
&lt;br /&gt;
The next step is to read the file of Intensities and Q values into the python script attached. The Intensity and Q values that are either background before the first real Bragg peak or are small values past Q~20 are gotten rid of. The interpolation is only done on the largest 5-10 peaks. The number of peaks that can be reasonably interpolated decreases with increasing number of dislocations as the peaks broaden. The following file plots and interpolates the intensity and it should be run as:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
python MD++_plot.py Radius flag cutoff&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
where Radius, flag, and cutoff are parameters. These are some important parameters to consider, especially in the interpolation. &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Parameters&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
wavelength = 0.67&lt;br /&gt;
Radius = int(sys.argv[1])&lt;br /&gt;
flag = int(sys.argv[2])&lt;br /&gt;
cutoff = float(sys.argv[3])  # Bragg peaks with maximum below this cutoff will be ignored&lt;br /&gt;
tol = 0.1     # The Q range around which the program searches for a half-maximum.&lt;br /&gt;
              # This really doesn&#039;t need to be changed&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Thus the cutoff must be chosen carefully if one wants to get the most number of peaks that have resolved half-widths. This gets more important with increased peak broadening.&lt;br /&gt;
&lt;br /&gt;
===CUDA Code===&lt;br /&gt;
The code is obviously parallel. The next step is to re-write the code in CUDA to improve speed. The vast majority of time is spent in the distances calculation so for now, only this section will be made into a CUDA kernel. As the particles get bigger and more heavily deformed, the number of bins may need to be increased, leading to a notable increase in the XRD time. Unless the number of bins necessary is outrageously large (even at the huge overkill of 100,000 bins for a 4 nm nanoparticle, the entire calculation of distances + XRD takes 75 seconds), the XRD time should not get too large from this contribution. One important note is that the cluster of GPUs need to have the GSL libraries available.&lt;/div&gt;</summary>
		<author><name>Alank2</name></author>
	</entry>
	<entry>
		<id>http://micro.stanford.edu/mediawiki/index.php?title=Computational_XRD&amp;diff=6145</id>
		<title>Computational XRD</title>
		<link rel="alternate" type="text/html" href="http://micro.stanford.edu/mediawiki/index.php?title=Computational_XRD&amp;diff=6145"/>
		<updated>2015-08-23T21:57:22Z</updated>

		<summary type="html">&lt;p&gt;Alank2: /* Intensity Calculation in C++ */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;P ALIGN=&amp;quot;CENTER&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;FONT SIZE=&amp;quot;+3&amp;quot; color=&amp;quot;darkred&amp;quot;&amp;gt;&amp;lt;STRONG&amp;gt;&lt;br /&gt;
Computational XRD&amp;lt;/STRONG&amp;gt;&amp;lt;/font&amp;gt;&amp;lt;/P&amp;gt;&lt;br /&gt;
&amp;lt;DIV&amp;gt;&lt;br /&gt;
&amp;lt;P ALIGN=&amp;quot;CENTER&amp;quot;&amp;gt;&amp;lt;STRONG&amp;gt; &amp;lt;/STRONG&amp;gt;&amp;lt;/P&amp;gt;&lt;br /&gt;
&amp;lt;/DIV&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Making Nanoparticles===&lt;br /&gt;
&lt;br /&gt;
Here we give an example of how to generate nanoparticles with different dislocations. One may have to play around a bit with the directories to make sure that the files get opened and written to the correct places. A python version of the MD++ code is necessary. The relevant python files are:&lt;br /&gt;
generate_particles.py&lt;br /&gt;
XRDsetup.py&lt;br /&gt;
&lt;br /&gt;
and these can be run with the command:&lt;br /&gt;
bin/eam generate_particles.py&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Notable Parameters&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# flag = 0 is no dislocations&lt;br /&gt;
# flag = 1 is only one dislocation&lt;br /&gt;
# flag = 2 is multiple randomly generated dislocations&lt;br /&gt;
flag = 0 &lt;br /&gt;
start = 40    # Radius of the nanoparticle&lt;br /&gt;
numDisls = 6  # if flag == 2, the number of dislocations&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This generates a series of .cn, .cfg, and a file of atomic positions which will be read by the C++ code to calculate the Intensity.&lt;br /&gt;
&lt;br /&gt;
===Intensity Calculation in C++===&lt;br /&gt;
&lt;br /&gt;
First, make sure the required libraries are installed. The GSL and C++11 packages are required (the GSL library is for easily making histograms). The required files are the previous file of atomic positions written by generate_particles.py and the following C++ file which can be run as:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
g++ -o XRD.exe XRD.cpp -lgsl -lgslcblas -lm -std=c++11&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
followed simply by &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
./XRD.exe&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Parameters&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
flag = 0 &lt;br /&gt;
Radius = 40   &lt;br /&gt;
&lt;br /&gt;
wavelength = 0.67 # the wavelength of the incident monochromatic X-ray beam&lt;br /&gt;
&lt;br /&gt;
num_bins = 25000   # the number of bins in the histogram per division&lt;br /&gt;
                   # the background noise is quite dependent on this&lt;br /&gt;
                   # parameter so don&#039;t make it too small&lt;br /&gt;
&lt;br /&gt;
N = 10000          # the number of Intensity points to calculate&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
I plan to run several different sizes and compare the time taken for this calculation for a fixed num_bins, divs, and N to access the scalability. Currently the code is highly un-optimized (completely serial) and still runs very fast. A 4 nm nanoparticle calculation takes ~30 seconds with this code.&lt;br /&gt;
&lt;br /&gt;
===Plotting and Interpolating===&lt;br /&gt;
&lt;br /&gt;
The next step is to read the file of Intensities and Q values into the python script attached. The Intensity and Q values that are either background before the first real Bragg peak or are small values past Q~20 are gotten rid of. The interpolation is only done on the largest 5-10 peaks. The number of peaks that can be reasonably interpolated decreases with increasing number of dislocations as the peaks broaden. The following file plots and interpolates the intensity and it should be run as:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
python MD++_plot.py Radius flag cutoff&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
where Radius, flag, and cutoff are parameters. These are some important parameters to consider, especially in the interpolation. &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Parameters&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
wavelength = 0.67&lt;br /&gt;
Radius = int(sys.argv[1])&lt;br /&gt;
flag = int(sys.argv[2])&lt;br /&gt;
cutoff = float(sys.argv[3])  # Bragg peaks with maximum below this cutoff will be ignored&lt;br /&gt;
tol = 0.1     # The Q range around which the program searches for a half-maximum.&lt;br /&gt;
              # This really doesn&#039;t need to be changed&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Thus the cutoff must be chosen carefully if one wants to get the most number of peaks that have resolved half-widths. This gets more important with increased peak broadening.&lt;br /&gt;
&lt;br /&gt;
===CUDA Code===&lt;br /&gt;
The code is obviously parallel. The next step is to re-write the code in CUDA to improve speed. The vast majority of time is spent in the distances calculation so for now, only this section will be made into a CUDA kernel. As the particles get bigger and more heavily deformed, the number of bins may need to be increased, leading to a notable increase in the XRD time. Unless the number of bins necessary is outrageously large (even at the huge overkill of 100,000 bins for a 4 nm nanoparticle, the entire calculation of distances + XRD takes 75 seconds), the XRD time should not get too large from this contribution. One important note is that the cluster of GPUs need to have the GSL libraries available.&lt;/div&gt;</summary>
		<author><name>Alank2</name></author>
	</entry>
	<entry>
		<id>http://micro.stanford.edu/mediawiki/index.php?title=Computational_XRD&amp;diff=6144</id>
		<title>Computational XRD</title>
		<link rel="alternate" type="text/html" href="http://micro.stanford.edu/mediawiki/index.php?title=Computational_XRD&amp;diff=6144"/>
		<updated>2015-08-23T21:56:37Z</updated>

		<summary type="html">&lt;p&gt;Alank2: /* Making Nanoparticles */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;P ALIGN=&amp;quot;CENTER&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;FONT SIZE=&amp;quot;+3&amp;quot; color=&amp;quot;darkred&amp;quot;&amp;gt;&amp;lt;STRONG&amp;gt;&lt;br /&gt;
Computational XRD&amp;lt;/STRONG&amp;gt;&amp;lt;/font&amp;gt;&amp;lt;/P&amp;gt;&lt;br /&gt;
&amp;lt;DIV&amp;gt;&lt;br /&gt;
&amp;lt;P ALIGN=&amp;quot;CENTER&amp;quot;&amp;gt;&amp;lt;STRONG&amp;gt; &amp;lt;/STRONG&amp;gt;&amp;lt;/P&amp;gt;&lt;br /&gt;
&amp;lt;/DIV&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Making Nanoparticles===&lt;br /&gt;
&lt;br /&gt;
Here we give an example of how to generate nanoparticles with different dislocations. One may have to play around a bit with the directories to make sure that the files get opened and written to the correct places. A python version of the MD++ code is necessary. The relevant python files are:&lt;br /&gt;
generate_particles.py&lt;br /&gt;
XRDsetup.py&lt;br /&gt;
&lt;br /&gt;
and these can be run with the command:&lt;br /&gt;
bin/eam generate_particles.py&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Notable Parameters&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# flag = 0 is no dislocations&lt;br /&gt;
# flag = 1 is only one dislocation&lt;br /&gt;
# flag = 2 is multiple randomly generated dislocations&lt;br /&gt;
flag = 0 &lt;br /&gt;
start = 40    # Radius of the nanoparticle&lt;br /&gt;
numDisls = 6  # if flag == 2, the number of dislocations&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This generates a series of .cn, .cfg, and a file of atomic positions which will be read by the C++ code to calculate the Intensity.&lt;br /&gt;
&lt;br /&gt;
===Intensity Calculation in C++===&lt;br /&gt;
&lt;br /&gt;
First, make sure the required libraries are installed. The GSL and C++11 packages are required (the GSL library is for easily making histograms). The required files are the previous file of atomic positions and the attached C++ file:&lt;br /&gt;
&lt;br /&gt;
Now we are ready to run&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
g++ -o XRD.exe XRD.cpp -lgsl -lgslcblas -lm -std=c++11&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
followed simply by &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
./XRD.exe&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Parameters&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
flag = 0 &lt;br /&gt;
Radius = 40   &lt;br /&gt;
&lt;br /&gt;
wavelength = 0.67 # the wavelength of the incident monochromatic X-ray beam&lt;br /&gt;
&lt;br /&gt;
num_bins = 25000   # the number of bins in the histogram per division&lt;br /&gt;
                   # the background noise is quite dependent on this&lt;br /&gt;
                   # parameter so don&#039;t make it too small&lt;br /&gt;
&lt;br /&gt;
N = 10000          # the number of Intensity points to calculate&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
I plan to run several different sizes and compare the time taken for this calculation for a fixed num_bins, divs, and N to access the scalability. Currently the code is highly un-optimized (completely serial) and still runs very fast. A 4 nm nanoparticle calculation takes ~30 seconds with this code.&lt;br /&gt;
&lt;br /&gt;
===Plotting and Interpolating===&lt;br /&gt;
&lt;br /&gt;
The next step is to read the file of Intensities and Q values into the python script attached. The Intensity and Q values that are either background before the first real Bragg peak or are small values past Q~20 are gotten rid of. The interpolation is only done on the largest 5-10 peaks. The number of peaks that can be reasonably interpolated decreases with increasing number of dislocations as the peaks broaden. The following file plots and interpolates the intensity and it should be run as:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
python MD++_plot.py Radius flag cutoff&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
where Radius, flag, and cutoff are parameters. These are some important parameters to consider, especially in the interpolation. &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Parameters&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
wavelength = 0.67&lt;br /&gt;
Radius = int(sys.argv[1])&lt;br /&gt;
flag = int(sys.argv[2])&lt;br /&gt;
cutoff = float(sys.argv[3])  # Bragg peaks with maximum below this cutoff will be ignored&lt;br /&gt;
tol = 0.1     # The Q range around which the program searches for a half-maximum.&lt;br /&gt;
              # This really doesn&#039;t need to be changed&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Thus the cutoff must be chosen carefully if one wants to get the most number of peaks that have resolved half-widths. This gets more important with increased peak broadening.&lt;br /&gt;
&lt;br /&gt;
===CUDA Code===&lt;br /&gt;
The code is obviously parallel. The next step is to re-write the code in CUDA to improve speed. The vast majority of time is spent in the distances calculation so for now, only this section will be made into a CUDA kernel. As the particles get bigger and more heavily deformed, the number of bins may need to be increased, leading to a notable increase in the XRD time. Unless the number of bins necessary is outrageously large (even at the huge overkill of 100,000 bins for a 4 nm nanoparticle, the entire calculation of distances + XRD takes 75 seconds), the XRD time should not get too large from this contribution. One important note is that the cluster of GPUs need to have the GSL libraries available.&lt;/div&gt;</summary>
		<author><name>Alank2</name></author>
	</entry>
	<entry>
		<id>http://micro.stanford.edu/mediawiki/index.php?title=Computational_XRD&amp;diff=6143</id>
		<title>Computational XRD</title>
		<link rel="alternate" type="text/html" href="http://micro.stanford.edu/mediawiki/index.php?title=Computational_XRD&amp;diff=6143"/>
		<updated>2015-08-23T21:54:23Z</updated>

		<summary type="html">&lt;p&gt;Alank2: /* Making Nanoparticles */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;P ALIGN=&amp;quot;CENTER&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;FONT SIZE=&amp;quot;+3&amp;quot; color=&amp;quot;darkred&amp;quot;&amp;gt;&amp;lt;STRONG&amp;gt;&lt;br /&gt;
Computational XRD&amp;lt;/STRONG&amp;gt;&amp;lt;/font&amp;gt;&amp;lt;/P&amp;gt;&lt;br /&gt;
&amp;lt;DIV&amp;gt;&lt;br /&gt;
&amp;lt;P ALIGN=&amp;quot;CENTER&amp;quot;&amp;gt;&amp;lt;STRONG&amp;gt; &amp;lt;/STRONG&amp;gt;&amp;lt;/P&amp;gt;&lt;br /&gt;
&amp;lt;/DIV&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Making Nanoparticles===&lt;br /&gt;
&lt;br /&gt;
Here we give an example of how to generate nanoparticles with different dislocations. One may have to play around a bit with the directories to make sure that the files get opened and written to the correct places. A python version of the MD++ code is necessary. The relevant python files are:&lt;br /&gt;
[[media:generate_particles.py | generate_particles.py]] &lt;br /&gt;
&lt;br /&gt;
XRDsetup.py&lt;br /&gt;
&lt;br /&gt;
and these can be run with the command:&lt;br /&gt;
bin/eam generate_particles.py&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Notable Parameters&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# flag = 0 is no dislocations&lt;br /&gt;
# flag = 1 is only one dislocation&lt;br /&gt;
# flag = 2 is multiple randomly generated dislocations&lt;br /&gt;
flag = 0 &lt;br /&gt;
start = 40    # Radius of the nanoparticle&lt;br /&gt;
numDisls = 6  # if flag == 2, the number of dislocations&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This generates a series of .cn, .cfg, and a file of atomic positions which will be read by the C++ code to calculate the Intensity.&lt;br /&gt;
&lt;br /&gt;
===Intensity Calculation in C++===&lt;br /&gt;
&lt;br /&gt;
First, make sure the required libraries are installed. The GSL and C++11 packages are required (the GSL library is for easily making histograms). The required files are the previous file of atomic positions and the attached C++ file:&lt;br /&gt;
&lt;br /&gt;
Now we are ready to run&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
g++ -o XRD.exe XRD.cpp -lgsl -lgslcblas -lm -std=c++11&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
followed simply by &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
./XRD.exe&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Parameters&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
flag = 0 &lt;br /&gt;
Radius = 40   &lt;br /&gt;
&lt;br /&gt;
wavelength = 0.67 # the wavelength of the incident monochromatic X-ray beam&lt;br /&gt;
&lt;br /&gt;
num_bins = 25000   # the number of bins in the histogram per division&lt;br /&gt;
                   # the background noise is quite dependent on this&lt;br /&gt;
                   # parameter so don&#039;t make it too small&lt;br /&gt;
&lt;br /&gt;
N = 10000          # the number of Intensity points to calculate&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
I plan to run several different sizes and compare the time taken for this calculation for a fixed num_bins, divs, and N to access the scalability. Currently the code is highly un-optimized (completely serial) and still runs very fast. A 4 nm nanoparticle calculation takes ~30 seconds with this code.&lt;br /&gt;
&lt;br /&gt;
===Plotting and Interpolating===&lt;br /&gt;
&lt;br /&gt;
The next step is to read the file of Intensities and Q values into the python script attached. The Intensity and Q values that are either background before the first real Bragg peak or are small values past Q~20 are gotten rid of. The interpolation is only done on the largest 5-10 peaks. The number of peaks that can be reasonably interpolated decreases with increasing number of dislocations as the peaks broaden. The following file plots and interpolates the intensity and it should be run as:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
python MD++_plot.py Radius flag cutoff&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
where Radius, flag, and cutoff are parameters. These are some important parameters to consider, especially in the interpolation. &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Parameters&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
wavelength = 0.67&lt;br /&gt;
Radius = int(sys.argv[1])&lt;br /&gt;
flag = int(sys.argv[2])&lt;br /&gt;
cutoff = float(sys.argv[3])  # Bragg peaks with maximum below this cutoff will be ignored&lt;br /&gt;
tol = 0.1     # The Q range around which the program searches for a half-maximum.&lt;br /&gt;
              # This really doesn&#039;t need to be changed&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Thus the cutoff must be chosen carefully if one wants to get the most number of peaks that have resolved half-widths. This gets more important with increased peak broadening.&lt;br /&gt;
&lt;br /&gt;
===CUDA Code===&lt;br /&gt;
The code is obviously parallel. The next step is to re-write the code in CUDA to improve speed. The vast majority of time is spent in the distances calculation so for now, only this section will be made into a CUDA kernel. As the particles get bigger and more heavily deformed, the number of bins may need to be increased, leading to a notable increase in the XRD time. Unless the number of bins necessary is outrageously large (even at the huge overkill of 100,000 bins for a 4 nm nanoparticle, the entire calculation of distances + XRD takes 75 seconds), the XRD time should not get too large from this contribution. One important note is that the cluster of GPUs need to have the GSL libraries available.&lt;/div&gt;</summary>
		<author><name>Alank2</name></author>
	</entry>
	<entry>
		<id>http://micro.stanford.edu/mediawiki/index.php?title=Computational_XRD&amp;diff=6142</id>
		<title>Computational XRD</title>
		<link rel="alternate" type="text/html" href="http://micro.stanford.edu/mediawiki/index.php?title=Computational_XRD&amp;diff=6142"/>
		<updated>2015-08-23T21:50:55Z</updated>

		<summary type="html">&lt;p&gt;Alank2: /* CUDA Code */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;P ALIGN=&amp;quot;CENTER&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;FONT SIZE=&amp;quot;+3&amp;quot; color=&amp;quot;darkred&amp;quot;&amp;gt;&amp;lt;STRONG&amp;gt;&lt;br /&gt;
Computational XRD&amp;lt;/STRONG&amp;gt;&amp;lt;/font&amp;gt;&amp;lt;/P&amp;gt;&lt;br /&gt;
&amp;lt;DIV&amp;gt;&lt;br /&gt;
&amp;lt;P ALIGN=&amp;quot;CENTER&amp;quot;&amp;gt;&amp;lt;STRONG&amp;gt; &amp;lt;/STRONG&amp;gt;&amp;lt;/P&amp;gt;&lt;br /&gt;
&amp;lt;/DIV&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Making Nanoparticles===&lt;br /&gt;
&lt;br /&gt;
Here we give an example of how to generate nanoparticles with different dislocations. One may have to play around a bit with the directories to make sure that the files get opened and written to the correct places. A python version of the MD++ code is necessary. The relevant python files are:&lt;br /&gt;
&lt;br /&gt;
generate_particles.py&lt;br /&gt;
XRDsetup.py&lt;br /&gt;
&lt;br /&gt;
and these can be run with the command:&lt;br /&gt;
bin/eam generate_particles.py&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Notable Parameters&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# flag = 0 is no dislocations&lt;br /&gt;
# flag = 1 is only one dislocation&lt;br /&gt;
# flag = 2 is multiple randomly generated dislocations&lt;br /&gt;
flag = 0 &lt;br /&gt;
start = 40    # Radius of the nanoparticle&lt;br /&gt;
numDisls = 6  # if flag == 2, the number of dislocations&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This generates a series of .cn, .cfg, and a file of atomic positions which will be read by the C++ code to calculate the Intensity. &lt;br /&gt;
&lt;br /&gt;
===Intensity Calculation in C++===&lt;br /&gt;
&lt;br /&gt;
First, make sure the required libraries are installed. The GSL and C++11 packages are required (the GSL library is for easily making histograms). The required files are the previous file of atomic positions and the attached C++ file:&lt;br /&gt;
&lt;br /&gt;
Now we are ready to run&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
g++ -o XRD.exe XRD.cpp -lgsl -lgslcblas -lm -std=c++11&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
followed simply by &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
./XRD.exe&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Parameters&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
flag = 0 &lt;br /&gt;
Radius = 40   &lt;br /&gt;
&lt;br /&gt;
wavelength = 0.67 # the wavelength of the incident monochromatic X-ray beam&lt;br /&gt;
&lt;br /&gt;
num_bins = 25000   # the number of bins in the histogram per division&lt;br /&gt;
                   # the background noise is quite dependent on this&lt;br /&gt;
                   # parameter so don&#039;t make it too small&lt;br /&gt;
&lt;br /&gt;
N = 10000          # the number of Intensity points to calculate&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
I plan to run several different sizes and compare the time taken for this calculation for a fixed num_bins, divs, and N to access the scalability. Currently the code is highly un-optimized (completely serial) and still runs very fast. A 4 nm nanoparticle calculation takes ~30 seconds with this code.&lt;br /&gt;
&lt;br /&gt;
===Plotting and Interpolating===&lt;br /&gt;
&lt;br /&gt;
The next step is to read the file of Intensities and Q values into the python script attached. The Intensity and Q values that are either background before the first real Bragg peak or are small values past Q~20 are gotten rid of. The interpolation is only done on the largest 5-10 peaks. The number of peaks that can be reasonably interpolated decreases with increasing number of dislocations as the peaks broaden. The following file plots and interpolates the intensity and it should be run as:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
python MD++_plot.py Radius flag cutoff&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
where Radius, flag, and cutoff are parameters. These are some important parameters to consider, especially in the interpolation. &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Parameters&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
wavelength = 0.67&lt;br /&gt;
Radius = int(sys.argv[1])&lt;br /&gt;
flag = int(sys.argv[2])&lt;br /&gt;
cutoff = float(sys.argv[3])  # Bragg peaks with maximum below this cutoff will be ignored&lt;br /&gt;
tol = 0.1     # The Q range around which the program searches for a half-maximum.&lt;br /&gt;
              # This really doesn&#039;t need to be changed&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Thus the cutoff must be chosen carefully if one wants to get the most number of peaks that have resolved half-widths. This gets more important with increased peak broadening.&lt;br /&gt;
&lt;br /&gt;
===CUDA Code===&lt;br /&gt;
The code is obviously parallel. The next step is to re-write the code in CUDA to improve speed. The vast majority of time is spent in the distances calculation so for now, only this section will be made into a CUDA kernel. As the particles get bigger and more heavily deformed, the number of bins may need to be increased, leading to a notable increase in the XRD time. Unless the number of bins necessary is outrageously large (even at the huge overkill of 100,000 bins for a 4 nm nanoparticle, the entire calculation of distances + XRD takes 75 seconds), the XRD time should not get too large from this contribution. One important note is that the cluster of GPUs need to have the GSL libraries available.&lt;/div&gt;</summary>
		<author><name>Alank2</name></author>
	</entry>
	<entry>
		<id>http://micro.stanford.edu/mediawiki/index.php?title=Computational_XRD&amp;diff=6141</id>
		<title>Computational XRD</title>
		<link rel="alternate" type="text/html" href="http://micro.stanford.edu/mediawiki/index.php?title=Computational_XRD&amp;diff=6141"/>
		<updated>2015-08-23T21:47:51Z</updated>

		<summary type="html">&lt;p&gt;Alank2: /* CUDA Code */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;P ALIGN=&amp;quot;CENTER&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;FONT SIZE=&amp;quot;+3&amp;quot; color=&amp;quot;darkred&amp;quot;&amp;gt;&amp;lt;STRONG&amp;gt;&lt;br /&gt;
Computational XRD&amp;lt;/STRONG&amp;gt;&amp;lt;/font&amp;gt;&amp;lt;/P&amp;gt;&lt;br /&gt;
&amp;lt;DIV&amp;gt;&lt;br /&gt;
&amp;lt;P ALIGN=&amp;quot;CENTER&amp;quot;&amp;gt;&amp;lt;STRONG&amp;gt; &amp;lt;/STRONG&amp;gt;&amp;lt;/P&amp;gt;&lt;br /&gt;
&amp;lt;/DIV&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Making Nanoparticles===&lt;br /&gt;
&lt;br /&gt;
Here we give an example of how to generate nanoparticles with different dislocations. One may have to play around a bit with the directories to make sure that the files get opened and written to the correct places. A python version of the MD++ code is necessary. The relevant python files are:&lt;br /&gt;
&lt;br /&gt;
generate_particles.py&lt;br /&gt;
XRDsetup.py&lt;br /&gt;
&lt;br /&gt;
and these can be run with the command:&lt;br /&gt;
bin/eam generate_particles.py&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Notable Parameters&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# flag = 0 is no dislocations&lt;br /&gt;
# flag = 1 is only one dislocation&lt;br /&gt;
# flag = 2 is multiple randomly generated dislocations&lt;br /&gt;
flag = 0 &lt;br /&gt;
start = 40    # Radius of the nanoparticle&lt;br /&gt;
numDisls = 6  # if flag == 2, the number of dislocations&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This generates a series of .cn, .cfg, and a file of atomic positions which will be read by the C++ code to calculate the Intensity. &lt;br /&gt;
&lt;br /&gt;
===Intensity Calculation in C++===&lt;br /&gt;
&lt;br /&gt;
First, make sure the required libraries are installed. The GSL and C++11 packages are required (the GSL library is for easily making histograms). The required files are the previous file of atomic positions and the attached C++ file:&lt;br /&gt;
&lt;br /&gt;
Now we are ready to run&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
g++ -o XRD.exe XRD.cpp -lgsl -lgslcblas -lm -std=c++11&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
followed simply by &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
./XRD.exe&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Parameters&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
flag = 0 &lt;br /&gt;
Radius = 40   &lt;br /&gt;
&lt;br /&gt;
wavelength = 0.67 # the wavelength of the incident monochromatic X-ray beam&lt;br /&gt;
&lt;br /&gt;
num_bins = 25000   # the number of bins in the histogram per division&lt;br /&gt;
                   # the background noise is quite dependent on this&lt;br /&gt;
                   # parameter so don&#039;t make it too small&lt;br /&gt;
&lt;br /&gt;
N = 10000          # the number of Intensity points to calculate&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
I plan to run several different sizes and compare the time taken for this calculation for a fixed num_bins, divs, and N to access the scalability. Currently the code is highly un-optimized (completely serial) and still runs very fast. A 4 nm nanoparticle calculation takes ~30 seconds with this code.&lt;br /&gt;
&lt;br /&gt;
===Plotting and Interpolating===&lt;br /&gt;
&lt;br /&gt;
The next step is to read the file of Intensities and Q values into the python script attached. The Intensity and Q values that are either background before the first real Bragg peak or are small values past Q~20 are gotten rid of. The interpolation is only done on the largest 5-10 peaks. The number of peaks that can be reasonably interpolated decreases with increasing number of dislocations as the peaks broaden. The following file plots and interpolates the intensity and it should be run as:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
python MD++_plot.py Radius flag cutoff&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
where Radius, flag, and cutoff are parameters. These are some important parameters to consider, especially in the interpolation. &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Parameters&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
wavelength = 0.67&lt;br /&gt;
Radius = int(sys.argv[1])&lt;br /&gt;
flag = int(sys.argv[2])&lt;br /&gt;
cutoff = float(sys.argv[3])  # Bragg peaks with maximum below this cutoff will be ignored&lt;br /&gt;
tol = 0.1     # The Q range around which the program searches for a half-maximum.&lt;br /&gt;
              # This really doesn&#039;t need to be changed&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Thus the cutoff must be chosen carefully if one wants to get the most number of peaks that have resolved half-widths. This gets more important with increased peak broadening.&lt;br /&gt;
&lt;br /&gt;
===CUDA Code===&lt;br /&gt;
The code is obviously parallel. The next step is to re-write the code in CUDA to improve speed. The vast majority of time is spent in the distances calculation so for now, only this section will be made into a CUDA kernel. As the particles get bigger and more heavily deformed, the number of bins may need to be increased, leading to a notable increase in the XRD time. Unless the number of bins necessary is outrageously large (even at the huge overkill of 100,000 bins for a 4 nm nanoparticle, the entire calculation of distances + XRD takes ), the XRD time should not get too large from this contribution. One important note is that the cluster of GPUs need to have the gsl libraries available.&lt;/div&gt;</summary>
		<author><name>Alank2</name></author>
	</entry>
	<entry>
		<id>http://micro.stanford.edu/mediawiki/index.php?title=Computational_XRD&amp;diff=6140</id>
		<title>Computational XRD</title>
		<link rel="alternate" type="text/html" href="http://micro.stanford.edu/mediawiki/index.php?title=Computational_XRD&amp;diff=6140"/>
		<updated>2015-08-23T21:43:19Z</updated>

		<summary type="html">&lt;p&gt;Alank2: /* Intensity Calculation in C++ */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;P ALIGN=&amp;quot;CENTER&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;FONT SIZE=&amp;quot;+3&amp;quot; color=&amp;quot;darkred&amp;quot;&amp;gt;&amp;lt;STRONG&amp;gt;&lt;br /&gt;
Computational XRD&amp;lt;/STRONG&amp;gt;&amp;lt;/font&amp;gt;&amp;lt;/P&amp;gt;&lt;br /&gt;
&amp;lt;DIV&amp;gt;&lt;br /&gt;
&amp;lt;P ALIGN=&amp;quot;CENTER&amp;quot;&amp;gt;&amp;lt;STRONG&amp;gt; &amp;lt;/STRONG&amp;gt;&amp;lt;/P&amp;gt;&lt;br /&gt;
&amp;lt;/DIV&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Making Nanoparticles===&lt;br /&gt;
&lt;br /&gt;
Here we give an example of how to generate nanoparticles with different dislocations. One may have to play around a bit with the directories to make sure that the files get opened and written to the correct places. A python version of the MD++ code is necessary. The relevant python files are:&lt;br /&gt;
&lt;br /&gt;
generate_particles.py&lt;br /&gt;
XRDsetup.py&lt;br /&gt;
&lt;br /&gt;
and these can be run with the command:&lt;br /&gt;
bin/eam generate_particles.py&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Notable Parameters&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# flag = 0 is no dislocations&lt;br /&gt;
# flag = 1 is only one dislocation&lt;br /&gt;
# flag = 2 is multiple randomly generated dislocations&lt;br /&gt;
flag = 0 &lt;br /&gt;
start = 40    # Radius of the nanoparticle&lt;br /&gt;
numDisls = 6  # if flag == 2, the number of dislocations&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This generates a series of .cn, .cfg, and a file of atomic positions which will be read by the C++ code to calculate the Intensity. &lt;br /&gt;
&lt;br /&gt;
===Intensity Calculation in C++===&lt;br /&gt;
&lt;br /&gt;
First, make sure the required libraries are installed. The GSL and C++11 packages are required (the GSL library is for easily making histograms). The required files are the previous file of atomic positions and the attached C++ file:&lt;br /&gt;
&lt;br /&gt;
Now we are ready to run&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
g++ -o XRD.exe XRD.cpp -lgsl -lgslcblas -lm -std=c++11&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
followed simply by &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
./XRD.exe&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Parameters&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
flag = 0 &lt;br /&gt;
Radius = 40   &lt;br /&gt;
&lt;br /&gt;
wavelength = 0.67 # the wavelength of the incident monochromatic X-ray beam&lt;br /&gt;
&lt;br /&gt;
num_bins = 25000   # the number of bins in the histogram per division&lt;br /&gt;
                   # the background noise is quite dependent on this&lt;br /&gt;
                   # parameter so don&#039;t make it too small&lt;br /&gt;
&lt;br /&gt;
N = 10000          # the number of Intensity points to calculate&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
I plan to run several different sizes and compare the time taken for this calculation for a fixed num_bins, divs, and N to access the scalability. Currently the code is highly un-optimized (completely serial) and still runs very fast. A 4 nm nanoparticle calculation takes ~30 seconds with this code.&lt;br /&gt;
&lt;br /&gt;
===Plotting and Interpolating===&lt;br /&gt;
&lt;br /&gt;
The next step is to read the file of Intensities and Q values into the python script attached. The Intensity and Q values that are either background before the first real Bragg peak or are small values past Q~20 are gotten rid of. The interpolation is only done on the largest 5-10 peaks. The number of peaks that can be reasonably interpolated decreases with increasing number of dislocations as the peaks broaden. The following file plots and interpolates the intensity and it should be run as:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
python MD++_plot.py Radius flag cutoff&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
where Radius, flag, and cutoff are parameters. These are some important parameters to consider, especially in the interpolation. &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Parameters&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
wavelength = 0.67&lt;br /&gt;
Radius = int(sys.argv[1])&lt;br /&gt;
flag = int(sys.argv[2])&lt;br /&gt;
cutoff = float(sys.argv[3])  # Bragg peaks with maximum below this cutoff will be ignored&lt;br /&gt;
tol = 0.1     # The Q range around which the program searches for a half-maximum.&lt;br /&gt;
              # This really doesn&#039;t need to be changed&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Thus the cutoff must be chosen carefully if one wants to get the most number of peaks that have resolved half-widths. This gets more important with increased peak broadening.&lt;br /&gt;
&lt;br /&gt;
===CUDA Code===&lt;br /&gt;
The code is obviously parallel. The next step is to re-write the code in CUDA to improve speed. The vast majority of time is spent in the distances calculation so for now, only this section will be made into a CUDA kernel. One important note is that the cluster of GPUs need to have the gsl libraries available.&lt;/div&gt;</summary>
		<author><name>Alank2</name></author>
	</entry>
	<entry>
		<id>http://micro.stanford.edu/mediawiki/index.php?title=Computational_XRD&amp;diff=6139</id>
		<title>Computational XRD</title>
		<link rel="alternate" type="text/html" href="http://micro.stanford.edu/mediawiki/index.php?title=Computational_XRD&amp;diff=6139"/>
		<updated>2015-08-23T21:39:20Z</updated>

		<summary type="html">&lt;p&gt;Alank2: /* Intensity Calculation in C++ */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;P ALIGN=&amp;quot;CENTER&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;FONT SIZE=&amp;quot;+3&amp;quot; color=&amp;quot;darkred&amp;quot;&amp;gt;&amp;lt;STRONG&amp;gt;&lt;br /&gt;
Computational XRD&amp;lt;/STRONG&amp;gt;&amp;lt;/font&amp;gt;&amp;lt;/P&amp;gt;&lt;br /&gt;
&amp;lt;DIV&amp;gt;&lt;br /&gt;
&amp;lt;P ALIGN=&amp;quot;CENTER&amp;quot;&amp;gt;&amp;lt;STRONG&amp;gt; &amp;lt;/STRONG&amp;gt;&amp;lt;/P&amp;gt;&lt;br /&gt;
&amp;lt;/DIV&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Making Nanoparticles===&lt;br /&gt;
&lt;br /&gt;
Here we give an example of how to generate nanoparticles with different dislocations. One may have to play around a bit with the directories to make sure that the files get opened and written to the correct places. A python version of the MD++ code is necessary. The relevant python files are:&lt;br /&gt;
&lt;br /&gt;
generate_particles.py&lt;br /&gt;
XRDsetup.py&lt;br /&gt;
&lt;br /&gt;
and these can be run with the command:&lt;br /&gt;
bin/eam generate_particles.py&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Notable Parameters&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# flag = 0 is no dislocations&lt;br /&gt;
# flag = 1 is only one dislocation&lt;br /&gt;
# flag = 2 is multiple randomly generated dislocations&lt;br /&gt;
flag = 0 &lt;br /&gt;
start = 40    # Radius of the nanoparticle&lt;br /&gt;
numDisls = 6  # if flag == 2, the number of dislocations&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This generates a series of .cn, .cfg, and a file of atomic positions which will be read by the C++ code to calculate the Intensity. &lt;br /&gt;
&lt;br /&gt;
===Intensity Calculation in C++===&lt;br /&gt;
&lt;br /&gt;
First, make sure the required libraries are installed. The GSL, C++11, and OpenMP packages are required (the GSL library is for easily making histograms). The required files are the previous file of atomic positions and the attached C++ file:&lt;br /&gt;
&lt;br /&gt;
Now we are ready to run&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
g++ -o XRD.exe XRD_OpenMP.cpp -lgsl -lgslcblas -lm -fopenmp -std=c++11&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
followed simply by &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
./XRD.exe&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Parameters&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
flag = 0 &lt;br /&gt;
Radius = 40   &lt;br /&gt;
&lt;br /&gt;
wavelength = 0.67 # the wavelength of the incident monochromatic X-ray beam&lt;br /&gt;
num_bins = 25000   # the number of bins in the histogram per division&lt;br /&gt;
N = 10000          # the number of points for the Intensity and Q&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
I plan to run several different sizes and compare the time taken for this calculation for a fixed num_bins, divs, and N to access the scalability. Currently the code is highly un-optimized and still runs very fast.&lt;br /&gt;
&lt;br /&gt;
===Plotting and Interpolating===&lt;br /&gt;
&lt;br /&gt;
The next step is to read the file of Intensities and Q values into the python script attached. The Intensity and Q values that are either background before the first real Bragg peak or are small values past Q~20 are gotten rid of. The interpolation is only done on the largest 5-10 peaks. The number of peaks that can be reasonably interpolated decreases with increasing number of dislocations as the peaks broaden. The following file plots and interpolates the intensity and it should be run as:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
python MD++_plot.py Radius flag cutoff&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
where Radius, flag, and cutoff are parameters. These are some important parameters to consider, especially in the interpolation. &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Parameters&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
wavelength = 0.67&lt;br /&gt;
Radius = int(sys.argv[1])&lt;br /&gt;
flag = int(sys.argv[2])&lt;br /&gt;
cutoff = float(sys.argv[3])  # Bragg peaks with maximum below this cutoff will be ignored&lt;br /&gt;
tol = 0.1     # The Q range around which the program searches for a half-maximum.&lt;br /&gt;
              # This really doesn&#039;t need to be changed&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Thus the cutoff must be chosen carefully if one wants to get the most number of peaks that have resolved half-widths. This gets more important with increased peak broadening.&lt;br /&gt;
&lt;br /&gt;
===CUDA Code===&lt;br /&gt;
The code is obviously parallel. The next step is to re-write the code in CUDA to improve speed. The vast majority of time is spent in the distances calculation so for now, only this section will be made into a CUDA kernel. One important note is that the cluster of GPUs need to have the gsl libraries available.&lt;/div&gt;</summary>
		<author><name>Alank2</name></author>
	</entry>
	<entry>
		<id>http://micro.stanford.edu/mediawiki/index.php?title=Computational_XRD&amp;diff=6138</id>
		<title>Computational XRD</title>
		<link rel="alternate" type="text/html" href="http://micro.stanford.edu/mediawiki/index.php?title=Computational_XRD&amp;diff=6138"/>
		<updated>2015-08-23T20:35:40Z</updated>

		<summary type="html">&lt;p&gt;Alank2: /* CUDA Code */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;P ALIGN=&amp;quot;CENTER&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;FONT SIZE=&amp;quot;+3&amp;quot; color=&amp;quot;darkred&amp;quot;&amp;gt;&amp;lt;STRONG&amp;gt;&lt;br /&gt;
Computational XRD&amp;lt;/STRONG&amp;gt;&amp;lt;/font&amp;gt;&amp;lt;/P&amp;gt;&lt;br /&gt;
&amp;lt;DIV&amp;gt;&lt;br /&gt;
&amp;lt;P ALIGN=&amp;quot;CENTER&amp;quot;&amp;gt;&amp;lt;STRONG&amp;gt; &amp;lt;/STRONG&amp;gt;&amp;lt;/P&amp;gt;&lt;br /&gt;
&amp;lt;/DIV&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Making Nanoparticles===&lt;br /&gt;
&lt;br /&gt;
Here we give an example of how to generate nanoparticles with different dislocations. One may have to play around a bit with the directories to make sure that the files get opened and written to the correct places. A python version of the MD++ code is necessary. The relevant python files are:&lt;br /&gt;
&lt;br /&gt;
generate_particles.py&lt;br /&gt;
XRDsetup.py&lt;br /&gt;
&lt;br /&gt;
and these can be run with the command:&lt;br /&gt;
bin/eam generate_particles.py&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Notable Parameters&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# flag = 0 is no dislocations&lt;br /&gt;
# flag = 1 is only one dislocation&lt;br /&gt;
# flag = 2 is multiple randomly generated dislocations&lt;br /&gt;
flag = 0 &lt;br /&gt;
start = 40    # Radius of the nanoparticle&lt;br /&gt;
numDisls = 6  # if flag == 2, the number of dislocations&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This generates a series of .cn, .cfg, and a file of atomic positions which will be read by the C++ code to calculate the Intensity. &lt;br /&gt;
&lt;br /&gt;
===Intensity Calculation in C++===&lt;br /&gt;
&lt;br /&gt;
First, make sure the required libraries are installed. The GSL, C++11, and OpenMP packages are required (the GSL library is for easily making histograms). The required files are the previous file of atomic positions and the attached C++ file:&lt;br /&gt;
&lt;br /&gt;
Now we are ready to run&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
g++ -o XRD.exe XRD_OpenMP.cpp -lgsl -lgslcblas -lm -fopenmp -std=c++11&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
followed simply by &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
./XRD.exe&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Parameters&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
flag = 0 &lt;br /&gt;
Radius = 40   &lt;br /&gt;
&lt;br /&gt;
wavelength = 0.67 # the wavelength of the incident monochromatic X-ray beam&lt;br /&gt;
divs = 6          # the number of partial distance calculations to compute.&lt;br /&gt;
                  # this needs to be adjusted to larger values for large runs&lt;br /&gt;
                  # because of memory issues. If not set properly, the code will&lt;br /&gt;
                  # exit with a memory error.&lt;br /&gt;
num_bins = 5000   # the number of bins in the histogram per division&lt;br /&gt;
N = 1000          # the number of points for the Intensity and Q&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
I plan to run several different sizes and compare the time taken for this calculation for a fixed num_bins, divs, and N to access the scalability. Currently the code is highly un-optimized. This code should be re-written with dynamic arrays instead of vectors in order to become much more parallel.&lt;br /&gt;
&lt;br /&gt;
===Plotting and Interpolating===&lt;br /&gt;
&lt;br /&gt;
The next step is to read the file of Intensities and Q values into the python script attached. The Intensity and Q values that are either background before the first real Bragg peak or are small values past Q~20 are gotten rid of. The interpolation is only done on the largest 5-10 peaks. The number of peaks that can be reasonably interpolated decreases with increasing number of dislocations as the peaks broaden. The following file plots and interpolates the intensity and it should be run as:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
python MD++_plot.py Radius flag cutoff&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
where Radius, flag, and cutoff are parameters. These are some important parameters to consider, especially in the interpolation. &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Parameters&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
wavelength = 0.67&lt;br /&gt;
Radius = int(sys.argv[1])&lt;br /&gt;
flag = int(sys.argv[2])&lt;br /&gt;
cutoff = float(sys.argv[3])  # Bragg peaks with maximum below this cutoff will be ignored&lt;br /&gt;
tol = 0.1     # The Q range around which the program searches for a half-maximum.&lt;br /&gt;
              # This really doesn&#039;t need to be changed&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Thus the cutoff must be chosen carefully if one wants to get the most number of peaks that have resolved half-widths. This gets more important with increased peak broadening.&lt;br /&gt;
&lt;br /&gt;
===CUDA Code===&lt;br /&gt;
The code is obviously parallel. The next step is to re-write the code in CUDA to improve speed. The vast majority of time is spent in the distances calculation so for now, only this section will be made into a CUDA kernel. One important note is that the cluster of GPUs need to have the gsl libraries available.&lt;/div&gt;</summary>
		<author><name>Alank2</name></author>
	</entry>
	<entry>
		<id>http://micro.stanford.edu/mediawiki/index.php?title=Computational_XRD&amp;diff=6137</id>
		<title>Computational XRD</title>
		<link rel="alternate" type="text/html" href="http://micro.stanford.edu/mediawiki/index.php?title=Computational_XRD&amp;diff=6137"/>
		<updated>2015-08-23T19:03:10Z</updated>

		<summary type="html">&lt;p&gt;Alank2: /* CUDA Code */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;P ALIGN=&amp;quot;CENTER&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;FONT SIZE=&amp;quot;+3&amp;quot; color=&amp;quot;darkred&amp;quot;&amp;gt;&amp;lt;STRONG&amp;gt;&lt;br /&gt;
Computational XRD&amp;lt;/STRONG&amp;gt;&amp;lt;/font&amp;gt;&amp;lt;/P&amp;gt;&lt;br /&gt;
&amp;lt;DIV&amp;gt;&lt;br /&gt;
&amp;lt;P ALIGN=&amp;quot;CENTER&amp;quot;&amp;gt;&amp;lt;STRONG&amp;gt; &amp;lt;/STRONG&amp;gt;&amp;lt;/P&amp;gt;&lt;br /&gt;
&amp;lt;/DIV&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Making Nanoparticles===&lt;br /&gt;
&lt;br /&gt;
Here we give an example of how to generate nanoparticles with different dislocations. One may have to play around a bit with the directories to make sure that the files get opened and written to the correct places. A python version of the MD++ code is necessary. The relevant python files are:&lt;br /&gt;
&lt;br /&gt;
generate_particles.py&lt;br /&gt;
XRDsetup.py&lt;br /&gt;
&lt;br /&gt;
and these can be run with the command:&lt;br /&gt;
bin/eam generate_particles.py&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Notable Parameters&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# flag = 0 is no dislocations&lt;br /&gt;
# flag = 1 is only one dislocation&lt;br /&gt;
# flag = 2 is multiple randomly generated dislocations&lt;br /&gt;
flag = 0 &lt;br /&gt;
start = 40    # Radius of the nanoparticle&lt;br /&gt;
numDisls = 6  # if flag == 2, the number of dislocations&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This generates a series of .cn, .cfg, and a file of atomic positions which will be read by the C++ code to calculate the Intensity. &lt;br /&gt;
&lt;br /&gt;
===Intensity Calculation in C++===&lt;br /&gt;
&lt;br /&gt;
First, make sure the required libraries are installed. The GSL, C++11, and OpenMP packages are required (the GSL library is for easily making histograms). The required files are the previous file of atomic positions and the attached C++ file:&lt;br /&gt;
&lt;br /&gt;
Now we are ready to run&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
g++ -o XRD.exe XRD_OpenMP.cpp -lgsl -lgslcblas -lm -fopenmp -std=c++11&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
followed simply by &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
./XRD.exe&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Parameters&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
flag = 0 &lt;br /&gt;
Radius = 40   &lt;br /&gt;
&lt;br /&gt;
wavelength = 0.67 # the wavelength of the incident monochromatic X-ray beam&lt;br /&gt;
divs = 6          # the number of partial distance calculations to compute.&lt;br /&gt;
                  # this needs to be adjusted to larger values for large runs&lt;br /&gt;
                  # because of memory issues. If not set properly, the code will&lt;br /&gt;
                  # exit with a memory error.&lt;br /&gt;
num_bins = 5000   # the number of bins in the histogram per division&lt;br /&gt;
N = 1000          # the number of points for the Intensity and Q&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
I plan to run several different sizes and compare the time taken for this calculation for a fixed num_bins, divs, and N to access the scalability. Currently the code is highly un-optimized. This code should be re-written with dynamic arrays instead of vectors in order to become much more parallel.&lt;br /&gt;
&lt;br /&gt;
===Plotting and Interpolating===&lt;br /&gt;
&lt;br /&gt;
The next step is to read the file of Intensities and Q values into the python script attached. The Intensity and Q values that are either background before the first real Bragg peak or are small values past Q~20 are gotten rid of. The interpolation is only done on the largest 5-10 peaks. The number of peaks that can be reasonably interpolated decreases with increasing number of dislocations as the peaks broaden. The following file plots and interpolates the intensity and it should be run as:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
python MD++_plot.py Radius flag cutoff&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
where Radius, flag, and cutoff are parameters. These are some important parameters to consider, especially in the interpolation. &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Parameters&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
wavelength = 0.67&lt;br /&gt;
Radius = int(sys.argv[1])&lt;br /&gt;
flag = int(sys.argv[2])&lt;br /&gt;
cutoff = float(sys.argv[3])  # Bragg peaks with maximum below this cutoff will be ignored&lt;br /&gt;
tol = 0.1     # The Q range around which the program searches for a half-maximum.&lt;br /&gt;
              # This really doesn&#039;t need to be changed&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Thus the cutoff must be chosen carefully if one wants to get the most number of peaks that have resolved half-widths. This gets more important with increased peak broadening.&lt;br /&gt;
&lt;br /&gt;
===CUDA Code===&lt;br /&gt;
The code is obviously parallel. The next step is to re-write the code in CUDA to improve speed. The vast majority of time is spent in the distances calculation so for now, only this section will be made into a CUDA kernel.&lt;/div&gt;</summary>
		<author><name>Alank2</name></author>
	</entry>
	<entry>
		<id>http://micro.stanford.edu/mediawiki/index.php?title=Computational_XRD&amp;diff=6136</id>
		<title>Computational XRD</title>
		<link rel="alternate" type="text/html" href="http://micro.stanford.edu/mediawiki/index.php?title=Computational_XRD&amp;diff=6136"/>
		<updated>2015-08-23T18:59:56Z</updated>

		<summary type="html">&lt;p&gt;Alank2: /* Plotting and Interpolating */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;P ALIGN=&amp;quot;CENTER&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;FONT SIZE=&amp;quot;+3&amp;quot; color=&amp;quot;darkred&amp;quot;&amp;gt;&amp;lt;STRONG&amp;gt;&lt;br /&gt;
Computational XRD&amp;lt;/STRONG&amp;gt;&amp;lt;/font&amp;gt;&amp;lt;/P&amp;gt;&lt;br /&gt;
&amp;lt;DIV&amp;gt;&lt;br /&gt;
&amp;lt;P ALIGN=&amp;quot;CENTER&amp;quot;&amp;gt;&amp;lt;STRONG&amp;gt; &amp;lt;/STRONG&amp;gt;&amp;lt;/P&amp;gt;&lt;br /&gt;
&amp;lt;/DIV&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Making Nanoparticles===&lt;br /&gt;
&lt;br /&gt;
Here we give an example of how to generate nanoparticles with different dislocations. One may have to play around a bit with the directories to make sure that the files get opened and written to the correct places. A python version of the MD++ code is necessary. The relevant python files are:&lt;br /&gt;
&lt;br /&gt;
generate_particles.py&lt;br /&gt;
XRDsetup.py&lt;br /&gt;
&lt;br /&gt;
and these can be run with the command:&lt;br /&gt;
bin/eam generate_particles.py&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Notable Parameters&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# flag = 0 is no dislocations&lt;br /&gt;
# flag = 1 is only one dislocation&lt;br /&gt;
# flag = 2 is multiple randomly generated dislocations&lt;br /&gt;
flag = 0 &lt;br /&gt;
start = 40    # Radius of the nanoparticle&lt;br /&gt;
numDisls = 6  # if flag == 2, the number of dislocations&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This generates a series of .cn, .cfg, and a file of atomic positions which will be read by the C++ code to calculate the Intensity. &lt;br /&gt;
&lt;br /&gt;
===Intensity Calculation in C++===&lt;br /&gt;
&lt;br /&gt;
First, make sure the required libraries are installed. The GSL, C++11, and OpenMP packages are required (the GSL library is for easily making histograms). The required files are the previous file of atomic positions and the attached C++ file:&lt;br /&gt;
&lt;br /&gt;
Now we are ready to run&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
g++ -o XRD.exe XRD_OpenMP.cpp -lgsl -lgslcblas -lm -fopenmp -std=c++11&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
followed simply by &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
./XRD.exe&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Parameters&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
flag = 0 &lt;br /&gt;
Radius = 40   &lt;br /&gt;
&lt;br /&gt;
wavelength = 0.67 # the wavelength of the incident monochromatic X-ray beam&lt;br /&gt;
divs = 6          # the number of partial distance calculations to compute.&lt;br /&gt;
                  # this needs to be adjusted to larger values for large runs&lt;br /&gt;
                  # because of memory issues. If not set properly, the code will&lt;br /&gt;
                  # exit with a memory error.&lt;br /&gt;
num_bins = 5000   # the number of bins in the histogram per division&lt;br /&gt;
N = 1000          # the number of points for the Intensity and Q&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
I plan to run several different sizes and compare the time taken for this calculation for a fixed num_bins, divs, and N to access the scalability. Currently the code is highly un-optimized. This code should be re-written with dynamic arrays instead of vectors in order to become much more parallel.&lt;br /&gt;
&lt;br /&gt;
===Plotting and Interpolating===&lt;br /&gt;
&lt;br /&gt;
The next step is to read the file of Intensities and Q values into the python script attached. The Intensity and Q values that are either background before the first real Bragg peak or are small values past Q~20 are gotten rid of. The interpolation is only done on the largest 5-10 peaks. The number of peaks that can be reasonably interpolated decreases with increasing number of dislocations as the peaks broaden. The following file plots and interpolates the intensity and it should be run as:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
python MD++_plot.py Radius flag cutoff&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
where Radius, flag, and cutoff are parameters. These are some important parameters to consider, especially in the interpolation. &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Parameters&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
wavelength = 0.67&lt;br /&gt;
Radius = int(sys.argv[1])&lt;br /&gt;
flag = int(sys.argv[2])&lt;br /&gt;
cutoff = float(sys.argv[3])  # Bragg peaks with maximum below this cutoff will be ignored&lt;br /&gt;
tol = 0.1     # The Q range around which the program searches for a half-maximum.&lt;br /&gt;
              # This really doesn&#039;t need to be changed&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Thus the cutoff must be chosen carefully if one wants to get the most number of peaks that have resolved half-widths. This gets more important with increased peak broadening.&lt;br /&gt;
&lt;br /&gt;
===CUDA Code===&lt;br /&gt;
The code is obviously parallel. The next step is to re-write the code in CUDA to improve speed.&lt;/div&gt;</summary>
		<author><name>Alank2</name></author>
	</entry>
	<entry>
		<id>http://micro.stanford.edu/mediawiki/index.php?title=Computational_XRD&amp;diff=6135</id>
		<title>Computational XRD</title>
		<link rel="alternate" type="text/html" href="http://micro.stanford.edu/mediawiki/index.php?title=Computational_XRD&amp;diff=6135"/>
		<updated>2015-08-20T02:54:58Z</updated>

		<summary type="html">&lt;p&gt;Alank2: /* Intensity Calculation in C++ */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;P ALIGN=&amp;quot;CENTER&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;FONT SIZE=&amp;quot;+3&amp;quot; color=&amp;quot;darkred&amp;quot;&amp;gt;&amp;lt;STRONG&amp;gt;&lt;br /&gt;
Computational XRD&amp;lt;/STRONG&amp;gt;&amp;lt;/font&amp;gt;&amp;lt;/P&amp;gt;&lt;br /&gt;
&amp;lt;DIV&amp;gt;&lt;br /&gt;
&amp;lt;P ALIGN=&amp;quot;CENTER&amp;quot;&amp;gt;&amp;lt;STRONG&amp;gt; &amp;lt;/STRONG&amp;gt;&amp;lt;/P&amp;gt;&lt;br /&gt;
&amp;lt;/DIV&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Making Nanoparticles===&lt;br /&gt;
&lt;br /&gt;
Here we give an example of how to generate nanoparticles with different dislocations. One may have to play around a bit with the directories to make sure that the files get opened and written to the correct places. A python version of the MD++ code is necessary. The relevant python files are:&lt;br /&gt;
&lt;br /&gt;
generate_particles.py&lt;br /&gt;
XRDsetup.py&lt;br /&gt;
&lt;br /&gt;
and these can be run with the command:&lt;br /&gt;
bin/eam generate_particles.py&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Notable Parameters&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# flag = 0 is no dislocations&lt;br /&gt;
# flag = 1 is only one dislocation&lt;br /&gt;
# flag = 2 is multiple randomly generated dislocations&lt;br /&gt;
flag = 0 &lt;br /&gt;
start = 40    # Radius of the nanoparticle&lt;br /&gt;
numDisls = 6  # if flag == 2, the number of dislocations&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This generates a series of .cn, .cfg, and a file of atomic positions which will be read by the C++ code to calculate the Intensity. &lt;br /&gt;
&lt;br /&gt;
===Intensity Calculation in C++===&lt;br /&gt;
&lt;br /&gt;
First, make sure the required libraries are installed. The GSL, C++11, and OpenMP packages are required (the GSL library is for easily making histograms). The required files are the previous file of atomic positions and the attached C++ file:&lt;br /&gt;
&lt;br /&gt;
Now we are ready to run&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
g++ -o XRD.exe XRD_OpenMP.cpp -lgsl -lgslcblas -lm -fopenmp -std=c++11&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
followed simply by &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
./XRD.exe&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Parameters&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
flag = 0 &lt;br /&gt;
Radius = 40   &lt;br /&gt;
&lt;br /&gt;
wavelength = 0.67 # the wavelength of the incident monochromatic X-ray beam&lt;br /&gt;
divs = 6          # the number of partial distance calculations to compute.&lt;br /&gt;
                  # this needs to be adjusted to larger values for large runs&lt;br /&gt;
                  # because of memory issues. If not set properly, the code will&lt;br /&gt;
                  # exit with a memory error.&lt;br /&gt;
num_bins = 5000   # the number of bins in the histogram per division&lt;br /&gt;
N = 1000          # the number of points for the Intensity and Q&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
I plan to run several different sizes and compare the time taken for this calculation for a fixed num_bins, divs, and N to access the scalability. Currently the code is highly un-optimized. This code should be re-written with dynamic arrays instead of vectors in order to become much more parallel.&lt;br /&gt;
&lt;br /&gt;
===Plotting and Interpolating===&lt;br /&gt;
&lt;br /&gt;
The next step is to read the file of Intensities and Q values into the python script attached. The Intensity and Q values that are either background before the first real Bragg peak or are small values past Q~20 are gotten rid of. The interpolation is only done on the largest 5-10 peaks. The number of peaks that can be reasonably interpolated decreases with increasing number of dislocations as the peaks broaden. The following file plots and interpolates the intensity and it should be run as:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
python MD++_plot.py Radius flag cutoff&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
where Radius, flag, and cutoff are parameters. These are some important parameters to consider, especially in the interpolation. &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Parameters&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
wavelength = 0.67&lt;br /&gt;
Radius = int(sys.argv[1])&lt;br /&gt;
flag = int(sys.argv[2])&lt;br /&gt;
cutoff = 2e4  # Bragg peaks with maximum below this cutoff will be ignored&lt;br /&gt;
tol = 0.1     # The Q range around which the program searches for a half-maximum.&lt;br /&gt;
              # This really doesn&#039;t need to be changed&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Thus the cutoff must be chosen carefully if one wants to get the most number of peaks that have resolved half-widths. This gets more important with increased peak broadening.&lt;br /&gt;
&lt;br /&gt;
===CUDA Code===&lt;br /&gt;
The code is obviously parallel. The next step is to re-write the code in CUDA to improve speed.&lt;/div&gt;</summary>
		<author><name>Alank2</name></author>
	</entry>
	<entry>
		<id>http://micro.stanford.edu/mediawiki/index.php?title=Computational_XRD&amp;diff=6134</id>
		<title>Computational XRD</title>
		<link rel="alternate" type="text/html" href="http://micro.stanford.edu/mediawiki/index.php?title=Computational_XRD&amp;diff=6134"/>
		<updated>2015-08-20T02:52:50Z</updated>

		<summary type="html">&lt;p&gt;Alank2: /* Plotting and Interpolating */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;P ALIGN=&amp;quot;CENTER&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;FONT SIZE=&amp;quot;+3&amp;quot; color=&amp;quot;darkred&amp;quot;&amp;gt;&amp;lt;STRONG&amp;gt;&lt;br /&gt;
Computational XRD&amp;lt;/STRONG&amp;gt;&amp;lt;/font&amp;gt;&amp;lt;/P&amp;gt;&lt;br /&gt;
&amp;lt;DIV&amp;gt;&lt;br /&gt;
&amp;lt;P ALIGN=&amp;quot;CENTER&amp;quot;&amp;gt;&amp;lt;STRONG&amp;gt; &amp;lt;/STRONG&amp;gt;&amp;lt;/P&amp;gt;&lt;br /&gt;
&amp;lt;/DIV&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Making Nanoparticles===&lt;br /&gt;
&lt;br /&gt;
Here we give an example of how to generate nanoparticles with different dislocations. One may have to play around a bit with the directories to make sure that the files get opened and written to the correct places. A python version of the MD++ code is necessary. The relevant python files are:&lt;br /&gt;
&lt;br /&gt;
generate_particles.py&lt;br /&gt;
XRDsetup.py&lt;br /&gt;
&lt;br /&gt;
and these can be run with the command:&lt;br /&gt;
bin/eam generate_particles.py&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Notable Parameters&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# flag = 0 is no dislocations&lt;br /&gt;
# flag = 1 is only one dislocation&lt;br /&gt;
# flag = 2 is multiple randomly generated dislocations&lt;br /&gt;
flag = 0 &lt;br /&gt;
start = 40    # Radius of the nanoparticle&lt;br /&gt;
numDisls = 6  # if flag == 2, the number of dislocations&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This generates a series of .cn, .cfg, and a file of atomic positions which will be read by the C++ code to calculate the Intensity. &lt;br /&gt;
&lt;br /&gt;
===Intensity Calculation in C++===&lt;br /&gt;
&lt;br /&gt;
First, make sure the required libraries are installed. The GSL, C++11, and OpenMP packages are required (the GSL library is for easily making histograms). The required files are the previous file of atomic positions and the attached C++ file:&lt;br /&gt;
&lt;br /&gt;
Now we are ready to run&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
g++ -o XRD.exe XRD_OpenMP.cpp -lgsl -lgslcblas -lm -fopenmp -std=c++11&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
followed simply by &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
./XRD.exe&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Parameters&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
flag = 0 &lt;br /&gt;
Radius = 40    &lt;br /&gt;
divs = 6         # the number of partial distance calculations to compute.&lt;br /&gt;
                 # this needs to be adjusted to larger values for large runs&lt;br /&gt;
                 # because of memory issues. If not set properly, the code will&lt;br /&gt;
                 # exit with a memory error.&lt;br /&gt;
num_bins = 5000  # the number of bins in the histogram per division&lt;br /&gt;
N = 1000         # the number of points for the Intensity and Q&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
I plan to run several different sizes and compare the time taken for this calculation for a fixed num_bins, divs, and N to access the scalability. Currently the code is highly un-optimized. This code should be re-written with dynamic arrays instead of vectors in order to become much more parallel.&lt;br /&gt;
&lt;br /&gt;
===Plotting and Interpolating===&lt;br /&gt;
&lt;br /&gt;
The next step is to read the file of Intensities and Q values into the python script attached. The Intensity and Q values that are either background before the first real Bragg peak or are small values past Q~20 are gotten rid of. The interpolation is only done on the largest 5-10 peaks. The number of peaks that can be reasonably interpolated decreases with increasing number of dislocations as the peaks broaden. The following file plots and interpolates the intensity and it should be run as:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
python MD++_plot.py Radius flag cutoff&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
where Radius, flag, and cutoff are parameters. These are some important parameters to consider, especially in the interpolation. &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Parameters&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
wavelength = 0.67&lt;br /&gt;
Radius = int(sys.argv[1])&lt;br /&gt;
flag = int(sys.argv[2])&lt;br /&gt;
cutoff = 2e4  # Bragg peaks with maximum below this cutoff will be ignored&lt;br /&gt;
tol = 0.1     # The Q range around which the program searches for a half-maximum.&lt;br /&gt;
              # This really doesn&#039;t need to be changed&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Thus the cutoff must be chosen carefully if one wants to get the most number of peaks that have resolved half-widths. This gets more important with increased peak broadening.&lt;br /&gt;
&lt;br /&gt;
===CUDA Code===&lt;br /&gt;
The code is obviously parallel. The next step is to re-write the code in CUDA to improve speed.&lt;/div&gt;</summary>
		<author><name>Alank2</name></author>
	</entry>
	<entry>
		<id>http://micro.stanford.edu/mediawiki/index.php?title=Computational_XRD&amp;diff=6133</id>
		<title>Computational XRD</title>
		<link rel="alternate" type="text/html" href="http://micro.stanford.edu/mediawiki/index.php?title=Computational_XRD&amp;diff=6133"/>
		<updated>2015-08-20T02:47:59Z</updated>

		<summary type="html">&lt;p&gt;Alank2: /* Intensity Calculation in C++ */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;P ALIGN=&amp;quot;CENTER&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;FONT SIZE=&amp;quot;+3&amp;quot; color=&amp;quot;darkred&amp;quot;&amp;gt;&amp;lt;STRONG&amp;gt;&lt;br /&gt;
Computational XRD&amp;lt;/STRONG&amp;gt;&amp;lt;/font&amp;gt;&amp;lt;/P&amp;gt;&lt;br /&gt;
&amp;lt;DIV&amp;gt;&lt;br /&gt;
&amp;lt;P ALIGN=&amp;quot;CENTER&amp;quot;&amp;gt;&amp;lt;STRONG&amp;gt; &amp;lt;/STRONG&amp;gt;&amp;lt;/P&amp;gt;&lt;br /&gt;
&amp;lt;/DIV&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Making Nanoparticles===&lt;br /&gt;
&lt;br /&gt;
Here we give an example of how to generate nanoparticles with different dislocations. One may have to play around a bit with the directories to make sure that the files get opened and written to the correct places. A python version of the MD++ code is necessary. The relevant python files are:&lt;br /&gt;
&lt;br /&gt;
generate_particles.py&lt;br /&gt;
XRDsetup.py&lt;br /&gt;
&lt;br /&gt;
and these can be run with the command:&lt;br /&gt;
bin/eam generate_particles.py&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Notable Parameters&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# flag = 0 is no dislocations&lt;br /&gt;
# flag = 1 is only one dislocation&lt;br /&gt;
# flag = 2 is multiple randomly generated dislocations&lt;br /&gt;
flag = 0 &lt;br /&gt;
start = 40    # Radius of the nanoparticle&lt;br /&gt;
numDisls = 6  # if flag == 2, the number of dislocations&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This generates a series of .cn, .cfg, and a file of atomic positions which will be read by the C++ code to calculate the Intensity. &lt;br /&gt;
&lt;br /&gt;
===Intensity Calculation in C++===&lt;br /&gt;
&lt;br /&gt;
First, make sure the required libraries are installed. The GSL, C++11, and OpenMP packages are required (the GSL library is for easily making histograms). The required files are the previous file of atomic positions and the attached C++ file:&lt;br /&gt;
&lt;br /&gt;
Now we are ready to run&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
g++ -o XRD.exe XRD_OpenMP.cpp -lgsl -lgslcblas -lm -fopenmp -std=c++11&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
followed simply by &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
./XRD.exe&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Parameters&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
flag = 0 &lt;br /&gt;
Radius = 40    &lt;br /&gt;
divs = 6         # the number of partial distance calculations to compute.&lt;br /&gt;
                 # this needs to be adjusted to larger values for large runs&lt;br /&gt;
                 # because of memory issues. If not set properly, the code will&lt;br /&gt;
                 # exit with a memory error.&lt;br /&gt;
num_bins = 5000  # the number of bins in the histogram per division&lt;br /&gt;
N = 1000         # the number of points for the Intensity and Q&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
I plan to run several different sizes and compare the time taken for this calculation for a fixed num_bins, divs, and N to access the scalability. Currently the code is highly un-optimized. This code should be re-written with dynamic arrays instead of vectors in order to become much more parallel.&lt;br /&gt;
&lt;br /&gt;
===Plotting and Interpolating===&lt;br /&gt;
&lt;br /&gt;
The next step is to read the file of Intensities and Q values into the python script attached. The Intensity and Q values that are either background before the first real Bragg peak or are small values past Q~20 are gotten rid of. The interpolation is only done on the largest 5-10 peaks. The number of peaks that can be reasonably interpolated decreases with increasing number of dislocations as the peaks broaden. There are some important parameters to consider, especially in the interpolation. These are:&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Parameters&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
wavelength = 0.67&lt;br /&gt;
Radius = int(sys.argv[1])&lt;br /&gt;
flag = int(sys.argv[2])&lt;br /&gt;
cutoff = 2e4  # Bragg peaks with maxima below cutoff will be ignored&lt;br /&gt;
tol = 0.1     # The Q range around which the program searches for a half-maximum&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===CUDA Code===&lt;br /&gt;
The code is obviously parallel. The next step is to re-write the code in CUDA to improve speed.&lt;/div&gt;</summary>
		<author><name>Alank2</name></author>
	</entry>
	<entry>
		<id>http://micro.stanford.edu/mediawiki/index.php?title=Computational_XRD&amp;diff=6132</id>
		<title>Computational XRD</title>
		<link rel="alternate" type="text/html" href="http://micro.stanford.edu/mediawiki/index.php?title=Computational_XRD&amp;diff=6132"/>
		<updated>2015-08-20T02:47:45Z</updated>

		<summary type="html">&lt;p&gt;Alank2: /* Intensity Calculation in C++ */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;P ALIGN=&amp;quot;CENTER&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;FONT SIZE=&amp;quot;+3&amp;quot; color=&amp;quot;darkred&amp;quot;&amp;gt;&amp;lt;STRONG&amp;gt;&lt;br /&gt;
Computational XRD&amp;lt;/STRONG&amp;gt;&amp;lt;/font&amp;gt;&amp;lt;/P&amp;gt;&lt;br /&gt;
&amp;lt;DIV&amp;gt;&lt;br /&gt;
&amp;lt;P ALIGN=&amp;quot;CENTER&amp;quot;&amp;gt;&amp;lt;STRONG&amp;gt; &amp;lt;/STRONG&amp;gt;&amp;lt;/P&amp;gt;&lt;br /&gt;
&amp;lt;/DIV&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Making Nanoparticles===&lt;br /&gt;
&lt;br /&gt;
Here we give an example of how to generate nanoparticles with different dislocations. One may have to play around a bit with the directories to make sure that the files get opened and written to the correct places. A python version of the MD++ code is necessary. The relevant python files are:&lt;br /&gt;
&lt;br /&gt;
generate_particles.py&lt;br /&gt;
XRDsetup.py&lt;br /&gt;
&lt;br /&gt;
and these can be run with the command:&lt;br /&gt;
bin/eam generate_particles.py&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Notable Parameters&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# flag = 0 is no dislocations&lt;br /&gt;
# flag = 1 is only one dislocation&lt;br /&gt;
# flag = 2 is multiple randomly generated dislocations&lt;br /&gt;
flag = 0 &lt;br /&gt;
start = 40    # Radius of the nanoparticle&lt;br /&gt;
numDisls = 6  # if flag == 2, the number of dislocations&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This generates a series of .cn, .cfg, and a file of atomic positions which will be read by the C++ code to calculate the Intensity. &lt;br /&gt;
&lt;br /&gt;
===Intensity Calculation in C++===&lt;br /&gt;
&lt;br /&gt;
First, make sure the required libraries are installed. The GSL, C++11, and OpenMP packages are required (the GSL library is for easily making histograms). The required files are the previous file of atomic positions and the attached C++ file:&lt;br /&gt;
&lt;br /&gt;
Now we are ready to run&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
g++ -o XRD.exe XRD_OpenMP.cpp -lgsl -lgslcblas -lm -fopenmp -std=c++11&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
followed simply by &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
./XRD.exe.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Parameters&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
flag = 0 &lt;br /&gt;
Radius = 40    &lt;br /&gt;
divs = 6         # the number of partial distance calculations to compute.&lt;br /&gt;
                 # this needs to be adjusted to larger values for large runs&lt;br /&gt;
                 # because of memory issues. If not set properly, the code will&lt;br /&gt;
                 # exit with a memory error.&lt;br /&gt;
num_bins = 5000  # the number of bins in the histogram per division&lt;br /&gt;
N = 1000         # the number of points for the Intensity and Q&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
I plan to run several different sizes and compare the time taken for this calculation for a fixed num_bins, divs, and N to access the scalability. Currently the code is highly un-optimized. This code should be re-written with dynamic arrays instead of vectors in order to become much more parallel.&lt;br /&gt;
&lt;br /&gt;
===Plotting and Interpolating===&lt;br /&gt;
&lt;br /&gt;
The next step is to read the file of Intensities and Q values into the python script attached. The Intensity and Q values that are either background before the first real Bragg peak or are small values past Q~20 are gotten rid of. The interpolation is only done on the largest 5-10 peaks. The number of peaks that can be reasonably interpolated decreases with increasing number of dislocations as the peaks broaden. There are some important parameters to consider, especially in the interpolation. These are:&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Parameters&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
wavelength = 0.67&lt;br /&gt;
Radius = int(sys.argv[1])&lt;br /&gt;
flag = int(sys.argv[2])&lt;br /&gt;
cutoff = 2e4  # Bragg peaks with maxima below cutoff will be ignored&lt;br /&gt;
tol = 0.1     # The Q range around which the program searches for a half-maximum&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===CUDA Code===&lt;br /&gt;
The code is obviously parallel. The next step is to re-write the code in CUDA to improve speed.&lt;/div&gt;</summary>
		<author><name>Alank2</name></author>
	</entry>
	<entry>
		<id>http://micro.stanford.edu/mediawiki/index.php?title=Computational_XRD&amp;diff=6131</id>
		<title>Computational XRD</title>
		<link rel="alternate" type="text/html" href="http://micro.stanford.edu/mediawiki/index.php?title=Computational_XRD&amp;diff=6131"/>
		<updated>2015-08-20T02:47:12Z</updated>

		<summary type="html">&lt;p&gt;Alank2: /* Intensity Calculation in C++ */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;P ALIGN=&amp;quot;CENTER&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;FONT SIZE=&amp;quot;+3&amp;quot; color=&amp;quot;darkred&amp;quot;&amp;gt;&amp;lt;STRONG&amp;gt;&lt;br /&gt;
Computational XRD&amp;lt;/STRONG&amp;gt;&amp;lt;/font&amp;gt;&amp;lt;/P&amp;gt;&lt;br /&gt;
&amp;lt;DIV&amp;gt;&lt;br /&gt;
&amp;lt;P ALIGN=&amp;quot;CENTER&amp;quot;&amp;gt;&amp;lt;STRONG&amp;gt; &amp;lt;/STRONG&amp;gt;&amp;lt;/P&amp;gt;&lt;br /&gt;
&amp;lt;/DIV&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Making Nanoparticles===&lt;br /&gt;
&lt;br /&gt;
Here we give an example of how to generate nanoparticles with different dislocations. One may have to play around a bit with the directories to make sure that the files get opened and written to the correct places. A python version of the MD++ code is necessary. The relevant python files are:&lt;br /&gt;
&lt;br /&gt;
generate_particles.py&lt;br /&gt;
XRDsetup.py&lt;br /&gt;
&lt;br /&gt;
and these can be run with the command:&lt;br /&gt;
bin/eam generate_particles.py&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Notable Parameters&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# flag = 0 is no dislocations&lt;br /&gt;
# flag = 1 is only one dislocation&lt;br /&gt;
# flag = 2 is multiple randomly generated dislocations&lt;br /&gt;
flag = 0 &lt;br /&gt;
start = 40    # Radius of the nanoparticle&lt;br /&gt;
numDisls = 6  # if flag == 2, the number of dislocations&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This generates a series of .cn, .cfg, and a file of atomic positions which will be read by the C++ code to calculate the Intensity. &lt;br /&gt;
&lt;br /&gt;
===Intensity Calculation in C++===&lt;br /&gt;
&lt;br /&gt;
First, make sure the required libraries are installed. The GSL, C++11, and OpenMP packages are required (the GSL library is for easily making histograms). The required files are the previous file of atomic positions and the attached C++ file:&lt;br /&gt;
&lt;br /&gt;
Now we are ready to run&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
g++ -o XRD.exe XRD_OpenMP.cpp -lgsl -lgslcblas -lm -fopenmp -std=c++11&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
followed simply by &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
./XRD.exe.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Parameters&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
flag = 0 &lt;br /&gt;
Radius = 40    &lt;br /&gt;
divs = 6         # the number of partial distance calculations to compute.&lt;br /&gt;
                 # this needs to be adjusted to larger values for large runs&lt;br /&gt;
                 # because of memory issues. If not set properly, the code will&lt;br /&gt;
                 # exit with a memory error.&lt;br /&gt;
num_bins = 5000  # the number of bins in the histogram per division&lt;br /&gt;
N = 1000         # the number of points for the Intensity and Q&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
I plan to run several different sizes and compare the time taken for this calculation for a fixed num_bins, divs, and N to access the scalability. Currently the code is highly un-optimized. This code should be re-written with dynamic arrays instead of vectors in order to become much more parallel.&lt;br /&gt;
&lt;br /&gt;
===Plotting and Interpolating===&lt;br /&gt;
&lt;br /&gt;
The next step is to read the file of Intensities and Q values into the python script attached. The Intensity and Q values that are either background before the first real Bragg peak or are small values past Q~20 are gotten rid of. The interpolation is only done on the largest 5-10 peaks. The number of peaks that can be reasonably interpolated decreases with increasing number of dislocations as the peaks broaden. There are some important parameters to consider, especially in the interpolation. These are:&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Parameters&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
wavelength = 0.67&lt;br /&gt;
Radius = int(sys.argv[1])&lt;br /&gt;
flag = int(sys.argv[2])&lt;br /&gt;
cutoff = 2e4  # Bragg peaks with maxima below cutoff will be ignored&lt;br /&gt;
tol = 0.1     # The Q range around which the program searches for a half-maximum&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===CUDA Code===&lt;br /&gt;
The code is obviously parallel. The next step is to re-write the code in CUDA to improve speed.&lt;/div&gt;</summary>
		<author><name>Alank2</name></author>
	</entry>
	<entry>
		<id>http://micro.stanford.edu/mediawiki/index.php?title=Computational_XRD&amp;diff=6130</id>
		<title>Computational XRD</title>
		<link rel="alternate" type="text/html" href="http://micro.stanford.edu/mediawiki/index.php?title=Computational_XRD&amp;diff=6130"/>
		<updated>2015-08-15T05:14:49Z</updated>

		<summary type="html">&lt;p&gt;Alank2: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;P ALIGN=&amp;quot;CENTER&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;FONT SIZE=&amp;quot;+3&amp;quot; color=&amp;quot;darkred&amp;quot;&amp;gt;&amp;lt;STRONG&amp;gt;&lt;br /&gt;
Computational XRD&amp;lt;/STRONG&amp;gt;&amp;lt;/font&amp;gt;&amp;lt;/P&amp;gt;&lt;br /&gt;
&amp;lt;DIV&amp;gt;&lt;br /&gt;
&amp;lt;P ALIGN=&amp;quot;CENTER&amp;quot;&amp;gt;&amp;lt;STRONG&amp;gt; &amp;lt;/STRONG&amp;gt;&amp;lt;/P&amp;gt;&lt;br /&gt;
&amp;lt;/DIV&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Making Nanoparticles===&lt;br /&gt;
&lt;br /&gt;
Here we give an example of how to generate nanoparticles with different dislocations. One may have to play around a bit with the directories to make sure that the files get opened and written to the correct places. A python version of the MD++ code is necessary. The relevant python files are:&lt;br /&gt;
&lt;br /&gt;
generate_particles.py&lt;br /&gt;
XRDsetup.py&lt;br /&gt;
&lt;br /&gt;
and these can be run with the command:&lt;br /&gt;
bin/eam generate_particles.py&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Notable Parameters&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# flag = 0 is no dislocations&lt;br /&gt;
# flag = 1 is only one dislocation&lt;br /&gt;
# flag = 2 is multiple randomly generated dislocations&lt;br /&gt;
flag = 0 &lt;br /&gt;
start = 40    # Radius of the nanoparticle&lt;br /&gt;
numDisls = 6  # if flag == 2, the number of dislocations&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This generates a series of .cn, .cfg, and a file of atomic positions which will be read by the C++ code to calculate the Intensity. &lt;br /&gt;
&lt;br /&gt;
===Intensity Calculation in C++===&lt;br /&gt;
&lt;br /&gt;
First, make sure the required libraries are installed. The GSL, C++11, and OpenMP packages are required (the GSL library is for easily making histograms). The required files are the previous file of atomic positions and the attached C++ file:&lt;br /&gt;
&lt;br /&gt;
Now we are ready to run&lt;br /&gt;
g++ -o XRD.exe XRD_OpenMP.cpp -lgsl -lgslcblas -lm -fopenmp -std=c++11&lt;br /&gt;
followed simply by ./XRD.exe.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Parameters&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
flag = 0 &lt;br /&gt;
Radius = 40    &lt;br /&gt;
divs = 6         # the number of partial distance calculations to compute.&lt;br /&gt;
                 # this needs to be adjusted to larger values for large runs&lt;br /&gt;
                 # because of memory issues. If not set properly, the code will&lt;br /&gt;
                 # exit with a memory error.&lt;br /&gt;
num_bins = 5000  # the number of bins in the histogram per division&lt;br /&gt;
N = 1000         # the number of points for the Intensity and Q&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
I plan to run several different sizes and compare the time taken for this calculation for a fixed num_bins, divs, and N to access the scalability. Currently the code is highly un-optimized. This code should be re-written with dynamic arrays instead of vectors in order to become much more parallel.&lt;br /&gt;
&lt;br /&gt;
===Plotting and Interpolating===&lt;br /&gt;
&lt;br /&gt;
The next step is to read the file of Intensities and Q values into the python script attached. The Intensity and Q values that are either background before the first real Bragg peak or are small values past Q~20 are gotten rid of. The interpolation is only done on the largest 5-10 peaks. The number of peaks that can be reasonably interpolated decreases with increasing number of dislocations as the peaks broaden. There are some important parameters to consider, especially in the interpolation. These are:&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Parameters&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
wavelength = 0.67&lt;br /&gt;
Radius = int(sys.argv[1])&lt;br /&gt;
flag = int(sys.argv[2])&lt;br /&gt;
cutoff = 2e4  # Bragg peaks with maxima below cutoff will be ignored&lt;br /&gt;
tol = 0.1     # The Q range around which the program searches for a half-maximum&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===CUDA Code===&lt;br /&gt;
The code is obviously parallel. The next step is to re-write the code in CUDA to improve speed.&lt;/div&gt;</summary>
		<author><name>Alank2</name></author>
	</entry>
	<entry>
		<id>http://micro.stanford.edu/mediawiki/index.php?title=Computational_XRD&amp;diff=6129</id>
		<title>Computational XRD</title>
		<link rel="alternate" type="text/html" href="http://micro.stanford.edu/mediawiki/index.php?title=Computational_XRD&amp;diff=6129"/>
		<updated>2015-08-15T05:12:29Z</updated>

		<summary type="html">&lt;p&gt;Alank2: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;P ALIGN=&amp;quot;CENTER&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;FONT SIZE=&amp;quot;+3&amp;quot; color=&amp;quot;darkred&amp;quot;&amp;gt;&amp;lt;STRONG&amp;gt;&lt;br /&gt;
Computational XRD&amp;lt;/STRONG&amp;gt;&amp;lt;/font&amp;gt;&amp;lt;/P&amp;gt;&lt;br /&gt;
&amp;lt;DIV&amp;gt;&lt;br /&gt;
&amp;lt;P ALIGN=&amp;quot;CENTER&amp;quot;&amp;gt;&amp;lt;STRONG&amp;gt; &amp;lt;/STRONG&amp;gt;&amp;lt;/P&amp;gt;&lt;br /&gt;
&amp;lt;/DIV&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Making Nanoparticles===&lt;br /&gt;
&lt;br /&gt;
Here we give an example of how to generate nanoparticles with different dislocations. One may have to play around a bit with the directories to make sure that the files get opened and written to the correct places. A python version of the MD++ code is necessary. The relevant python files are:&lt;br /&gt;
&lt;br /&gt;
generate_particles.py&lt;br /&gt;
XRDsetup.py&lt;br /&gt;
&lt;br /&gt;
and these can be run with the command:&lt;br /&gt;
bin/eam generate_particles.py&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Notable Parameters&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# flag = 0 is no dislocations&lt;br /&gt;
# flag = 1 is only one dislocation&lt;br /&gt;
# flag = 2 is multiple randomly generated dislocations&lt;br /&gt;
flag = 0 &lt;br /&gt;
start = 40    # Radius of the nanoparticle&lt;br /&gt;
numDisls = 6  # if flag == 2, the number of dislocations&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This generates a series of .cn, .cfg, and a file of atomic positions which will be read by the C++ code to calculate the Intensity. &lt;br /&gt;
&lt;br /&gt;
===Intensity Calculation in C++===&lt;br /&gt;
&lt;br /&gt;
First, make sure the required libraries are installed. The GSL, C++11, and OpenMP packages are required (the GSL library is for easily making histograms). The required files are the previous file of atomic positions and the attached C++ file:&lt;br /&gt;
&lt;br /&gt;
Now we are ready to run&lt;br /&gt;
g++ -o XRD.exe XRD_OpenMP.cpp -lgsl -lgslcblas -lm -fopenmp -std=c++11&lt;br /&gt;
followed simply by ./XRD.exe.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Parameters&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
flag = 0 &lt;br /&gt;
Radius = 40    &lt;br /&gt;
divs = 6         # the number of partial distance calculations to compute.&lt;br /&gt;
                 # this needs to be adjusted to larger values for large runs&lt;br /&gt;
                 # because of memory issues. If not set properly, the code will&lt;br /&gt;
                 # exit with a memory error.&lt;br /&gt;
num_bins = 5000  # the number of bins in the histogram per division&lt;br /&gt;
N = 1000         # the number of points for the Intensity and Q&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Plotting and Interpolating===&lt;br /&gt;
&lt;br /&gt;
The next step is to read the file of Intensities and Q values into the python script attached. The Intensity and Q values that are either background before the first real Bragg peak or are small values past Q~20 are gotten rid of. The interpolation is only done on the largest 5-10 peaks. The number of peaks that can be reasonably interpolated decreases with increasing number of dislocations as the peaks broaden. There are some important parameters to consider, especially in the interpolation. These are:&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Parameters&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
wavelength = 0.67&lt;br /&gt;
Radius = int(sys.argv[1])&lt;br /&gt;
flag = int(sys.argv[2])&lt;br /&gt;
cutoff = 2e4  # Bragg peaks with maxima below cutoff will be ignored&lt;br /&gt;
tol = 0.1     # The Q range around which the program searches for a half-maximum&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===CUDA Code===&lt;br /&gt;
The code is obviously parallel. The next step is to re-write the code in CUDA to improve speed.&lt;/div&gt;</summary>
		<author><name>Alank2</name></author>
	</entry>
	<entry>
		<id>http://micro.stanford.edu/mediawiki/index.php?title=Computational_XRD&amp;diff=6128</id>
		<title>Computational XRD</title>
		<link rel="alternate" type="text/html" href="http://micro.stanford.edu/mediawiki/index.php?title=Computational_XRD&amp;diff=6128"/>
		<updated>2015-08-15T05:11:51Z</updated>

		<summary type="html">&lt;p&gt;Alank2: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;P ALIGN=&amp;quot;CENTER&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;FONT SIZE=&amp;quot;+3&amp;quot; color=&amp;quot;darkred&amp;quot;&amp;gt;&amp;lt;STRONG&amp;gt;&lt;br /&gt;
Computational XRD&amp;lt;/STRONG&amp;gt;&amp;lt;/font&amp;gt;&amp;lt;/P&amp;gt;&lt;br /&gt;
&amp;lt;DIV&amp;gt;&lt;br /&gt;
&amp;lt;P ALIGN=&amp;quot;CENTER&amp;quot;&amp;gt;&amp;lt;STRONG&amp;gt; &amp;lt;/STRONG&amp;gt;&amp;lt;/P&amp;gt;&lt;br /&gt;
&amp;lt;/DIV&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Making Nanoparticles===&lt;br /&gt;
&lt;br /&gt;
Here we give an example of how to generate nanoparticles with different dislocations. One may have to play around a bit with the directories to make sure that the files get opened and written to the correct places. A python version of the MD++ code is necessary. The relevant python files are:&lt;br /&gt;
&lt;br /&gt;
generate_particles.py&lt;br /&gt;
XRDsetup.py&lt;br /&gt;
&lt;br /&gt;
and these can be run with the command:&lt;br /&gt;
bin/eam generate_particles.py&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Notable Parameters&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# flag = 0 is no dislocations&lt;br /&gt;
# flag = 1 is only one dislocation&lt;br /&gt;
# flag = 2 is multiple randomly generated dislocations&lt;br /&gt;
flag = 0 &lt;br /&gt;
start = 40    # Radius of the nanoparticle&lt;br /&gt;
numDisls = 6  # if flag == 2, the number of dislocations&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This generates a series of .cn, .cfg, and a file of atomic positions which will be read by the C++ code to calculate the Intensity. &lt;br /&gt;
&lt;br /&gt;
===Intensity Calculation in C++===&lt;br /&gt;
&lt;br /&gt;
First, make sure the required libraries are installed. The GSL, C++11, and OpenMP packages are required (the GSL library is for easily making histograms). The required files are the previous file of atomic positions and the attached C++ file:&lt;br /&gt;
&lt;br /&gt;
Now we are ready to run&lt;br /&gt;
g++ -o XRD.exe XRD_OpenMP.cpp -lgsl -lgslcblas -lm -fopenmp -std=c++11&lt;br /&gt;
followed simply by ./XRD.exe.&lt;br /&gt;
&#039;&#039;&#039;Parameters&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
flag = 0 &lt;br /&gt;
Radius = 40    &lt;br /&gt;
divs = 6         # the number of partial distance calculations to compute.&lt;br /&gt;
                 # this needs to be adjusted to larger values for large runs&lt;br /&gt;
                 # because of memory issues. If not set properly, the code will&lt;br /&gt;
                 # exit with a memory error.&lt;br /&gt;
num_bins = 5000  # the number of bins in the histogram per division&lt;br /&gt;
N = 1000         # the number of points for the Intensity and Q&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Plotting and Interpolating===&lt;br /&gt;
&lt;br /&gt;
The next step is to read the file of Intensities and Q values into the python script attached. The Intensity and Q values that are either background before the first real Bragg peak or are small values past Q~20 are gotten rid of. The interpolation is only done on the largest 5-10 peaks. The number of peaks that can be reasonably interpolated decreases with increasing number of dislocations as the peaks broaden. There are some important parameters to consider, especially in the interpolation. These are:&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Parameters&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
wavelength = 0.67&lt;br /&gt;
Radius = int(sys.argv[1])&lt;br /&gt;
flag = int(sys.argv[2])&lt;br /&gt;
cutoff = 2e4  # Bragg peaks with maxima below cutoff will be ignored&lt;br /&gt;
tol = 0.1     # The Q range around which the program searches for a half-maximum&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===CUDA Code===&lt;br /&gt;
The code is obviously parallel. The next step is to re-write the code in CUDA to improve speed.&lt;/div&gt;</summary>
		<author><name>Alank2</name></author>
	</entry>
	<entry>
		<id>http://micro.stanford.edu/mediawiki/index.php?title=Computational_XRD&amp;diff=6127</id>
		<title>Computational XRD</title>
		<link rel="alternate" type="text/html" href="http://micro.stanford.edu/mediawiki/index.php?title=Computational_XRD&amp;diff=6127"/>
		<updated>2015-08-15T04:57:24Z</updated>

		<summary type="html">&lt;p&gt;Alank2: Created page with &amp;quot;&amp;lt;P ALIGN=&amp;quot;CENTER&amp;quot;&amp;gt; &amp;lt;FONT SIZE=&amp;quot;+3&amp;quot; color=&amp;quot;darkred&amp;quot;&amp;gt;&amp;lt;STRONG&amp;gt; Computational XRD&amp;lt;/STRONG&amp;gt;&amp;lt;/font&amp;gt;&amp;lt;/P&amp;gt; &amp;lt;DIV&amp;gt; &amp;lt;P ALIGN=&amp;quot;CENTER&amp;quot;&amp;gt;&amp;lt;STRONG&amp;gt; &amp;lt;/STRONG&amp;gt;&amp;lt;/P&amp;gt; &amp;lt;/DIV&amp;gt;  ===Making Nanoparticle...&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;P ALIGN=&amp;quot;CENTER&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;FONT SIZE=&amp;quot;+3&amp;quot; color=&amp;quot;darkred&amp;quot;&amp;gt;&amp;lt;STRONG&amp;gt;&lt;br /&gt;
Computational XRD&amp;lt;/STRONG&amp;gt;&amp;lt;/font&amp;gt;&amp;lt;/P&amp;gt;&lt;br /&gt;
&amp;lt;DIV&amp;gt;&lt;br /&gt;
&amp;lt;P ALIGN=&amp;quot;CENTER&amp;quot;&amp;gt;&amp;lt;STRONG&amp;gt; &amp;lt;/STRONG&amp;gt;&amp;lt;/P&amp;gt;&lt;br /&gt;
&amp;lt;/DIV&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Making Nanoparticles===&lt;br /&gt;
&lt;br /&gt;
Here we give an example of how to generate nanoparticles with different dislocations. A python version of the MD++ code is necessary. The relevant python files are:&lt;br /&gt;
&lt;br /&gt;
generate_particles.py&lt;br /&gt;
XRDsetup.py&lt;br /&gt;
&lt;br /&gt;
and these can be run with the command:&lt;br /&gt;
bin/eam generate_particles.py&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Flags&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# flag = 0 is no dislocations&lt;br /&gt;
# flag = 1 is only one dislocation&lt;br /&gt;
# flag = 2 is multiple randomly generated dislocations&lt;br /&gt;
flag = 0 &lt;br /&gt;
start = 40    # Radius of the nanoparticle&lt;br /&gt;
numDisls = 6  # if flag == 2, the number of dislocations&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This generates a series of .cn, .cfg, and a file of atomic positions which will be read by the C++ code to calculate the Intensity. &lt;br /&gt;
&lt;br /&gt;
===Intensity Calculation in C++===&lt;br /&gt;
&lt;br /&gt;
First, make sure the required libraries are installed. The GSL, C++11, and OpenMP packages are required (the GSL library is for easily making histograms). The required files are the previous file of atomic positions and the attached C++ file:&lt;br /&gt;
&lt;br /&gt;
Now we are ready to run&lt;br /&gt;
g++ -o XRD.exe XRD_OpenMP.cpp -lgsl -lgslcblas -lm -fopenmp -std=c++11&lt;br /&gt;
&lt;br /&gt;
===Plotting and Interpolating===&lt;br /&gt;
&lt;br /&gt;
The next step is to read the file of Intensities and Q values into the python script attached. The Intensity and Q values that are either background before the first real Bragg peak or are small values past Q~20 are gotten rid of. The interpolation is only done on the largest 5-10 peaks. The number of peaks that can be reasonably interpolated decreases with increasing number of dislocations as the peaks broaden. There are some important parameters to consider, especially in the interpolation. These are:&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Parameters&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
wavelength = 0.67&lt;br /&gt;
Radius = int(sys.argv[1])&lt;br /&gt;
flag = int(sys.argv[2])&lt;br /&gt;
cutoff = 2e4  # Bragg peaks with maxima below cutoff will be ignored&lt;br /&gt;
tol = 0.1     # The Q range around which the program searches for a half-maximum&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===CUDA Code===&lt;br /&gt;
The code is obviously parallel. The next step is to re-write the code in CUDA to improve speed.&lt;/div&gt;</summary>
		<author><name>Alank2</name></author>
	</entry>
</feed>