<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://turbogap.fi/wiki/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Tigany+Zarrouk</id>
	<title>TurboGAP - User contributions [en]</title>
	<link rel="self" type="application/atom+xml" href="https://turbogap.fi/wiki/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Tigany+Zarrouk"/>
	<link rel="alternate" type="text/html" href="https://turbogap.fi/wiki/index.php/Special:Contributions/Tigany_Zarrouk"/>
	<updated>2026-05-06T15:51:44Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.34.2</generator>
	<entry>
		<id>https://turbogap.fi/wiki/index.php?title=Structural_Inference_Options&amp;diff=684</id>
		<title>Structural Inference Options</title>
		<link rel="alternate" type="text/html" href="https://turbogap.fi/wiki/index.php?title=Structural_Inference_Options&amp;diff=684"/>
		<updated>2026-03-22T14:59:28Z</updated>

		<summary type="html">&lt;p&gt;Tigany Zarrouk: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Structural inference of experimental data (of the types that can be simulated by [[Experimental Observable Options]] can be performed with TurboGAP via Reverse Monte-Carlo (RMC) or Molecular Augmented Dynamics (MAD). &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 n_exp = 1                                     # Number of experimental observables we wish&lt;br /&gt;
                                               # the structure to replicate&lt;br /&gt;
 exp_labels = 'xps'                            # Labels of experimental observables&lt;br /&gt;
                                               # (currently limited to xps/xrd/nd/pdf)&lt;br /&gt;
 exp_data_files = 'xps_spectra_exp.dat'        # Experimental data&lt;br /&gt;
 exp_n_samples = 501                           # Number of samples for linear interpolation&lt;br /&gt;
                                               # of experimental data (needed if data is not&lt;br /&gt;
                                               # on a uniform grid), this number should be &lt;br /&gt;
                                               # greater than the number of data points in&lt;br /&gt;
                                               # the exp. data file.&lt;br /&gt;
 exp_energy_scales = 10.0                      # The energy scale (gamma) for exp. potential. &lt;br /&gt;
 exp_energy_scales_beg = 10.0                  # The intital energy scale &lt;br /&gt;
 exp_energy_scales_end = 100.0                 # The final energy scale &lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;/div&gt;</summary>
		<author><name>Tigany Zarrouk</name></author>
		
	</entry>
	<entry>
		<id>https://turbogap.fi/wiki/index.php?title=Structural_Inference_Options&amp;diff=683</id>
		<title>Structural Inference Options</title>
		<link rel="alternate" type="text/html" href="https://turbogap.fi/wiki/index.php?title=Structural_Inference_Options&amp;diff=683"/>
		<updated>2026-03-22T14:58:44Z</updated>

		<summary type="html">&lt;p&gt;Tigany Zarrouk: Created page with &amp;quot;Structural inference of experimental data (of the types that can be simulated by Experimental Observable Options can be performed with TurboGAP via Reverse Monte-Carlo (RM...&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Structural inference of experimental data (of the types that can be simulated by [[Experimental Observable Options]] can be performed with TurboGAP via Reverse Monte-Carlo (RMC) or Molecular Augmented Dynamics (MAD). &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 n_exp = 1                                     # Number of experimental observables we wish&lt;br /&gt;
                                               # the structure to replicate&lt;br /&gt;
 exp_labels = 'xps'                            # Labels of experimental observables&lt;br /&gt;
                                               # (currently limited to xps/xrd/nd/pdf)&lt;br /&gt;
 exp_data_files = 'xps_spectra_exp.dat'        # Experimental data&lt;br /&gt;
 exp_n_samples = 501                           # Number of samples for linear interpolation&lt;br /&gt;
                                               # of experimental data (needed if data is not on&lt;br /&gt;
                                               # a uniform grid), this number should be greater &lt;br /&gt;
                                               # than the number of data points in the exp data file.&lt;br /&gt;
 exp_energy_scales = 10.0                      # The energy scale (gamma) for exp. potential. &lt;br /&gt;
 exp_energy_scales_beg = 10.0                  # The intital energy scale &lt;br /&gt;
 exp_energy_scales_end = 100.0                 # The final energy scale &lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;/div&gt;</summary>
		<author><name>Tigany Zarrouk</name></author>
		
	</entry>
	<entry>
		<id>https://turbogap.fi/wiki/index.php?title=Experimental_Observable_Options&amp;diff=682</id>
		<title>Experimental Observable Options</title>
		<link rel="alternate" type="text/html" href="https://turbogap.fi/wiki/index.php?title=Experimental_Observable_Options&amp;diff=682"/>
		<updated>2026-03-22T14:53:56Z</updated>

		<summary type="html">&lt;p&gt;Tigany Zarrouk: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Options for predicting experimental observables are found below. &lt;br /&gt;
&lt;br /&gt;
Currently implemented observables are pair distribution functions, powder x-ray diffraction, powder neutron diffraction and x-ray photoelectron spectra.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
do_xrd                      = .true.     # Do X-Ray diffraction prediction &lt;br /&gt;
q_range_min                 =   1.0      # -&amp;gt; Range for the XRD/structure factor &lt;br /&gt;
                                         #    calculation: q = 4 pi sin( theta ) &lt;br /&gt;
                                         #    / lambda, where theta is the half &lt;br /&gt;
                                         #    angle of diffraction&lt;br /&gt;
q_range_max                 =  10.0      # -&amp;gt; Range - &amp;quot; - &lt;br /&gt;
write_xrd                   = .true.     # -&amp;gt; Write out xrd pattern&lt;br /&gt;
xrd_output                  = 'q*F(q)'   # -&amp;gt; Output the XRD pattern as the direct&lt;br /&gt;
                                         #    Fourier transform of G(r), the reduced &lt;br /&gt;
                                         #    PDF (this can be 'F(q)'/'i(q)' or &lt;br /&gt;
                                         #    the full xrd intensity 'xrd')&lt;br /&gt;
&lt;br /&gt;
do_pair_distribution        = .true.     # Calculate the XRD from the pair &lt;br /&gt;
                                         # distribution function, so it scales &lt;br /&gt;
                                         # linearly with the number of atoms&lt;br /&gt;
pair_distribution_kde_sigma =   0.1      # -&amp;gt; Use Gaussian Kernel Density Estimate &lt;br /&gt;
                                         #    of width 0.1A to smooth out, &lt;br /&gt;
                                         #    accounting for thermal broadening&lt;br /&gt;
pair_distribution_partial   = .true.     # -&amp;gt; Calculate partial pair-distribution functions&lt;br /&gt;
pair_distribution_rcut      =  10.6      # -&amp;gt; Cutoff partial pair distribution &lt;br /&gt;
r_range_min                 =   0.1      # -&amp;gt; Range for the PDF calculation   &lt;br /&gt;
r_range_max                 =  10.0      # -&amp;gt; Range - &amp;quot; - &lt;br /&gt;
write_pair_distribution     = .true.     # -&amp;gt; Write out pair distribution functions &lt;br /&gt;
&lt;br /&gt;
do_structure_factor         = .true.     # Use (raw, non-scattering factor corrected)&lt;br /&gt;
                                         # (partial) structure factor(s) for calculations &lt;br /&gt;
structure_factor_from_pdf   = .true.     # -&amp;gt; Fourier transform the pair distribution &lt;br /&gt;
                                         #    functions to obtain the uncorrected structure&lt;br /&gt;
                                         #    factors, which when corrected give the XRD pattern. &lt;br /&gt;
structure_factor_window     = .true.     # -&amp;gt; Use a multiplicative &amp;quot;windowing&amp;quot; function&lt;br /&gt;
                                         #    (sin(pi r / r_cut)/(pi r / r_cut)) in the fourier&lt;br /&gt;
                                         #    transform of pdf to minimize high frequency &lt;br /&gt;
                                         #    artifacts resulting from the finite range &lt;br /&gt;
                                         #    Fourier transform.&lt;br /&gt;
write_structure_factor      = .true.     # -&amp;gt; Write out structure factors&lt;br /&gt;
&lt;br /&gt;
do_xps = .true.                          # Do x-ray photoelectron spectroscopy (XPS) &lt;br /&gt;
                                         # prediction if a model has been specified&lt;br /&gt;
                                         # in the .gap file&lt;br /&gt;
xps_e_min = 280.                         # -&amp;gt; Minimum of range for XPS prediction&lt;br /&gt;
xps_e_max = 300.                         # -&amp;gt; Maximum of range for XPS prediction&lt;br /&gt;
xps_n_samples = 301                      # -&amp;gt; Number of samples for XPS prediction&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;/div&gt;</summary>
		<author><name>Tigany Zarrouk</name></author>
		
	</entry>
	<entry>
		<id>https://turbogap.fi/wiki/index.php?title=Experimental_Observable_Options&amp;diff=681</id>
		<title>Experimental Observable Options</title>
		<link rel="alternate" type="text/html" href="https://turbogap.fi/wiki/index.php?title=Experimental_Observable_Options&amp;diff=681"/>
		<updated>2026-03-22T14:53:14Z</updated>

		<summary type="html">&lt;p&gt;Tigany Zarrouk: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Options for predicting experimental observables are found below. &lt;br /&gt;
&lt;br /&gt;
Currently implemented observables are pair distribution functions, powder x-ray diffraction, powder neutron diffraction and x-ray photoelectron spectra.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
do_xrd                      = .true.     # Do X-Ray diffraction prediction &lt;br /&gt;
q_range_min                 =   1.0      # -&amp;gt; Range for the XRD/structure factor &lt;br /&gt;
                                         #    calculation: q = 4 pi sin( theta ) &lt;br /&gt;
                                         #    / lambda, where theta is the half &lt;br /&gt;
                                         #    angle of diffraction&lt;br /&gt;
q_range_max                 =  10.0      # -&amp;gt; Range - &amp;quot; - &lt;br /&gt;
write_xrd                   = .true.     # -&amp;gt; Write out xrd pattern&lt;br /&gt;
xrd_output                  = 'q*F(q)'   # -&amp;gt; Output the XRD pattern as the direct&lt;br /&gt;
                                         #    Fourier transform of G(r), the reduced &lt;br /&gt;
                                         #    PDF (this can be 'F(q)'/'i(q)' or &lt;br /&gt;
                                         #    the full xrd intensity 'xrd')&lt;br /&gt;
&lt;br /&gt;
do_pair_distribution        = .true.     # Calculate the XRD from the pair &lt;br /&gt;
                                         # distribution function, so it scales &lt;br /&gt;
                                         # linearly with the number of atoms&lt;br /&gt;
pair_distribution_kde_sigma =   0.1      # -&amp;gt; Use Gaussian Kernel Density Estimate &lt;br /&gt;
                                         #    of width 0.1A to smooth out, &lt;br /&gt;
                                         #    accounting for thermal broadening&lt;br /&gt;
pair_distribution_partial   = .true.     # -&amp;gt; Calculate partial pair-distribution functions&lt;br /&gt;
pair_distribution_rcut      =  10.6      # -&amp;gt; Cutoff partial pair distribution &lt;br /&gt;
r_range_min                 =   0.1      # -&amp;gt; Range for the PDF calculation   &lt;br /&gt;
r_range_max                 =  10.0      # -&amp;gt; Range - &amp;quot; - &lt;br /&gt;
write_pair_distribution     = .true.     # -&amp;gt; Write out pair distribution functions &lt;br /&gt;
&lt;br /&gt;
do_structure_factor         = .true.     # Use (raw, non-scattering factor corrected)&lt;br /&gt;
                                         # (partial) structure factor(s) for calculations &lt;br /&gt;
structure_factor_from_pdf   = .true.     # -&amp;gt; Fourier transform the pair distribution &lt;br /&gt;
                                         #    functions to obtain the uncorrected structure&lt;br /&gt;
                                         #    factors, which when corrected give the XRD pattern. &lt;br /&gt;
structure_factor_window     = .true.     # -&amp;gt; Use a multiplicative &amp;quot;windowing&amp;quot; function&lt;br /&gt;
                                         #    (sin(pi r / r_cut)/(pi r / r_cut)) in the fourier&lt;br /&gt;
                                         #    transform of pdf to minimize high frequency &lt;br /&gt;
                                         #    artifacts resulting from the finite range &lt;br /&gt;
                                         #    Fourier transform.&lt;br /&gt;
write_structure_factor      = .true.     # -&amp;gt; Write out structure factors&lt;br /&gt;
&lt;br /&gt;
do_xps = .true.                          # Do x-ray photoelectron spectroscopy (XPS) prediction&lt;br /&gt;
                                         # if a model has been specified in the .gap file&lt;br /&gt;
xps_e_min = 280.                         # -&amp;gt; Minimum of range for XPS prediction&lt;br /&gt;
xps_e_max = 300.                         # -&amp;gt; Maximum of range for XPS prediction&lt;br /&gt;
xps_n_samples = 301                      # -&amp;gt; Number of samples for XPS prediction&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;/div&gt;</summary>
		<author><name>Tigany Zarrouk</name></author>
		
	</entry>
	<entry>
		<id>https://turbogap.fi/wiki/index.php?title=Experimental_Observable_Options&amp;diff=680</id>
		<title>Experimental Observable Options</title>
		<link rel="alternate" type="text/html" href="https://turbogap.fi/wiki/index.php?title=Experimental_Observable_Options&amp;diff=680"/>
		<updated>2026-03-22T14:52:36Z</updated>

		<summary type="html">&lt;p&gt;Tigany Zarrouk: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Options for predicting experimental observables are found below. &lt;br /&gt;
&lt;br /&gt;
Currently implemented observables are pair distribution functions, powder x-ray diffraction, powder neutron diffraction and x-ray photoelectron spectra.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
do_xrd                      = .true.     # Do X-Ray diffraction prediction &lt;br /&gt;
q_range_min                 =   1.0      # -&amp;gt; Range for the XRD/structure factor &lt;br /&gt;
                                         #    calculation: q = 4 pi sin( theta ) &lt;br /&gt;
                                         #    / lambda, where theta is the half &lt;br /&gt;
                                         #    angle of diffraction&lt;br /&gt;
q_range_max                 =  10.0      # -&amp;gt; Range - &amp;quot; - &lt;br /&gt;
write_xrd                   = .true.     # -&amp;gt; Write out xrd pattern&lt;br /&gt;
xrd_output                  = 'q*F(q)'   # -&amp;gt; Output the XRD pattern as the direct&lt;br /&gt;
                                         #    Fourier transform of G(r), the reduced &lt;br /&gt;
                                         #    PDF (this can be 'F(q)'/'i(q)' or &lt;br /&gt;
                                         #    the full xrd intensity 'xrd')&lt;br /&gt;
&lt;br /&gt;
do_pair_distribution        = .true.     # Calculate the XRD from the pair &lt;br /&gt;
                                         # distribution function, so it scales &lt;br /&gt;
                                         # linearly with the number of atoms&lt;br /&gt;
pair_distribution_kde_sigma =   0.1      # -&amp;gt; Use Gaussian Kernel Density Estimate &lt;br /&gt;
                                         #    of width 0.1A to smooth out, &lt;br /&gt;
                                         #    accounting for thermal broadening&lt;br /&gt;
pair_distribution_partial   = .true.     # -&amp;gt; Calculate partial pair-distribution functions&lt;br /&gt;
pair_distribution_rcut      =  10.6      # -&amp;gt; Cutoff partial pair distribution &lt;br /&gt;
r_range_min                 =   0.1      # -&amp;gt; Range for the PDF calculation   &lt;br /&gt;
r_range_max                 =  10.0      # -&amp;gt; Range - &amp;quot; - &lt;br /&gt;
write_pair_distribution     = .true.     # -&amp;gt; Write out pair distribution functions &lt;br /&gt;
&lt;br /&gt;
do_structure_factor         = .true.     # Use (raw, non-scattering factor corrected)&lt;br /&gt;
                                         # (partial) structure factor(s) for calculations &lt;br /&gt;
structure_factor_from_pdf   = .true.     # -&amp;gt; Fourier transform the pair distribution &lt;br /&gt;
                                         #    functions to obtain the uncorrected structure&lt;br /&gt;
                                         #    factors, which when corrected give the XRD pattern. &lt;br /&gt;
structure_factor_window     = .true.     # -&amp;gt; Use a multiplicative &amp;quot;windowing&amp;quot; function&lt;br /&gt;
                                         #    (sin(pi r / r_cut)/(pi r / r_cut)) in the fourier&lt;br /&gt;
                                         #    transform of pdf to minimize high frequency &lt;br /&gt;
                                         #    artifacts resulting from the finite range &lt;br /&gt;
                                         #    Fourier transform.&lt;br /&gt;
write_structure_factor      = .true.     # -&amp;gt; Write out structure factors&lt;br /&gt;
&lt;br /&gt;
do_xps = .true.                          # Do x-ray photoelectron spectroscopy (XPS) prediction if &lt;br /&gt;
                                         # a model has been specified in the .gap file&lt;br /&gt;
xps_e_min = 280.                         # Minimum of range for XPS prediction&lt;br /&gt;
xps_e_max = 300.                         # Maximum of range for XPS prediction&lt;br /&gt;
xps_n_samples = 301                      # Number of samples for XPS prediction&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;/div&gt;</summary>
		<author><name>Tigany Zarrouk</name></author>
		
	</entry>
	<entry>
		<id>https://turbogap.fi/wiki/index.php?title=Experimental_Observable_Options&amp;diff=679</id>
		<title>Experimental Observable Options</title>
		<link rel="alternate" type="text/html" href="https://turbogap.fi/wiki/index.php?title=Experimental_Observable_Options&amp;diff=679"/>
		<updated>2026-03-22T14:52:07Z</updated>

		<summary type="html">&lt;p&gt;Tigany Zarrouk: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Options for predicting experimental observables are found below. &lt;br /&gt;
&lt;br /&gt;
Currently implemented observables are pair distribution functions, powder x-ray diffraction, powder neutron diffraction and x-ray photoelectron spectra.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
do_xrd                      = .true.     # Do X-Ray diffraction prediction &lt;br /&gt;
q_range_min                 =   1.0      # -&amp;gt; Range for the XRD/structure factor &lt;br /&gt;
                                         #    calculation: q = 4 pi sin( theta ) &lt;br /&gt;
                                         #    / lambda, where theta is the half &lt;br /&gt;
                                         #    angle of diffraction&lt;br /&gt;
q_range_max                 =  10.0      # -&amp;gt; Range - &amp;quot; - &lt;br /&gt;
write_xrd                   = .true.     # -&amp;gt; Write out xrd pattern&lt;br /&gt;
xrd_output                  = 'q*F(q)'   # -&amp;gt; Output the XRD pattern as the direct&lt;br /&gt;
                                         #    Fourier transform of G(r), the reduced &lt;br /&gt;
                                         #    PDF (this can be 'F(q)'/'i(q)' or &lt;br /&gt;
                                         #    the full xrd intensity 'xrd')&lt;br /&gt;
&lt;br /&gt;
do_pair_distribution        = .true.     # Calculate the XRD from the pair &lt;br /&gt;
                                         # distribution function, so it scales &lt;br /&gt;
                                         # linearly with the number of atoms&lt;br /&gt;
pair_distribution_kde_sigma =   0.1      # -&amp;gt; Use Gaussian Kernel Density Estimate &lt;br /&gt;
                                         #    of width 0.1A to smooth out, &lt;br /&gt;
                                         #    accounting for thermal broadening&lt;br /&gt;
pair_distribution_partial   = .true.     # -&amp;gt; Calculate partial pair-distribution functions&lt;br /&gt;
pair_distribution_rcut      =  10.6      # -&amp;gt; Cutoff partial pair distribution &lt;br /&gt;
r_range_min                 =   0.1      # -&amp;gt; Range for the PDF calculation   &lt;br /&gt;
r_range_max                 =  10.0      # -&amp;gt; Range - &amp;quot; - &lt;br /&gt;
write_pair_distribution     = .true.     # -&amp;gt; Write out pair distribution functions &lt;br /&gt;
&lt;br /&gt;
do_structure_factor         = .true.     # Use (raw, non-scattering factor corrected)&lt;br /&gt;
                                         # (partial) structure factor(s) for calculations &lt;br /&gt;
structure_factor_from_pdf   = .true.     # -&amp;gt; Fourier transform the pair distribution &lt;br /&gt;
                                         #    functions to obtain the uncorrected structure&lt;br /&gt;
                                         #    factors, which when corrected give the XRD pattern. &lt;br /&gt;
structure_factor_window     = .true.     # -&amp;gt; Use a multiplicative &amp;quot;windowing&amp;quot; function&lt;br /&gt;
                                         #    (sin(pi r / r_cut)/(pi r / r_cut)) in the fourier&lt;br /&gt;
                                         #    transform of pdf to minimize high frequency &lt;br /&gt;
                                         #    artifacts resulting from the finite range Fourier&lt;br /&gt;
                                         #    transform.&lt;br /&gt;
write_structure_factor      = .true.     # -&amp;gt; Write out structure factors&lt;br /&gt;
&lt;br /&gt;
do_xps = .true.                          # Do x-ray photoelectron spectroscopy (XPS) prediction if &lt;br /&gt;
                                         # a model has been specified in the .gap file&lt;br /&gt;
xps_e_min = 280.                         # Minimum of range for XPS prediction&lt;br /&gt;
xps_e_max = 300.                         # Maximum of range for XPS prediction&lt;br /&gt;
xps_n_samples = 301                      # Number of samples for XPS prediction&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;/div&gt;</summary>
		<author><name>Tigany Zarrouk</name></author>
		
	</entry>
	<entry>
		<id>https://turbogap.fi/wiki/index.php?title=Experimental_Observable_Options&amp;diff=678</id>
		<title>Experimental Observable Options</title>
		<link rel="alternate" type="text/html" href="https://turbogap.fi/wiki/index.php?title=Experimental_Observable_Options&amp;diff=678"/>
		<updated>2026-03-22T14:50:35Z</updated>

		<summary type="html">&lt;p&gt;Tigany Zarrouk: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Options for predicting experimental observables are found below. &lt;br /&gt;
&lt;br /&gt;
Currently implemented observables are pair distribution functions, powder x-ray diffraction, powder neutron diffraction and x-ray photoelectron spectra.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
do_xrd                      = .true.     # Do X-Ray diffraction prediction &lt;br /&gt;
q_range_min                 =   1.0      # -&amp;gt; Range for the XRD/structure factor &lt;br /&gt;
                                         #    calculation: q = 4 pi sin( theta ) &lt;br /&gt;
                                         #    / lambda, where theta is the half &lt;br /&gt;
                                         #    angle of diffraction&lt;br /&gt;
q_range_max                 =  10.0      # -&amp;gt; Range - &amp;quot; - &lt;br /&gt;
write_xrd                   = .true.     # -&amp;gt; Write out xrd pattern&lt;br /&gt;
xrd_output                  = 'q*F(q)'   # -&amp;gt; Output the XRD pattern as the direct&lt;br /&gt;
                                         #    Fourier transform of G(r), the reduced &lt;br /&gt;
                                         #    PDF (this can be 'F(q)'/'i(q)' or &lt;br /&gt;
                                         #    the full xrd intensity 'xrd')&lt;br /&gt;
&lt;br /&gt;
do_pair_distribution        = .true.     # Calculate the XRD from the pair &lt;br /&gt;
                                         # distribution function, so it scales &lt;br /&gt;
                                         # linearly with the number of atoms&lt;br /&gt;
pair_distribution_kde_sigma =   0.1      # -&amp;gt; Use Gaussian Kernel Density Estimate &lt;br /&gt;
                                         #    of width 0.1A to smooth out, &lt;br /&gt;
                                         #    accounting for thermal broadening&lt;br /&gt;
pair_distribution_partial   = .true.     # -&amp;gt; Calculate partial pair-distribution functions&lt;br /&gt;
pair_distribution_rcut      =  10.6      # -&amp;gt; Cutoff partial pair distribution &lt;br /&gt;
r_range_min                 =   0.1      # -&amp;gt; Range for the PDF calculation   &lt;br /&gt;
r_range_max                 =  10.0      # -&amp;gt; Range - &amp;quot; - &lt;br /&gt;
write_pair_distribution     = .true.     # -&amp;gt; Write out pair distribution functions &lt;br /&gt;
&lt;br /&gt;
do_structure_factor         = .true.     # Use (raw, non-scattering factor corrected)&lt;br /&gt;
                                         # (partial) structure factor(s) for calculations &lt;br /&gt;
structure_factor_from_pdf   = .true.     # -&amp;gt; Fourier transform the pair distribution &lt;br /&gt;
                                         #    functions to obtain the uncorrected structure&lt;br /&gt;
                                         #    factors, which when corrected give the XRD pattern. &lt;br /&gt;
structure_factor_window     = .true.     # -&amp;gt; Use a multiplicative &amp;quot;windowing&amp;quot; function&lt;br /&gt;
                                         #    (sin(pi r / r_cut)/(pi r / r_cut)) in the fourier&lt;br /&gt;
                                         #    transform of pdf to minimize high frequency &lt;br /&gt;
                                         #    artifacts resulting from the finite range Fourier&lt;br /&gt;
                                         #    transform.&lt;br /&gt;
write_structure_factor      = .true.     # -&amp;gt; Write out structure factors&lt;br /&gt;
&lt;br /&gt;
do_xps = .true. &lt;br /&gt;
xps_e_min = 280.&lt;br /&gt;
xps_e_max = 300.&lt;br /&gt;
xps_n_samples = 301 &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;/div&gt;</summary>
		<author><name>Tigany Zarrouk</name></author>
		
	</entry>
	<entry>
		<id>https://turbogap.fi/wiki/index.php?title=Experimental_Observable_Options&amp;diff=677</id>
		<title>Experimental Observable Options</title>
		<link rel="alternate" type="text/html" href="https://turbogap.fi/wiki/index.php?title=Experimental_Observable_Options&amp;diff=677"/>
		<updated>2026-03-22T14:39:59Z</updated>

		<summary type="html">&lt;p&gt;Tigany Zarrouk: Created page with &amp;quot;Options for predicting experimental observables are found below.   Currently implemented observables are pair distribution functions, powder x-ray diffraction, powder neutron...&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Options for predicting experimental observables are found below. &lt;br /&gt;
&lt;br /&gt;
Currently implemented observables are pair distribution functions, powder x-ray diffraction, powder neutron diffraction and x-ray photoelecton spectra.&lt;/div&gt;</summary>
		<author><name>Tigany Zarrouk</name></author>
		
	</entry>
	<entry>
		<id>https://turbogap.fi/wiki/index.php?title=Documentation&amp;diff=676</id>
		<title>Documentation</title>
		<link rel="alternate" type="text/html" href="https://turbogap.fi/wiki/index.php?title=Documentation&amp;diff=676"/>
		<updated>2026-03-22T14:36:26Z</updated>

		<summary type="html">&lt;p&gt;Tigany Zarrouk: /* Special Features */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;'''TurboGAP''' is a program and associated collection of routines designed for carrying out atomistic calculations based on machine learning interatomic potentials. This page deals with the technical aspects of using '''TurboGAP'''; to learn more about the underlying theory, check the [[GAP theory]] page. Since it is often easier to learn by example, make sure to take a look at the [[tutorials]] to familiarize yourself with '''TurboGAP'''.&lt;br /&gt;
&lt;br /&gt;
== Calculation mode ==&lt;br /&gt;
&lt;br /&gt;
There are three basic modes for running a '''TurboGAP''' calculation, &amp;lt;code&amp;gt;turbogap predict&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;turbogap md&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;turbogap mc&amp;lt;/code&amp;gt;. They are invoked by simply typing &amp;lt;code&amp;gt;turbogap predict&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;turbogap md&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;turbogap mc&amp;lt;/code&amp;gt; in the command line or a bash script (e.g., to run MD in parallel on 8 CPU cores: &amp;lt;code&amp;gt;mpirun -np 8 turbogap md&amp;lt;/code&amp;gt;). All execution modes require an &amp;lt;code&amp;gt;input&amp;lt;/code&amp;gt; file with '''TurboGAP''' options, a &amp;lt;code&amp;gt;gap_files&amp;lt;/code&amp;gt; directory with the GAP potential to be used in the calculation, and an XYZ file in ASE's extended XYZ format with atomic positions, lattice vectors and chemical species information (for MD, also atomic velocities are needed).&lt;br /&gt;
&lt;br /&gt;
=== turbogap predict ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;turbogap predict&amp;lt;/code&amp;gt; performs single-point calculation (i.e., the atomic positions are ''not'' updated during the simulation) for [[total energy]], [[local energy]], [[forces]] and [[virial pressure]]. When available for the specific potential, it can also perform a [[Hirshfeld volume]] prediction. If the atoms file contains more than one configuration, in the form of concatenated individual atomic structures, '''TurboGAP''' will perform predictions for all of them.&lt;br /&gt;
&lt;br /&gt;
=== turbogap md ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;turbogap md&amp;lt;/code&amp;gt; performs [[molecular dynamics]] (default) or [[energy minimization]] according to the [[MD options|options]] specified in the &amp;lt;code&amp;gt;input&amp;lt;/code&amp;gt; file. Currently only Velocity-Verlet MD and gradient descent energy minimization are supported. We expect to add support for Monte Carlo and other simulation protocols in the near future. To choose between different methods to propagate the atomic positions, take a look at the &amp;lt;code&amp;gt;[[optimize]]&amp;lt;/code&amp;gt; keyword. If there are more than one atomic structures in the XYZ file, &amp;lt;code&amp;gt;turbogap md&amp;lt;/code&amp;gt; will use the first one as starting point. Note how this differs from the behavior of &amp;lt;code&amp;gt;turbogap predict&amp;lt;/code&amp;gt;, where single-point calculations are performed for ''all'' the structures in the XYZ file.&lt;br /&gt;
&lt;br /&gt;
=== turbogap mc ===&lt;br /&gt;
&amp;lt;code&amp;gt;turbogap mc&amp;lt;/code&amp;gt; performs (Grand-Canonical) [[Monte-Carlo]] simulations. These can be (NVT), (NPT), (mu VT) or (mu PT). Hybrid MC (using molecular dynamics to produce a trial move) can be performed as well as relaxation after specific trial moves. The user can specify a large number of move types. For reference on the specification see [[Monte-Carlo]]. The outputs are &amp;lt;code&amp;gt;mc.log&amp;lt;/code&amp;gt; (the log file), &amp;lt;code&amp;gt;mc_all.xyz&amp;lt;/code&amp;gt; all of the accepted MC steps, &amp;lt;code&amp;gt;mc_trial.xyz&amp;lt;/code&amp;gt; which is an .xyz containing a trial move and &amp;lt;code&amp;gt;mc_current.xyz&amp;lt;/code&amp;gt; which is the current accepted step. The .xyz files are written every &amp;lt;code&amp;gt;write_xyz=N&amp;lt;/code&amp;gt; steps.&lt;br /&gt;
&lt;br /&gt;
== Files ==&lt;br /&gt;
&lt;br /&gt;
=== Input file (input) ===&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;code&amp;gt;input&amp;lt;/code&amp;gt; file contains the keywords that tell '''TurboGAP''' how to perform the single-point or MD calculation requested by the user. A minimal &amp;lt;code&amp;gt;input&amp;lt;/code&amp;gt; file (without MD options) contains only information about the structure XYZ file, the location of the potential, and chemical species. An example looks like this:&lt;br /&gt;
&lt;br /&gt;
 ! Species-specific info&lt;br /&gt;
 [[atoms_file]] = 'atoms.xyz'&lt;br /&gt;
 [[pot_file]] = 'gap_files/cho.gap'&lt;br /&gt;
 [[n_species]] = 3&lt;br /&gt;
 [[species]] = H C O&lt;br /&gt;
 [[masses]] = 1.01 12.01 16.00 ! this is optional for single point, for MD TurboGAP will try to get them from a database if not provided &lt;br /&gt;
 [[e0]] = 0. 0. 0. ! this is optional, to specify per-species energy offsets&lt;br /&gt;
&lt;br /&gt;
For a single-point &amp;lt;code&amp;gt;turbogap predict&amp;lt;/code&amp;gt; calculation, something like the above is all that is needed. For running MD and other specialized simulations one needs to additionally specify the appropriate keywords. Check [[MD options]] for a complete list.&lt;br /&gt;
&lt;br /&gt;
=== Atoms file (*.xyz) ===&lt;br /&gt;
&lt;br /&gt;
The atoms file is an atomic structure file in ASE's [https://wiki.fysik.dtu.dk/ase/ase/io/formatoptions.html#extxyz extended XYZ] format. '''TurboGAP''' (currently) works exclusively in periodic boundary conditions; this must be taken into consideration when simulating molecular systems or surfaces (i.e., that an appropriate amount of vacuum is present). The format of the XYZ file must conform to the following:&lt;br /&gt;
&lt;br /&gt;
 Number_of_atoms&lt;br /&gt;
 Comment line including Lattice=&amp;quot;ax ay az bx by bz cx cy cz&amp;quot; and Properties=species:S:1:pos:R:3[:vel:R:3]&lt;br /&gt;
 Atom_name_1   posx posy posz (velx vely velz)&lt;br /&gt;
 Atom_name_2   posx posy posz (velx vely velz)&lt;br /&gt;
 ...&lt;br /&gt;
 Atom_name_nat posx posy posz (velx vely velz)&lt;br /&gt;
&lt;br /&gt;
where the velocity information is needed for MD ('''TurboGAP''' will generate random velocities if not provided). The positions must be in units of Angstrom, the velocities in Angstrom/fs and the masses in amu. '''TurboGAP''' XYZ reading adheres strictly to extXYZ format, with &amp;quot;species&amp;quot; (S:1), &amp;quot;pos&amp;quot; (R:3), &amp;quot;vel&amp;quot; (R:3), &amp;quot;fix_atom&amp;quot; (S:3, with values F or T allowed) and &amp;quot;mass&amp;quot; (R:1) read from the Properties attribute. &amp;quot;positions&amp;quot;, &amp;quot;velocities&amp;quot;, &amp;quot;fix_atoms&amp;quot; and &amp;quot;masses&amp;quot; are used as synonyms for &amp;quot;pos&amp;quot;, &amp;quot;vel&amp;quot;, &amp;quot;fix_atom&amp;quot; and &amp;quot;mass&amp;quot;, respectively.&lt;br /&gt;
&lt;br /&gt;
=== Potential directory (gap_files/) ===&lt;br /&gt;
&lt;br /&gt;
The [[Potentials|GAP potential files]] are usually put into a subdirectory under your working directory named &amp;lt;code&amp;gt;gap_files&amp;lt;/code&amp;gt;. This subdirectory contains a bunch of files generated with QUIP's &amp;lt;code&amp;gt;gap_fit&amp;lt;/code&amp;gt; program, with XML extension, as well as a mumber of other files. The XML files are often enough to run a [[Running a GAP calculation with QUIP|GAP calculation with QUIP]], with the notable exception of potentials with [[vdW corrections]], which might need some preprocessing before they can be used with QUIP. The &amp;lt;code&amp;gt;*.gap&amp;lt;/code&amp;gt; file tells '''TurboGAP''' how to use the different files to run a GAP calculation. When using these files with '''TurboGAP''' you do not need to worry about preprocessing, they're ready to go.&lt;br /&gt;
&lt;br /&gt;
=== Output files ===&lt;br /&gt;
&lt;br /&gt;
Besides standard output (basic messages, progress bar, etc.) that you get printed to stdout, '''TurboGAP''' produces one or two output files, depending on whether you are running a static calculation (&amp;lt;code&amp;gt;turbogap predict&amp;lt;/code&amp;gt;) or molecular dynamics (&amp;lt;code&amp;gt;turbogap md&amp;lt;/code&amp;gt;). Output file &amp;lt;code&amp;gt;[[trajectory_out.xyz]]&amp;lt;/code&amp;gt; is always written out, and it contains atomic positions, predicted energy and forces, etc. Output file &amp;lt;code&amp;gt;[[thermo.log]]&amp;lt;/code&amp;gt; is only written when doing MD, and it contains basic thermodynamic information (energy, temperature, pressure, etc.). One can control the frequency with which each file is written (for MD only) with &amp;lt;code&amp;gt;[[write_xyz]]&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;[[write_thermo]]&amp;lt;/code&amp;gt;, respectively. For finer control over which properties are written and which are not, refer to [[writeouts]]. &amp;lt;code&amp;gt;turbogap mc&amp;lt;/code&amp;gt; mode writes &amp;lt;code&amp;gt;mc_all.xyz&amp;lt;/code&amp;gt;, which contains all accepted monte-carlo moves, &amp;lt;code&amp;gt;mc_current.xyz&amp;lt;/code&amp;gt; which contains the last accepted monte-carlo move, for ease of restarting, and &amp;lt;code&amp;gt;mc.log&amp;lt;/code&amp;gt; which contains information of the monte-carlo trials done during the simulation.&lt;br /&gt;
&lt;br /&gt;
== Special Features ==&lt;br /&gt;
&lt;br /&gt;
TurboGAP has the capability for predicting arbitrary number of local properties. &lt;br /&gt;
&lt;br /&gt;
Local hirshfeld volumes can be predicted given an appropriate model, which can be used for including van der Waals interactions via a Tkatchenko-Scheffler formalism, or many-body dispersion.  &lt;br /&gt;
&lt;br /&gt;
TurboGAP can also perform experimental observable predictions (pair-distribution functions, x-ray diffraction, neutron diffraction and x-ray photoelectron spectra - the latter via Gaussian Process Prediction of local core-electron binding energies). The keyword options can be found in [[Experimental Observable Options]]. &lt;br /&gt;
&lt;br /&gt;
Structural inference of experimental data of all the above types can be invoked by Reverse Monte-Carlo (RMC) or Molecular Augmented Dynamics (MAD). This performs a multi-objective optimization of the interatomic potential energy and experimental agreement. Relevant options are found in [[Experimental Observable Options]] and [[Structural Inference Options]].&lt;br /&gt;
&lt;br /&gt;
== Parallel support ==&lt;br /&gt;
&lt;br /&gt;
Parallel support in '''TurboGAP''' is provided specifically via MPI. To build the '''TurboGAP''' code with MPI support you need an MPI-enabled Fortran compiler. '''TurboGAP''' is routinely tested and works reliably with the &amp;lt;code&amp;gt;gfortran&amp;lt;/code&amp;gt; MPI wrapper, usually called &amp;lt;code&amp;gt;mpif90&amp;lt;/code&amp;gt;. It should also be possible to build '''TurboGAP''' with Intel's &amp;lt;code&amp;gt;mpifort&amp;lt;/code&amp;gt;, but we do not usually test the code with it. Note that the BLAS/LAPACK libraries used by '''TurboGAP''' should be compiled with the same compiler suite used to build '''TurboGAP''', to ensure compatibility. Also note that OpenMP support can be available from BLAS/LAPACK. In that case, hybrid MPI/OpenMP '''TurboGAP''' execution can be achieved, although be mindful that OpenMP acceleration can only be exploited for energy and force evaluation, not descriptor construction. We recommend to run '''TurboGAP''' with exclusive MPI parallelization, and our tests showed MPI performance to be superior to hybrid MPI/OpenMP. Since system architecture and the details of the potential might affect said performance, run your own tests to evaluate whether you gain speed up from BLAS/LAPACK's threading support.&lt;/div&gt;</summary>
		<author><name>Tigany Zarrouk</name></author>
		
	</entry>
	<entry>
		<id>https://turbogap.fi/wiki/index.php?title=Documentation&amp;diff=675</id>
		<title>Documentation</title>
		<link rel="alternate" type="text/html" href="https://turbogap.fi/wiki/index.php?title=Documentation&amp;diff=675"/>
		<updated>2026-03-22T14:35:52Z</updated>

		<summary type="html">&lt;p&gt;Tigany Zarrouk: /* Special Features */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;'''TurboGAP''' is a program and associated collection of routines designed for carrying out atomistic calculations based on machine learning interatomic potentials. This page deals with the technical aspects of using '''TurboGAP'''; to learn more about the underlying theory, check the [[GAP theory]] page. Since it is often easier to learn by example, make sure to take a look at the [[tutorials]] to familiarize yourself with '''TurboGAP'''.&lt;br /&gt;
&lt;br /&gt;
== Calculation mode ==&lt;br /&gt;
&lt;br /&gt;
There are three basic modes for running a '''TurboGAP''' calculation, &amp;lt;code&amp;gt;turbogap predict&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;turbogap md&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;turbogap mc&amp;lt;/code&amp;gt;. They are invoked by simply typing &amp;lt;code&amp;gt;turbogap predict&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;turbogap md&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;turbogap mc&amp;lt;/code&amp;gt; in the command line or a bash script (e.g., to run MD in parallel on 8 CPU cores: &amp;lt;code&amp;gt;mpirun -np 8 turbogap md&amp;lt;/code&amp;gt;). All execution modes require an &amp;lt;code&amp;gt;input&amp;lt;/code&amp;gt; file with '''TurboGAP''' options, a &amp;lt;code&amp;gt;gap_files&amp;lt;/code&amp;gt; directory with the GAP potential to be used in the calculation, and an XYZ file in ASE's extended XYZ format with atomic positions, lattice vectors and chemical species information (for MD, also atomic velocities are needed).&lt;br /&gt;
&lt;br /&gt;
=== turbogap predict ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;turbogap predict&amp;lt;/code&amp;gt; performs single-point calculation (i.e., the atomic positions are ''not'' updated during the simulation) for [[total energy]], [[local energy]], [[forces]] and [[virial pressure]]. When available for the specific potential, it can also perform a [[Hirshfeld volume]] prediction. If the atoms file contains more than one configuration, in the form of concatenated individual atomic structures, '''TurboGAP''' will perform predictions for all of them.&lt;br /&gt;
&lt;br /&gt;
=== turbogap md ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;turbogap md&amp;lt;/code&amp;gt; performs [[molecular dynamics]] (default) or [[energy minimization]] according to the [[MD options|options]] specified in the &amp;lt;code&amp;gt;input&amp;lt;/code&amp;gt; file. Currently only Velocity-Verlet MD and gradient descent energy minimization are supported. We expect to add support for Monte Carlo and other simulation protocols in the near future. To choose between different methods to propagate the atomic positions, take a look at the &amp;lt;code&amp;gt;[[optimize]]&amp;lt;/code&amp;gt; keyword. If there are more than one atomic structures in the XYZ file, &amp;lt;code&amp;gt;turbogap md&amp;lt;/code&amp;gt; will use the first one as starting point. Note how this differs from the behavior of &amp;lt;code&amp;gt;turbogap predict&amp;lt;/code&amp;gt;, where single-point calculations are performed for ''all'' the structures in the XYZ file.&lt;br /&gt;
&lt;br /&gt;
=== turbogap mc ===&lt;br /&gt;
&amp;lt;code&amp;gt;turbogap mc&amp;lt;/code&amp;gt; performs (Grand-Canonical) [[Monte-Carlo]] simulations. These can be (NVT), (NPT), (mu VT) or (mu PT). Hybrid MC (using molecular dynamics to produce a trial move) can be performed as well as relaxation after specific trial moves. The user can specify a large number of move types. For reference on the specification see [[Monte-Carlo]]. The outputs are &amp;lt;code&amp;gt;mc.log&amp;lt;/code&amp;gt; (the log file), &amp;lt;code&amp;gt;mc_all.xyz&amp;lt;/code&amp;gt; all of the accepted MC steps, &amp;lt;code&amp;gt;mc_trial.xyz&amp;lt;/code&amp;gt; which is an .xyz containing a trial move and &amp;lt;code&amp;gt;mc_current.xyz&amp;lt;/code&amp;gt; which is the current accepted step. The .xyz files are written every &amp;lt;code&amp;gt;write_xyz=N&amp;lt;/code&amp;gt; steps.&lt;br /&gt;
&lt;br /&gt;
== Files ==&lt;br /&gt;
&lt;br /&gt;
=== Input file (input) ===&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;code&amp;gt;input&amp;lt;/code&amp;gt; file contains the keywords that tell '''TurboGAP''' how to perform the single-point or MD calculation requested by the user. A minimal &amp;lt;code&amp;gt;input&amp;lt;/code&amp;gt; file (without MD options) contains only information about the structure XYZ file, the location of the potential, and chemical species. An example looks like this:&lt;br /&gt;
&lt;br /&gt;
 ! Species-specific info&lt;br /&gt;
 [[atoms_file]] = 'atoms.xyz'&lt;br /&gt;
 [[pot_file]] = 'gap_files/cho.gap'&lt;br /&gt;
 [[n_species]] = 3&lt;br /&gt;
 [[species]] = H C O&lt;br /&gt;
 [[masses]] = 1.01 12.01 16.00 ! this is optional for single point, for MD TurboGAP will try to get them from a database if not provided &lt;br /&gt;
 [[e0]] = 0. 0. 0. ! this is optional, to specify per-species energy offsets&lt;br /&gt;
&lt;br /&gt;
For a single-point &amp;lt;code&amp;gt;turbogap predict&amp;lt;/code&amp;gt; calculation, something like the above is all that is needed. For running MD and other specialized simulations one needs to additionally specify the appropriate keywords. Check [[MD options]] for a complete list.&lt;br /&gt;
&lt;br /&gt;
=== Atoms file (*.xyz) ===&lt;br /&gt;
&lt;br /&gt;
The atoms file is an atomic structure file in ASE's [https://wiki.fysik.dtu.dk/ase/ase/io/formatoptions.html#extxyz extended XYZ] format. '''TurboGAP''' (currently) works exclusively in periodic boundary conditions; this must be taken into consideration when simulating molecular systems or surfaces (i.e., that an appropriate amount of vacuum is present). The format of the XYZ file must conform to the following:&lt;br /&gt;
&lt;br /&gt;
 Number_of_atoms&lt;br /&gt;
 Comment line including Lattice=&amp;quot;ax ay az bx by bz cx cy cz&amp;quot; and Properties=species:S:1:pos:R:3[:vel:R:3]&lt;br /&gt;
 Atom_name_1   posx posy posz (velx vely velz)&lt;br /&gt;
 Atom_name_2   posx posy posz (velx vely velz)&lt;br /&gt;
 ...&lt;br /&gt;
 Atom_name_nat posx posy posz (velx vely velz)&lt;br /&gt;
&lt;br /&gt;
where the velocity information is needed for MD ('''TurboGAP''' will generate random velocities if not provided). The positions must be in units of Angstrom, the velocities in Angstrom/fs and the masses in amu. '''TurboGAP''' XYZ reading adheres strictly to extXYZ format, with &amp;quot;species&amp;quot; (S:1), &amp;quot;pos&amp;quot; (R:3), &amp;quot;vel&amp;quot; (R:3), &amp;quot;fix_atom&amp;quot; (S:3, with values F or T allowed) and &amp;quot;mass&amp;quot; (R:1) read from the Properties attribute. &amp;quot;positions&amp;quot;, &amp;quot;velocities&amp;quot;, &amp;quot;fix_atoms&amp;quot; and &amp;quot;masses&amp;quot; are used as synonyms for &amp;quot;pos&amp;quot;, &amp;quot;vel&amp;quot;, &amp;quot;fix_atom&amp;quot; and &amp;quot;mass&amp;quot;, respectively.&lt;br /&gt;
&lt;br /&gt;
=== Potential directory (gap_files/) ===&lt;br /&gt;
&lt;br /&gt;
The [[Potentials|GAP potential files]] are usually put into a subdirectory under your working directory named &amp;lt;code&amp;gt;gap_files&amp;lt;/code&amp;gt;. This subdirectory contains a bunch of files generated with QUIP's &amp;lt;code&amp;gt;gap_fit&amp;lt;/code&amp;gt; program, with XML extension, as well as a mumber of other files. The XML files are often enough to run a [[Running a GAP calculation with QUIP|GAP calculation with QUIP]], with the notable exception of potentials with [[vdW corrections]], which might need some preprocessing before they can be used with QUIP. The &amp;lt;code&amp;gt;*.gap&amp;lt;/code&amp;gt; file tells '''TurboGAP''' how to use the different files to run a GAP calculation. When using these files with '''TurboGAP''' you do not need to worry about preprocessing, they're ready to go.&lt;br /&gt;
&lt;br /&gt;
=== Output files ===&lt;br /&gt;
&lt;br /&gt;
Besides standard output (basic messages, progress bar, etc.) that you get printed to stdout, '''TurboGAP''' produces one or two output files, depending on whether you are running a static calculation (&amp;lt;code&amp;gt;turbogap predict&amp;lt;/code&amp;gt;) or molecular dynamics (&amp;lt;code&amp;gt;turbogap md&amp;lt;/code&amp;gt;). Output file &amp;lt;code&amp;gt;[[trajectory_out.xyz]]&amp;lt;/code&amp;gt; is always written out, and it contains atomic positions, predicted energy and forces, etc. Output file &amp;lt;code&amp;gt;[[thermo.log]]&amp;lt;/code&amp;gt; is only written when doing MD, and it contains basic thermodynamic information (energy, temperature, pressure, etc.). One can control the frequency with which each file is written (for MD only) with &amp;lt;code&amp;gt;[[write_xyz]]&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;[[write_thermo]]&amp;lt;/code&amp;gt;, respectively. For finer control over which properties are written and which are not, refer to [[writeouts]]. &amp;lt;code&amp;gt;turbogap mc&amp;lt;/code&amp;gt; mode writes &amp;lt;code&amp;gt;mc_all.xyz&amp;lt;/code&amp;gt;, which contains all accepted monte-carlo moves, &amp;lt;code&amp;gt;mc_current.xyz&amp;lt;/code&amp;gt; which contains the last accepted monte-carlo move, for ease of restarting, and &amp;lt;code&amp;gt;mc.log&amp;lt;/code&amp;gt; which contains information of the monte-carlo trials done during the simulation.&lt;br /&gt;
&lt;br /&gt;
== Special Features ==&lt;br /&gt;
&lt;br /&gt;
TurboGAP has the capability for predicting arbitrary number of local properties. &lt;br /&gt;
&lt;br /&gt;
Local hirshfeld volumes can be predicted given an appropriate model, which can be used for including van der Waals interactions via a Tkatchenko-Scheffler formalism, or many-body dispersion.  &lt;br /&gt;
&lt;br /&gt;
TurboGAP can also perform experimental observable predictions (pair-distribution functions, x-ray diffraction, neutron diffraction and x-ray photoelectron spectra - the latter via Gaussian Process Prediction of local core-electron binding energies).  &lt;br /&gt;
&lt;br /&gt;
Structural inference of experimental data of all the above types can be invoked by Reverse Monte-Carlo (RMC) or Molecular Augmented Dynamics (MAD). This performs a multi-objective optimization of the interatomic potential energy and experimental agreement. Relevant options are found in [[Experimental Observable Options]] and [[Structural Inference Options]].&lt;br /&gt;
&lt;br /&gt;
== Parallel support ==&lt;br /&gt;
&lt;br /&gt;
Parallel support in '''TurboGAP''' is provided specifically via MPI. To build the '''TurboGAP''' code with MPI support you need an MPI-enabled Fortran compiler. '''TurboGAP''' is routinely tested and works reliably with the &amp;lt;code&amp;gt;gfortran&amp;lt;/code&amp;gt; MPI wrapper, usually called &amp;lt;code&amp;gt;mpif90&amp;lt;/code&amp;gt;. It should also be possible to build '''TurboGAP''' with Intel's &amp;lt;code&amp;gt;mpifort&amp;lt;/code&amp;gt;, but we do not usually test the code with it. Note that the BLAS/LAPACK libraries used by '''TurboGAP''' should be compiled with the same compiler suite used to build '''TurboGAP''', to ensure compatibility. Also note that OpenMP support can be available from BLAS/LAPACK. In that case, hybrid MPI/OpenMP '''TurboGAP''' execution can be achieved, although be mindful that OpenMP acceleration can only be exploited for energy and force evaluation, not descriptor construction. We recommend to run '''TurboGAP''' with exclusive MPI parallelization, and our tests showed MPI performance to be superior to hybrid MPI/OpenMP. Since system architecture and the details of the potential might affect said performance, run your own tests to evaluate whether you gain speed up from BLAS/LAPACK's threading support.&lt;/div&gt;</summary>
		<author><name>Tigany Zarrouk</name></author>
		
	</entry>
	<entry>
		<id>https://turbogap.fi/wiki/index.php?title=Documentation&amp;diff=674</id>
		<title>Documentation</title>
		<link rel="alternate" type="text/html" href="https://turbogap.fi/wiki/index.php?title=Documentation&amp;diff=674"/>
		<updated>2026-03-22T14:34:54Z</updated>

		<summary type="html">&lt;p&gt;Tigany Zarrouk: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;'''TurboGAP''' is a program and associated collection of routines designed for carrying out atomistic calculations based on machine learning interatomic potentials. This page deals with the technical aspects of using '''TurboGAP'''; to learn more about the underlying theory, check the [[GAP theory]] page. Since it is often easier to learn by example, make sure to take a look at the [[tutorials]] to familiarize yourself with '''TurboGAP'''.&lt;br /&gt;
&lt;br /&gt;
== Calculation mode ==&lt;br /&gt;
&lt;br /&gt;
There are three basic modes for running a '''TurboGAP''' calculation, &amp;lt;code&amp;gt;turbogap predict&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;turbogap md&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;turbogap mc&amp;lt;/code&amp;gt;. They are invoked by simply typing &amp;lt;code&amp;gt;turbogap predict&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;turbogap md&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;turbogap mc&amp;lt;/code&amp;gt; in the command line or a bash script (e.g., to run MD in parallel on 8 CPU cores: &amp;lt;code&amp;gt;mpirun -np 8 turbogap md&amp;lt;/code&amp;gt;). All execution modes require an &amp;lt;code&amp;gt;input&amp;lt;/code&amp;gt; file with '''TurboGAP''' options, a &amp;lt;code&amp;gt;gap_files&amp;lt;/code&amp;gt; directory with the GAP potential to be used in the calculation, and an XYZ file in ASE's extended XYZ format with atomic positions, lattice vectors and chemical species information (for MD, also atomic velocities are needed).&lt;br /&gt;
&lt;br /&gt;
=== turbogap predict ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;turbogap predict&amp;lt;/code&amp;gt; performs single-point calculation (i.e., the atomic positions are ''not'' updated during the simulation) for [[total energy]], [[local energy]], [[forces]] and [[virial pressure]]. When available for the specific potential, it can also perform a [[Hirshfeld volume]] prediction. If the atoms file contains more than one configuration, in the form of concatenated individual atomic structures, '''TurboGAP''' will perform predictions for all of them.&lt;br /&gt;
&lt;br /&gt;
=== turbogap md ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;turbogap md&amp;lt;/code&amp;gt; performs [[molecular dynamics]] (default) or [[energy minimization]] according to the [[MD options|options]] specified in the &amp;lt;code&amp;gt;input&amp;lt;/code&amp;gt; file. Currently only Velocity-Verlet MD and gradient descent energy minimization are supported. We expect to add support for Monte Carlo and other simulation protocols in the near future. To choose between different methods to propagate the atomic positions, take a look at the &amp;lt;code&amp;gt;[[optimize]]&amp;lt;/code&amp;gt; keyword. If there are more than one atomic structures in the XYZ file, &amp;lt;code&amp;gt;turbogap md&amp;lt;/code&amp;gt; will use the first one as starting point. Note how this differs from the behavior of &amp;lt;code&amp;gt;turbogap predict&amp;lt;/code&amp;gt;, where single-point calculations are performed for ''all'' the structures in the XYZ file.&lt;br /&gt;
&lt;br /&gt;
=== turbogap mc ===&lt;br /&gt;
&amp;lt;code&amp;gt;turbogap mc&amp;lt;/code&amp;gt; performs (Grand-Canonical) [[Monte-Carlo]] simulations. These can be (NVT), (NPT), (mu VT) or (mu PT). Hybrid MC (using molecular dynamics to produce a trial move) can be performed as well as relaxation after specific trial moves. The user can specify a large number of move types. For reference on the specification see [[Monte-Carlo]]. The outputs are &amp;lt;code&amp;gt;mc.log&amp;lt;/code&amp;gt; (the log file), &amp;lt;code&amp;gt;mc_all.xyz&amp;lt;/code&amp;gt; all of the accepted MC steps, &amp;lt;code&amp;gt;mc_trial.xyz&amp;lt;/code&amp;gt; which is an .xyz containing a trial move and &amp;lt;code&amp;gt;mc_current.xyz&amp;lt;/code&amp;gt; which is the current accepted step. The .xyz files are written every &amp;lt;code&amp;gt;write_xyz=N&amp;lt;/code&amp;gt; steps.&lt;br /&gt;
&lt;br /&gt;
== Files ==&lt;br /&gt;
&lt;br /&gt;
=== Input file (input) ===&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;code&amp;gt;input&amp;lt;/code&amp;gt; file contains the keywords that tell '''TurboGAP''' how to perform the single-point or MD calculation requested by the user. A minimal &amp;lt;code&amp;gt;input&amp;lt;/code&amp;gt; file (without MD options) contains only information about the structure XYZ file, the location of the potential, and chemical species. An example looks like this:&lt;br /&gt;
&lt;br /&gt;
 ! Species-specific info&lt;br /&gt;
 [[atoms_file]] = 'atoms.xyz'&lt;br /&gt;
 [[pot_file]] = 'gap_files/cho.gap'&lt;br /&gt;
 [[n_species]] = 3&lt;br /&gt;
 [[species]] = H C O&lt;br /&gt;
 [[masses]] = 1.01 12.01 16.00 ! this is optional for single point, for MD TurboGAP will try to get them from a database if not provided &lt;br /&gt;
 [[e0]] = 0. 0. 0. ! this is optional, to specify per-species energy offsets&lt;br /&gt;
&lt;br /&gt;
For a single-point &amp;lt;code&amp;gt;turbogap predict&amp;lt;/code&amp;gt; calculation, something like the above is all that is needed. For running MD and other specialized simulations one needs to additionally specify the appropriate keywords. Check [[MD options]] for a complete list.&lt;br /&gt;
&lt;br /&gt;
=== Atoms file (*.xyz) ===&lt;br /&gt;
&lt;br /&gt;
The atoms file is an atomic structure file in ASE's [https://wiki.fysik.dtu.dk/ase/ase/io/formatoptions.html#extxyz extended XYZ] format. '''TurboGAP''' (currently) works exclusively in periodic boundary conditions; this must be taken into consideration when simulating molecular systems or surfaces (i.e., that an appropriate amount of vacuum is present). The format of the XYZ file must conform to the following:&lt;br /&gt;
&lt;br /&gt;
 Number_of_atoms&lt;br /&gt;
 Comment line including Lattice=&amp;quot;ax ay az bx by bz cx cy cz&amp;quot; and Properties=species:S:1:pos:R:3[:vel:R:3]&lt;br /&gt;
 Atom_name_1   posx posy posz (velx vely velz)&lt;br /&gt;
 Atom_name_2   posx posy posz (velx vely velz)&lt;br /&gt;
 ...&lt;br /&gt;
 Atom_name_nat posx posy posz (velx vely velz)&lt;br /&gt;
&lt;br /&gt;
where the velocity information is needed for MD ('''TurboGAP''' will generate random velocities if not provided). The positions must be in units of Angstrom, the velocities in Angstrom/fs and the masses in amu. '''TurboGAP''' XYZ reading adheres strictly to extXYZ format, with &amp;quot;species&amp;quot; (S:1), &amp;quot;pos&amp;quot; (R:3), &amp;quot;vel&amp;quot; (R:3), &amp;quot;fix_atom&amp;quot; (S:3, with values F or T allowed) and &amp;quot;mass&amp;quot; (R:1) read from the Properties attribute. &amp;quot;positions&amp;quot;, &amp;quot;velocities&amp;quot;, &amp;quot;fix_atoms&amp;quot; and &amp;quot;masses&amp;quot; are used as synonyms for &amp;quot;pos&amp;quot;, &amp;quot;vel&amp;quot;, &amp;quot;fix_atom&amp;quot; and &amp;quot;mass&amp;quot;, respectively.&lt;br /&gt;
&lt;br /&gt;
=== Potential directory (gap_files/) ===&lt;br /&gt;
&lt;br /&gt;
The [[Potentials|GAP potential files]] are usually put into a subdirectory under your working directory named &amp;lt;code&amp;gt;gap_files&amp;lt;/code&amp;gt;. This subdirectory contains a bunch of files generated with QUIP's &amp;lt;code&amp;gt;gap_fit&amp;lt;/code&amp;gt; program, with XML extension, as well as a mumber of other files. The XML files are often enough to run a [[Running a GAP calculation with QUIP|GAP calculation with QUIP]], with the notable exception of potentials with [[vdW corrections]], which might need some preprocessing before they can be used with QUIP. The &amp;lt;code&amp;gt;*.gap&amp;lt;/code&amp;gt; file tells '''TurboGAP''' how to use the different files to run a GAP calculation. When using these files with '''TurboGAP''' you do not need to worry about preprocessing, they're ready to go.&lt;br /&gt;
&lt;br /&gt;
=== Output files ===&lt;br /&gt;
&lt;br /&gt;
Besides standard output (basic messages, progress bar, etc.) that you get printed to stdout, '''TurboGAP''' produces one or two output files, depending on whether you are running a static calculation (&amp;lt;code&amp;gt;turbogap predict&amp;lt;/code&amp;gt;) or molecular dynamics (&amp;lt;code&amp;gt;turbogap md&amp;lt;/code&amp;gt;). Output file &amp;lt;code&amp;gt;[[trajectory_out.xyz]]&amp;lt;/code&amp;gt; is always written out, and it contains atomic positions, predicted energy and forces, etc. Output file &amp;lt;code&amp;gt;[[thermo.log]]&amp;lt;/code&amp;gt; is only written when doing MD, and it contains basic thermodynamic information (energy, temperature, pressure, etc.). One can control the frequency with which each file is written (for MD only) with &amp;lt;code&amp;gt;[[write_xyz]]&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;[[write_thermo]]&amp;lt;/code&amp;gt;, respectively. For finer control over which properties are written and which are not, refer to [[writeouts]]. &amp;lt;code&amp;gt;turbogap mc&amp;lt;/code&amp;gt; mode writes &amp;lt;code&amp;gt;mc_all.xyz&amp;lt;/code&amp;gt;, which contains all accepted monte-carlo moves, &amp;lt;code&amp;gt;mc_current.xyz&amp;lt;/code&amp;gt; which contains the last accepted monte-carlo move, for ease of restarting, and &amp;lt;code&amp;gt;mc.log&amp;lt;/code&amp;gt; which contains information of the monte-carlo trials done during the simulation.&lt;br /&gt;
&lt;br /&gt;
== Special Features ==&lt;br /&gt;
&lt;br /&gt;
TurboGAP has the capability for predicting arbitrary number of local properties. &lt;br /&gt;
&lt;br /&gt;
Local hirshfeld volumes can be predicted given an appropriate model, which can be used for including van der Waals interactions via a Tkatchenko-Scheffler formalism, or many-body dispersion.  &lt;br /&gt;
&lt;br /&gt;
TurboGAP can also perform experimental observable predictions (pair-distribution functions, x-ray diffraction, neutron diffraction and x-ray photoelectron spectra - the latter via Gaussian Process Prediction of local core-electron binding energies).  &lt;br /&gt;
&lt;br /&gt;
Structural inference of experimental data of all the above types can be invoked by Reverse Monte-Carlo (RMC) or Molecular Augmented Dynamics (MAD). This performs a multi-objective optimization of the interatomic potential energy and experimental agreement. Relevant options are found on [[Structural Inference Options]].  &lt;br /&gt;
&lt;br /&gt;
== Parallel support ==&lt;br /&gt;
&lt;br /&gt;
Parallel support in '''TurboGAP''' is provided specifically via MPI. To build the '''TurboGAP''' code with MPI support you need an MPI-enabled Fortran compiler. '''TurboGAP''' is routinely tested and works reliably with the &amp;lt;code&amp;gt;gfortran&amp;lt;/code&amp;gt; MPI wrapper, usually called &amp;lt;code&amp;gt;mpif90&amp;lt;/code&amp;gt;. It should also be possible to build '''TurboGAP''' with Intel's &amp;lt;code&amp;gt;mpifort&amp;lt;/code&amp;gt;, but we do not usually test the code with it. Note that the BLAS/LAPACK libraries used by '''TurboGAP''' should be compiled with the same compiler suite used to build '''TurboGAP''', to ensure compatibility. Also note that OpenMP support can be available from BLAS/LAPACK. In that case, hybrid MPI/OpenMP '''TurboGAP''' execution can be achieved, although be mindful that OpenMP acceleration can only be exploited for energy and force evaluation, not descriptor construction. We recommend to run '''TurboGAP''' with exclusive MPI parallelization, and our tests showed MPI performance to be superior to hybrid MPI/OpenMP. Since system architecture and the details of the potential might affect said performance, run your own tests to evaluate whether you gain speed up from BLAS/LAPACK's threading support.&lt;/div&gt;</summary>
		<author><name>Tigany Zarrouk</name></author>
		
	</entry>
	<entry>
		<id>https://turbogap.fi/wiki/index.php?title=Documentation&amp;diff=673</id>
		<title>Documentation</title>
		<link rel="alternate" type="text/html" href="https://turbogap.fi/wiki/index.php?title=Documentation&amp;diff=673"/>
		<updated>2026-03-22T14:21:31Z</updated>

		<summary type="html">&lt;p&gt;Tigany Zarrouk: /* Output files */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;'''TurboGAP''' is a program and associated collection of routines designed for carrying out atomistic calculations based on machine learning interatomic potentials. This page deals with the technical aspects of using '''TurboGAP'''; to learn more about the underlying theory, check the [[GAP theory]] page. Since it is often easier to learn by example, make sure to take a look at the [[tutorials]] to familiarize yourself with '''TurboGAP'''.&lt;br /&gt;
&lt;br /&gt;
== Calculation mode ==&lt;br /&gt;
&lt;br /&gt;
There are three basic modes for running a '''TurboGAP''' calculation, &amp;lt;code&amp;gt;turbogap predict&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;turbogap md&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;turbogap mc&amp;lt;/code&amp;gt;. They are invoked by simply typing &amp;lt;code&amp;gt;turbogap predict&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;turbogap md&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;turbogap mc&amp;lt;/code&amp;gt; in the command line or a bash script (e.g., to run MD in parallel on 8 CPU cores: &amp;lt;code&amp;gt;mpirun -np 8 turbogap md&amp;lt;/code&amp;gt;). All execution modes require an &amp;lt;code&amp;gt;input&amp;lt;/code&amp;gt; file with '''TurboGAP''' options, a &amp;lt;code&amp;gt;gap_files&amp;lt;/code&amp;gt; directory with the GAP potential to be used in the calculation, and an XYZ file in ASE's extended XYZ format with atomic positions, lattice vectors and chemical species information (for MD, also atomic velocities are needed).&lt;br /&gt;
&lt;br /&gt;
=== turbogap predict ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;turbogap predict&amp;lt;/code&amp;gt; performs single-point calculation (i.e., the atomic positions are ''not'' updated during the simulation) for [[total energy]], [[local energy]], [[forces]] and [[virial pressure]]. When available for the specific potential, it can also perform a [[Hirshfeld volume]] prediction. If the atoms file contains more than one configuration, in the form of concatenated individual atomic structures, '''TurboGAP''' will perform predictions for all of them.&lt;br /&gt;
&lt;br /&gt;
=== turbogap md ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;turbogap md&amp;lt;/code&amp;gt; performs [[molecular dynamics]] (default) or [[energy minimization]] according to the [[MD options|options]] specified in the &amp;lt;code&amp;gt;input&amp;lt;/code&amp;gt; file. Currently only Velocity-Verlet MD and gradient descent energy minimization are supported. We expect to add support for Monte Carlo and other simulation protocols in the near future. To choose between different methods to propagate the atomic positions, take a look at the &amp;lt;code&amp;gt;[[optimize]]&amp;lt;/code&amp;gt; keyword. If there are more than one atomic structures in the XYZ file, &amp;lt;code&amp;gt;turbogap md&amp;lt;/code&amp;gt; will use the first one as starting point. Note how this differs from the behavior of &amp;lt;code&amp;gt;turbogap predict&amp;lt;/code&amp;gt;, where single-point calculations are performed for ''all'' the structures in the XYZ file.&lt;br /&gt;
&lt;br /&gt;
=== turbogap mc ===&lt;br /&gt;
&amp;lt;code&amp;gt;turbogap mc&amp;lt;/code&amp;gt; performs (Grand-Canonical) [[Monte-Carlo]] simulations. These can be (NVT), (NPT), (mu VT) or (mu PT). Hybrid MC (using molecular dynamics to produce a trial move) can be performed as well as relaxation after specific trial moves. The user can specify a large number of move types. For reference on the specification see [[Monte-Carlo]]. The outputs are &amp;lt;code&amp;gt;mc.log&amp;lt;/code&amp;gt; (the log file), &amp;lt;code&amp;gt;mc_all.xyz&amp;lt;/code&amp;gt; all of the accepted MC steps, &amp;lt;code&amp;gt;mc_trial.xyz&amp;lt;/code&amp;gt; which is an .xyz containing a trial move and &amp;lt;code&amp;gt;mc_current.xyz&amp;lt;/code&amp;gt; which is the current accepted step. The .xyz files are written every &amp;lt;code&amp;gt;write_xyz=N&amp;lt;/code&amp;gt; steps.&lt;br /&gt;
&lt;br /&gt;
== Files ==&lt;br /&gt;
&lt;br /&gt;
=== Input file (input) ===&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;code&amp;gt;input&amp;lt;/code&amp;gt; file contains the keywords that tell '''TurboGAP''' how to perform the single-point or MD calculation requested by the user. A minimal &amp;lt;code&amp;gt;input&amp;lt;/code&amp;gt; file (without MD options) contains only information about the structure XYZ file, the location of the potential, and chemical species. An example looks like this:&lt;br /&gt;
&lt;br /&gt;
 ! Species-specific info&lt;br /&gt;
 [[atoms_file]] = 'atoms.xyz'&lt;br /&gt;
 [[pot_file]] = 'gap_files/cho.gap'&lt;br /&gt;
 [[n_species]] = 3&lt;br /&gt;
 [[species]] = H C O&lt;br /&gt;
 [[masses]] = 1.01 12.01 16.00 ! this is optional for single point, for MD TurboGAP will try to get them from a database if not provided &lt;br /&gt;
 [[e0]] = 0. 0. 0. ! this is optional, to specify per-species energy offsets&lt;br /&gt;
&lt;br /&gt;
For a single-point &amp;lt;code&amp;gt;turbogap predict&amp;lt;/code&amp;gt; calculation, something like the above is all that is needed. For running MD and other specialized simulations one needs to additionally specify the appropriate keywords. Check [[MD options]] for a complete list.&lt;br /&gt;
&lt;br /&gt;
=== Atoms file (*.xyz) ===&lt;br /&gt;
&lt;br /&gt;
The atoms file is an atomic structure file in ASE's [https://wiki.fysik.dtu.dk/ase/ase/io/formatoptions.html#extxyz extended XYZ] format. '''TurboGAP''' (currently) works exclusively in periodic boundary conditions; this must be taken into consideration when simulating molecular systems or surfaces (i.e., that an appropriate amount of vacuum is present). The format of the XYZ file must conform to the following:&lt;br /&gt;
&lt;br /&gt;
 Number_of_atoms&lt;br /&gt;
 Comment line including Lattice=&amp;quot;ax ay az bx by bz cx cy cz&amp;quot; and Properties=species:S:1:pos:R:3[:vel:R:3]&lt;br /&gt;
 Atom_name_1   posx posy posz (velx vely velz)&lt;br /&gt;
 Atom_name_2   posx posy posz (velx vely velz)&lt;br /&gt;
 ...&lt;br /&gt;
 Atom_name_nat posx posy posz (velx vely velz)&lt;br /&gt;
&lt;br /&gt;
where the velocity information is needed for MD ('''TurboGAP''' will generate random velocities if not provided). The positions must be in units of Angstrom, the velocities in Angstrom/fs and the masses in amu. '''TurboGAP''' XYZ reading adheres strictly to extXYZ format, with &amp;quot;species&amp;quot; (S:1), &amp;quot;pos&amp;quot; (R:3), &amp;quot;vel&amp;quot; (R:3), &amp;quot;fix_atom&amp;quot; (S:3, with values F or T allowed) and &amp;quot;mass&amp;quot; (R:1) read from the Properties attribute. &amp;quot;positions&amp;quot;, &amp;quot;velocities&amp;quot;, &amp;quot;fix_atoms&amp;quot; and &amp;quot;masses&amp;quot; are used as synonyms for &amp;quot;pos&amp;quot;, &amp;quot;vel&amp;quot;, &amp;quot;fix_atom&amp;quot; and &amp;quot;mass&amp;quot;, respectively.&lt;br /&gt;
&lt;br /&gt;
=== Potential directory (gap_files/) ===&lt;br /&gt;
&lt;br /&gt;
The [[Potentials|GAP potential files]] are usually put into a subdirectory under your working directory named &amp;lt;code&amp;gt;gap_files&amp;lt;/code&amp;gt;. This subdirectory contains a bunch of files generated with QUIP's &amp;lt;code&amp;gt;gap_fit&amp;lt;/code&amp;gt; program, with XML extension, as well as a mumber of other files. The XML files are often enough to run a [[Running a GAP calculation with QUIP|GAP calculation with QUIP]], with the notable exception of potentials with [[vdW corrections]], which might need some preprocessing before they can be used with QUIP. The &amp;lt;code&amp;gt;*.gap&amp;lt;/code&amp;gt; file tells '''TurboGAP''' how to use the different files to run a GAP calculation. When using these files with '''TurboGAP''' you do not need to worry about preprocessing, they're ready to go.&lt;br /&gt;
&lt;br /&gt;
=== Output files ===&lt;br /&gt;
&lt;br /&gt;
Besides standard output (basic messages, progress bar, etc.) that you get printed to stdout, '''TurboGAP''' produces one or two output files, depending on whether you are running a static calculation (&amp;lt;code&amp;gt;turbogap predict&amp;lt;/code&amp;gt;) or molecular dynamics (&amp;lt;code&amp;gt;turbogap md&amp;lt;/code&amp;gt;). Output file &amp;lt;code&amp;gt;[[trajectory_out.xyz]]&amp;lt;/code&amp;gt; is always written out, and it contains atomic positions, predicted energy and forces, etc. Output file &amp;lt;code&amp;gt;[[thermo.log]]&amp;lt;/code&amp;gt; is only written when doing MD, and it contains basic thermodynamic information (energy, temperature, pressure, etc.). One can control the frequency with which each file is written (for MD only) with &amp;lt;code&amp;gt;[[write_xyz]]&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;[[write_thermo]]&amp;lt;/code&amp;gt;, respectively. For finer control over which properties are written and which are not, refer to [[writeouts]]. &amp;lt;code&amp;gt;turbogap mc&amp;lt;/code&amp;gt; mode writes &amp;lt;code&amp;gt;mc_all.xyz&amp;lt;/code&amp;gt;, which contains all accepted monte-carlo moves, &amp;lt;code&amp;gt;mc_current.xyz&amp;lt;/code&amp;gt; which contains the last accepted monte-carlo move, for ease of restarting, and &amp;lt;code&amp;gt;mc.log&amp;lt;/code&amp;gt; which contains information of the monte-carlo trials done during the simulation.&lt;br /&gt;
&lt;br /&gt;
== Parallel support ==&lt;br /&gt;
&lt;br /&gt;
Parallel support in '''TurboGAP''' is provided specifically via MPI. To build the '''TurboGAP''' code with MPI support you need an MPI-enabled Fortran compiler. '''TurboGAP''' is routinely tested and works reliably with the &amp;lt;code&amp;gt;gfortran&amp;lt;/code&amp;gt; MPI wrapper, usually called &amp;lt;code&amp;gt;mpif90&amp;lt;/code&amp;gt;. It should also be possible to build '''TurboGAP''' with Intel's &amp;lt;code&amp;gt;mpifort&amp;lt;/code&amp;gt;, but we do not usually test the code with it. Note that the BLAS/LAPACK libraries used by '''TurboGAP''' should be compiled with the same compiler suite used to build '''TurboGAP''', to ensure compatibility. Also note that OpenMP support can be available from BLAS/LAPACK. In that case, hybrid MPI/OpenMP '''TurboGAP''' execution can be achieved, although be mindful that OpenMP acceleration can only be exploited for energy and force evaluation, not descriptor construction. We recommend to run '''TurboGAP''' with exclusive MPI parallelization, and our tests showed MPI performance to be superior to hybrid MPI/OpenMP. Since system architecture and the details of the potential might affect said performance, run your own tests to evaluate whether you gain speed up from BLAS/LAPACK's threading support.&lt;/div&gt;</summary>
		<author><name>Tigany Zarrouk</name></author>
		
	</entry>
	<entry>
		<id>https://turbogap.fi/wiki/index.php?title=Documentation&amp;diff=672</id>
		<title>Documentation</title>
		<link rel="alternate" type="text/html" href="https://turbogap.fi/wiki/index.php?title=Documentation&amp;diff=672"/>
		<updated>2026-03-22T14:18:50Z</updated>

		<summary type="html">&lt;p&gt;Tigany Zarrouk: /* Calculation mode */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;'''TurboGAP''' is a program and associated collection of routines designed for carrying out atomistic calculations based on machine learning interatomic potentials. This page deals with the technical aspects of using '''TurboGAP'''; to learn more about the underlying theory, check the [[GAP theory]] page. Since it is often easier to learn by example, make sure to take a look at the [[tutorials]] to familiarize yourself with '''TurboGAP'''.&lt;br /&gt;
&lt;br /&gt;
== Calculation mode ==&lt;br /&gt;
&lt;br /&gt;
There are three basic modes for running a '''TurboGAP''' calculation, &amp;lt;code&amp;gt;turbogap predict&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;turbogap md&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;turbogap mc&amp;lt;/code&amp;gt;. They are invoked by simply typing &amp;lt;code&amp;gt;turbogap predict&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;turbogap md&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;turbogap mc&amp;lt;/code&amp;gt; in the command line or a bash script (e.g., to run MD in parallel on 8 CPU cores: &amp;lt;code&amp;gt;mpirun -np 8 turbogap md&amp;lt;/code&amp;gt;). All execution modes require an &amp;lt;code&amp;gt;input&amp;lt;/code&amp;gt; file with '''TurboGAP''' options, a &amp;lt;code&amp;gt;gap_files&amp;lt;/code&amp;gt; directory with the GAP potential to be used in the calculation, and an XYZ file in ASE's extended XYZ format with atomic positions, lattice vectors and chemical species information (for MD, also atomic velocities are needed).&lt;br /&gt;
&lt;br /&gt;
=== turbogap predict ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;turbogap predict&amp;lt;/code&amp;gt; performs single-point calculation (i.e., the atomic positions are ''not'' updated during the simulation) for [[total energy]], [[local energy]], [[forces]] and [[virial pressure]]. When available for the specific potential, it can also perform a [[Hirshfeld volume]] prediction. If the atoms file contains more than one configuration, in the form of concatenated individual atomic structures, '''TurboGAP''' will perform predictions for all of them.&lt;br /&gt;
&lt;br /&gt;
=== turbogap md ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;turbogap md&amp;lt;/code&amp;gt; performs [[molecular dynamics]] (default) or [[energy minimization]] according to the [[MD options|options]] specified in the &amp;lt;code&amp;gt;input&amp;lt;/code&amp;gt; file. Currently only Velocity-Verlet MD and gradient descent energy minimization are supported. We expect to add support for Monte Carlo and other simulation protocols in the near future. To choose between different methods to propagate the atomic positions, take a look at the &amp;lt;code&amp;gt;[[optimize]]&amp;lt;/code&amp;gt; keyword. If there are more than one atomic structures in the XYZ file, &amp;lt;code&amp;gt;turbogap md&amp;lt;/code&amp;gt; will use the first one as starting point. Note how this differs from the behavior of &amp;lt;code&amp;gt;turbogap predict&amp;lt;/code&amp;gt;, where single-point calculations are performed for ''all'' the structures in the XYZ file.&lt;br /&gt;
&lt;br /&gt;
=== turbogap mc ===&lt;br /&gt;
&amp;lt;code&amp;gt;turbogap mc&amp;lt;/code&amp;gt; performs (Grand-Canonical) [[Monte-Carlo]] simulations. These can be (NVT), (NPT), (mu VT) or (mu PT). Hybrid MC (using molecular dynamics to produce a trial move) can be performed as well as relaxation after specific trial moves. The user can specify a large number of move types. For reference on the specification see [[Monte-Carlo]]. The outputs are &amp;lt;code&amp;gt;mc.log&amp;lt;/code&amp;gt; (the log file), &amp;lt;code&amp;gt;mc_all.xyz&amp;lt;/code&amp;gt; all of the accepted MC steps, &amp;lt;code&amp;gt;mc_trial.xyz&amp;lt;/code&amp;gt; which is an .xyz containing a trial move and &amp;lt;code&amp;gt;mc_current.xyz&amp;lt;/code&amp;gt; which is the current accepted step. The .xyz files are written every &amp;lt;code&amp;gt;write_xyz=N&amp;lt;/code&amp;gt; steps.&lt;br /&gt;
&lt;br /&gt;
== Files ==&lt;br /&gt;
&lt;br /&gt;
=== Input file (input) ===&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;code&amp;gt;input&amp;lt;/code&amp;gt; file contains the keywords that tell '''TurboGAP''' how to perform the single-point or MD calculation requested by the user. A minimal &amp;lt;code&amp;gt;input&amp;lt;/code&amp;gt; file (without MD options) contains only information about the structure XYZ file, the location of the potential, and chemical species. An example looks like this:&lt;br /&gt;
&lt;br /&gt;
 ! Species-specific info&lt;br /&gt;
 [[atoms_file]] = 'atoms.xyz'&lt;br /&gt;
 [[pot_file]] = 'gap_files/cho.gap'&lt;br /&gt;
 [[n_species]] = 3&lt;br /&gt;
 [[species]] = H C O&lt;br /&gt;
 [[masses]] = 1.01 12.01 16.00 ! this is optional for single point, for MD TurboGAP will try to get them from a database if not provided &lt;br /&gt;
 [[e0]] = 0. 0. 0. ! this is optional, to specify per-species energy offsets&lt;br /&gt;
&lt;br /&gt;
For a single-point &amp;lt;code&amp;gt;turbogap predict&amp;lt;/code&amp;gt; calculation, something like the above is all that is needed. For running MD and other specialized simulations one needs to additionally specify the appropriate keywords. Check [[MD options]] for a complete list.&lt;br /&gt;
&lt;br /&gt;
=== Atoms file (*.xyz) ===&lt;br /&gt;
&lt;br /&gt;
The atoms file is an atomic structure file in ASE's [https://wiki.fysik.dtu.dk/ase/ase/io/formatoptions.html#extxyz extended XYZ] format. '''TurboGAP''' (currently) works exclusively in periodic boundary conditions; this must be taken into consideration when simulating molecular systems or surfaces (i.e., that an appropriate amount of vacuum is present). The format of the XYZ file must conform to the following:&lt;br /&gt;
&lt;br /&gt;
 Number_of_atoms&lt;br /&gt;
 Comment line including Lattice=&amp;quot;ax ay az bx by bz cx cy cz&amp;quot; and Properties=species:S:1:pos:R:3[:vel:R:3]&lt;br /&gt;
 Atom_name_1   posx posy posz (velx vely velz)&lt;br /&gt;
 Atom_name_2   posx posy posz (velx vely velz)&lt;br /&gt;
 ...&lt;br /&gt;
 Atom_name_nat posx posy posz (velx vely velz)&lt;br /&gt;
&lt;br /&gt;
where the velocity information is needed for MD ('''TurboGAP''' will generate random velocities if not provided). The positions must be in units of Angstrom, the velocities in Angstrom/fs and the masses in amu. '''TurboGAP''' XYZ reading adheres strictly to extXYZ format, with &amp;quot;species&amp;quot; (S:1), &amp;quot;pos&amp;quot; (R:3), &amp;quot;vel&amp;quot; (R:3), &amp;quot;fix_atom&amp;quot; (S:3, with values F or T allowed) and &amp;quot;mass&amp;quot; (R:1) read from the Properties attribute. &amp;quot;positions&amp;quot;, &amp;quot;velocities&amp;quot;, &amp;quot;fix_atoms&amp;quot; and &amp;quot;masses&amp;quot; are used as synonyms for &amp;quot;pos&amp;quot;, &amp;quot;vel&amp;quot;, &amp;quot;fix_atom&amp;quot; and &amp;quot;mass&amp;quot;, respectively.&lt;br /&gt;
&lt;br /&gt;
=== Potential directory (gap_files/) ===&lt;br /&gt;
&lt;br /&gt;
The [[Potentials|GAP potential files]] are usually put into a subdirectory under your working directory named &amp;lt;code&amp;gt;gap_files&amp;lt;/code&amp;gt;. This subdirectory contains a bunch of files generated with QUIP's &amp;lt;code&amp;gt;gap_fit&amp;lt;/code&amp;gt; program, with XML extension, as well as a mumber of other files. The XML files are often enough to run a [[Running a GAP calculation with QUIP|GAP calculation with QUIP]], with the notable exception of potentials with [[vdW corrections]], which might need some preprocessing before they can be used with QUIP. The &amp;lt;code&amp;gt;*.gap&amp;lt;/code&amp;gt; file tells '''TurboGAP''' how to use the different files to run a GAP calculation. When using these files with '''TurboGAP''' you do not need to worry about preprocessing, they're ready to go.&lt;br /&gt;
&lt;br /&gt;
=== Output files ===&lt;br /&gt;
&lt;br /&gt;
Besides standard output (basic messages, progress bar, etc.) that you get printed to stdout, '''TurboGAP''' produces one or two output files, depending on whether you are running a static calculation (&amp;lt;code&amp;gt;turbogap predict&amp;lt;/code&amp;gt;) or molecular dynamics (&amp;lt;code&amp;gt;turbogap md&amp;lt;/code&amp;gt;). Output file &amp;lt;code&amp;gt;[[trajectory_out.xyz]]&amp;lt;/code&amp;gt; is always written out, and it contains atomic positions, predicted energy and forces, etc. Output file &amp;lt;code&amp;gt;[[thermo.log]]&amp;lt;/code&amp;gt; is only written when doing MD, and it contains basic thermodynamic information (energy, temperature, pressure, etc.). One can control the frequency with which each file is written (for MD only) with &amp;lt;code&amp;gt;[[write_xyz]]&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;[[write_thermo]]&amp;lt;/code&amp;gt;, respectively. For finer control over which properties are written and which are not, refer to [[writeouts]].&lt;br /&gt;
&lt;br /&gt;
== Parallel support ==&lt;br /&gt;
&lt;br /&gt;
Parallel support in '''TurboGAP''' is provided specifically via MPI. To build the '''TurboGAP''' code with MPI support you need an MPI-enabled Fortran compiler. '''TurboGAP''' is routinely tested and works reliably with the &amp;lt;code&amp;gt;gfortran&amp;lt;/code&amp;gt; MPI wrapper, usually called &amp;lt;code&amp;gt;mpif90&amp;lt;/code&amp;gt;. It should also be possible to build '''TurboGAP''' with Intel's &amp;lt;code&amp;gt;mpifort&amp;lt;/code&amp;gt;, but we do not usually test the code with it. Note that the BLAS/LAPACK libraries used by '''TurboGAP''' should be compiled with the same compiler suite used to build '''TurboGAP''', to ensure compatibility. Also note that OpenMP support can be available from BLAS/LAPACK. In that case, hybrid MPI/OpenMP '''TurboGAP''' execution can be achieved, although be mindful that OpenMP acceleration can only be exploited for energy and force evaluation, not descriptor construction. We recommend to run '''TurboGAP''' with exclusive MPI parallelization, and our tests showed MPI performance to be superior to hybrid MPI/OpenMP. Since system architecture and the details of the potential might affect said performance, run your own tests to evaluate whether you gain speed up from BLAS/LAPACK's threading support.&lt;/div&gt;</summary>
		<author><name>Tigany Zarrouk</name></author>
		
	</entry>
	<entry>
		<id>https://turbogap.fi/wiki/index.php?title=Monte-Carlo&amp;diff=671</id>
		<title>Monte-Carlo</title>
		<link rel="alternate" type="text/html" href="https://turbogap.fi/wiki/index.php?title=Monte-Carlo&amp;diff=671"/>
		<updated>2026-03-02T11:50:20Z</updated>

		<summary type="html">&lt;p&gt;Tigany Zarrouk: /* Monte-Carlo options */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Running Monte-Carlo = &lt;br /&gt;
To perform a (Grand-Canonical) Monte-Carlo simulation we must run '''TurboGAP''' in &amp;lt;code&amp;gt;mc&amp;lt;/code&amp;gt; mode:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;turbogap mc&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
The following files are written to every &amp;lt;code&amp;gt;write_xyz = N&amp;lt;/code&amp;gt; steps&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;code&amp;gt;mc.log&amp;lt;/code&amp;gt;: self-explanatory,&lt;br /&gt;
** format: &amp;lt;code&amp;gt;mc_step  mc_move  accepted  E_trial  E_current  N_sites(trial) N_gcmc_species(trial)&amp;lt;/code&amp;gt;&lt;br /&gt;
* &amp;lt;code&amp;gt;mc_all.xyz&amp;lt;/code&amp;gt;: an appended file which contains all accepted moves&lt;br /&gt;
* &amp;lt;code&amp;gt;mc_trial.xyz&amp;lt;/code&amp;gt;: a single configuration which contains the trial move&lt;br /&gt;
* &amp;lt;code&amp;gt;mc_current.xyz&amp;lt;/code&amp;gt;: a single configuration which contains the current accepted&lt;br /&gt;
&lt;br /&gt;
= Monte-Carlo Move Types = &lt;br /&gt;
We can specify a number of Monte-Carlo trial move types, including doing molecular dynamics (hybrid Monte-Carlo) as trial moves. These include &lt;br /&gt;
* Displacement&lt;br /&gt;
* Swap (to swap atoms in the simulation box)&lt;br /&gt;
* Volume (for NPT)&lt;br /&gt;
* Insertion (for mu VT) &lt;br /&gt;
* Removal  (for mu VT)&lt;br /&gt;
* MD (for hybrid Monte-Carlo)&lt;br /&gt;
&lt;br /&gt;
= Minimal Input File = &lt;br /&gt;
&amp;lt;pre class=&amp;quot;conf&amp;quot;&amp;gt;! Species-specific info&lt;br /&gt;
atoms_file = 'atoms.xyz'&lt;br /&gt;
pot_file = 'gap_files/CO.gap'&lt;br /&gt;
n_species = 2&lt;br /&gt;
species = C O&lt;br /&gt;
masses = 12.01 15.99&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
mc_nsteps = 5000                         ! Number of mc trial steps to be performed&lt;br /&gt;
&lt;br /&gt;
n_mc_types = 3                           ! Number of mc trial types&lt;br /&gt;
mc_types = 'move' 'insertion' 'removal'  ! MC types can be: 'insertion' 'removal' 'md' 'swap' 'move'&lt;br /&gt;
                                         !                  'volume'&lt;br /&gt;
mc_acceptance = 1 1 1                    ! Ratios for choosing the respective trial moves (all equally likely here)&lt;br /&gt;
&lt;br /&gt;
mc_move_max = 0.2                        ! Maximum distance for the move of a particular particle&lt;br /&gt;
&lt;br /&gt;
n_mc_mu = 1&lt;br /&gt;
mc_mu = 0.0                              ! gcmc: Chemical potential [eV], using a large one here&lt;br /&gt;
mc_species = 'O'                         ! gcmc: species to insert / remove&lt;br /&gt;
mc_min_dist = 0.1                        ! gcmc: minimum distance between particles for insertion&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
! Note: The following files are written to every write_xyz steps&lt;br /&gt;
!       mc.log: self-explanatory,&lt;br /&gt;
!          format: mc_step  mc_move  accepted  E_trial  E_current  N_sites(trial)&lt;br /&gt;
!                                                                     N_gcmc_species(trial)&lt;br /&gt;
!       mc_all.xyz:     an appended file which contains all accepted moves&lt;br /&gt;
!       mc_trial.xyz:   a single configuration which contains the trial move&lt;br /&gt;
!       mc_current.xyz: a single configuration which contains the current accepted&lt;br /&gt;
&lt;br /&gt;
write_xyz = 200&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;monte-carlo-options&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
= Monte-Carlo options =&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Keyword&lt;br /&gt;
! Definition&lt;br /&gt;
! Optional&lt;br /&gt;
! Type&lt;br /&gt;
! Default&lt;br /&gt;
! Used when&lt;br /&gt;
! Example&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;mc_nsteps&amp;lt;/code&amp;gt;&lt;br /&gt;
| Number of MC steps&lt;br /&gt;
| N&lt;br /&gt;
| Int&lt;br /&gt;
| 0&lt;br /&gt;
| turbogap mc&lt;br /&gt;
| &amp;lt;code&amp;gt;mc_nsteps = 1000&amp;lt;/code&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;n_mc_types&amp;lt;/code&amp;gt;&lt;br /&gt;
| Number of MC types&lt;br /&gt;
| N&lt;br /&gt;
| Int&lt;br /&gt;
| 0&lt;br /&gt;
| turbogap mc&lt;br /&gt;
| &amp;lt;code&amp;gt;n_mc_types = 2&amp;lt;/code&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;mc_types&amp;lt;/code&amp;gt;&lt;br /&gt;
| Types of MC trials&lt;br /&gt;
| N&lt;br /&gt;
| Str(s)&lt;br /&gt;
| None&lt;br /&gt;
| &amp;lt;code&amp;gt;n_mc_types&amp;lt;/code&amp;gt; &amp;amp;gt; 0&lt;br /&gt;
| &amp;lt;code&amp;gt;mc_types = 'volume' 'move'&amp;lt;/code&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;mc_acceptance&amp;lt;/code&amp;gt;&lt;br /&gt;
| Ratios of MC trial moves&lt;br /&gt;
| N&lt;br /&gt;
| Int(s)&lt;br /&gt;
| None&lt;br /&gt;
| &amp;lt;code&amp;gt;n_mc_types&amp;lt;/code&amp;gt; &amp;amp;gt; 0&lt;br /&gt;
| &amp;lt;code&amp;gt;mc_acceptance = 2 1&amp;lt;/code&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;n_mc_swaps&amp;lt;/code&amp;gt;&lt;br /&gt;
| Number of swap pairs (e.g. C O is one pair)&lt;br /&gt;
| Y&lt;br /&gt;
| Int&lt;br /&gt;
| 0&lt;br /&gt;
| 'swap' in &amp;lt;code&amp;gt;mc_types&amp;lt;/code&amp;gt;&lt;br /&gt;
| &amp;lt;code&amp;gt;n_mc_swaps = 2&amp;lt;/code&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;mc_swaps&amp;lt;/code&amp;gt;&lt;br /&gt;
| Swap species pairs &lt;br /&gt;
| Y&lt;br /&gt;
| Strs&lt;br /&gt;
| None&lt;br /&gt;
| 'swap' in &amp;lt;code&amp;gt;mc_types&amp;lt;/code&amp;gt;&lt;br /&gt;
| &amp;lt;code&amp;gt;mc_swaps = 'C' 'O' 'N' 'C'&amp;lt;/code&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;mc_move_max&amp;lt;/code&amp;gt;&lt;br /&gt;
| Maximum displacement [A]&lt;br /&gt;
| Y&lt;br /&gt;
| Float&lt;br /&gt;
| 1.0&lt;br /&gt;
| 'move' in &amp;lt;code&amp;gt;mc_types&amp;lt;/code&amp;gt;&lt;br /&gt;
| &amp;lt;code&amp;gt;mc_move_max = 0.5&amp;lt;/code&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;mc_lnvol_max&amp;lt;/code&amp;gt;&lt;br /&gt;
| Log volume max for volume moves.&lt;br /&gt;
| Y&lt;br /&gt;
| Float&lt;br /&gt;
| 0.01&lt;br /&gt;
| 'volume' in &amp;lt;code&amp;gt;mc_types&amp;lt;/code&amp;gt;&lt;br /&gt;
| &amp;lt;code&amp;gt;mc_lnvol_max = 0.02&amp;lt;/code&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;mc_min_dist&amp;lt;/code&amp;gt;&lt;br /&gt;
| Minimum distance for insertion [A]&lt;br /&gt;
| Y&lt;br /&gt;
| Float&lt;br /&gt;
| 0.2&lt;br /&gt;
| 'insertion in &amp;lt;code&amp;gt;mc_types&amp;lt;/code&amp;gt;&lt;br /&gt;
| &amp;lt;code&amp;gt;mc_min_dist = 0.1&amp;lt;/code&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;mc_max_dist&amp;lt;/code&amp;gt;&lt;br /&gt;
| Maximum distance for insertion [A]&lt;br /&gt;
| Y&lt;br /&gt;
| Float&lt;br /&gt;
| 10000000.0&lt;br /&gt;
| 'insertion in &amp;lt;code&amp;gt;mc_types&amp;lt;/code&amp;gt;&lt;br /&gt;
| &amp;lt;code&amp;gt;mc_max_dist = 5.0&amp;lt;/code&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;n_mc_mu&amp;lt;/code&amp;gt;&lt;br /&gt;
| Number of chemical potentials/gcmc species&lt;br /&gt;
| Y&lt;br /&gt;
| Int&lt;br /&gt;
| 1&lt;br /&gt;
| 'insertion'/'removal' in &amp;lt;code&amp;gt;mc_types&amp;lt;/code&amp;gt;&lt;br /&gt;
| &amp;lt;code&amp;gt;n_mc_mu = 2&amp;lt;/code&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;mc_mu&amp;lt;/code&amp;gt;&lt;br /&gt;
| Chemical potential(s) [eV]&lt;br /&gt;
| Y&lt;br /&gt;
| Float&lt;br /&gt;
| 0.0&lt;br /&gt;
| 'insertion'/'removal' in &amp;lt;code&amp;gt;mc_types&amp;lt;/code&amp;gt;&lt;br /&gt;
| &amp;lt;code&amp;gt;mc_mu = -5.16 -2.25&amp;lt;/code&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;mc_species&amp;lt;/code&amp;gt;&lt;br /&gt;
| GCMC species&lt;br /&gt;
| Y&lt;br /&gt;
| Str&lt;br /&gt;
| None&lt;br /&gt;
| 'insertion'/'removal' in &amp;lt;code&amp;gt;mc_types&amp;lt;/code&amp;gt;&lt;br /&gt;
| &amp;lt;code&amp;gt;mc_species = 'O' 'H'&amp;lt;/code&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;mc_relax&amp;lt;/code&amp;gt;&lt;br /&gt;
| Relax MC trials prior to acc. evaluation&lt;br /&gt;
| Y&lt;br /&gt;
| Bool&lt;br /&gt;
| .false.&lt;br /&gt;
| turbogap mc&lt;br /&gt;
| &amp;lt;code&amp;gt;mc_relax = .true.&amp;lt;/code&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;n_mc_relax_after&amp;lt;/code&amp;gt;&lt;br /&gt;
| Number of specific trials to relax&lt;br /&gt;
| Y&lt;br /&gt;
| Int&lt;br /&gt;
| 0&lt;br /&gt;
| &amp;lt;code&amp;gt;mc_relax = .true.&amp;lt;/code&amp;gt;&lt;br /&gt;
| &amp;lt;code&amp;gt;n_mc_relax_after = 1&amp;lt;/code&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;mc_relax_after&amp;lt;/code&amp;gt;&lt;br /&gt;
| Relax specific MC trial types&lt;br /&gt;
| Y&lt;br /&gt;
| Str(s)&lt;br /&gt;
| None&lt;br /&gt;
| &amp;lt;code&amp;gt;n_mc_relax_after &amp;amp;gt; 0&amp;lt;/code&amp;gt;&lt;br /&gt;
| &amp;lt;code&amp;gt;mc_relax_after = 'volume'&amp;lt;/code&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;mc_nrelax&amp;lt;/code&amp;gt;&lt;br /&gt;
| Number of relaxation steps after trial&lt;br /&gt;
| Y&lt;br /&gt;
| Int&lt;br /&gt;
| 0&lt;br /&gt;
| &amp;lt;code&amp;gt;mc_relax = .true.&amp;lt;/code&amp;gt;&lt;br /&gt;
| &amp;lt;code&amp;gt;mc_nrelax = 50&amp;lt;/code&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;mc_relax_opt&amp;lt;/code&amp;gt;&lt;br /&gt;
| Optimisation for relaxing after steps&lt;br /&gt;
| Y&lt;br /&gt;
| Str&lt;br /&gt;
| 'gd'&lt;br /&gt;
| &amp;lt;code&amp;gt;mc_relax = .true.&amp;lt;/code&amp;gt;&lt;br /&gt;
| &amp;lt;code&amp;gt;mc_relax_opt = 'gd-box-ortho'&amp;lt;/code&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;mc_hamiltonian&amp;lt;/code&amp;gt;&lt;br /&gt;
| Use NVE for 'md' trials&lt;br /&gt;
| Y&lt;br /&gt;
| Bool&lt;br /&gt;
| .false.&lt;br /&gt;
| 'md' in &amp;lt;code&amp;gt;mc_types&amp;lt;/code&amp;gt;&lt;br /&gt;
| &amp;lt;code&amp;gt;mc_hamiltonian = .true.&amp;lt;/code&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;mc_hybrid_opt&amp;lt;/code&amp;gt;&lt;br /&gt;
| Optimisation for 'md' steps&lt;br /&gt;
| Y&lt;br /&gt;
| Str&lt;br /&gt;
| 'vv'&lt;br /&gt;
| 'md' in &amp;lt;code&amp;gt;mc_types&amp;lt;/code&amp;gt;&lt;br /&gt;
| &amp;lt;code&amp;gt;mc_hybrid_opt = 'vv'&amp;lt;/code&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;mc_write_xyz&amp;lt;/code&amp;gt;&lt;br /&gt;
| Debug: read and write to files every step&lt;br /&gt;
| Y&lt;br /&gt;
| Bool&lt;br /&gt;
| .false.&lt;br /&gt;
| &amp;lt;code&amp;gt;turbogap mc&amp;lt;/code&amp;gt;&lt;br /&gt;
| &amp;lt;code&amp;gt;mc_write_xyz = .true.&amp;lt;/code&amp;gt;&lt;br /&gt;
|}&lt;/div&gt;</summary>
		<author><name>Tigany Zarrouk</name></author>
		
	</entry>
	<entry>
		<id>https://turbogap.fi/wiki/index.php?title=Monte-Carlo&amp;diff=663</id>
		<title>Monte-Carlo</title>
		<link rel="alternate" type="text/html" href="https://turbogap.fi/wiki/index.php?title=Monte-Carlo&amp;diff=663"/>
		<updated>2025-01-06T11:44:14Z</updated>

		<summary type="html">&lt;p&gt;Tigany Zarrouk: /* Monte-Carlo options */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Running Monte-Carlo = &lt;br /&gt;
To perform a (Grand-Canonical) Monte-Carlo simulation we must run '''TurboGAP''' in &amp;lt;code&amp;gt;mc&amp;lt;/code&amp;gt; mode:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;turbogap mc&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
The following files are written to every &amp;lt;code&amp;gt;write_xyz = N&amp;lt;/code&amp;gt; steps&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;code&amp;gt;mc.log&amp;lt;/code&amp;gt;: self-explanatory,&lt;br /&gt;
** format: &amp;lt;code&amp;gt;mc_step  mc_move  accepted  E_trial  E_current  N_sites(trial) N_gcmc_species(trial)&amp;lt;/code&amp;gt;&lt;br /&gt;
* &amp;lt;code&amp;gt;mc_all.xyz&amp;lt;/code&amp;gt;: an appended file which contains all accepted moves&lt;br /&gt;
* &amp;lt;code&amp;gt;mc_trial.xyz&amp;lt;/code&amp;gt;: a single configuration which contains the trial move&lt;br /&gt;
* &amp;lt;code&amp;gt;mc_current.xyz&amp;lt;/code&amp;gt;: a single configuration which contains the current accepted&lt;br /&gt;
&lt;br /&gt;
= Monte-Carlo Move Types = &lt;br /&gt;
We can specify a number of Monte-Carlo trial move types, including doing molecular dynamics (hybrid Monte-Carlo) as trial moves. These include &lt;br /&gt;
* Displacement&lt;br /&gt;
* Swap (to swap atoms in the simulation box)&lt;br /&gt;
* Volume (for NPT)&lt;br /&gt;
* Insertion (for mu VT) &lt;br /&gt;
* Removal  (for mu VT)&lt;br /&gt;
* MD (for hybrid Monte-Carlo)&lt;br /&gt;
&lt;br /&gt;
= Minimal Input File = &lt;br /&gt;
&amp;lt;pre class=&amp;quot;conf&amp;quot;&amp;gt;! Species-specific info&lt;br /&gt;
atoms_file = 'atoms.xyz'&lt;br /&gt;
pot_file = 'gap_files/CO.gap'&lt;br /&gt;
n_species = 2&lt;br /&gt;
species = C O&lt;br /&gt;
masses = 12.01 15.99&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
mc_nsteps = 5000                         ! Number of mc trial steps to be performed&lt;br /&gt;
&lt;br /&gt;
n_mc_types = 3                           ! Number of mc trial types&lt;br /&gt;
mc_types = 'move' 'insertion' 'removal'  ! MC types can be: 'insertion' 'removal' 'md' 'swap' 'move'&lt;br /&gt;
                                         !                  'volume'&lt;br /&gt;
mc_acceptance = 1 1 1                    ! Ratios for choosing the respective trial moves (all equally likely here)&lt;br /&gt;
&lt;br /&gt;
mc_move_max = 0.2                        ! Maximum distance for the move of a particular particle&lt;br /&gt;
&lt;br /&gt;
n_mc_mu = 1&lt;br /&gt;
mc_mu = 0.0                              ! gcmc: Chemical potential [eV], using a large one here&lt;br /&gt;
mc_species = 'O'                         ! gcmc: species to insert / remove&lt;br /&gt;
mc_min_dist = 0.1                        ! gcmc: minimum distance between particles for insertion&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
! Note: The following files are written to every write_xyz steps&lt;br /&gt;
!       mc.log: self-explanatory,&lt;br /&gt;
!          format: mc_step  mc_move  accepted  E_trial  E_current  N_sites(trial)&lt;br /&gt;
!                                                                     N_gcmc_species(trial)&lt;br /&gt;
!       mc_all.xyz:     an appended file which contains all accepted moves&lt;br /&gt;
!       mc_trial.xyz:   a single configuration which contains the trial move&lt;br /&gt;
!       mc_current.xyz: a single configuration which contains the current accepted&lt;br /&gt;
&lt;br /&gt;
write_xyz = 200&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;monte-carlo-options&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
= Monte-Carlo options =&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Keyword&lt;br /&gt;
! Definition&lt;br /&gt;
! Optional&lt;br /&gt;
! Type&lt;br /&gt;
! Default&lt;br /&gt;
! Used when&lt;br /&gt;
! Example&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;mc_nsteps&amp;lt;/code&amp;gt;&lt;br /&gt;
| Number of MC steps&lt;br /&gt;
| N&lt;br /&gt;
| Int&lt;br /&gt;
| 0&lt;br /&gt;
| turbogap mc&lt;br /&gt;
| &amp;lt;code&amp;gt;mc_nsteps = 1000&amp;lt;/code&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;n_mc_types&amp;lt;/code&amp;gt;&lt;br /&gt;
| Number of MC types&lt;br /&gt;
| N&lt;br /&gt;
| Int&lt;br /&gt;
| 0&lt;br /&gt;
| turbogap mc&lt;br /&gt;
| &amp;lt;code&amp;gt;n_mc_types = 2&amp;lt;/code&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;mc_types&amp;lt;/code&amp;gt;&lt;br /&gt;
| Types of MC trials&lt;br /&gt;
| N&lt;br /&gt;
| Str(s)&lt;br /&gt;
| None&lt;br /&gt;
| &amp;lt;code&amp;gt;n_mc_types&amp;lt;/code&amp;gt; &amp;amp;gt; 0&lt;br /&gt;
| &amp;lt;code&amp;gt;mc_types = 'volume' 'move'&amp;lt;/code&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;mc_acceptance&amp;lt;/code&amp;gt;&lt;br /&gt;
| Ratios of MC trial moves&lt;br /&gt;
| N&lt;br /&gt;
| Int(s)&lt;br /&gt;
| None&lt;br /&gt;
| &amp;lt;code&amp;gt;n_mc_types&amp;lt;/code&amp;gt; &amp;amp;gt; 0&lt;br /&gt;
| &amp;lt;code&amp;gt;mc_acceptance = 2 1&amp;lt;/code&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;n_mc_swaps&amp;lt;/code&amp;gt;&lt;br /&gt;
| Number of swap pairs (e.g. C O is one pair)&lt;br /&gt;
| Y&lt;br /&gt;
| Int&lt;br /&gt;
| 0&lt;br /&gt;
| 'swap' in &amp;lt;code&amp;gt;mc_types&amp;lt;/code&amp;gt;&lt;br /&gt;
| &amp;lt;code&amp;gt;n_mc_swaps = 2&amp;lt;/code&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;mc_swaps&amp;lt;/code&amp;gt;&lt;br /&gt;
| Swap species pairs &lt;br /&gt;
| Y&lt;br /&gt;
| Strs&lt;br /&gt;
| None&lt;br /&gt;
| 'swap' in &amp;lt;code&amp;gt;mc_types&amp;lt;/code&amp;gt;&lt;br /&gt;
| &amp;lt;code&amp;gt;mc_swaps = 'C' 'O' 'N' 'C'&amp;lt;/code&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;mc_move_max&amp;lt;/code&amp;gt;&lt;br /&gt;
| Maximum displacement [A]&lt;br /&gt;
| Y&lt;br /&gt;
| Float&lt;br /&gt;
| 1.0&lt;br /&gt;
| 'move' in &amp;lt;code&amp;gt;mc_types&amp;lt;/code&amp;gt;&lt;br /&gt;
| &amp;lt;code&amp;gt;mc_move_max = 0.5&amp;lt;/code&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;mc_lnvol_max&amp;lt;/code&amp;gt;&lt;br /&gt;
| Log volume max for volume moves.&lt;br /&gt;
| Y&lt;br /&gt;
| Float&lt;br /&gt;
| 0.01&lt;br /&gt;
| 'volume' in &amp;lt;code&amp;gt;mc_types&amp;lt;/code&amp;gt;&lt;br /&gt;
| &amp;lt;code&amp;gt;mc_lnvol_max = 0.02&amp;lt;/code&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;mc_min_dist&amp;lt;/code&amp;gt;&lt;br /&gt;
| Minimum distance for insertion [A]&lt;br /&gt;
| Y&lt;br /&gt;
| Float&lt;br /&gt;
| 0.2&lt;br /&gt;
| 'insertion in &amp;lt;code&amp;gt;mc_types&amp;lt;/code&amp;gt;&lt;br /&gt;
| &amp;lt;code&amp;gt;mc_min_dist = 0.1&amp;lt;/code&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;n_mc_mu&amp;lt;/code&amp;gt;&lt;br /&gt;
| Number of chemical potentials/gcmc species&lt;br /&gt;
| Y&lt;br /&gt;
| Int&lt;br /&gt;
| 1&lt;br /&gt;
| 'insertion'/'removal' in &amp;lt;code&amp;gt;mc_types&amp;lt;/code&amp;gt;&lt;br /&gt;
| &amp;lt;code&amp;gt;n_mc_mu = 2&amp;lt;/code&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;mc_mu&amp;lt;/code&amp;gt;&lt;br /&gt;
| Chemical potential(s) [eV]&lt;br /&gt;
| Y&lt;br /&gt;
| Float&lt;br /&gt;
| 0.0&lt;br /&gt;
| 'insertion'/'removal' in &amp;lt;code&amp;gt;mc_types&amp;lt;/code&amp;gt;&lt;br /&gt;
| &amp;lt;code&amp;gt;mc_mu = -5.16 -2.25&amp;lt;/code&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;mc_species&amp;lt;/code&amp;gt;&lt;br /&gt;
| GCMC species&lt;br /&gt;
| Y&lt;br /&gt;
| Str&lt;br /&gt;
| None&lt;br /&gt;
| 'insertion'/'removal' in &amp;lt;code&amp;gt;mc_types&amp;lt;/code&amp;gt;&lt;br /&gt;
| &amp;lt;code&amp;gt;mc_species = 'O' 'H'&amp;lt;/code&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;mc_relax&amp;lt;/code&amp;gt;&lt;br /&gt;
| Relax MC trials prior to acc. evaluation&lt;br /&gt;
| Y&lt;br /&gt;
| Bool&lt;br /&gt;
| .false.&lt;br /&gt;
| turbogap mc&lt;br /&gt;
| &amp;lt;code&amp;gt;mc_relax = .true.&amp;lt;/code&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;n_mc_relax_after&amp;lt;/code&amp;gt;&lt;br /&gt;
| Number of specific trials to relax&lt;br /&gt;
| Y&lt;br /&gt;
| Int&lt;br /&gt;
| 0&lt;br /&gt;
| &amp;lt;code&amp;gt;mc_relax = .true.&amp;lt;/code&amp;gt;&lt;br /&gt;
| &amp;lt;code&amp;gt;n_mc_relax_after = 1&amp;lt;/code&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;mc_relax_after&amp;lt;/code&amp;gt;&lt;br /&gt;
| Relax specific MC trial types&lt;br /&gt;
| Y&lt;br /&gt;
| Str(s)&lt;br /&gt;
| None&lt;br /&gt;
| &amp;lt;code&amp;gt;n_mc_relax_after &amp;amp;gt; 0&amp;lt;/code&amp;gt;&lt;br /&gt;
| &amp;lt;code&amp;gt;mc_relax_after = 'volume'&amp;lt;/code&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;mc_nrelax&amp;lt;/code&amp;gt;&lt;br /&gt;
| Number of relaxation steps after trial&lt;br /&gt;
| Y&lt;br /&gt;
| Int&lt;br /&gt;
| 0&lt;br /&gt;
| &amp;lt;code&amp;gt;mc_relax = .true.&amp;lt;/code&amp;gt;&lt;br /&gt;
| &amp;lt;code&amp;gt;mc_nrelax = 50&amp;lt;/code&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;mc_relax_opt&amp;lt;/code&amp;gt;&lt;br /&gt;
| Optimisation for relaxing after steps&lt;br /&gt;
| Y&lt;br /&gt;
| Str&lt;br /&gt;
| 'gd'&lt;br /&gt;
| &amp;lt;code&amp;gt;mc_relax = .true.&amp;lt;/code&amp;gt;&lt;br /&gt;
| &amp;lt;code&amp;gt;mc_relax_opt = 'gd-box-ortho'&amp;lt;/code&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;mc_hamiltonian&amp;lt;/code&amp;gt;&lt;br /&gt;
| Use NVE for 'md' trials&lt;br /&gt;
| Y&lt;br /&gt;
| Bool&lt;br /&gt;
| .false.&lt;br /&gt;
| 'md' in &amp;lt;code&amp;gt;mc_types&amp;lt;/code&amp;gt;&lt;br /&gt;
| &amp;lt;code&amp;gt;mc_hamiltonian = .true.&amp;lt;/code&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;mc_hybrid_opt&amp;lt;/code&amp;gt;&lt;br /&gt;
| Optimisation for 'md' steps&lt;br /&gt;
| Y&lt;br /&gt;
| Str&lt;br /&gt;
| 'vv'&lt;br /&gt;
| 'md' in &amp;lt;code&amp;gt;mc_types&amp;lt;/code&amp;gt;&lt;br /&gt;
| &amp;lt;code&amp;gt;mc_hybrid_opt = 'vv'&amp;lt;/code&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;mc_write_xyz&amp;lt;/code&amp;gt;&lt;br /&gt;
| Debug: read and write to files every step&lt;br /&gt;
| Y&lt;br /&gt;
| Bool&lt;br /&gt;
| .false.&lt;br /&gt;
| &amp;lt;code&amp;gt;turbogap mc&amp;lt;/code&amp;gt;&lt;br /&gt;
| &amp;lt;code&amp;gt;mc_write_xyz = .true.&amp;lt;/code&amp;gt;&lt;br /&gt;
|}&lt;/div&gt;</summary>
		<author><name>Tigany Zarrouk</name></author>
		
	</entry>
	<entry>
		<id>https://turbogap.fi/wiki/index.php?title=Creating_oxygenated_amorphous_carbon&amp;diff=662</id>
		<title>Creating oxygenated amorphous carbon</title>
		<link rel="alternate" type="text/html" href="https://turbogap.fi/wiki/index.php?title=Creating_oxygenated_amorphous_carbon&amp;diff=662"/>
		<updated>2024-11-14T13:22:51Z</updated>

		<summary type="html">&lt;p&gt;Tigany Zarrouk: /* GCMC in TurboGAP */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This tutorial will focus on using molecular dynamics and Grand-Canonical Monte-Carlo (GCMC) simulations to determine equilibrium structures of oxygenated amorphous carbon using '''TurboGAP'''.&lt;br /&gt;
&lt;br /&gt;
This tutorial is found on the '''TurboGAP''' wiki: &amp;lt;u&amp;gt;turbogap.fi&amp;lt;/u&amp;gt; (-&amp;amp;gt; tutorials -&amp;amp;gt; Creating oxygenated amorphous carbon) https://turbogap.fi/wiki/index.php/Creating_oxygenated_amorphous_carbon.&lt;br /&gt;
&lt;br /&gt;
The structure of this tutorial as as follows:&lt;br /&gt;
&lt;br /&gt;
# Create an amorphous carbon structure using molecular dynamics, via a melt-quench procedure.&lt;br /&gt;
# Perform a standard GCMC calculation to populate the structure with oxygen.&lt;br /&gt;
# Perform a hybrid Monte-Carlo/MD simulations, to relax the system.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;introduction&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
= Introduction =&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;what-is-turbogap&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
== What is '''TurboGAP'''? ==&lt;br /&gt;
&lt;br /&gt;
TurboGAP is a code used to simulate Machine-Learned Potentials, specifically, &amp;lt;u&amp;gt;Gaussian Approximation Potentials&amp;lt;/u&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
It has numerous selling points:&lt;br /&gt;
&lt;br /&gt;
# It is ''fast''.&lt;br /&gt;
#* It uses '''soap turbo''' descriptors, which are both faster and more accurate than your typical SOAP expansion (also found in QUIP). See the original paper paper by Miguel Caro for more details: [https://doi.org/10.1103/PhysRevB.100.024112 Optimizing many-body atomic descriptors for enhanced computational performance of machine learning based interatomic potentials]&lt;br /&gt;
#* MPI parallelised, (overlapping domain decomposition currently being developed with help of CSC).&lt;br /&gt;
#* &amp;lt;u&amp;gt;GPU implementation&amp;lt;/u&amp;gt; in progress (with CSC support too).&lt;br /&gt;
# It can perform not just typical molecular statics (with/without box relaxation) and dynamics (&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;NVT&amp;lt;/math&amp;gt; / &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;NPT&amp;lt;/math&amp;gt;), it can perform ''Grand-Canonical Monte-Carlo'' simulations.&lt;br /&gt;
#* Grand-Canonical Monte Carlo (&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mu VT&amp;lt;/math&amp;gt;), with (&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;NVT&amp;lt;/math&amp;gt;) / (&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;NPT&amp;lt;/math&amp;gt;) move types available.&lt;br /&gt;
#* Adaptive time-scale MD (by Uttiyoarnab Saha).&lt;br /&gt;
# Prediction of an arbitrary number of local properties.&lt;br /&gt;
#* &amp;lt;u&amp;gt;ML Van der Waals&amp;lt;/u&amp;gt; (by prediction of local hirshfeld volumes) using Tkatchenko-Scheffler [https://doi.org/10.1103/PhysRevB.104.054106 Machine learning force fields based on local parametrization of dispersion interactions]&lt;br /&gt;
#* Heikki Muhli has developed ''Many-Body Dispersion'' capability, with multiple optimisations.&lt;br /&gt;
#* Max Veit is developing ''electrostatics''.&lt;br /&gt;
# &amp;lt;u&amp;gt;Sneak Peek!&amp;lt;/u&amp;gt;: we have added the capability to predict/simulate numerous types of experimental data (ML XPS/XRD) and can allow them to influence simulation. (Talk to Tigany Zarrouk/look out for the papers when they come out on arXiv)!&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;installing-turbogap&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
== Installing TurboGAP ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;for-the-mlip-workshop&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== For the MLIP workshop ===&lt;br /&gt;
&lt;br /&gt;
If you have a CSC account and can ssh into Mahti/Puhti there is no need to install anything. TurboGAP is installed in the path (on Mahti / Puhti)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;/projappl/project_2008666/turbogap&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
The tutorial is in&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;cd /projappl/project_2008666/turbogap/tutorials/creating_a-COx&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
Copy the directory &amp;lt;code&amp;gt;creating_a-COx&amp;lt;/code&amp;gt; to wherever you want to do the simulations and then check the project in &amp;lt;code&amp;gt;creating_a-COx/sample_submit_script.sh&amp;lt;/code&amp;gt;, change it from &lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;#SBATCH --account=project_&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
to&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;#SBATCH --account=project_2008666&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
This tutorial depends on &amp;lt;code&amp;gt;ase&amp;lt;/code&amp;gt;, so install it as so (after loading the python module)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;module load python-data/3.9-22.04&lt;br /&gt;
pip install ase --user&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
Each of the simulations should take ~5-8 minutes.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;installation&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== Installation ===&lt;br /&gt;
&lt;br /&gt;
To install TurboGAP please run&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;git clone --recursive http://github.com/mcaroba/turbogap.git /your/turbogap/source/directory&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
Where /your/turbogap/source/directory is the directory where you're putting the TurboGAP source code. To build the TurboGAP binary and library, you need to select the options that best match your architecture, by editing this line in the Makefile with one of the names of the corresponding makefiles in turbogap/makefiles:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;include makefiles/Makefile.Ubuntu_gfortran_mpi&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
Then just run &amp;lt;code&amp;gt;make&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;make&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
Copy the directory &amp;lt;code&amp;gt;turbogap/tutorials/creating_a-COx&amp;lt;/code&amp;gt; to wherever you want to do the simulations.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;running-this-tutorial-on-a-cluster&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== Running this tutorial on a cluster ===&lt;br /&gt;
&lt;br /&gt;
* Copy the directory &amp;lt;code&amp;gt;turbogap/tutorials/creating_a-COx&amp;lt;/code&amp;gt; to where you want to run.&lt;br /&gt;
* Change &amp;lt;code&amp;gt;sample_submit_script.sh&amp;lt;/code&amp;gt; to reflect the type of job scheduler you use (here, it's slurm), the modules you've loaded for &amp;lt;code&amp;gt;turbogap&amp;lt;/code&amp;gt; and python, and change the &amp;lt;code&amp;gt;PATH&amp;lt;/code&amp;gt; environment variable to where you've installed &amp;lt;code&amp;gt;turbogap/bin&amp;lt;/code&amp;gt;.&lt;br /&gt;
* Make sure the project account is correct!&lt;br /&gt;
* Load the python module you will use, and make sure &amp;lt;code&amp;gt;ase&amp;lt;/code&amp;gt; is installed by running &amp;lt;code&amp;gt;pip install ase {--user}&amp;lt;/code&amp;gt;.&lt;br /&gt;
* Change the &amp;lt;code&amp;gt;srun turbogap&amp;lt;/code&amp;gt; commands in the &amp;lt;code&amp;gt;script_*.sh&amp;lt;/code&amp;gt; files to the standard for your cluster (e.g. &amp;lt;code&amp;gt;mpirun -np $N turbogap&amp;lt;/code&amp;gt;).&lt;br /&gt;
* In each of the directories enumerated with &amp;amp;quot;1.,2., etc&amp;amp;quot;, run the scripts in order after the preceding job has finished. They are enumerated with &amp;amp;quot;1.,2., etc&amp;amp;quot; with bash, e.g. &amp;lt;code&amp;gt;bash 1.run_randomise.sh&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;running-this-tutorial-locally&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== Running this tutorial locally ===&lt;br /&gt;
&lt;br /&gt;
* Copy the directory &amp;lt;code&amp;gt;turbogap/tutorials/creating_a-COx&amp;lt;/code&amp;gt; to where you want to run.&lt;br /&gt;
* Make sure the python package &amp;lt;code&amp;gt;ase&amp;lt;/code&amp;gt; is installed by running &amp;lt;code&amp;gt;pip install ase {--user}&amp;lt;/code&amp;gt;.&lt;br /&gt;
* Edit the convenience script &amp;lt;code&amp;gt;change_to_local.sh&amp;lt;/code&amp;gt; and run with bash.&lt;br /&gt;
* Change the path environment variable in &amp;lt;code&amp;gt;sample_submit_script.sh&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;note-how-to-make-a-potential-work-in-turbogap&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
== Note: how to make a potential work in '''TurboGAP''' ==&lt;br /&gt;
&lt;br /&gt;
You must convert potentials which are trained from [https://github.com/libatoms/QUIP libAtoms] (the xml files) to &amp;lt;code&amp;gt;*.gap&amp;lt;/code&amp;gt; files. It can be run by&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;python3 /path/turbogap/tools/quip_to_xml/make_gap_files.py  your_potential.xml your_potential.gap {your_hirshfeld.xml}&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;span id=&amp;quot;tutorial&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
= Tutorial =&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;create-amorphous-carbon&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
== Create Amorphous Carbon ==&lt;br /&gt;
&lt;br /&gt;
Here, we perform molecular dynamics simulations to form amorphous carbon from diamond. To do this, we use a simple melt-quench procedure, which is modified from the paper of Wang ''et al.'' to create amorphous carbon [https://doi.org/10.1021/acs.chemmater.1c03279 Structure and Pore Size Distribution in Nanoporous Carbon].&lt;br /&gt;
&lt;br /&gt;
This is also similar to what is done in other tutorials [https://turbogap.fi/wiki/index.php/Graphitization_simulation_with_van_der_Waals_corrections Graphitization simulation with van der Waals corrections] [https://turbogap.fi/wiki/index.php/Generating_amorphous_silicon_from_quenching_simulations Generating amorphous silicon from quenching simulations].&lt;br /&gt;
&lt;br /&gt;
The procedure we will follow is:&lt;br /&gt;
&lt;br /&gt;
# We heat up the diamond to 9000K, thereby randomizing the structure.&lt;br /&gt;
# We quench to 1000K (actual temp used is 3500K in the real paper).&lt;br /&gt;
# We anneal (partially graphitize) the structure at 1000K, to allow the carbon bonds a chance to reform.&lt;br /&gt;
# Relax the structure, allowing both atomic positions and cell vectors to relax.&lt;br /&gt;
&lt;br /&gt;
To run these calculations, do&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;cd 1.make_amorphous_carbon&lt;br /&gt;
bash 1.run_randomise.sh&lt;br /&gt;
# Wait for it to finish&lt;br /&gt;
&lt;br /&gt;
bash 2.run_quench.sh&lt;br /&gt;
# Wait for it to finish&lt;br /&gt;
&lt;br /&gt;
bash 3.run_anneal.sh&lt;br /&gt;
# Wait for it to finish&lt;br /&gt;
&lt;br /&gt;
bash 4.run_relax.sh&lt;br /&gt;
# Wait for it to finish&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;span id=&amp;quot;randomise&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== 1. Randomise ===&lt;br /&gt;
&lt;br /&gt;
First, we create a diamond structure using ASE, changing the volume to achieve a given density.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;sim_name=&amp;quot;md_diamond_randomise&amp;quot;&lt;br /&gt;
&lt;br /&gt;
input_atoms=&amp;quot;atoms.xyz&amp;quot;&lt;br /&gt;
output_atoms=&amp;quot;atoms_randomise.xyz&amp;quot;&lt;br /&gt;
&lt;br /&gt;
ln -sf ../gap_files ./&lt;br /&gt;
&lt;br /&gt;
# 1. Create diamond structure (1000 atoms in atoms.xyz file)&lt;br /&gt;
echo &amp;quot;&amp;gt; Running: python create_diamond.py&amp;quot;&lt;br /&gt;
python3 create_diamond.py&lt;br /&gt;
&lt;br /&gt;
cp diamond.xyz $input_atoms&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;u&amp;gt;Note:&amp;lt;/u&amp;gt; In &amp;lt;code&amp;gt;create_diamond.py&amp;lt;/code&amp;gt; we make 1000 atoms. You can change this to a smaller number, if you want things to run faster.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;python&amp;quot;&amp;gt;atoms *= (3,3,3)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
Then we create the input file for '''TurboGAP''' in &amp;lt;code&amp;gt;input&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre class=&amp;quot;conf&amp;quot;&amp;gt;! Species-specific info&lt;br /&gt;
atoms_file = '${input_atoms}'  ! Input file&lt;br /&gt;
pot_file = 'gap_files/CO.gap'  ! path to gap_files&lt;br /&gt;
n_species = 2                  ! &amp;amp;gt; Actually the number of species in atoms.xyz is 1 (C),&lt;br /&gt;
                               !   but we will add oxygen in future simulations&lt;br /&gt;
species = C O&lt;br /&gt;
masses = 12.01 15.99&lt;br /&gt;
&lt;br /&gt;
! MD options&lt;br /&gt;
md_nsteps = 5000               ! Number of MD steps (5ps randomise - actual time in paper is 20ps)&lt;br /&gt;
md_step = 1                    ! MD timestep [fs]&lt;br /&gt;
thermostat = bussi             ! Either bussi / berendsen&lt;br /&gt;
&lt;br /&gt;
t_beg = 9000                   ! Initial temperature [K]&lt;br /&gt;
t_end = 9000                   ! Final temperature   [K]&lt;br /&gt;
tau_t = 100.                   ! Time constant [fs]&lt;br /&gt;
&lt;br /&gt;
! Output&lt;br /&gt;
write_thermo = 1               ! Write thermodynamic information every step&lt;br /&gt;
                               !       (Step, Time, Temp, Kin_E, Pot_E, Pres)&lt;br /&gt;
&lt;br /&gt;
write_xyz = 200                ! Write extended xyz trajectory (trajectory_out.xyz) every 200 steps&lt;br /&gt;
&lt;br /&gt;
                               ! &amp;amp;gt; Predicted local properties are in the xyz, such as the local energy&lt;br /&gt;
                               !   and if specified, hirshfeld volumes, core electron binding energies etc&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
We run MD/relaxation simulations using the &amp;lt;code&amp;gt;md&amp;lt;/code&amp;gt; option&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;srun turbogap md&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
This simulation outputs a few files:&lt;br /&gt;
&lt;br /&gt;
# &amp;lt;code&amp;gt;trajectory_out.xyz&amp;lt;/code&amp;gt; is the extended xyz of the trajectory, written every write&amp;lt;sub&amp;gt;xyz&amp;lt;/sub&amp;gt; steps.&lt;br /&gt;
# &amp;lt;code&amp;gt;thermo.log&amp;lt;/code&amp;gt; logs the MD simulation&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;quench&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== 2. Quench ===&lt;br /&gt;
&lt;br /&gt;
Here, we cool the system.&lt;br /&gt;
&lt;br /&gt;
The only things necessary to change in the input file (if you rebel against using the provided scripts) is the temperature and the number of MD steps.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre class=&amp;quot;conf&amp;quot;&amp;gt;! MD options&lt;br /&gt;
md_nsteps = 5500               ! 5.5ps quench&lt;br /&gt;
md_step = 1.&lt;br /&gt;
thermostat = bussi&lt;br /&gt;
t_beg = 9000                   ! Quenching from 9000K&lt;br /&gt;
t_end = 1000                   !             to 1000K&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;span id=&amp;quot;anneal&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== 3. Anneal ===&lt;br /&gt;
&lt;br /&gt;
We can anneal the structure to graphitize. The method demonstrated here is different from that of the paper (we are hardly graphitising at 1000K and 10ps), but its here to illustrate the use of a barostat.&lt;br /&gt;
&lt;br /&gt;
The necessary changes to the input file are&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre class=&amp;quot;conf&amp;quot;&amp;gt;! MD options                                                                                                                        &lt;br /&gt;
md_nsteps = 10000                 ! Graphitization (actual time in the paper is 200ps)&lt;br /&gt;
md_step = 1.&lt;br /&gt;
barostat = berendsen              ! Using barostat&lt;br /&gt;
t_beg = 1000                                                                                                                        &lt;br /&gt;
t_end = 1000&lt;br /&gt;
p_beg = 1.0                       ! Initial pressure [bar]&lt;br /&gt;
p_end = 1.0                       ! Final pressure   [bar]&lt;br /&gt;
tau_t = 100.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;span id=&amp;quot;relax&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== 4. Relax ===&lt;br /&gt;
&lt;br /&gt;
Now we relax the structure. We can choose multiple options for this, but here we opt for relaxing the box and the positions.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre class=&amp;quot;conf&amp;quot;&amp;gt;! MD options&lt;br /&gt;
optimize = gd                 ! optimize option allows us to specify the type of relaxation&lt;br /&gt;
                              ! &amp;amp;gt; Can use &amp;amp;quot;gd&amp;amp;quot; (gradient descent)&lt;br /&gt;
                              !           &amp;amp;quot;gd-box-ortho&amp;amp;quot; (gradient descent relaxing diagonal cell vector components)&lt;br /&gt;
                              !           &amp;amp;quot;gd-box&amp;amp;quot; (gradient-decent relaxing all cell vector components)&lt;br /&gt;
&lt;br /&gt;
! e_tol = 1.d-6               ! Default energy/force tolerances used&lt;br /&gt;
! f_tol = 0.010&lt;br /&gt;
md_nsteps = 2000&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
We can now look at the simulation results by running&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;cat traj_* &amp;gt; all_traj.xyz&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
and using your atom viewer of choice.&lt;br /&gt;
&lt;br /&gt;
At the end, you should have a structure which is similar to this. &lt;br /&gt;
&lt;br /&gt;
[[File:amorphous_carbon.png]]&lt;br /&gt;
&lt;br /&gt;
You can look at the local energies predicted by the GAP (here I use &amp;lt;code&amp;gt;ovito&amp;lt;/code&amp;gt;).&lt;br /&gt;
&lt;br /&gt;
* Open structure in &amp;lt;code&amp;gt;ovito&amp;lt;/code&amp;gt;&lt;br /&gt;
* Use modifier &amp;amp;quot;Create Bonds&amp;amp;quot;&lt;br /&gt;
* Use modifier &amp;amp;quot;Color Coding&amp;amp;quot;&lt;br /&gt;
** Change &amp;amp;quot;Input Property&amp;amp;quot; to &amp;amp;quot;Potential Energy&amp;amp;quot; (it might also be called &amp;amp;quot;local energy&amp;amp;quot;).&lt;br /&gt;
&lt;br /&gt;
[[File:amorphous_carbon_local_energy.png]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;perform-standard-grand-canonical-monte-carlo-gcmc&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
== Perform Standard Grand-Canonical Monte-Carlo (GCMC) ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;theory-of-gcmc&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== Theory of GCMC ===&lt;br /&gt;
&lt;br /&gt;
In a GCMC simulation, a system of interest is at fixed volume, allowed to thermalize by contact with a heat bath, and it can exchange particles with an infinite reservoir, forming a constant (&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mu,V,T&amp;lt;/math&amp;gt;) ensemble.&lt;br /&gt;
&lt;br /&gt;
We perform GCMC using a Markov Chain: starting from an initial pure a-C&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;_x&amp;lt;/math&amp;gt; structure, we generate trial configurations by either randomly displacing a particular atom, or inserting/removing oxygen into/from a random position respectively. These trial configurations are either accepted or rejected using the standard acceptance criteria (see Frenkel 2002) for particle displacement/insertion/removal&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;    \mathrm{acc}( \mathrm{move})  = \mathrm{min}\biggl[1, \exp\left\{ -\beta ( E(\mathrm{trial}) - E(\mathrm{current}) ) \right\}     \biggr] &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; \mathrm{acc}(N \rightarrow N+1)  = \mathrm{min}\biggl[ 1,  \frac{V}{\lambda^3 (N+1)} \exp\left\{ - \beta ( E(N+1) - E(N) - \mu ) \right\}     \biggr] &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; \mathrm{acc}(N \rightarrow N-1)  = \mathrm{min}\biggl[1, \frac{\lambda^3 N}{V} \exp\left\{ -\beta ( E(N-1) - E(N) + \mu ) \right\}     \biggr] &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\lambda&amp;lt;/math&amp;gt; is the thermal de-Broglie wavelength which is given by &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\lambda = \sqrt{\frac{2\pi \hslash^2}{mk_BT}}&amp;lt;/math&amp;gt;. We then repeat the procedure with the last accepted configuration until the the maximum number of iterations has been reached.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;gcmc-in-turbogap&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== GCMC in '''TurboGAP''' ===&lt;br /&gt;
&lt;br /&gt;
Now we perform Grand-Canonical Monte-Carlo to obtain an oxygenated amorphous carbon structure. This is a &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mu VT&amp;lt;/math&amp;gt; ensemble, hence we must specify the chemical potential, &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mu&amp;lt;/math&amp;gt;, and the species which we want to insert: here, just oxygen.&lt;br /&gt;
&lt;br /&gt;
The format is similar to above, but there are more options:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre class=&amp;quot;conf&amp;quot;&amp;gt;mc_nsteps = 10000                         ! Number of mc trial steps to be performed&lt;br /&gt;
&lt;br /&gt;
n_mc_types = 3                           ! Number of mc trial types&lt;br /&gt;
mc_types = 'move' 'insertion' 'removal'  ! MC types can be: 'insertion' 'removal' 'md' 'swap' 'move'&lt;br /&gt;
                                         !                  'volume'&lt;br /&gt;
mc_acceptance = 1 1 1                    ! Ratios for choosing the respective trial moves (all equally likely here)&lt;br /&gt;
&lt;br /&gt;
mc_move_max = 0.2                        ! Maximum distance for the move of a particular particle&lt;br /&gt;
&lt;br /&gt;
n_mc_mu = 1&lt;br /&gt;
mc_mu = 0.0                              ! gcmc: Chemical potential [eV], using a large one here&lt;br /&gt;
mc_species = 'O'                         ! gcmc: species to insert / remove&lt;br /&gt;
mc_min_dist = 0.1                        ! gcmc: minimum distance between particles for insertion&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
To see all the options for Monte-Carlo, visit [https://turbogap.fi/wiki/index.php/Monte-Carlo Monte-Carlo].&lt;br /&gt;
&lt;br /&gt;
To run it, we run '''TurboGAP''' in &amp;lt;code&amp;gt;mc&amp;lt;/code&amp;gt; mode:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;srun turbogap mc&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
To run these calculations, do&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;cd ../2.standard_gcmc&lt;br /&gt;
bash 1.run_gcmc.sh&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
The following files are written to every write&amp;lt;sub&amp;gt;xyz&amp;lt;/sub&amp;gt; steps&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;code&amp;gt;mc.log&amp;lt;/code&amp;gt;: self-explanatory,&lt;br /&gt;
** format: &amp;lt;code&amp;gt;mc_step  mc_move  accepted  E_trial  E_current  N_sites(trial) N_gcmc_species(trial)&amp;lt;/code&amp;gt;&lt;br /&gt;
* &amp;lt;code&amp;gt;mc_all.xyz&amp;lt;/code&amp;gt;: an appended file which contains all accepted moves&lt;br /&gt;
* &amp;lt;code&amp;gt;mc_trial.xyz&amp;lt;/code&amp;gt;: a single configuration which contains the trial move&lt;br /&gt;
* &amp;lt;code&amp;gt;mc_current.xyz&amp;lt;/code&amp;gt;: a single configuration which contains the current accepted&lt;br /&gt;
&lt;br /&gt;
You should find a structure which looks like this (the last configuration in &amp;lt;code&amp;gt;mc_all.xyz&amp;lt;/code&amp;gt;).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;figure&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:oxygenated_amorphous_carbon_gcmc.png]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
Here, we use a chemical potential of &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mu = 0.0&amp;lt;/math&amp;gt; eV. You can experiment with different chemical potentials. Using &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mu =&lt;br /&gt;
-5.16&amp;lt;/math&amp;gt; eV is related to half the binding energy of O&amp;lt;sub&amp;gt;2&amp;lt;/sub&amp;gt; at 300K and 1atm. Try it for yourself (in your own time)!&lt;br /&gt;
&lt;br /&gt;
For this short simulation and this size of box, we will not reach convergence of the oxygen content (MC simulation steps are on the order of 10&amp;lt;sup&amp;gt;5&amp;lt;/sup&amp;gt; - 10&amp;lt;sup&amp;gt;6&amp;lt;/sup&amp;gt; steps). We can run&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;module load python-data/3.9&lt;br /&gt;
python analyse_O_content.py&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
to see the oxygen content.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;figure&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:simple_O_content_monitor.png]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
Here, we can see the local energy for the GCMC configuration.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;figure&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:oxygenated_amorphous_carbon_gcmc_local_energy.png]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;span id=&amp;quot;hamiltonian-monte-carlo&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Hamiltonian Monte-Carlo ==&lt;br /&gt;
&lt;br /&gt;
Observing the local energies above, we notice that there are some rather high values. To relax them using MC, we can use Hamiltonian MC, which uses the results of NVE molecular dynamics as trial configurations for MC displacements. This gives very high acceptance rates in comparison to other move types due to the energy being approximately conserved from the symplectic (velocity verlet) integrator (hence your acceptance criterion will be approximately 1).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre class=&amp;quot;conf&amp;quot;&amp;gt;md_nsteps = 20                           ! specifying the number of steps for velocity verlet&lt;br /&gt;
md_step = 0.1                            ! 0.1fs timestep&lt;br /&gt;
&lt;br /&gt;
mc_nsteps = 50                           ! Number of mc trial steps to be performed&lt;br /&gt;
n_mc_types = 1&lt;br /&gt;
mc_types = 'md'&lt;br /&gt;
mc_acceptance = 1                        ! Relative rate of choosing the respective trial moves&lt;br /&gt;
mc_hamiltonian = .true.                  ! For Hamiltonian Monte-Carlo&lt;br /&gt;
                                         !   (NVE ensemble used to increase trial acceptance) for md&lt;br /&gt;
                                         !   move type&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;cd ../3.hamiltonian_mc&lt;br /&gt;
bash 1.run_hamiltonian_mc.sh&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;span id=&amp;quot;npt-using-volume-moves&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
== &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;NPT&amp;lt;/math&amp;gt; using volume moves ==&lt;br /&gt;
&lt;br /&gt;
We can do constant pressure Monte-Carlo by doing volume moves. In fact, we can mix volume moves and MD &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;NPT&amp;lt;/math&amp;gt; moves to create trial configurations, if we so desire.&lt;br /&gt;
&lt;br /&gt;
Looking at the &amp;lt;code&amp;gt;input&amp;lt;/code&amp;gt; file, we see that we've specified a volume type MC move in which the acceptance criterion is given by &amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; \mathrm{acc}(V \rightarrow V')  = \mathrm{min}\biggl[1,  \exp\left\{ -\beta ( E(V') - E(V) + P(V-V') - (N+1)\ln (V/V')/\beta ) \right\}     \biggr] &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre class=&amp;quot;conf&amp;quot;&amp;gt;mc_nsteps = 200&lt;br /&gt;
&lt;br /&gt;
n_mc_types = 3&lt;br /&gt;
mc_types = 'move' 'volume' 'md'                  ! We now specify an MD move type for doing NPT&lt;br /&gt;
&lt;br /&gt;
mc_acceptance = 1 1 1&lt;br /&gt;
mc_move_max = 0.2&lt;br /&gt;
&lt;br /&gt;
mc_lnvol_max = 0.01                              ! Maximum lnvol to modify the volume&lt;br /&gt;
&lt;br /&gt;
! Specify MD configuration&lt;br /&gt;
t_beg = 300&lt;br /&gt;
t_end = 300&lt;br /&gt;
p_beg = 1.0&lt;br /&gt;
p_end = 1.0&lt;br /&gt;
&lt;br /&gt;
md_nsteps = 30&lt;br /&gt;
md_step = 0.1                                    ! Reducing the timestep&lt;br /&gt;
barostat = berendsen&lt;br /&gt;
tau_t = 100.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
To run it we do&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;cd ../4.volume_mc&lt;br /&gt;
bash 1.run_volume.sh&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
This gives an expansion of the volume.&lt;/div&gt;</summary>
		<author><name>Tigany Zarrouk</name></author>
		
	</entry>
	<entry>
		<id>https://turbogap.fi/wiki/index.php?title=Monte-Carlo&amp;diff=661</id>
		<title>Monte-Carlo</title>
		<link rel="alternate" type="text/html" href="https://turbogap.fi/wiki/index.php?title=Monte-Carlo&amp;diff=661"/>
		<updated>2024-07-17T08:56:11Z</updated>

		<summary type="html">&lt;p&gt;Tigany Zarrouk: /* Monte-Carlo options */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Running Monte-Carlo = &lt;br /&gt;
To perform a (Grand-Canonical) Monte-Carlo simulation we must run '''TurboGAP''' in &amp;lt;code&amp;gt;mc&amp;lt;/code&amp;gt; mode:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;turbogap mc&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
The following files are written to every &amp;lt;code&amp;gt;write_xyz = N&amp;lt;/code&amp;gt; steps&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;code&amp;gt;mc.log&amp;lt;/code&amp;gt;: self-explanatory,&lt;br /&gt;
** format: &amp;lt;code&amp;gt;mc_step  mc_move  accepted  E_trial  E_current  N_sites(trial) N_gcmc_species(trial)&amp;lt;/code&amp;gt;&lt;br /&gt;
* &amp;lt;code&amp;gt;mc_all.xyz&amp;lt;/code&amp;gt;: an appended file which contains all accepted moves&lt;br /&gt;
* &amp;lt;code&amp;gt;mc_trial.xyz&amp;lt;/code&amp;gt;: a single configuration which contains the trial move&lt;br /&gt;
* &amp;lt;code&amp;gt;mc_current.xyz&amp;lt;/code&amp;gt;: a single configuration which contains the current accepted&lt;br /&gt;
&lt;br /&gt;
= Monte-Carlo Move Types = &lt;br /&gt;
We can specify a number of Monte-Carlo trial move types, including doing molecular dynamics (hybrid Monte-Carlo) as trial moves. These include &lt;br /&gt;
* Displacement&lt;br /&gt;
* Swap (to swap atoms in the simulation box)&lt;br /&gt;
* Volume (for NPT)&lt;br /&gt;
* Insertion (for mu VT) &lt;br /&gt;
* Removal  (for mu VT)&lt;br /&gt;
* MD (for hybrid Monte-Carlo)&lt;br /&gt;
&lt;br /&gt;
= Minimal Input File = &lt;br /&gt;
&amp;lt;pre class=&amp;quot;conf&amp;quot;&amp;gt;! Species-specific info&lt;br /&gt;
atoms_file = 'atoms.xyz'&lt;br /&gt;
pot_file = 'gap_files/CO.gap'&lt;br /&gt;
n_species = 2&lt;br /&gt;
species = C O&lt;br /&gt;
masses = 12.01 15.99&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
mc_nsteps = 5000                         ! Number of mc trial steps to be performed&lt;br /&gt;
&lt;br /&gt;
n_mc_types = 3                           ! Number of mc trial types&lt;br /&gt;
mc_types = 'move' 'insertion' 'removal'  ! MC types can be: 'insertion' 'removal' 'md' 'swap' 'move'&lt;br /&gt;
                                         !                  'volume'&lt;br /&gt;
mc_acceptance = 1 1 1                    ! Ratios for choosing the respective trial moves (all equally likely here)&lt;br /&gt;
&lt;br /&gt;
mc_move_max = 0.2                        ! Maximum distance for the move of a particular particle&lt;br /&gt;
&lt;br /&gt;
n_mc_mu = 1&lt;br /&gt;
mc_mu = 0.0                              ! gcmc: Chemical potential [eV], using a large one here&lt;br /&gt;
mc_species = 'O'                         ! gcmc: species to insert / remove&lt;br /&gt;
mc_min_dist = 0.1                        ! gcmc: minimum distance between particles for insertion&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
! Note: The following files are written to every write_xyz steps&lt;br /&gt;
!       mc.log: self-explanatory,&lt;br /&gt;
!          format: mc_step  mc_move  accepted  E_trial  E_current  N_sites(trial)&lt;br /&gt;
!                                                                     N_gcmc_species(trial)&lt;br /&gt;
!       mc_all.xyz:     an appended file which contains all accepted moves&lt;br /&gt;
!       mc_trial.xyz:   a single configuration which contains the trial move&lt;br /&gt;
!       mc_current.xyz: a single configuration which contains the current accepted&lt;br /&gt;
&lt;br /&gt;
write_xyz = 200&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;monte-carlo-options&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
= Monte-Carlo options =&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Keyword&lt;br /&gt;
! Definition&lt;br /&gt;
! Optional&lt;br /&gt;
! Type&lt;br /&gt;
! Default&lt;br /&gt;
! Used when&lt;br /&gt;
! Example&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;mc_nsteps&amp;lt;/code&amp;gt;&lt;br /&gt;
| Number of MC steps&lt;br /&gt;
| N&lt;br /&gt;
| Int&lt;br /&gt;
| 0&lt;br /&gt;
| turbogap mc&lt;br /&gt;
| &amp;lt;code&amp;gt;mc_nsteps = 1000&amp;lt;/code&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;n_mc_types&amp;lt;/code&amp;gt;&lt;br /&gt;
| Number of MC types&lt;br /&gt;
| N&lt;br /&gt;
| Int&lt;br /&gt;
| 0&lt;br /&gt;
| turbogap mc&lt;br /&gt;
| &amp;lt;code&amp;gt;n_mc_types = 2&amp;lt;/code&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;mc_types&amp;lt;/code&amp;gt;&lt;br /&gt;
| Types of MC trials&lt;br /&gt;
| N&lt;br /&gt;
| Str(s)&lt;br /&gt;
| None&lt;br /&gt;
| &amp;lt;code&amp;gt;n_mc_types&amp;lt;/code&amp;gt; &amp;amp;gt; 0&lt;br /&gt;
| &amp;lt;code&amp;gt;mc_types = 'volume' 'move'&amp;lt;/code&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;mc_acceptance&amp;lt;/code&amp;gt;&lt;br /&gt;
| Ratios of MC trial moves&lt;br /&gt;
| N&lt;br /&gt;
| Int(s)&lt;br /&gt;
| None&lt;br /&gt;
| &amp;lt;code&amp;gt;n_mc_types&amp;lt;/code&amp;gt; &amp;amp;gt; 0&lt;br /&gt;
| &amp;lt;code&amp;gt;mc_acceptance = 2 1&amp;lt;/code&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;n_mc_swaps&amp;lt;/code&amp;gt;&lt;br /&gt;
| Number of swaps&lt;br /&gt;
| Y&lt;br /&gt;
| Int&lt;br /&gt;
| 0&lt;br /&gt;
| 'swap' in &amp;lt;code&amp;gt;mc_types&amp;lt;/code&amp;gt;&lt;br /&gt;
| &amp;lt;code&amp;gt;n_mc_swaps = 2&amp;lt;/code&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;mc_swaps&amp;lt;/code&amp;gt;&lt;br /&gt;
| Swap species&lt;br /&gt;
| Y&lt;br /&gt;
| Strs&lt;br /&gt;
| None&lt;br /&gt;
| 'swap' in &amp;lt;code&amp;gt;mc_types&amp;lt;/code&amp;gt;&lt;br /&gt;
| &amp;lt;code&amp;gt;mc_swaps = 'C' 'O' 'N' 'C'&amp;lt;/code&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;mc_move_max&amp;lt;/code&amp;gt;&lt;br /&gt;
| Maximum displacement [A]&lt;br /&gt;
| Y&lt;br /&gt;
| Float&lt;br /&gt;
| 1.0&lt;br /&gt;
| 'move' in &amp;lt;code&amp;gt;mc_types&amp;lt;/code&amp;gt;&lt;br /&gt;
| &amp;lt;code&amp;gt;mc_move_max = 0.5&amp;lt;/code&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;mc_lnvol_max&amp;lt;/code&amp;gt;&lt;br /&gt;
| Log volume max for volume moves.&lt;br /&gt;
| Y&lt;br /&gt;
| Float&lt;br /&gt;
| 0.01&lt;br /&gt;
| 'volume' in &amp;lt;code&amp;gt;mc_types&amp;lt;/code&amp;gt;&lt;br /&gt;
| &amp;lt;code&amp;gt;mc_lnvol_max = 0.02&amp;lt;/code&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;mc_min_dist&amp;lt;/code&amp;gt;&lt;br /&gt;
| Minimum distance for insertion [A]&lt;br /&gt;
| Y&lt;br /&gt;
| Float&lt;br /&gt;
| 0.2&lt;br /&gt;
| 'insertion in &amp;lt;code&amp;gt;mc_types&amp;lt;/code&amp;gt;&lt;br /&gt;
| &amp;lt;code&amp;gt;mc_min_dist = 0.1&amp;lt;/code&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;n_mc_mu&amp;lt;/code&amp;gt;&lt;br /&gt;
| Number of chemical potentials/gcmc species&lt;br /&gt;
| Y&lt;br /&gt;
| Int&lt;br /&gt;
| 1&lt;br /&gt;
| 'insertion'/'removal' in &amp;lt;code&amp;gt;mc_types&amp;lt;/code&amp;gt;&lt;br /&gt;
| &amp;lt;code&amp;gt;n_mc_mu = 2&amp;lt;/code&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;mc_mu&amp;lt;/code&amp;gt;&lt;br /&gt;
| Chemical potential(s) [eV]&lt;br /&gt;
| Y&lt;br /&gt;
| Float&lt;br /&gt;
| 0.0&lt;br /&gt;
| 'insertion'/'removal' in &amp;lt;code&amp;gt;mc_types&amp;lt;/code&amp;gt;&lt;br /&gt;
| &amp;lt;code&amp;gt;mc_mu = -5.16 -2.25&amp;lt;/code&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;mc_species&amp;lt;/code&amp;gt;&lt;br /&gt;
| GCMC species&lt;br /&gt;
| Y&lt;br /&gt;
| Str&lt;br /&gt;
| None&lt;br /&gt;
| 'insertion'/'removal' in &amp;lt;code&amp;gt;mc_types&amp;lt;/code&amp;gt;&lt;br /&gt;
| &amp;lt;code&amp;gt;mc_species = 'O' 'H'&amp;lt;/code&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;mc_relax&amp;lt;/code&amp;gt;&lt;br /&gt;
| Relax MC trials prior to acc. evaluation&lt;br /&gt;
| Y&lt;br /&gt;
| Bool&lt;br /&gt;
| .false.&lt;br /&gt;
| turbogap mc&lt;br /&gt;
| &amp;lt;code&amp;gt;mc_relax = .true.&amp;lt;/code&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;n_mc_relax_after&amp;lt;/code&amp;gt;&lt;br /&gt;
| Number of specific trials to relax&lt;br /&gt;
| Y&lt;br /&gt;
| Int&lt;br /&gt;
| 0&lt;br /&gt;
| &amp;lt;code&amp;gt;mc_relax = .true.&amp;lt;/code&amp;gt;&lt;br /&gt;
| &amp;lt;code&amp;gt;n_mc_relax_after = 1&amp;lt;/code&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;mc_relax_after&amp;lt;/code&amp;gt;&lt;br /&gt;
| Relax specific MC trial types&lt;br /&gt;
| Y&lt;br /&gt;
| Str(s)&lt;br /&gt;
| None&lt;br /&gt;
| &amp;lt;code&amp;gt;n_mc_relax_after &amp;amp;gt; 0&amp;lt;/code&amp;gt;&lt;br /&gt;
| &amp;lt;code&amp;gt;mc_relax_after = 'volume'&amp;lt;/code&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;mc_nrelax&amp;lt;/code&amp;gt;&lt;br /&gt;
| Number of relaxation steps after trial&lt;br /&gt;
| Y&lt;br /&gt;
| Int&lt;br /&gt;
| 0&lt;br /&gt;
| &amp;lt;code&amp;gt;mc_relax = .true.&amp;lt;/code&amp;gt;&lt;br /&gt;
| &amp;lt;code&amp;gt;mc_nrelax = 50&amp;lt;/code&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;mc_relax_opt&amp;lt;/code&amp;gt;&lt;br /&gt;
| Optimisation for relaxing after steps&lt;br /&gt;
| Y&lt;br /&gt;
| Str&lt;br /&gt;
| 'gd'&lt;br /&gt;
| &amp;lt;code&amp;gt;mc_relax = .true.&amp;lt;/code&amp;gt;&lt;br /&gt;
| &amp;lt;code&amp;gt;mc_relax_opt = 'gd-box-ortho'&amp;lt;/code&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;mc_hamiltonian&amp;lt;/code&amp;gt;&lt;br /&gt;
| Use NVE for 'md' trials&lt;br /&gt;
| Y&lt;br /&gt;
| Bool&lt;br /&gt;
| .false.&lt;br /&gt;
| 'md' in &amp;lt;code&amp;gt;mc_types&amp;lt;/code&amp;gt;&lt;br /&gt;
| &amp;lt;code&amp;gt;mc_hamiltonian = .true.&amp;lt;/code&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;mc_hybrid_opt&amp;lt;/code&amp;gt;&lt;br /&gt;
| Optimisation for 'md' steps&lt;br /&gt;
| Y&lt;br /&gt;
| Str&lt;br /&gt;
| 'vv'&lt;br /&gt;
| 'md' in &amp;lt;code&amp;gt;mc_types&amp;lt;/code&amp;gt;&lt;br /&gt;
| &amp;lt;code&amp;gt;mc_hybrid_opt = 'vv'&amp;lt;/code&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;mc_write_xyz&amp;lt;/code&amp;gt;&lt;br /&gt;
| Debug: read and write to files every step&lt;br /&gt;
| Y&lt;br /&gt;
| Bool&lt;br /&gt;
| .false.&lt;br /&gt;
| &amp;lt;code&amp;gt;turbogap mc&amp;lt;/code&amp;gt;&lt;br /&gt;
| &amp;lt;code&amp;gt;mc_write_xyz = .true.&amp;lt;/code&amp;gt;&lt;br /&gt;
|}&lt;/div&gt;</summary>
		<author><name>Tigany Zarrouk</name></author>
		
	</entry>
	<entry>
		<id>https://turbogap.fi/wiki/index.php?title=XPS-optimized_oxygenated_amorphous_carbon&amp;diff=660</id>
		<title>XPS-optimized oxygenated amorphous carbon</title>
		<link rel="alternate" type="text/html" href="https://turbogap.fi/wiki/index.php?title=XPS-optimized_oxygenated_amorphous_carbon&amp;diff=660"/>
		<updated>2024-06-19T10:26:09Z</updated>

		<summary type="html">&lt;p&gt;Tigany Zarrouk: /* Motivation for structural inference */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
&amp;lt;span id=&amp;quot;what-is-turbogap&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
= What is ''TurboGAP'' ? =&lt;br /&gt;
&lt;br /&gt;
* ''TurboGAP'' is a &amp;lt;code&amp;gt;Fortran&amp;lt;/code&amp;gt; atomistic code which uses &amp;lt;u&amp;gt;Gaussian Approximation Potentials&amp;lt;/u&amp;gt; (GAPs).&lt;br /&gt;
* Its specialty are ''SOAP turbo'' descriptors: faster and more accurate than SOAP (Smooth Overlap of Atomic Positions).&lt;br /&gt;
* It's (probably!) the fastest SOAP prediction code, which will be made even faster with ''GPU acceleration'' (ongoing with CSC).&lt;br /&gt;
&lt;br /&gt;
* Through GAP/SOAP predictions, one can perform simulations with ''ab-initio'' accuracy '''at scale'''&lt;br /&gt;
** Molecular Dynamics&lt;br /&gt;
** Grand-Canonical Monte-Carlo simulations&lt;br /&gt;
** Electronic-stopping and spatially-correlated Langevin Dynamics (in-development).&lt;br /&gt;
** '''Prediction/optimization of experimental observables''' (''e.g.'' X-Ray photoelectron spectra ([[#citeproc_bib_item_6|Golze et al. 2022]]; [[#citeproc_bib_item_11|Zarrouk et al. 2024]]), X-ray/Neutron Diffraction and more to come!).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;motivation-for-structural-inference&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Motivation for structural inference =&lt;br /&gt;
&lt;br /&gt;
* We typically want to &amp;lt;u&amp;gt;predict structures&amp;lt;/u&amp;gt;, to make sense of experimental data.&lt;br /&gt;
* We usually pray structures have &amp;lt;u&amp;gt;experimental agreement&amp;lt;/u&amp;gt; (a “bottom-up” approach).&lt;br /&gt;
* What if we can &amp;lt;u&amp;gt;promote agreement&amp;lt;/u&amp;gt; with experimental data?&lt;br /&gt;
* ''Reverse Monte-Carlo'' techniques match experimental data to atomic structure (“top-down” approach).&lt;br /&gt;
** Downsides: “By-hand” constraints&lt;br /&gt;
** Simple experimental observables.&lt;br /&gt;
** Unphysical structures/artifacts ([[#citeproc_bib_item_8|Opletal et al. 2017]])&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Need efficient structure search to find '''agreement''' with '''experimental''' data ''and'' '''ab-inito''' data.&lt;br /&gt;
&lt;br /&gt;
With &amp;lt;u&amp;gt;CO GAP + Core electron binding energy SOAP&amp;lt;/u&amp;gt; model we will perform '''modified (Grand-canonical) Monte-Carlo''' to produce ''experimentally consistent, low energy structures'' of oxygenated amorphous carbon.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:deconvolution_comparison_fill_-3_new.png | 400px]]&lt;br /&gt;
&lt;br /&gt;
We will do simulations similar to the above, which is from our JACS paper ([[#citeproc_bib_item_11|Zarrouk et al. 2024]]). &lt;br /&gt;
&amp;lt;span id=&amp;quot;theory-and-methods&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Theory and Methods =&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;gaussian-approximation-potentials-gap&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
== Gaussian Approximation Potentials (GAP) ==&lt;br /&gt;
&lt;br /&gt;
([[#citeproc_bib_item_2|Bartók et al. 2010]]; [[#citeproc_bib_item_1|Bartók, Kondor, and Csányi 2013]]; [[#citeproc_bib_item_4|Deringer et al. 2021]])&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;u&amp;gt;Assumption&amp;lt;/u&amp;gt;: Total energy is sum of '''local energies'''. &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;E_{\rm total}(\{\mathbf{r}\}) = \sum_i^{N_{\text{atoms}}} \varepsilon^i(\{r\}, \{\xi^{\text{2b}}_i\}, \{\boldsymbol{\xi}^{\text{3b}}_i\}, \boldsymbol{\xi}^{\text{mb}}_i))&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;\begin{align}&lt;br /&gt;
  \varepsilon^i ( &amp;amp;\{r\}, \{\xi^{\text{2b}}_i\}, \{\boldsymbol{\xi}^{\text{3b}}_i\}, \boldsymbol{\xi}^{\text{mb}}_i) =&lt;br /&gt;
   E^{\text{2b}}(\{\xi^{\text{2b}}_i\}) + E^{\text{3b}}(\{\boldsymbol{\xi}^{\text{3b}}_i\}) \nonumber\\&lt;br /&gt;
  &amp;amp; + E^{\text{mb}}(\boldsymbol{\xi}^{\text{mb}}_i)&lt;br /&gt;
  + \sum_{r &amp;lt; r_{\rm cut}^{\rm core}} E^{\text{core}}(r)  \nonumber&lt;br /&gt;
\end{align}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
; Local energy&lt;br /&gt;
: Sum of '''2b, 3b and many-body''' terms.&lt;br /&gt;
; Descriptor &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\xi / \boldsymbol{\xi}&amp;lt;/math&amp;gt;.&lt;br /&gt;
: ''e.g'' &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\{\xi^{\text{2b}}\} = \{r_{ij}\}&amp;lt;/math&amp;gt;, &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\{\boldsymbol{\xi}^{\text{3b}}\} = \{ [ r_{ij}, r_{ik}, r_{kj} ] \}&amp;lt;/math&amp;gt;&lt;br /&gt;
; Local environment&lt;br /&gt;
: A set of descriptors.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;using-descriptors-to-predict-quantities&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== Using descriptors to predict quantities ===&lt;br /&gt;
&lt;br /&gt;
* ''Kernel/basis functions'' &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;k_{ij}(\boldsymbol{\xi}_i, \boldsymbol{\xi}_j)&amp;lt;/math&amp;gt; measure the ''similarity between descriptors''.&lt;br /&gt;
* ''e.g'' Exponential 2b kernel: &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;k^{2b}_{ij}(\xi_i, \xi_j) \equiv k^{2b}_{ij}(r_{i}, r_{j}) = \exp( - (r_{i} - r_{j})^2/2\sigma^2 )&amp;lt;/math&amp;gt;&lt;br /&gt;
* ''Gaussian Process Regression'' (kernel matrix algebra on training set) → ''fitting coefficients'' &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\{\alpha\}&amp;lt;/math&amp;gt;, ([[#citeproc_bib_item_4|Deringer et al. 2021]])&lt;br /&gt;
* ''e.g.'' 2b model trained with &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;N_s&amp;lt;/math&amp;gt; descriptors &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\{\xi\} \in \{\xi_i, \ldots, \xi_{Ns}\}&amp;lt;/math&amp;gt;, the energy for atom with &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;M&amp;lt;/math&amp;gt; pairwise distances in local environment: &amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;E^{2b} = \sum_i^M \left(E^{2b}_0 + \delta^2\sum_j^{N_s}  \alpha_j k^{2b}_{ij}(\xi_i, \xi_j) \right) &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;soap-many-body-descriptor&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== SOAP (many-body) descriptor ===&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;u&amp;gt;SOAP descriptor&amp;lt;/u&amp;gt;: &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\boldsymbol{\xi}_i(\{\mathbf{r}\}_{ &amp;lt; r_{\rm cut}} )&amp;lt;/math&amp;gt;, represents environment of an atom ([[#citeproc_bib_item_2|Bartók et al. 2010]]).&lt;br /&gt;
* &amp;lt;u&amp;gt;Kernel&amp;lt;/u&amp;gt;: &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;k_{ij} = (\boldsymbol{\xi}_i \cdot \boldsymbol{\xi}_j)^{\zeta}&amp;lt;/math&amp;gt; measures &amp;lt;u&amp;gt;similarity of environments&amp;lt;/u&amp;gt;.&lt;br /&gt;
* &amp;lt;u&amp;gt;Fitting coefficients&amp;lt;/u&amp;gt;: &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\alpha_j&amp;lt;/math&amp;gt; result from Gaussian Process Regression.&lt;br /&gt;
* &amp;lt;u&amp;gt;Prediction&amp;lt;/u&amp;gt;: &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;E^{\rm mb}_i(\boldsymbol{\xi}_i) = E^{\rm mb}_0 + \delta^2\sum_j  \alpha_j k_{ij}&amp;lt;/math&amp;gt;&lt;br /&gt;
* For specifics of SOAP turbo, refer to Miguel's paper ([[#citeproc_bib_item_3|Caro 2019]])&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;how-do-we-model-xps&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== How do we model XPS? ==&lt;br /&gt;
&lt;br /&gt;
* XPS (X-ray photoelectron spectroscopy) spectra measure '''core electron binding energies'''.&lt;br /&gt;
* Core electron binding energies ''depend on atomic environment''.&lt;br /&gt;
* SOAP turbo model trained on DFT (&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\Delta\text{KS}&amp;lt;/math&amp;gt;) data with a &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;GW&amp;lt;/math&amp;gt; correction on top ([[#citeproc_bib_item_6|Golze et al. 2022]]).&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\text{CEBE} = ( \Delta KS^0_{\rm extended} + GW_{\rm carved} - \Delta \mathrm{KS}^+_{\rm carved} )&amp;lt;/math&amp;gt;&lt;br /&gt;
* Thermal and instrumental broadening accounted for by a Gaussian with &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\sigma = 0.4\text{ eV}&amp;lt;/math&amp;gt;&lt;br /&gt;
* Can analyse environments which make up spectra.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;prediction-of-local-properties&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Prediction of Local Properties ==&lt;br /&gt;
&lt;br /&gt;
* We can predict an &amp;lt;u&amp;gt;arbitrary number&amp;lt;/u&amp;gt; of ''local properties'' which use SOAP turbo descriptors using ''TurboGAP''.&lt;br /&gt;
* /One can get these for “free”/ if local property models are trained using the same descriptors as atomic energies/forces.&lt;br /&gt;
*; ''Hirshfeld volumes''&lt;br /&gt;
*: gives vdW dispersion via Tkatchenko-Scheffler. &amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; E_{\rm TS} = \sum_i \sum_{j\neq i} C_{6, ij}(v_{i}(\boldsymbol{\xi}_i), v_{j}(\boldsymbol{\xi}_j))\frac{f_{\rm damp}(r_{ij}, \ldots)}{r_{ij}^6} &amp;lt;/math&amp;gt;&lt;br /&gt;
*; ''Core-electron binding energies''&lt;br /&gt;
*: give '''X-ray Photoelectron Spectroscopy''' prediction. &amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; g_{\rm xps}(\varepsilon) = \frac{1}{M} \sum_i \exp\left( -(\varepsilon - \varepsilon_{i}(\boldsymbol{\xi}_i))^2/(2\sigma^2)  \right) &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;how-do-we-marry-experimental-data-and-gap&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
== How do we marry experimental data and GAP? ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* '''Generalized Hamiltonian within Grand-Canonical Monte-Carlo''' scheme.&lt;br /&gt;
* Vary oxygen content with chemical potential, to see motif differences.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;  \textcolor{violet}{ \mathbf{\tilde{g}}_{\rm {pred}}}(\varepsilon)  = \sum_{i} \exp\left(&lt;br /&gt;
-\frac{(\varepsilon - \textcolor{blue}{\varepsilon^{i}_{\rm&lt;br /&gt;
{pred}}(\boldsymbol{\xi}_i)})^2}{2\sigma^2}\right)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; \tilde{E} = E_{\rm GAP} + E_{\rm spectra} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; E_{\rm spectra} =  \frac{1}{2}\gamma \int \,d\varepsilon \left( \textcolor{violet}{ g_{\rm pred}(\varepsilon)} - g_{\rm exp}(\varepsilon)\right)^2&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;p&amp;gt;A simple squared difference, which is a penalty with increases with spectra dissimilarity and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\gamma&amp;lt;/math&amp;gt; is an energy scale.&amp;lt;/p&amp;gt;&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;p&amp;gt;We can do not just XPS but also X-ray/neutron diffraction and pair distribution functions.&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;[[File:xps_gcmc_scheme.png | 400px]]&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;/ul&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* We use the standard acceptance criteria for adding/removing/moving a particle&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; \mathrm{acc}(N \rightarrow N+1) = \mathrm{min}\left[1,&lt;br /&gt;
\frac{V}{\lambda^3 (N+1)} \exp\left\{ - \frac{\tilde{E}(N+1) -&lt;br /&gt;
\tilde{E}(N) - \mu}{k_BT} \right\}     \right] &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; \mathrm{acc}(N \rightarrow N-1) = \mathrm{min}\left[1,&lt;br /&gt;
\frac{\lambda^3 N}{V} \exp\left\{ -\frac{\tilde{E}(N-1) -&lt;br /&gt;
\tilde{E}(N) + \mu}{k_BT} \right\}     \right] &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; \mathrm{acc}_{\rm move} = \mathrm{min }\left[ 1, \exp\left\{ -&lt;br /&gt;
  \frac{\tilde{E}(\mathrm{new}) - \tilde{E}(\mathrm{old})}{k_BT} \right\} \right]&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;usage&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Usage =&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;installing-turbogap&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
== Installing ''TurboGAP'' ==&lt;br /&gt;
&lt;br /&gt;
We can install the ''TurboGAP'' code, found here https://github.com/mcaroba/turbogap through ''recursively cloning'' the main branch&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;git clone --recursive https://github.com/mcaroba/turbogap.git&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
Then we edit this line in the &amp;lt;code&amp;gt;Makefile&amp;lt;/code&amp;gt; to match our system architecture.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;include makefiles/Makefile.Ubuntu_gfortran_mpi&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Then, we make&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;make&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
and then export the path in &amp;lt;code&amp;gt;.bashrc&amp;lt;/code&amp;gt; file&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;export PATH=&amp;quot;~/turbogap/bin:$PATH&amp;quot;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;span id=&amp;quot;what-you-need-for-a-calculation&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
== What you need for a calculation ==&lt;br /&gt;
&lt;br /&gt;
; &amp;lt;code&amp;gt;gap_files/&amp;lt;/code&amp;gt; directory&lt;br /&gt;
: The directory which contains your &amp;lt;code&amp;gt;*.gap&amp;lt;/code&amp;gt;, with alphas (fitting coefficients) and sparse set descriptor files.&lt;br /&gt;
;* Potentials are available from ''TurboGAP'' wiki https://turbogap.fi/wiki/index.php/Potentials&lt;br /&gt;
;* Conversion script from &amp;lt;code&amp;gt;gap_fit .xml&amp;lt;/code&amp;gt; to &amp;lt;code&amp;gt;.gap&amp;lt;/code&amp;gt; can be used &amp;lt;code&amp;gt;turbogap/tools/make_gap_files.py&amp;lt;/code&amp;gt;&lt;br /&gt;
; &amp;lt;code&amp;gt;input&amp;lt;/code&amp;gt; file&lt;br /&gt;
: The file which tells the code what to do&lt;br /&gt;
; &amp;lt;code&amp;gt;*.xyz&amp;lt;/code&amp;gt;&lt;br /&gt;
: An extended xyz format file which contains positions/lattice/velocity information.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;adding-a-local-property-model-for-cebe-prediction&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== Adding a local property model for CEBE prediction ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;  gap_beg soap_turbo&lt;br /&gt;
  n_species = 2&lt;br /&gt;
  species = C O&lt;br /&gt;
  central_species = 1&lt;br /&gt;
... some params ...&lt;br /&gt;
  zeta = 4&lt;br /&gt;
  delta = 0.1&lt;br /&gt;
  desc_sparse = &amp;quot;gap_files/CO.xml.sparseX.GAP_2022_5_19_180_7_17_31_41410&amp;quot;&lt;br /&gt;
  alphas_sparse = &amp;quot;gap_files/alphas_soap_turbo_1.dat&amp;quot;&lt;br /&gt;
  compress_mode = &amp;quot;trivial&amp;quot;&lt;br /&gt;
  has_local_properties = .true.&lt;br /&gt;
  n_local_properties = 1&lt;br /&gt;
  local_property_qs = 'gap_files/core_electron_be.xml.sparseX.GAP_2024_1_26_120_18_36_33_6091'&lt;br /&gt;
  local_property_alphas = 'gap_files/alphas_core_electron_be_1.dat'&lt;br /&gt;
  local_property_labels = 'core_electron_be'&lt;br /&gt;
  local_property_zetas = 2&lt;br /&gt;
  local_property_deltas = 1.0&lt;br /&gt;
  local_property_v0s = 290.0&lt;br /&gt;
  gap_end&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;span id=&amp;quot;conversion-of-gap_fit-.xml-files-to-.gap-format&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== Conversion of &amp;lt;code&amp;gt;gap_fit&amp;lt;/code&amp;gt; &amp;lt;code&amp;gt;*.xml&amp;lt;/code&amp;gt; files to &amp;lt;code&amp;gt;*.gap&amp;lt;/code&amp;gt; format ===&lt;br /&gt;
&lt;br /&gt;
* Then we convert the &amp;lt;code&amp;gt;*.xml&amp;lt;/code&amp;gt; files which result from &amp;lt;code&amp;gt;gap_fit&amp;lt;/code&amp;gt; into the required format for ''TurboGAP''.&lt;br /&gt;
* This is done using the convenience script in &amp;lt;code&amp;gt;turbogap/tools/make_gap_files.py&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;python3 make_gap_files.py {gap_file.xml} {gap_file.gap} {N_local_prop.} \&lt;br /&gt;
              {local_prop1.xml} {local_prop_label1} \&lt;br /&gt;
              {local_prop2.xml} {local_prop_label2}...&lt;br /&gt;
# e.g. let's build a carbon oxygen GAP&lt;br /&gt;
# with core electron binding energy prediction capability.&lt;br /&gt;
python3 make_gap_files.py CO.xml CO.gap 1 \&lt;br /&gt;
        core_electron_be_co.xml core_electron_be&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
* This creates a directory &amp;lt;code&amp;gt;gap_files/&amp;lt;/code&amp;gt; which has&lt;br /&gt;
*# &amp;lt;code&amp;gt;alphas_{descriptor}.dat&amp;lt;/code&amp;gt; which are fitting coefficients for a particular descriptor&lt;br /&gt;
*# &amp;lt;code&amp;gt;qs_{descriptor}.dat&amp;lt;/code&amp;gt; which are the '''sparse set''' descriptors, used for prediction.&lt;br /&gt;
*# &amp;lt;code&amp;gt;alphas_{local_property}.dat&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;qs_{local_property}.dat&amp;lt;/code&amp;gt; for local property prediction.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;running-the-tutorial&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
== Running the Tutorial ==&lt;br /&gt;
&lt;br /&gt;
* Navigate to &amp;lt;code&amp;gt;turbogap/tutorials/xps_optimizaton&amp;lt;/code&amp;gt;&lt;br /&gt;
* Run &amp;lt;code&amp;gt;bash run.sh {calc_type}&amp;lt;/code&amp;gt; where &amp;lt;code&amp;gt;{calc_type}&amp;lt;/code&amp;gt; is either:&lt;br /&gt;
** &amp;lt;code&amp;gt;prediction&amp;lt;/code&amp;gt;&lt;br /&gt;
** &amp;lt;code&amp;gt;standard_gcmc&amp;lt;/code&amp;gt;&lt;br /&gt;
** &amp;lt;code&amp;gt;xps_optimization_gcmc&amp;lt;/code&amp;gt;&lt;br /&gt;
* Note that these simulations have a high chemical potential and (have high &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\gamma&amp;lt;/math&amp;gt; factors), these are just to give a result in a reasonable amount of time. Take care with real simulations.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;core-electron-binding-energy-prediction&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
== Core electron binding energy prediction ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;[mpirun -np N] turbogap predict&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
* We have in our &amp;lt;code&amp;gt;input&amp;lt;/code&amp;gt; file&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre class=&amp;quot;conf&amp;quot;&amp;gt;! Species-specific info&lt;br /&gt;
atoms_file = 'atoms.xyz'&lt;br /&gt;
pot_file = 'gap_files/CO.gap'&lt;br /&gt;
n_species = 2&lt;br /&gt;
species = C O&lt;br /&gt;
masses = 12.01 15.99&lt;br /&gt;
e0 = -.16138053 0.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Output:&lt;br /&gt;
&lt;br /&gt;
; &amp;lt;code&amp;gt;trajectory_out.xyz&amp;lt;/code&amp;gt;&lt;br /&gt;
: which contains atomic positions, local energy and local property arrays for each structure.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt; 512&lt;br /&gt;
Properties=species:S:1:pos:R:3:forces:R:3:local_energy:R:1:core_electron_be:R:1 \&lt;br /&gt;
   Lattice=&amp;quot;...&amp;quot; energy=-4321.582604 energy_soap=-4114.77018429  energy_2b=-124.73820332 energy_3b=0.55261463 \&lt;br /&gt;
   energy_core_pot=0.00000000 energy_vdw=0.00000000 energy_exp=0.00000000 energy_xps=0.00000000 \&lt;br /&gt;
   virial=&amp;quot;...&amp;quot; stress=&amp;quot;...&amp;quot; volume=5372.640346&lt;br /&gt;
   C              4.39625950       7.79414272      11.91703476     \&lt;br /&gt;
                  -0.00176074      -0.00403026       0.00040104    \&lt;br /&gt;
                  -8.32055957 \ # Local energy prediction&lt;br /&gt;
                  283.83841418  # CEBE Prediction&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Withiout specifying Exp. data, Turbogap does not predict the spectra.&lt;br /&gt;
* XPS spectra can simply be calculated from &amp;lt;code&amp;gt;core_electron_be&amp;lt;/code&amp;gt; in &amp;lt;code&amp;gt;trajectory_out.xyz&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;grand-canonical-monte-carlo&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
== (Grand-Canonical) Monte-Carlo ==&lt;br /&gt;
&lt;br /&gt;
* We use &amp;lt;code&amp;gt;mc&amp;lt;/code&amp;gt; mode&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;[mpirun -np N] turbogap mc&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
* ''e.g'' For a &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mu V T&amp;lt;/math&amp;gt; simulation of system in oxygen environment&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre class=&amp;quot;conf&amp;quot;&amp;gt;! Monte-carlo options&lt;br /&gt;
mc_nsteps = 1000                         # Number of Monte-Carlo Steps&lt;br /&gt;
n_mc_types = 3                           # Number of MC move types&lt;br /&gt;
mc_types = 'move' 'insertion' 'removal'  # MC move types (move/insertion/removal/volume/swap/md)&lt;br /&gt;
mc_move_max = 0.5                        # Maximum distance for MC displacement (&amp;amp;quot;move&amp;amp;quot;) type moves&lt;br /&gt;
&lt;br /&gt;
! - GCMC Options&lt;br /&gt;
n_mc_mu = 1              # Number of chemical potentials to add&lt;br /&gt;
mc_mu = 0                # Chemical potential(s) [eV]&lt;br /&gt;
mc_species = 'O'         # GCMC species types&lt;br /&gt;
mc_min_dist = 0.1        # GCMC minimum insertion distance&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Output:&lt;br /&gt;
&lt;br /&gt;
; &amp;lt;code&amp;gt;mc.log&amp;lt;/code&amp;gt;&lt;br /&gt;
: &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;# mc_istep  mc_move  accepted  E_trial              E_current             E_exp_trial          E_exp_current  N_tot_trial  N_mc_species_trial&lt;br /&gt;
       1       move    F       -4321.10376531       -4321.58260476         272.97693282         272.83692252      512  O        0&lt;br /&gt;
       2       move    F       -4321.10017027       -4321.58260476         272.68730901         272.83692252      512  O        0&lt;br /&gt;
       3  insertion    F       -4319.14082561       -4321.58260476         269.49191203         272.83692252      513  O        1&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; &amp;lt;code&amp;gt;mc_all.xyz&amp;lt;/code&amp;gt;&lt;br /&gt;
: xyz file written to every &amp;lt;code&amp;gt;write_xyz = N&amp;lt;/code&amp;gt; steps.&lt;br /&gt;
; &amp;lt;code&amp;gt;mc_current.xyz&amp;lt;/code&amp;gt;&lt;br /&gt;
: xyz file saving current accepted config written to every &amp;lt;code&amp;gt;write_xyz = N&amp;lt;/code&amp;gt; steps.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* If we run &amp;lt;code&amp;gt;bash run.sh standard_gcmc&amp;lt;/code&amp;gt; (may take a few minutes), we can see a prediction of the XPS with oxygen content&lt;br /&gt;
&lt;br /&gt;
[[File:standard_gcmc.png | 800px]]&lt;br /&gt;
&lt;br /&gt;
We see there is a large amount of oxygen inserted due to the large chemical potential for this simulation. This shifts the xps to large binding core electron binding energies, and there is no agreement the final structure with the experimental XPS. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;experimental-observable-optimization&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Experimental Observable Optimization ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;[mpirun -np N] turbogap mc/md&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
* We can specify experimental observables to predict and optimize them using MC or MD. &amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; E_{\rm spectra} = \frac{1}{2} \gamma \int \,d\varepsilon (g_{\rm pred}(\varepsilon) - g_{\rm exp}(\varepsilon))^2  &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre class=&amp;quot;conf&amp;quot;&amp;gt;! Experimental data options&lt;br /&gt;
n_exp = 1                                  # Number of experimental observables&lt;br /&gt;
exp_labels = 'xps'                         # Experimental observable types (xps/xrd/nd/pdf)&lt;br /&gt;
exp_data_files = 'xps_spectra_interp.dat'  # Experimental data files (Note: the range of resulting XPS prediction will be the same as the experimental range.)&lt;br /&gt;
exp_n_samples = 501                        # Number of interpolations samples over the experimental range.&lt;br /&gt;
exp_energy_scales = 100.0                    # Energy scale (gamma) [eV]&lt;br /&gt;
&lt;br /&gt;
# XPS smearing&lt;br /&gt;
xps_sigma = 0.4&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Output:&lt;br /&gt;
&lt;br /&gt;
; &amp;lt;code&amp;gt;xps_prediction.dat&amp;lt;/code&amp;gt;&lt;br /&gt;
: Data file written every &amp;lt;code&amp;gt;write_xyz = N&amp;lt;/code&amp;gt; steps. Separate predictions separated by blank lines.&lt;br /&gt;
; &amp;lt;code&amp;gt;xps_exp.dat&amp;lt;/code&amp;gt;&lt;br /&gt;
: The experimental data fed into ''TurboGAP''.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* If we run &amp;lt;code&amp;gt;bash run.sh xps_optimization_gcmc&amp;lt;/code&amp;gt; (may take a few minutes), we can see a prediction of the XPS with oxygen content&lt;br /&gt;
&lt;br /&gt;
[[File:xps_optimization_gcmc.png | 800px]]&lt;br /&gt;
&lt;br /&gt;
We can observe the significant effect of the energy scale here. The experimental energy decreases quickly, with a concurrent increase in the energy per atom. After spectral agreement, the system is allowed to relax. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;multiple-observables&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Multiple Observables ==&lt;br /&gt;
&lt;br /&gt;
* This is not in the tutorial files, but ''TurboGAP'' allows for we can optimization multiple observables.&lt;br /&gt;
** X-ray diffraction&lt;br /&gt;
** Neutron diffraction&lt;br /&gt;
** Pair distribution function&lt;br /&gt;
** XPS&lt;br /&gt;
* Here we show a fictitious example of XPS and XRD optimization.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre class=&amp;quot;conf&amp;quot;&amp;gt;# Partial PDFs needed for XRD calculation&lt;br /&gt;
pair_distribution_n_samples = 301&lt;br /&gt;
r_range_min = 0.1&lt;br /&gt;
r_range_max = 13.5&lt;br /&gt;
pair_distribution_rcut = 14.1&lt;br /&gt;
&lt;br /&gt;
do_xrd = .true.&lt;br /&gt;
&lt;br /&gt;
# Experimental Data Specification&lt;br /&gt;
n_exp = 2                  # Number of Exp. observables&lt;br /&gt;
exp_labels = 'xps' 'xrd'   # Exp. observable type (xps/xrd/nd/pdf)&lt;br /&gt;
exp_data_files = 'xps_spectra_experiment.dat' 'xrd_CO_experiment.dat'&lt;br /&gt;
exp_n_samples = 301 301 # Number of samples for the experimental data&lt;br /&gt;
exp_energy_scales = 10.0 10.0  # The &amp;amp;quot;gamma&amp;amp;quot; term for each observable&lt;br /&gt;
&lt;br /&gt;
# If using monte-carlo, the experimental energies are added directly to the local energy&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;span id=&amp;quot;applications&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
= Applications =&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;experimental-observable-predictionoptimization&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
== Experimental Observable prediction/optimization ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;deconvolution-analysis&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== Deconvolution analysis ===&lt;br /&gt;
&lt;br /&gt;
* Use subgraph isomorphisms of bonding networks to discern motifs present.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:exp_xps_with_background_high.png | 400px]]&lt;br /&gt;
&lt;br /&gt;
↑ Experimental XPS deconvolution ([[#citeproc_bib_item_9|Santini et al. 2015]])&lt;br /&gt;
&lt;br /&gt;
We see in the experimental deconvolution analysis that sp3 motifs compose the primary XPS peak. The generation of a-COx here was done by physical vapor deposition of graphitic carbon in an oxygen environment. They see a reduction in the number of sp2 bonds. They also claim there is a complete transformation of sp2 to sp3 that is reversible with a short annealing at 500C. &lt;br /&gt;
&lt;br /&gt;
[[File:deconvolution_comparison_fill_-3_new.png| 400px]]&lt;br /&gt;
&lt;br /&gt;
↑ Our XPS deconvolution ([[#citeproc_bib_item_9|Santini et al. 2015]])&lt;br /&gt;
&lt;br /&gt;
However from our deconvolution analysis, we see that this primary peak is composed of sp2 motifs. We can explain why the experimentalists see only sp2 with a simple computational experiment. &lt;br /&gt;
&lt;br /&gt;
We add in oxygen to the bottom layer of a graphene bilayer system to see the influence of oxygen on sp2 core electron binding energies. &lt;br /&gt;
&lt;br /&gt;
[[File:xps_shifts_miguel_first.png| 400px]]&lt;br /&gt;
&lt;br /&gt;
[[File:xps_shifts_miguel_last.png| 400px]]&lt;br /&gt;
&lt;br /&gt;
We see with oxygen content that sp2 motifs are shifted significantly, even past the sp3 reference. Due to the presence of oxygen, there is a shift of sp2 motifs which are not accounted for by the experimental deconvolution references, as these are fixed. This is why the experimental deconvolution did not give what we expect: sp2 carbon that composes the primary XPS peak. &lt;br /&gt;
&amp;lt;span id=&amp;quot;summary&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Summary =&lt;br /&gt;
&lt;br /&gt;
* Machine-learned potentials can be combined with experimental models to give structures which are consistent with both ''ab-inito'' and experimental data.&lt;br /&gt;
* We can generate oxygenated amorphous carbon structures using a CO GAP with XPS prediction using modified GCMC and a “Molecular Augmented Dynamics” method.&lt;br /&gt;
* We can use ''multiple experimental observables''.&lt;br /&gt;
* '''Finding structures which match experimental data allows us to understand specific experimental results.'''&lt;br /&gt;
* Deconvolve experimental XPS exactly.&lt;br /&gt;
* All of this is implemented in the ''TurboGAP'' code.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;references&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
= References =&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;citeproc_bib_item_1&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;Bartók, Albert P., Risi Kondor, and Gábor Csányi. 2013. “On Representing Chemical Environments.” ''Physical Review B'' 87 (18): 184115. https://doi.org/10.1103/PhysRevB.87.184115.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;citeproc_bib_item_2&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;Bartók, Albert P., Mike C. Payne, Risi Kondor, and Gábor Csányi. 2010. “Gaussian Approximation Potentials: The Accuracy of Quantum Mechanics, without the Electrons.” ''Physical Review Letters'' 104 (13): 136403. https://doi.org/10.1103/PhysRevLett.104.136403.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;citeproc_bib_item_3&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;Caro, Miguel A. 2019. “Optimizing Many-Body Atomic Descriptors for Enhanced Computational Performance of Machine Learning Based Interatomic Potentials.” ''Physical Review B'' 100 (2): 024112. https://doi.org/10.1103/PhysRevB.100.024112.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;citeproc_bib_item_4&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;Deringer, Volker L., Albert P. Bartók, Noam Bernstein, David M. Wilkins, Michele Ceriotti, and Gábor Csányi. 2021. “Gaussian Process Regression for Materials and Molecules.” ''Chemical Reviews'' 121 (16): 10073–141. https://doi.org/10.1021/acs.chemrev.1c00022.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;citeproc_bib_item_5&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;El-Machachi, Zakariya, Damyan Frantzov, A. Nijamudheen, Tigany Zarrouk, Miguel A. Caro, and Volker L. Deringer. 2024. “Accelerated First-Principles Exploration of Structure and Reactivity in Graphene Oxide.” arXiv. https://doi.org/10.48550/arXiv.2405.14814.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;citeproc_bib_item_6&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;Golze, Dorothea, Markus Hirvensalo, Patricia Hernández-León, Anja Aarva, Jarkko Etula, Toma Susi, Patrick Rinke, Tomi Laurila, and Miguel A. Caro. 2022. “Accurate Computational Prediction of Core-Electron Binding Energies in Carbon-Based Materials: A Machine-Learning Model Combining Density-Functional Theory and GW.” ''Chemistry of Materials'' 34 (14): 6240–54. https://doi.org/10.1021/acs.chemmater.1c04279.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;citeproc_bib_item_7&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;Muhli, Heikki, Xi Chen, Albert P. Bartók, Patricia Hernández-León, Gábor Csányi, Tapio Ala-Nissila, and Miguel A. Caro. 2021. “Machine Learning Force Fields Based on Local Parametrization of Dispersion Interactions: Application to the Phase Diagram of \&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathrm\\\C\\\\\_\60\\&amp;lt;/math&amp;gt;.” ''Physical Review B'' 104 (5): 054106. https://doi.org/10.1103/PhysRevB.104.054106.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;citeproc_bib_item_8&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;Opletal, George, Timothy C. Petersen, Amanda S. Barnard, and Salvy P. Russo. 2017. “On Reverse Monte Carlo Constraints and Model Reproduction.” ''Journal of Computational Chemistry'' 38 (17): 1547–51. https://doi.org/10.1002/jcc.24799.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;citeproc_bib_item_9&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;Santini, Claudia A., Abu Sebastian, Chiara Marchiori, Vara Prasad Jonnalagadda, Laurent Dellmann, Wabe W. Koelmans, Marta D. Rossell, Christophe P. Rossel, and Evangelos Eleftheriou. 2015. “Oxygenated Amorphous Carbon for Resistive Memory Applications.” ''Nature Communications'' 6 (1): 8600. https://doi.org/10.1038/ncomms9600.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;citeproc_bib_item_10&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;Wang, Yanzhou, Zheyong Fan, Ping Qian, Tapio Ala-Nissila, and Miguel A. Caro. 2022. “Structure and Pore Size Distribution in Nanoporous Carbon.” ''Chemistry of Materials'' 34 (2): 617–28. https://doi.org/10.1021/acs.chemmater.1c03279.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;citeproc_bib_item_11&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;Zarrouk, Tigany, Rina Ibragimova, Albert P. Bartók, and Miguel A. Caro. 2024. “Experiment-Driven Atomistic Materials Modeling: A Case Study Combining X-Ray Photoelectron Spectroscopy and Machine Learning Potentials to Infer the Structure of Oxygen-Rich Amorphous Carbon.” ''Journal of the American Chemical Society'' 146 (21): 14645–59. https://doi.org/10.1021/jacs.4c01897.&lt;/div&gt;</summary>
		<author><name>Tigany Zarrouk</name></author>
		
	</entry>
	<entry>
		<id>https://turbogap.fi/wiki/index.php?title=XPS-optimized_oxygenated_amorphous_carbon&amp;diff=659</id>
		<title>XPS-optimized oxygenated amorphous carbon</title>
		<link rel="alternate" type="text/html" href="https://turbogap.fi/wiki/index.php?title=XPS-optimized_oxygenated_amorphous_carbon&amp;diff=659"/>
		<updated>2024-06-19T10:25:47Z</updated>

		<summary type="html">&lt;p&gt;Tigany Zarrouk: /* Motivation for structural inference */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
&amp;lt;span id=&amp;quot;what-is-turbogap&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
= What is ''TurboGAP'' ? =&lt;br /&gt;
&lt;br /&gt;
* ''TurboGAP'' is a &amp;lt;code&amp;gt;Fortran&amp;lt;/code&amp;gt; atomistic code which uses &amp;lt;u&amp;gt;Gaussian Approximation Potentials&amp;lt;/u&amp;gt; (GAPs).&lt;br /&gt;
* Its specialty are ''SOAP turbo'' descriptors: faster and more accurate than SOAP (Smooth Overlap of Atomic Positions).&lt;br /&gt;
* It's (probably!) the fastest SOAP prediction code, which will be made even faster with ''GPU acceleration'' (ongoing with CSC).&lt;br /&gt;
&lt;br /&gt;
* Through GAP/SOAP predictions, one can perform simulations with ''ab-initio'' accuracy '''at scale'''&lt;br /&gt;
** Molecular Dynamics&lt;br /&gt;
** Grand-Canonical Monte-Carlo simulations&lt;br /&gt;
** Electronic-stopping and spatially-correlated Langevin Dynamics (in-development).&lt;br /&gt;
** '''Prediction/optimization of experimental observables''' (''e.g.'' X-Ray photoelectron spectra ([[#citeproc_bib_item_6|Golze et al. 2022]]; [[#citeproc_bib_item_11|Zarrouk et al. 2024]]), X-ray/Neutron Diffraction and more to come!).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;motivation-for-structural-inference&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Motivation for structural inference =&lt;br /&gt;
&lt;br /&gt;
* We typically want to &amp;lt;u&amp;gt;predict structures&amp;lt;/u&amp;gt;, to make sense of experimental data.&lt;br /&gt;
* We usually pray structures have &amp;lt;u&amp;gt;experimental agreement&amp;lt;/u&amp;gt; (a “bottom-up” approach).&lt;br /&gt;
* What if we can &amp;lt;u&amp;gt;promote agreement&amp;lt;/u&amp;gt; with experimental data?&lt;br /&gt;
* ''Reverse Monte-Carlo'' techniques match experimental data to atomic structure (“top-down” approach).&lt;br /&gt;
** Downsides: “By-hand” constraints&lt;br /&gt;
** Simple experimental observables.&lt;br /&gt;
** Unphysical structures/artifacts ([[#citeproc_bib_item_8|Opletal et al. 2017]])&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Need efficient structure search to find '''agreement''' with '''experimental''' data ''and'' '''ab-inito''' data.&lt;br /&gt;
&lt;br /&gt;
With &amp;lt;u&amp;gt;CO GAP + Core electron binding energy SOAP&amp;lt;/u&amp;gt; model we will perform '''modified (Grand-canonical) Monte-Carlo''' to produce ''experimentally consistent, low energy structures'' of oxygenated amorphous carbon.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:deconvolution_comparison_fill_-3_new.png | 400px]]&lt;br /&gt;
We will do simulations similar to the above, which is from our JACS paper ([[#citeproc_bib_item_11|Zarrouk et al. 2024]]). &lt;br /&gt;
&amp;lt;span id=&amp;quot;theory-and-methods&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Theory and Methods =&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;gaussian-approximation-potentials-gap&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
== Gaussian Approximation Potentials (GAP) ==&lt;br /&gt;
&lt;br /&gt;
([[#citeproc_bib_item_2|Bartók et al. 2010]]; [[#citeproc_bib_item_1|Bartók, Kondor, and Csányi 2013]]; [[#citeproc_bib_item_4|Deringer et al. 2021]])&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;u&amp;gt;Assumption&amp;lt;/u&amp;gt;: Total energy is sum of '''local energies'''. &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;E_{\rm total}(\{\mathbf{r}\}) = \sum_i^{N_{\text{atoms}}} \varepsilon^i(\{r\}, \{\xi^{\text{2b}}_i\}, \{\boldsymbol{\xi}^{\text{3b}}_i\}, \boldsymbol{\xi}^{\text{mb}}_i))&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;\begin{align}&lt;br /&gt;
  \varepsilon^i ( &amp;amp;\{r\}, \{\xi^{\text{2b}}_i\}, \{\boldsymbol{\xi}^{\text{3b}}_i\}, \boldsymbol{\xi}^{\text{mb}}_i) =&lt;br /&gt;
   E^{\text{2b}}(\{\xi^{\text{2b}}_i\}) + E^{\text{3b}}(\{\boldsymbol{\xi}^{\text{3b}}_i\}) \nonumber\\&lt;br /&gt;
  &amp;amp; + E^{\text{mb}}(\boldsymbol{\xi}^{\text{mb}}_i)&lt;br /&gt;
  + \sum_{r &amp;lt; r_{\rm cut}^{\rm core}} E^{\text{core}}(r)  \nonumber&lt;br /&gt;
\end{align}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
; Local energy&lt;br /&gt;
: Sum of '''2b, 3b and many-body''' terms.&lt;br /&gt;
; Descriptor &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\xi / \boldsymbol{\xi}&amp;lt;/math&amp;gt;.&lt;br /&gt;
: ''e.g'' &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\{\xi^{\text{2b}}\} = \{r_{ij}\}&amp;lt;/math&amp;gt;, &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\{\boldsymbol{\xi}^{\text{3b}}\} = \{ [ r_{ij}, r_{ik}, r_{kj} ] \}&amp;lt;/math&amp;gt;&lt;br /&gt;
; Local environment&lt;br /&gt;
: A set of descriptors.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;using-descriptors-to-predict-quantities&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== Using descriptors to predict quantities ===&lt;br /&gt;
&lt;br /&gt;
* ''Kernel/basis functions'' &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;k_{ij}(\boldsymbol{\xi}_i, \boldsymbol{\xi}_j)&amp;lt;/math&amp;gt; measure the ''similarity between descriptors''.&lt;br /&gt;
* ''e.g'' Exponential 2b kernel: &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;k^{2b}_{ij}(\xi_i, \xi_j) \equiv k^{2b}_{ij}(r_{i}, r_{j}) = \exp( - (r_{i} - r_{j})^2/2\sigma^2 )&amp;lt;/math&amp;gt;&lt;br /&gt;
* ''Gaussian Process Regression'' (kernel matrix algebra on training set) → ''fitting coefficients'' &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\{\alpha\}&amp;lt;/math&amp;gt;, ([[#citeproc_bib_item_4|Deringer et al. 2021]])&lt;br /&gt;
* ''e.g.'' 2b model trained with &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;N_s&amp;lt;/math&amp;gt; descriptors &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\{\xi\} \in \{\xi_i, \ldots, \xi_{Ns}\}&amp;lt;/math&amp;gt;, the energy for atom with &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;M&amp;lt;/math&amp;gt; pairwise distances in local environment: &amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;E^{2b} = \sum_i^M \left(E^{2b}_0 + \delta^2\sum_j^{N_s}  \alpha_j k^{2b}_{ij}(\xi_i, \xi_j) \right) &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;soap-many-body-descriptor&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== SOAP (many-body) descriptor ===&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;u&amp;gt;SOAP descriptor&amp;lt;/u&amp;gt;: &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\boldsymbol{\xi}_i(\{\mathbf{r}\}_{ &amp;lt; r_{\rm cut}} )&amp;lt;/math&amp;gt;, represents environment of an atom ([[#citeproc_bib_item_2|Bartók et al. 2010]]).&lt;br /&gt;
* &amp;lt;u&amp;gt;Kernel&amp;lt;/u&amp;gt;: &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;k_{ij} = (\boldsymbol{\xi}_i \cdot \boldsymbol{\xi}_j)^{\zeta}&amp;lt;/math&amp;gt; measures &amp;lt;u&amp;gt;similarity of environments&amp;lt;/u&amp;gt;.&lt;br /&gt;
* &amp;lt;u&amp;gt;Fitting coefficients&amp;lt;/u&amp;gt;: &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\alpha_j&amp;lt;/math&amp;gt; result from Gaussian Process Regression.&lt;br /&gt;
* &amp;lt;u&amp;gt;Prediction&amp;lt;/u&amp;gt;: &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;E^{\rm mb}_i(\boldsymbol{\xi}_i) = E^{\rm mb}_0 + \delta^2\sum_j  \alpha_j k_{ij}&amp;lt;/math&amp;gt;&lt;br /&gt;
* For specifics of SOAP turbo, refer to Miguel's paper ([[#citeproc_bib_item_3|Caro 2019]])&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;how-do-we-model-xps&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== How do we model XPS? ==&lt;br /&gt;
&lt;br /&gt;
* XPS (X-ray photoelectron spectroscopy) spectra measure '''core electron binding energies'''.&lt;br /&gt;
* Core electron binding energies ''depend on atomic environment''.&lt;br /&gt;
* SOAP turbo model trained on DFT (&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\Delta\text{KS}&amp;lt;/math&amp;gt;) data with a &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;GW&amp;lt;/math&amp;gt; correction on top ([[#citeproc_bib_item_6|Golze et al. 2022]]).&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\text{CEBE} = ( \Delta KS^0_{\rm extended} + GW_{\rm carved} - \Delta \mathrm{KS}^+_{\rm carved} )&amp;lt;/math&amp;gt;&lt;br /&gt;
* Thermal and instrumental broadening accounted for by a Gaussian with &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\sigma = 0.4\text{ eV}&amp;lt;/math&amp;gt;&lt;br /&gt;
* Can analyse environments which make up spectra.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;prediction-of-local-properties&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Prediction of Local Properties ==&lt;br /&gt;
&lt;br /&gt;
* We can predict an &amp;lt;u&amp;gt;arbitrary number&amp;lt;/u&amp;gt; of ''local properties'' which use SOAP turbo descriptors using ''TurboGAP''.&lt;br /&gt;
* /One can get these for “free”/ if local property models are trained using the same descriptors as atomic energies/forces.&lt;br /&gt;
*; ''Hirshfeld volumes''&lt;br /&gt;
*: gives vdW dispersion via Tkatchenko-Scheffler. &amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; E_{\rm TS} = \sum_i \sum_{j\neq i} C_{6, ij}(v_{i}(\boldsymbol{\xi}_i), v_{j}(\boldsymbol{\xi}_j))\frac{f_{\rm damp}(r_{ij}, \ldots)}{r_{ij}^6} &amp;lt;/math&amp;gt;&lt;br /&gt;
*; ''Core-electron binding energies''&lt;br /&gt;
*: give '''X-ray Photoelectron Spectroscopy''' prediction. &amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; g_{\rm xps}(\varepsilon) = \frac{1}{M} \sum_i \exp\left( -(\varepsilon - \varepsilon_{i}(\boldsymbol{\xi}_i))^2/(2\sigma^2)  \right) &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;how-do-we-marry-experimental-data-and-gap&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
== How do we marry experimental data and GAP? ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* '''Generalized Hamiltonian within Grand-Canonical Monte-Carlo''' scheme.&lt;br /&gt;
* Vary oxygen content with chemical potential, to see motif differences.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;  \textcolor{violet}{ \mathbf{\tilde{g}}_{\rm {pred}}}(\varepsilon)  = \sum_{i} \exp\left(&lt;br /&gt;
-\frac{(\varepsilon - \textcolor{blue}{\varepsilon^{i}_{\rm&lt;br /&gt;
{pred}}(\boldsymbol{\xi}_i)})^2}{2\sigma^2}\right)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; \tilde{E} = E_{\rm GAP} + E_{\rm spectra} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; E_{\rm spectra} =  \frac{1}{2}\gamma \int \,d\varepsilon \left( \textcolor{violet}{ g_{\rm pred}(\varepsilon)} - g_{\rm exp}(\varepsilon)\right)^2&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;p&amp;gt;A simple squared difference, which is a penalty with increases with spectra dissimilarity and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\gamma&amp;lt;/math&amp;gt; is an energy scale.&amp;lt;/p&amp;gt;&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;p&amp;gt;We can do not just XPS but also X-ray/neutron diffraction and pair distribution functions.&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;[[File:xps_gcmc_scheme.png | 400px]]&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;/ul&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* We use the standard acceptance criteria for adding/removing/moving a particle&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; \mathrm{acc}(N \rightarrow N+1) = \mathrm{min}\left[1,&lt;br /&gt;
\frac{V}{\lambda^3 (N+1)} \exp\left\{ - \frac{\tilde{E}(N+1) -&lt;br /&gt;
\tilde{E}(N) - \mu}{k_BT} \right\}     \right] &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; \mathrm{acc}(N \rightarrow N-1) = \mathrm{min}\left[1,&lt;br /&gt;
\frac{\lambda^3 N}{V} \exp\left\{ -\frac{\tilde{E}(N-1) -&lt;br /&gt;
\tilde{E}(N) + \mu}{k_BT} \right\}     \right] &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; \mathrm{acc}_{\rm move} = \mathrm{min }\left[ 1, \exp\left\{ -&lt;br /&gt;
  \frac{\tilde{E}(\mathrm{new}) - \tilde{E}(\mathrm{old})}{k_BT} \right\} \right]&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;usage&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Usage =&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;installing-turbogap&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
== Installing ''TurboGAP'' ==&lt;br /&gt;
&lt;br /&gt;
We can install the ''TurboGAP'' code, found here https://github.com/mcaroba/turbogap through ''recursively cloning'' the main branch&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;git clone --recursive https://github.com/mcaroba/turbogap.git&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
Then we edit this line in the &amp;lt;code&amp;gt;Makefile&amp;lt;/code&amp;gt; to match our system architecture.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;include makefiles/Makefile.Ubuntu_gfortran_mpi&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Then, we make&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;make&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
and then export the path in &amp;lt;code&amp;gt;.bashrc&amp;lt;/code&amp;gt; file&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;export PATH=&amp;quot;~/turbogap/bin:$PATH&amp;quot;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;span id=&amp;quot;what-you-need-for-a-calculation&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
== What you need for a calculation ==&lt;br /&gt;
&lt;br /&gt;
; &amp;lt;code&amp;gt;gap_files/&amp;lt;/code&amp;gt; directory&lt;br /&gt;
: The directory which contains your &amp;lt;code&amp;gt;*.gap&amp;lt;/code&amp;gt;, with alphas (fitting coefficients) and sparse set descriptor files.&lt;br /&gt;
;* Potentials are available from ''TurboGAP'' wiki https://turbogap.fi/wiki/index.php/Potentials&lt;br /&gt;
;* Conversion script from &amp;lt;code&amp;gt;gap_fit .xml&amp;lt;/code&amp;gt; to &amp;lt;code&amp;gt;.gap&amp;lt;/code&amp;gt; can be used &amp;lt;code&amp;gt;turbogap/tools/make_gap_files.py&amp;lt;/code&amp;gt;&lt;br /&gt;
; &amp;lt;code&amp;gt;input&amp;lt;/code&amp;gt; file&lt;br /&gt;
: The file which tells the code what to do&lt;br /&gt;
; &amp;lt;code&amp;gt;*.xyz&amp;lt;/code&amp;gt;&lt;br /&gt;
: An extended xyz format file which contains positions/lattice/velocity information.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;adding-a-local-property-model-for-cebe-prediction&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== Adding a local property model for CEBE prediction ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;  gap_beg soap_turbo&lt;br /&gt;
  n_species = 2&lt;br /&gt;
  species = C O&lt;br /&gt;
  central_species = 1&lt;br /&gt;
... some params ...&lt;br /&gt;
  zeta = 4&lt;br /&gt;
  delta = 0.1&lt;br /&gt;
  desc_sparse = &amp;quot;gap_files/CO.xml.sparseX.GAP_2022_5_19_180_7_17_31_41410&amp;quot;&lt;br /&gt;
  alphas_sparse = &amp;quot;gap_files/alphas_soap_turbo_1.dat&amp;quot;&lt;br /&gt;
  compress_mode = &amp;quot;trivial&amp;quot;&lt;br /&gt;
  has_local_properties = .true.&lt;br /&gt;
  n_local_properties = 1&lt;br /&gt;
  local_property_qs = 'gap_files/core_electron_be.xml.sparseX.GAP_2024_1_26_120_18_36_33_6091'&lt;br /&gt;
  local_property_alphas = 'gap_files/alphas_core_electron_be_1.dat'&lt;br /&gt;
  local_property_labels = 'core_electron_be'&lt;br /&gt;
  local_property_zetas = 2&lt;br /&gt;
  local_property_deltas = 1.0&lt;br /&gt;
  local_property_v0s = 290.0&lt;br /&gt;
  gap_end&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;span id=&amp;quot;conversion-of-gap_fit-.xml-files-to-.gap-format&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== Conversion of &amp;lt;code&amp;gt;gap_fit&amp;lt;/code&amp;gt; &amp;lt;code&amp;gt;*.xml&amp;lt;/code&amp;gt; files to &amp;lt;code&amp;gt;*.gap&amp;lt;/code&amp;gt; format ===&lt;br /&gt;
&lt;br /&gt;
* Then we convert the &amp;lt;code&amp;gt;*.xml&amp;lt;/code&amp;gt; files which result from &amp;lt;code&amp;gt;gap_fit&amp;lt;/code&amp;gt; into the required format for ''TurboGAP''.&lt;br /&gt;
* This is done using the convenience script in &amp;lt;code&amp;gt;turbogap/tools/make_gap_files.py&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;python3 make_gap_files.py {gap_file.xml} {gap_file.gap} {N_local_prop.} \&lt;br /&gt;
              {local_prop1.xml} {local_prop_label1} \&lt;br /&gt;
              {local_prop2.xml} {local_prop_label2}...&lt;br /&gt;
# e.g. let's build a carbon oxygen GAP&lt;br /&gt;
# with core electron binding energy prediction capability.&lt;br /&gt;
python3 make_gap_files.py CO.xml CO.gap 1 \&lt;br /&gt;
        core_electron_be_co.xml core_electron_be&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
* This creates a directory &amp;lt;code&amp;gt;gap_files/&amp;lt;/code&amp;gt; which has&lt;br /&gt;
*# &amp;lt;code&amp;gt;alphas_{descriptor}.dat&amp;lt;/code&amp;gt; which are fitting coefficients for a particular descriptor&lt;br /&gt;
*# &amp;lt;code&amp;gt;qs_{descriptor}.dat&amp;lt;/code&amp;gt; which are the '''sparse set''' descriptors, used for prediction.&lt;br /&gt;
*# &amp;lt;code&amp;gt;alphas_{local_property}.dat&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;qs_{local_property}.dat&amp;lt;/code&amp;gt; for local property prediction.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;running-the-tutorial&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
== Running the Tutorial ==&lt;br /&gt;
&lt;br /&gt;
* Navigate to &amp;lt;code&amp;gt;turbogap/tutorials/xps_optimizaton&amp;lt;/code&amp;gt;&lt;br /&gt;
* Run &amp;lt;code&amp;gt;bash run.sh {calc_type}&amp;lt;/code&amp;gt; where &amp;lt;code&amp;gt;{calc_type}&amp;lt;/code&amp;gt; is either:&lt;br /&gt;
** &amp;lt;code&amp;gt;prediction&amp;lt;/code&amp;gt;&lt;br /&gt;
** &amp;lt;code&amp;gt;standard_gcmc&amp;lt;/code&amp;gt;&lt;br /&gt;
** &amp;lt;code&amp;gt;xps_optimization_gcmc&amp;lt;/code&amp;gt;&lt;br /&gt;
* Note that these simulations have a high chemical potential and (have high &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\gamma&amp;lt;/math&amp;gt; factors), these are just to give a result in a reasonable amount of time. Take care with real simulations.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;core-electron-binding-energy-prediction&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
== Core electron binding energy prediction ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;[mpirun -np N] turbogap predict&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
* We have in our &amp;lt;code&amp;gt;input&amp;lt;/code&amp;gt; file&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre class=&amp;quot;conf&amp;quot;&amp;gt;! Species-specific info&lt;br /&gt;
atoms_file = 'atoms.xyz'&lt;br /&gt;
pot_file = 'gap_files/CO.gap'&lt;br /&gt;
n_species = 2&lt;br /&gt;
species = C O&lt;br /&gt;
masses = 12.01 15.99&lt;br /&gt;
e0 = -.16138053 0.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Output:&lt;br /&gt;
&lt;br /&gt;
; &amp;lt;code&amp;gt;trajectory_out.xyz&amp;lt;/code&amp;gt;&lt;br /&gt;
: which contains atomic positions, local energy and local property arrays for each structure.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt; 512&lt;br /&gt;
Properties=species:S:1:pos:R:3:forces:R:3:local_energy:R:1:core_electron_be:R:1 \&lt;br /&gt;
   Lattice=&amp;quot;...&amp;quot; energy=-4321.582604 energy_soap=-4114.77018429  energy_2b=-124.73820332 energy_3b=0.55261463 \&lt;br /&gt;
   energy_core_pot=0.00000000 energy_vdw=0.00000000 energy_exp=0.00000000 energy_xps=0.00000000 \&lt;br /&gt;
   virial=&amp;quot;...&amp;quot; stress=&amp;quot;...&amp;quot; volume=5372.640346&lt;br /&gt;
   C              4.39625950       7.79414272      11.91703476     \&lt;br /&gt;
                  -0.00176074      -0.00403026       0.00040104    \&lt;br /&gt;
                  -8.32055957 \ # Local energy prediction&lt;br /&gt;
                  283.83841418  # CEBE Prediction&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Withiout specifying Exp. data, Turbogap does not predict the spectra.&lt;br /&gt;
* XPS spectra can simply be calculated from &amp;lt;code&amp;gt;core_electron_be&amp;lt;/code&amp;gt; in &amp;lt;code&amp;gt;trajectory_out.xyz&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;grand-canonical-monte-carlo&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
== (Grand-Canonical) Monte-Carlo ==&lt;br /&gt;
&lt;br /&gt;
* We use &amp;lt;code&amp;gt;mc&amp;lt;/code&amp;gt; mode&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;[mpirun -np N] turbogap mc&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
* ''e.g'' For a &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mu V T&amp;lt;/math&amp;gt; simulation of system in oxygen environment&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre class=&amp;quot;conf&amp;quot;&amp;gt;! Monte-carlo options&lt;br /&gt;
mc_nsteps = 1000                         # Number of Monte-Carlo Steps&lt;br /&gt;
n_mc_types = 3                           # Number of MC move types&lt;br /&gt;
mc_types = 'move' 'insertion' 'removal'  # MC move types (move/insertion/removal/volume/swap/md)&lt;br /&gt;
mc_move_max = 0.5                        # Maximum distance for MC displacement (&amp;amp;quot;move&amp;amp;quot;) type moves&lt;br /&gt;
&lt;br /&gt;
! - GCMC Options&lt;br /&gt;
n_mc_mu = 1              # Number of chemical potentials to add&lt;br /&gt;
mc_mu = 0                # Chemical potential(s) [eV]&lt;br /&gt;
mc_species = 'O'         # GCMC species types&lt;br /&gt;
mc_min_dist = 0.1        # GCMC minimum insertion distance&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Output:&lt;br /&gt;
&lt;br /&gt;
; &amp;lt;code&amp;gt;mc.log&amp;lt;/code&amp;gt;&lt;br /&gt;
: &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;# mc_istep  mc_move  accepted  E_trial              E_current             E_exp_trial          E_exp_current  N_tot_trial  N_mc_species_trial&lt;br /&gt;
       1       move    F       -4321.10376531       -4321.58260476         272.97693282         272.83692252      512  O        0&lt;br /&gt;
       2       move    F       -4321.10017027       -4321.58260476         272.68730901         272.83692252      512  O        0&lt;br /&gt;
       3  insertion    F       -4319.14082561       -4321.58260476         269.49191203         272.83692252      513  O        1&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; &amp;lt;code&amp;gt;mc_all.xyz&amp;lt;/code&amp;gt;&lt;br /&gt;
: xyz file written to every &amp;lt;code&amp;gt;write_xyz = N&amp;lt;/code&amp;gt; steps.&lt;br /&gt;
; &amp;lt;code&amp;gt;mc_current.xyz&amp;lt;/code&amp;gt;&lt;br /&gt;
: xyz file saving current accepted config written to every &amp;lt;code&amp;gt;write_xyz = N&amp;lt;/code&amp;gt; steps.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* If we run &amp;lt;code&amp;gt;bash run.sh standard_gcmc&amp;lt;/code&amp;gt; (may take a few minutes), we can see a prediction of the XPS with oxygen content&lt;br /&gt;
&lt;br /&gt;
[[File:standard_gcmc.png | 800px]]&lt;br /&gt;
&lt;br /&gt;
We see there is a large amount of oxygen inserted due to the large chemical potential for this simulation. This shifts the xps to large binding core electron binding energies, and there is no agreement the final structure with the experimental XPS. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;experimental-observable-optimization&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Experimental Observable Optimization ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;[mpirun -np N] turbogap mc/md&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
* We can specify experimental observables to predict and optimize them using MC or MD. &amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; E_{\rm spectra} = \frac{1}{2} \gamma \int \,d\varepsilon (g_{\rm pred}(\varepsilon) - g_{\rm exp}(\varepsilon))^2  &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre class=&amp;quot;conf&amp;quot;&amp;gt;! Experimental data options&lt;br /&gt;
n_exp = 1                                  # Number of experimental observables&lt;br /&gt;
exp_labels = 'xps'                         # Experimental observable types (xps/xrd/nd/pdf)&lt;br /&gt;
exp_data_files = 'xps_spectra_interp.dat'  # Experimental data files (Note: the range of resulting XPS prediction will be the same as the experimental range.)&lt;br /&gt;
exp_n_samples = 501                        # Number of interpolations samples over the experimental range.&lt;br /&gt;
exp_energy_scales = 100.0                    # Energy scale (gamma) [eV]&lt;br /&gt;
&lt;br /&gt;
# XPS smearing&lt;br /&gt;
xps_sigma = 0.4&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Output:&lt;br /&gt;
&lt;br /&gt;
; &amp;lt;code&amp;gt;xps_prediction.dat&amp;lt;/code&amp;gt;&lt;br /&gt;
: Data file written every &amp;lt;code&amp;gt;write_xyz = N&amp;lt;/code&amp;gt; steps. Separate predictions separated by blank lines.&lt;br /&gt;
; &amp;lt;code&amp;gt;xps_exp.dat&amp;lt;/code&amp;gt;&lt;br /&gt;
: The experimental data fed into ''TurboGAP''.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* If we run &amp;lt;code&amp;gt;bash run.sh xps_optimization_gcmc&amp;lt;/code&amp;gt; (may take a few minutes), we can see a prediction of the XPS with oxygen content&lt;br /&gt;
&lt;br /&gt;
[[File:xps_optimization_gcmc.png | 800px]]&lt;br /&gt;
&lt;br /&gt;
We can observe the significant effect of the energy scale here. The experimental energy decreases quickly, with a concurrent increase in the energy per atom. After spectral agreement, the system is allowed to relax. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;multiple-observables&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Multiple Observables ==&lt;br /&gt;
&lt;br /&gt;
* This is not in the tutorial files, but ''TurboGAP'' allows for we can optimization multiple observables.&lt;br /&gt;
** X-ray diffraction&lt;br /&gt;
** Neutron diffraction&lt;br /&gt;
** Pair distribution function&lt;br /&gt;
** XPS&lt;br /&gt;
* Here we show a fictitious example of XPS and XRD optimization.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre class=&amp;quot;conf&amp;quot;&amp;gt;# Partial PDFs needed for XRD calculation&lt;br /&gt;
pair_distribution_n_samples = 301&lt;br /&gt;
r_range_min = 0.1&lt;br /&gt;
r_range_max = 13.5&lt;br /&gt;
pair_distribution_rcut = 14.1&lt;br /&gt;
&lt;br /&gt;
do_xrd = .true.&lt;br /&gt;
&lt;br /&gt;
# Experimental Data Specification&lt;br /&gt;
n_exp = 2                  # Number of Exp. observables&lt;br /&gt;
exp_labels = 'xps' 'xrd'   # Exp. observable type (xps/xrd/nd/pdf)&lt;br /&gt;
exp_data_files = 'xps_spectra_experiment.dat' 'xrd_CO_experiment.dat'&lt;br /&gt;
exp_n_samples = 301 301 # Number of samples for the experimental data&lt;br /&gt;
exp_energy_scales = 10.0 10.0  # The &amp;amp;quot;gamma&amp;amp;quot; term for each observable&lt;br /&gt;
&lt;br /&gt;
# If using monte-carlo, the experimental energies are added directly to the local energy&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;span id=&amp;quot;applications&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
= Applications =&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;experimental-observable-predictionoptimization&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
== Experimental Observable prediction/optimization ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;deconvolution-analysis&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== Deconvolution analysis ===&lt;br /&gt;
&lt;br /&gt;
* Use subgraph isomorphisms of bonding networks to discern motifs present.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:exp_xps_with_background_high.png | 400px]]&lt;br /&gt;
&lt;br /&gt;
↑ Experimental XPS deconvolution ([[#citeproc_bib_item_9|Santini et al. 2015]])&lt;br /&gt;
&lt;br /&gt;
We see in the experimental deconvolution analysis that sp3 motifs compose the primary XPS peak. The generation of a-COx here was done by physical vapor deposition of graphitic carbon in an oxygen environment. They see a reduction in the number of sp2 bonds. They also claim there is a complete transformation of sp2 to sp3 that is reversible with a short annealing at 500C. &lt;br /&gt;
&lt;br /&gt;
[[File:deconvolution_comparison_fill_-3_new.png| 400px]]&lt;br /&gt;
&lt;br /&gt;
↑ Our XPS deconvolution ([[#citeproc_bib_item_9|Santini et al. 2015]])&lt;br /&gt;
&lt;br /&gt;
However from our deconvolution analysis, we see that this primary peak is composed of sp2 motifs. We can explain why the experimentalists see only sp2 with a simple computational experiment. &lt;br /&gt;
&lt;br /&gt;
We add in oxygen to the bottom layer of a graphene bilayer system to see the influence of oxygen on sp2 core electron binding energies. &lt;br /&gt;
&lt;br /&gt;
[[File:xps_shifts_miguel_first.png| 400px]]&lt;br /&gt;
&lt;br /&gt;
[[File:xps_shifts_miguel_last.png| 400px]]&lt;br /&gt;
&lt;br /&gt;
We see with oxygen content that sp2 motifs are shifted significantly, even past the sp3 reference. Due to the presence of oxygen, there is a shift of sp2 motifs which are not accounted for by the experimental deconvolution references, as these are fixed. This is why the experimental deconvolution did not give what we expect: sp2 carbon that composes the primary XPS peak. &lt;br /&gt;
&amp;lt;span id=&amp;quot;summary&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Summary =&lt;br /&gt;
&lt;br /&gt;
* Machine-learned potentials can be combined with experimental models to give structures which are consistent with both ''ab-inito'' and experimental data.&lt;br /&gt;
* We can generate oxygenated amorphous carbon structures using a CO GAP with XPS prediction using modified GCMC and a “Molecular Augmented Dynamics” method.&lt;br /&gt;
* We can use ''multiple experimental observables''.&lt;br /&gt;
* '''Finding structures which match experimental data allows us to understand specific experimental results.'''&lt;br /&gt;
* Deconvolve experimental XPS exactly.&lt;br /&gt;
* All of this is implemented in the ''TurboGAP'' code.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;references&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
= References =&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;citeproc_bib_item_1&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;Bartók, Albert P., Risi Kondor, and Gábor Csányi. 2013. “On Representing Chemical Environments.” ''Physical Review B'' 87 (18): 184115. https://doi.org/10.1103/PhysRevB.87.184115.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;citeproc_bib_item_2&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;Bartók, Albert P., Mike C. Payne, Risi Kondor, and Gábor Csányi. 2010. “Gaussian Approximation Potentials: The Accuracy of Quantum Mechanics, without the Electrons.” ''Physical Review Letters'' 104 (13): 136403. https://doi.org/10.1103/PhysRevLett.104.136403.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;citeproc_bib_item_3&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;Caro, Miguel A. 2019. “Optimizing Many-Body Atomic Descriptors for Enhanced Computational Performance of Machine Learning Based Interatomic Potentials.” ''Physical Review B'' 100 (2): 024112. https://doi.org/10.1103/PhysRevB.100.024112.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;citeproc_bib_item_4&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;Deringer, Volker L., Albert P. Bartók, Noam Bernstein, David M. Wilkins, Michele Ceriotti, and Gábor Csányi. 2021. “Gaussian Process Regression for Materials and Molecules.” ''Chemical Reviews'' 121 (16): 10073–141. https://doi.org/10.1021/acs.chemrev.1c00022.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;citeproc_bib_item_5&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;El-Machachi, Zakariya, Damyan Frantzov, A. Nijamudheen, Tigany Zarrouk, Miguel A. Caro, and Volker L. Deringer. 2024. “Accelerated First-Principles Exploration of Structure and Reactivity in Graphene Oxide.” arXiv. https://doi.org/10.48550/arXiv.2405.14814.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;citeproc_bib_item_6&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;Golze, Dorothea, Markus Hirvensalo, Patricia Hernández-León, Anja Aarva, Jarkko Etula, Toma Susi, Patrick Rinke, Tomi Laurila, and Miguel A. Caro. 2022. “Accurate Computational Prediction of Core-Electron Binding Energies in Carbon-Based Materials: A Machine-Learning Model Combining Density-Functional Theory and GW.” ''Chemistry of Materials'' 34 (14): 6240–54. https://doi.org/10.1021/acs.chemmater.1c04279.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;citeproc_bib_item_7&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;Muhli, Heikki, Xi Chen, Albert P. Bartók, Patricia Hernández-León, Gábor Csányi, Tapio Ala-Nissila, and Miguel A. Caro. 2021. “Machine Learning Force Fields Based on Local Parametrization of Dispersion Interactions: Application to the Phase Diagram of \&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathrm\\\C\\\\\_\60\\&amp;lt;/math&amp;gt;.” ''Physical Review B'' 104 (5): 054106. https://doi.org/10.1103/PhysRevB.104.054106.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;citeproc_bib_item_8&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;Opletal, George, Timothy C. Petersen, Amanda S. Barnard, and Salvy P. Russo. 2017. “On Reverse Monte Carlo Constraints and Model Reproduction.” ''Journal of Computational Chemistry'' 38 (17): 1547–51. https://doi.org/10.1002/jcc.24799.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;citeproc_bib_item_9&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;Santini, Claudia A., Abu Sebastian, Chiara Marchiori, Vara Prasad Jonnalagadda, Laurent Dellmann, Wabe W. Koelmans, Marta D. Rossell, Christophe P. Rossel, and Evangelos Eleftheriou. 2015. “Oxygenated Amorphous Carbon for Resistive Memory Applications.” ''Nature Communications'' 6 (1): 8600. https://doi.org/10.1038/ncomms9600.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;citeproc_bib_item_10&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;Wang, Yanzhou, Zheyong Fan, Ping Qian, Tapio Ala-Nissila, and Miguel A. Caro. 2022. “Structure and Pore Size Distribution in Nanoporous Carbon.” ''Chemistry of Materials'' 34 (2): 617–28. https://doi.org/10.1021/acs.chemmater.1c03279.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;citeproc_bib_item_11&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;Zarrouk, Tigany, Rina Ibragimova, Albert P. Bartók, and Miguel A. Caro. 2024. “Experiment-Driven Atomistic Materials Modeling: A Case Study Combining X-Ray Photoelectron Spectroscopy and Machine Learning Potentials to Infer the Structure of Oxygen-Rich Amorphous Carbon.” ''Journal of the American Chemical Society'' 146 (21): 14645–59. https://doi.org/10.1021/jacs.4c01897.&lt;/div&gt;</summary>
		<author><name>Tigany Zarrouk</name></author>
		
	</entry>
	<entry>
		<id>https://turbogap.fi/wiki/index.php?title=XPS-optimized_oxygenated_amorphous_carbon&amp;diff=658</id>
		<title>XPS-optimized oxygenated amorphous carbon</title>
		<link rel="alternate" type="text/html" href="https://turbogap.fi/wiki/index.php?title=XPS-optimized_oxygenated_amorphous_carbon&amp;diff=658"/>
		<updated>2024-06-19T10:25:33Z</updated>

		<summary type="html">&lt;p&gt;Tigany Zarrouk: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
&amp;lt;span id=&amp;quot;what-is-turbogap&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
= What is ''TurboGAP'' ? =&lt;br /&gt;
&lt;br /&gt;
* ''TurboGAP'' is a &amp;lt;code&amp;gt;Fortran&amp;lt;/code&amp;gt; atomistic code which uses &amp;lt;u&amp;gt;Gaussian Approximation Potentials&amp;lt;/u&amp;gt; (GAPs).&lt;br /&gt;
* Its specialty are ''SOAP turbo'' descriptors: faster and more accurate than SOAP (Smooth Overlap of Atomic Positions).&lt;br /&gt;
* It's (probably!) the fastest SOAP prediction code, which will be made even faster with ''GPU acceleration'' (ongoing with CSC).&lt;br /&gt;
&lt;br /&gt;
* Through GAP/SOAP predictions, one can perform simulations with ''ab-initio'' accuracy '''at scale'''&lt;br /&gt;
** Molecular Dynamics&lt;br /&gt;
** Grand-Canonical Monte-Carlo simulations&lt;br /&gt;
** Electronic-stopping and spatially-correlated Langevin Dynamics (in-development).&lt;br /&gt;
** '''Prediction/optimization of experimental observables''' (''e.g.'' X-Ray photoelectron spectra ([[#citeproc_bib_item_6|Golze et al. 2022]]; [[#citeproc_bib_item_11|Zarrouk et al. 2024]]), X-ray/Neutron Diffraction and more to come!).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;motivation-for-structural-inference&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Motivation for structural inference =&lt;br /&gt;
&lt;br /&gt;
* We typically want to &amp;lt;u&amp;gt;predict structures&amp;lt;/u&amp;gt;, to make sense of experimental data.&lt;br /&gt;
* We usually pray structures have &amp;lt;u&amp;gt;experimental agreement&amp;lt;/u&amp;gt; (a “bottom-up” approach).&lt;br /&gt;
* What if we can &amp;lt;u&amp;gt;promote agreement&amp;lt;/u&amp;gt; with experimental data?&lt;br /&gt;
* ''Reverse Monte-Carlo'' techniques match experimental data to atomic structure (“top-down” approach).&lt;br /&gt;
** Downsides: “By-hand” constraints&lt;br /&gt;
** Simple experimental observables.&lt;br /&gt;
** Unphysical structures/artifacts ([[#citeproc_bib_item_8|Opletal et al. 2017]])&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Need efficient structure search to find '''agreement''' with '''experimental''' data ''and'' '''ab-inito''' data.&lt;br /&gt;
&lt;br /&gt;
With &amp;lt;u&amp;gt;CO GAP + Core electron binding energy SOAP&amp;lt;/u&amp;gt; model we will perform '''modified (Grand-canonical) Monte-Carlo''' to produce ''experimentally consistent, low energy structures'' of oxygenated amorphous carbon.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:deconvolution_comparison_fill_-3_new.png | 400px]]&lt;br /&gt;
We will do simulations similar to the above, is from our JACS paper ([[#citeproc_bib_item_11|Zarrouk et al. 2024]]). &lt;br /&gt;
&amp;lt;span id=&amp;quot;theory-and-methods&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Theory and Methods =&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;gaussian-approximation-potentials-gap&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
== Gaussian Approximation Potentials (GAP) ==&lt;br /&gt;
&lt;br /&gt;
([[#citeproc_bib_item_2|Bartók et al. 2010]]; [[#citeproc_bib_item_1|Bartók, Kondor, and Csányi 2013]]; [[#citeproc_bib_item_4|Deringer et al. 2021]])&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;u&amp;gt;Assumption&amp;lt;/u&amp;gt;: Total energy is sum of '''local energies'''. &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;E_{\rm total}(\{\mathbf{r}\}) = \sum_i^{N_{\text{atoms}}} \varepsilon^i(\{r\}, \{\xi^{\text{2b}}_i\}, \{\boldsymbol{\xi}^{\text{3b}}_i\}, \boldsymbol{\xi}^{\text{mb}}_i))&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;\begin{align}&lt;br /&gt;
  \varepsilon^i ( &amp;amp;\{r\}, \{\xi^{\text{2b}}_i\}, \{\boldsymbol{\xi}^{\text{3b}}_i\}, \boldsymbol{\xi}^{\text{mb}}_i) =&lt;br /&gt;
   E^{\text{2b}}(\{\xi^{\text{2b}}_i\}) + E^{\text{3b}}(\{\boldsymbol{\xi}^{\text{3b}}_i\}) \nonumber\\&lt;br /&gt;
  &amp;amp; + E^{\text{mb}}(\boldsymbol{\xi}^{\text{mb}}_i)&lt;br /&gt;
  + \sum_{r &amp;lt; r_{\rm cut}^{\rm core}} E^{\text{core}}(r)  \nonumber&lt;br /&gt;
\end{align}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
; Local energy&lt;br /&gt;
: Sum of '''2b, 3b and many-body''' terms.&lt;br /&gt;
; Descriptor &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\xi / \boldsymbol{\xi}&amp;lt;/math&amp;gt;.&lt;br /&gt;
: ''e.g'' &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\{\xi^{\text{2b}}\} = \{r_{ij}\}&amp;lt;/math&amp;gt;, &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\{\boldsymbol{\xi}^{\text{3b}}\} = \{ [ r_{ij}, r_{ik}, r_{kj} ] \}&amp;lt;/math&amp;gt;&lt;br /&gt;
; Local environment&lt;br /&gt;
: A set of descriptors.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;using-descriptors-to-predict-quantities&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== Using descriptors to predict quantities ===&lt;br /&gt;
&lt;br /&gt;
* ''Kernel/basis functions'' &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;k_{ij}(\boldsymbol{\xi}_i, \boldsymbol{\xi}_j)&amp;lt;/math&amp;gt; measure the ''similarity between descriptors''.&lt;br /&gt;
* ''e.g'' Exponential 2b kernel: &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;k^{2b}_{ij}(\xi_i, \xi_j) \equiv k^{2b}_{ij}(r_{i}, r_{j}) = \exp( - (r_{i} - r_{j})^2/2\sigma^2 )&amp;lt;/math&amp;gt;&lt;br /&gt;
* ''Gaussian Process Regression'' (kernel matrix algebra on training set) → ''fitting coefficients'' &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\{\alpha\}&amp;lt;/math&amp;gt;, ([[#citeproc_bib_item_4|Deringer et al. 2021]])&lt;br /&gt;
* ''e.g.'' 2b model trained with &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;N_s&amp;lt;/math&amp;gt; descriptors &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\{\xi\} \in \{\xi_i, \ldots, \xi_{Ns}\}&amp;lt;/math&amp;gt;, the energy for atom with &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;M&amp;lt;/math&amp;gt; pairwise distances in local environment: &amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;E^{2b} = \sum_i^M \left(E^{2b}_0 + \delta^2\sum_j^{N_s}  \alpha_j k^{2b}_{ij}(\xi_i, \xi_j) \right) &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;soap-many-body-descriptor&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== SOAP (many-body) descriptor ===&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;u&amp;gt;SOAP descriptor&amp;lt;/u&amp;gt;: &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\boldsymbol{\xi}_i(\{\mathbf{r}\}_{ &amp;lt; r_{\rm cut}} )&amp;lt;/math&amp;gt;, represents environment of an atom ([[#citeproc_bib_item_2|Bartók et al. 2010]]).&lt;br /&gt;
* &amp;lt;u&amp;gt;Kernel&amp;lt;/u&amp;gt;: &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;k_{ij} = (\boldsymbol{\xi}_i \cdot \boldsymbol{\xi}_j)^{\zeta}&amp;lt;/math&amp;gt; measures &amp;lt;u&amp;gt;similarity of environments&amp;lt;/u&amp;gt;.&lt;br /&gt;
* &amp;lt;u&amp;gt;Fitting coefficients&amp;lt;/u&amp;gt;: &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\alpha_j&amp;lt;/math&amp;gt; result from Gaussian Process Regression.&lt;br /&gt;
* &amp;lt;u&amp;gt;Prediction&amp;lt;/u&amp;gt;: &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;E^{\rm mb}_i(\boldsymbol{\xi}_i) = E^{\rm mb}_0 + \delta^2\sum_j  \alpha_j k_{ij}&amp;lt;/math&amp;gt;&lt;br /&gt;
* For specifics of SOAP turbo, refer to Miguel's paper ([[#citeproc_bib_item_3|Caro 2019]])&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;how-do-we-model-xps&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== How do we model XPS? ==&lt;br /&gt;
&lt;br /&gt;
* XPS (X-ray photoelectron spectroscopy) spectra measure '''core electron binding energies'''.&lt;br /&gt;
* Core electron binding energies ''depend on atomic environment''.&lt;br /&gt;
* SOAP turbo model trained on DFT (&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\Delta\text{KS}&amp;lt;/math&amp;gt;) data with a &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;GW&amp;lt;/math&amp;gt; correction on top ([[#citeproc_bib_item_6|Golze et al. 2022]]).&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\text{CEBE} = ( \Delta KS^0_{\rm extended} + GW_{\rm carved} - \Delta \mathrm{KS}^+_{\rm carved} )&amp;lt;/math&amp;gt;&lt;br /&gt;
* Thermal and instrumental broadening accounted for by a Gaussian with &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\sigma = 0.4\text{ eV}&amp;lt;/math&amp;gt;&lt;br /&gt;
* Can analyse environments which make up spectra.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;prediction-of-local-properties&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Prediction of Local Properties ==&lt;br /&gt;
&lt;br /&gt;
* We can predict an &amp;lt;u&amp;gt;arbitrary number&amp;lt;/u&amp;gt; of ''local properties'' which use SOAP turbo descriptors using ''TurboGAP''.&lt;br /&gt;
* /One can get these for “free”/ if local property models are trained using the same descriptors as atomic energies/forces.&lt;br /&gt;
*; ''Hirshfeld volumes''&lt;br /&gt;
*: gives vdW dispersion via Tkatchenko-Scheffler. &amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; E_{\rm TS} = \sum_i \sum_{j\neq i} C_{6, ij}(v_{i}(\boldsymbol{\xi}_i), v_{j}(\boldsymbol{\xi}_j))\frac{f_{\rm damp}(r_{ij}, \ldots)}{r_{ij}^6} &amp;lt;/math&amp;gt;&lt;br /&gt;
*; ''Core-electron binding energies''&lt;br /&gt;
*: give '''X-ray Photoelectron Spectroscopy''' prediction. &amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; g_{\rm xps}(\varepsilon) = \frac{1}{M} \sum_i \exp\left( -(\varepsilon - \varepsilon_{i}(\boldsymbol{\xi}_i))^2/(2\sigma^2)  \right) &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;how-do-we-marry-experimental-data-and-gap&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
== How do we marry experimental data and GAP? ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* '''Generalized Hamiltonian within Grand-Canonical Monte-Carlo''' scheme.&lt;br /&gt;
* Vary oxygen content with chemical potential, to see motif differences.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;  \textcolor{violet}{ \mathbf{\tilde{g}}_{\rm {pred}}}(\varepsilon)  = \sum_{i} \exp\left(&lt;br /&gt;
-\frac{(\varepsilon - \textcolor{blue}{\varepsilon^{i}_{\rm&lt;br /&gt;
{pred}}(\boldsymbol{\xi}_i)})^2}{2\sigma^2}\right)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; \tilde{E} = E_{\rm GAP} + E_{\rm spectra} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; E_{\rm spectra} =  \frac{1}{2}\gamma \int \,d\varepsilon \left( \textcolor{violet}{ g_{\rm pred}(\varepsilon)} - g_{\rm exp}(\varepsilon)\right)^2&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;p&amp;gt;A simple squared difference, which is a penalty with increases with spectra dissimilarity and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\gamma&amp;lt;/math&amp;gt; is an energy scale.&amp;lt;/p&amp;gt;&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;p&amp;gt;We can do not just XPS but also X-ray/neutron diffraction and pair distribution functions.&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;[[File:xps_gcmc_scheme.png | 400px]]&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;/ul&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* We use the standard acceptance criteria for adding/removing/moving a particle&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; \mathrm{acc}(N \rightarrow N+1) = \mathrm{min}\left[1,&lt;br /&gt;
\frac{V}{\lambda^3 (N+1)} \exp\left\{ - \frac{\tilde{E}(N+1) -&lt;br /&gt;
\tilde{E}(N) - \mu}{k_BT} \right\}     \right] &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; \mathrm{acc}(N \rightarrow N-1) = \mathrm{min}\left[1,&lt;br /&gt;
\frac{\lambda^3 N}{V} \exp\left\{ -\frac{\tilde{E}(N-1) -&lt;br /&gt;
\tilde{E}(N) + \mu}{k_BT} \right\}     \right] &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; \mathrm{acc}_{\rm move} = \mathrm{min }\left[ 1, \exp\left\{ -&lt;br /&gt;
  \frac{\tilde{E}(\mathrm{new}) - \tilde{E}(\mathrm{old})}{k_BT} \right\} \right]&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;usage&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Usage =&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;installing-turbogap&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
== Installing ''TurboGAP'' ==&lt;br /&gt;
&lt;br /&gt;
We can install the ''TurboGAP'' code, found here https://github.com/mcaroba/turbogap through ''recursively cloning'' the main branch&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;git clone --recursive https://github.com/mcaroba/turbogap.git&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
Then we edit this line in the &amp;lt;code&amp;gt;Makefile&amp;lt;/code&amp;gt; to match our system architecture.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;include makefiles/Makefile.Ubuntu_gfortran_mpi&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Then, we make&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;make&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
and then export the path in &amp;lt;code&amp;gt;.bashrc&amp;lt;/code&amp;gt; file&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;export PATH=&amp;quot;~/turbogap/bin:$PATH&amp;quot;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;span id=&amp;quot;what-you-need-for-a-calculation&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
== What you need for a calculation ==&lt;br /&gt;
&lt;br /&gt;
; &amp;lt;code&amp;gt;gap_files/&amp;lt;/code&amp;gt; directory&lt;br /&gt;
: The directory which contains your &amp;lt;code&amp;gt;*.gap&amp;lt;/code&amp;gt;, with alphas (fitting coefficients) and sparse set descriptor files.&lt;br /&gt;
;* Potentials are available from ''TurboGAP'' wiki https://turbogap.fi/wiki/index.php/Potentials&lt;br /&gt;
;* Conversion script from &amp;lt;code&amp;gt;gap_fit .xml&amp;lt;/code&amp;gt; to &amp;lt;code&amp;gt;.gap&amp;lt;/code&amp;gt; can be used &amp;lt;code&amp;gt;turbogap/tools/make_gap_files.py&amp;lt;/code&amp;gt;&lt;br /&gt;
; &amp;lt;code&amp;gt;input&amp;lt;/code&amp;gt; file&lt;br /&gt;
: The file which tells the code what to do&lt;br /&gt;
; &amp;lt;code&amp;gt;*.xyz&amp;lt;/code&amp;gt;&lt;br /&gt;
: An extended xyz format file which contains positions/lattice/velocity information.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;adding-a-local-property-model-for-cebe-prediction&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== Adding a local property model for CEBE prediction ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;  gap_beg soap_turbo&lt;br /&gt;
  n_species = 2&lt;br /&gt;
  species = C O&lt;br /&gt;
  central_species = 1&lt;br /&gt;
... some params ...&lt;br /&gt;
  zeta = 4&lt;br /&gt;
  delta = 0.1&lt;br /&gt;
  desc_sparse = &amp;quot;gap_files/CO.xml.sparseX.GAP_2022_5_19_180_7_17_31_41410&amp;quot;&lt;br /&gt;
  alphas_sparse = &amp;quot;gap_files/alphas_soap_turbo_1.dat&amp;quot;&lt;br /&gt;
  compress_mode = &amp;quot;trivial&amp;quot;&lt;br /&gt;
  has_local_properties = .true.&lt;br /&gt;
  n_local_properties = 1&lt;br /&gt;
  local_property_qs = 'gap_files/core_electron_be.xml.sparseX.GAP_2024_1_26_120_18_36_33_6091'&lt;br /&gt;
  local_property_alphas = 'gap_files/alphas_core_electron_be_1.dat'&lt;br /&gt;
  local_property_labels = 'core_electron_be'&lt;br /&gt;
  local_property_zetas = 2&lt;br /&gt;
  local_property_deltas = 1.0&lt;br /&gt;
  local_property_v0s = 290.0&lt;br /&gt;
  gap_end&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;span id=&amp;quot;conversion-of-gap_fit-.xml-files-to-.gap-format&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== Conversion of &amp;lt;code&amp;gt;gap_fit&amp;lt;/code&amp;gt; &amp;lt;code&amp;gt;*.xml&amp;lt;/code&amp;gt; files to &amp;lt;code&amp;gt;*.gap&amp;lt;/code&amp;gt; format ===&lt;br /&gt;
&lt;br /&gt;
* Then we convert the &amp;lt;code&amp;gt;*.xml&amp;lt;/code&amp;gt; files which result from &amp;lt;code&amp;gt;gap_fit&amp;lt;/code&amp;gt; into the required format for ''TurboGAP''.&lt;br /&gt;
* This is done using the convenience script in &amp;lt;code&amp;gt;turbogap/tools/make_gap_files.py&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;python3 make_gap_files.py {gap_file.xml} {gap_file.gap} {N_local_prop.} \&lt;br /&gt;
              {local_prop1.xml} {local_prop_label1} \&lt;br /&gt;
              {local_prop2.xml} {local_prop_label2}...&lt;br /&gt;
# e.g. let's build a carbon oxygen GAP&lt;br /&gt;
# with core electron binding energy prediction capability.&lt;br /&gt;
python3 make_gap_files.py CO.xml CO.gap 1 \&lt;br /&gt;
        core_electron_be_co.xml core_electron_be&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
* This creates a directory &amp;lt;code&amp;gt;gap_files/&amp;lt;/code&amp;gt; which has&lt;br /&gt;
*# &amp;lt;code&amp;gt;alphas_{descriptor}.dat&amp;lt;/code&amp;gt; which are fitting coefficients for a particular descriptor&lt;br /&gt;
*# &amp;lt;code&amp;gt;qs_{descriptor}.dat&amp;lt;/code&amp;gt; which are the '''sparse set''' descriptors, used for prediction.&lt;br /&gt;
*# &amp;lt;code&amp;gt;alphas_{local_property}.dat&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;qs_{local_property}.dat&amp;lt;/code&amp;gt; for local property prediction.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;running-the-tutorial&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
== Running the Tutorial ==&lt;br /&gt;
&lt;br /&gt;
* Navigate to &amp;lt;code&amp;gt;turbogap/tutorials/xps_optimizaton&amp;lt;/code&amp;gt;&lt;br /&gt;
* Run &amp;lt;code&amp;gt;bash run.sh {calc_type}&amp;lt;/code&amp;gt; where &amp;lt;code&amp;gt;{calc_type}&amp;lt;/code&amp;gt; is either:&lt;br /&gt;
** &amp;lt;code&amp;gt;prediction&amp;lt;/code&amp;gt;&lt;br /&gt;
** &amp;lt;code&amp;gt;standard_gcmc&amp;lt;/code&amp;gt;&lt;br /&gt;
** &amp;lt;code&amp;gt;xps_optimization_gcmc&amp;lt;/code&amp;gt;&lt;br /&gt;
* Note that these simulations have a high chemical potential and (have high &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\gamma&amp;lt;/math&amp;gt; factors), these are just to give a result in a reasonable amount of time. Take care with real simulations.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;core-electron-binding-energy-prediction&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
== Core electron binding energy prediction ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;[mpirun -np N] turbogap predict&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
* We have in our &amp;lt;code&amp;gt;input&amp;lt;/code&amp;gt; file&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre class=&amp;quot;conf&amp;quot;&amp;gt;! Species-specific info&lt;br /&gt;
atoms_file = 'atoms.xyz'&lt;br /&gt;
pot_file = 'gap_files/CO.gap'&lt;br /&gt;
n_species = 2&lt;br /&gt;
species = C O&lt;br /&gt;
masses = 12.01 15.99&lt;br /&gt;
e0 = -.16138053 0.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Output:&lt;br /&gt;
&lt;br /&gt;
; &amp;lt;code&amp;gt;trajectory_out.xyz&amp;lt;/code&amp;gt;&lt;br /&gt;
: which contains atomic positions, local energy and local property arrays for each structure.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt; 512&lt;br /&gt;
Properties=species:S:1:pos:R:3:forces:R:3:local_energy:R:1:core_electron_be:R:1 \&lt;br /&gt;
   Lattice=&amp;quot;...&amp;quot; energy=-4321.582604 energy_soap=-4114.77018429  energy_2b=-124.73820332 energy_3b=0.55261463 \&lt;br /&gt;
   energy_core_pot=0.00000000 energy_vdw=0.00000000 energy_exp=0.00000000 energy_xps=0.00000000 \&lt;br /&gt;
   virial=&amp;quot;...&amp;quot; stress=&amp;quot;...&amp;quot; volume=5372.640346&lt;br /&gt;
   C              4.39625950       7.79414272      11.91703476     \&lt;br /&gt;
                  -0.00176074      -0.00403026       0.00040104    \&lt;br /&gt;
                  -8.32055957 \ # Local energy prediction&lt;br /&gt;
                  283.83841418  # CEBE Prediction&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Withiout specifying Exp. data, Turbogap does not predict the spectra.&lt;br /&gt;
* XPS spectra can simply be calculated from &amp;lt;code&amp;gt;core_electron_be&amp;lt;/code&amp;gt; in &amp;lt;code&amp;gt;trajectory_out.xyz&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;grand-canonical-monte-carlo&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
== (Grand-Canonical) Monte-Carlo ==&lt;br /&gt;
&lt;br /&gt;
* We use &amp;lt;code&amp;gt;mc&amp;lt;/code&amp;gt; mode&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;[mpirun -np N] turbogap mc&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
* ''e.g'' For a &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mu V T&amp;lt;/math&amp;gt; simulation of system in oxygen environment&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre class=&amp;quot;conf&amp;quot;&amp;gt;! Monte-carlo options&lt;br /&gt;
mc_nsteps = 1000                         # Number of Monte-Carlo Steps&lt;br /&gt;
n_mc_types = 3                           # Number of MC move types&lt;br /&gt;
mc_types = 'move' 'insertion' 'removal'  # MC move types (move/insertion/removal/volume/swap/md)&lt;br /&gt;
mc_move_max = 0.5                        # Maximum distance for MC displacement (&amp;amp;quot;move&amp;amp;quot;) type moves&lt;br /&gt;
&lt;br /&gt;
! - GCMC Options&lt;br /&gt;
n_mc_mu = 1              # Number of chemical potentials to add&lt;br /&gt;
mc_mu = 0                # Chemical potential(s) [eV]&lt;br /&gt;
mc_species = 'O'         # GCMC species types&lt;br /&gt;
mc_min_dist = 0.1        # GCMC minimum insertion distance&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Output:&lt;br /&gt;
&lt;br /&gt;
; &amp;lt;code&amp;gt;mc.log&amp;lt;/code&amp;gt;&lt;br /&gt;
: &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;# mc_istep  mc_move  accepted  E_trial              E_current             E_exp_trial          E_exp_current  N_tot_trial  N_mc_species_trial&lt;br /&gt;
       1       move    F       -4321.10376531       -4321.58260476         272.97693282         272.83692252      512  O        0&lt;br /&gt;
       2       move    F       -4321.10017027       -4321.58260476         272.68730901         272.83692252      512  O        0&lt;br /&gt;
       3  insertion    F       -4319.14082561       -4321.58260476         269.49191203         272.83692252      513  O        1&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; &amp;lt;code&amp;gt;mc_all.xyz&amp;lt;/code&amp;gt;&lt;br /&gt;
: xyz file written to every &amp;lt;code&amp;gt;write_xyz = N&amp;lt;/code&amp;gt; steps.&lt;br /&gt;
; &amp;lt;code&amp;gt;mc_current.xyz&amp;lt;/code&amp;gt;&lt;br /&gt;
: xyz file saving current accepted config written to every &amp;lt;code&amp;gt;write_xyz = N&amp;lt;/code&amp;gt; steps.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* If we run &amp;lt;code&amp;gt;bash run.sh standard_gcmc&amp;lt;/code&amp;gt; (may take a few minutes), we can see a prediction of the XPS with oxygen content&lt;br /&gt;
&lt;br /&gt;
[[File:standard_gcmc.png | 800px]]&lt;br /&gt;
&lt;br /&gt;
We see there is a large amount of oxygen inserted due to the large chemical potential for this simulation. This shifts the xps to large binding core electron binding energies, and there is no agreement the final structure with the experimental XPS. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;experimental-observable-optimization&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Experimental Observable Optimization ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;[mpirun -np N] turbogap mc/md&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
* We can specify experimental observables to predict and optimize them using MC or MD. &amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; E_{\rm spectra} = \frac{1}{2} \gamma \int \,d\varepsilon (g_{\rm pred}(\varepsilon) - g_{\rm exp}(\varepsilon))^2  &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre class=&amp;quot;conf&amp;quot;&amp;gt;! Experimental data options&lt;br /&gt;
n_exp = 1                                  # Number of experimental observables&lt;br /&gt;
exp_labels = 'xps'                         # Experimental observable types (xps/xrd/nd/pdf)&lt;br /&gt;
exp_data_files = 'xps_spectra_interp.dat'  # Experimental data files (Note: the range of resulting XPS prediction will be the same as the experimental range.)&lt;br /&gt;
exp_n_samples = 501                        # Number of interpolations samples over the experimental range.&lt;br /&gt;
exp_energy_scales = 100.0                    # Energy scale (gamma) [eV]&lt;br /&gt;
&lt;br /&gt;
# XPS smearing&lt;br /&gt;
xps_sigma = 0.4&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Output:&lt;br /&gt;
&lt;br /&gt;
; &amp;lt;code&amp;gt;xps_prediction.dat&amp;lt;/code&amp;gt;&lt;br /&gt;
: Data file written every &amp;lt;code&amp;gt;write_xyz = N&amp;lt;/code&amp;gt; steps. Separate predictions separated by blank lines.&lt;br /&gt;
; &amp;lt;code&amp;gt;xps_exp.dat&amp;lt;/code&amp;gt;&lt;br /&gt;
: The experimental data fed into ''TurboGAP''.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* If we run &amp;lt;code&amp;gt;bash run.sh xps_optimization_gcmc&amp;lt;/code&amp;gt; (may take a few minutes), we can see a prediction of the XPS with oxygen content&lt;br /&gt;
&lt;br /&gt;
[[File:xps_optimization_gcmc.png | 800px]]&lt;br /&gt;
&lt;br /&gt;
We can observe the significant effect of the energy scale here. The experimental energy decreases quickly, with a concurrent increase in the energy per atom. After spectral agreement, the system is allowed to relax. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;multiple-observables&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Multiple Observables ==&lt;br /&gt;
&lt;br /&gt;
* This is not in the tutorial files, but ''TurboGAP'' allows for we can optimization multiple observables.&lt;br /&gt;
** X-ray diffraction&lt;br /&gt;
** Neutron diffraction&lt;br /&gt;
** Pair distribution function&lt;br /&gt;
** XPS&lt;br /&gt;
* Here we show a fictitious example of XPS and XRD optimization.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre class=&amp;quot;conf&amp;quot;&amp;gt;# Partial PDFs needed for XRD calculation&lt;br /&gt;
pair_distribution_n_samples = 301&lt;br /&gt;
r_range_min = 0.1&lt;br /&gt;
r_range_max = 13.5&lt;br /&gt;
pair_distribution_rcut = 14.1&lt;br /&gt;
&lt;br /&gt;
do_xrd = .true.&lt;br /&gt;
&lt;br /&gt;
# Experimental Data Specification&lt;br /&gt;
n_exp = 2                  # Number of Exp. observables&lt;br /&gt;
exp_labels = 'xps' 'xrd'   # Exp. observable type (xps/xrd/nd/pdf)&lt;br /&gt;
exp_data_files = 'xps_spectra_experiment.dat' 'xrd_CO_experiment.dat'&lt;br /&gt;
exp_n_samples = 301 301 # Number of samples for the experimental data&lt;br /&gt;
exp_energy_scales = 10.0 10.0  # The &amp;amp;quot;gamma&amp;amp;quot; term for each observable&lt;br /&gt;
&lt;br /&gt;
# If using monte-carlo, the experimental energies are added directly to the local energy&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;span id=&amp;quot;applications&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
= Applications =&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;experimental-observable-predictionoptimization&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
== Experimental Observable prediction/optimization ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;deconvolution-analysis&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== Deconvolution analysis ===&lt;br /&gt;
&lt;br /&gt;
* Use subgraph isomorphisms of bonding networks to discern motifs present.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:exp_xps_with_background_high.png | 400px]]&lt;br /&gt;
&lt;br /&gt;
↑ Experimental XPS deconvolution ([[#citeproc_bib_item_9|Santini et al. 2015]])&lt;br /&gt;
&lt;br /&gt;
We see in the experimental deconvolution analysis that sp3 motifs compose the primary XPS peak. The generation of a-COx here was done by physical vapor deposition of graphitic carbon in an oxygen environment. They see a reduction in the number of sp2 bonds. They also claim there is a complete transformation of sp2 to sp3 that is reversible with a short annealing at 500C. &lt;br /&gt;
&lt;br /&gt;
[[File:deconvolution_comparison_fill_-3_new.png| 400px]]&lt;br /&gt;
&lt;br /&gt;
↑ Our XPS deconvolution ([[#citeproc_bib_item_9|Santini et al. 2015]])&lt;br /&gt;
&lt;br /&gt;
However from our deconvolution analysis, we see that this primary peak is composed of sp2 motifs. We can explain why the experimentalists see only sp2 with a simple computational experiment. &lt;br /&gt;
&lt;br /&gt;
We add in oxygen to the bottom layer of a graphene bilayer system to see the influence of oxygen on sp2 core electron binding energies. &lt;br /&gt;
&lt;br /&gt;
[[File:xps_shifts_miguel_first.png| 400px]]&lt;br /&gt;
&lt;br /&gt;
[[File:xps_shifts_miguel_last.png| 400px]]&lt;br /&gt;
&lt;br /&gt;
We see with oxygen content that sp2 motifs are shifted significantly, even past the sp3 reference. Due to the presence of oxygen, there is a shift of sp2 motifs which are not accounted for by the experimental deconvolution references, as these are fixed. This is why the experimental deconvolution did not give what we expect: sp2 carbon that composes the primary XPS peak. &lt;br /&gt;
&amp;lt;span id=&amp;quot;summary&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Summary =&lt;br /&gt;
&lt;br /&gt;
* Machine-learned potentials can be combined with experimental models to give structures which are consistent with both ''ab-inito'' and experimental data.&lt;br /&gt;
* We can generate oxygenated amorphous carbon structures using a CO GAP with XPS prediction using modified GCMC and a “Molecular Augmented Dynamics” method.&lt;br /&gt;
* We can use ''multiple experimental observables''.&lt;br /&gt;
* '''Finding structures which match experimental data allows us to understand specific experimental results.'''&lt;br /&gt;
* Deconvolve experimental XPS exactly.&lt;br /&gt;
* All of this is implemented in the ''TurboGAP'' code.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;references&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
= References =&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;citeproc_bib_item_1&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;Bartók, Albert P., Risi Kondor, and Gábor Csányi. 2013. “On Representing Chemical Environments.” ''Physical Review B'' 87 (18): 184115. https://doi.org/10.1103/PhysRevB.87.184115.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;citeproc_bib_item_2&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;Bartók, Albert P., Mike C. Payne, Risi Kondor, and Gábor Csányi. 2010. “Gaussian Approximation Potentials: The Accuracy of Quantum Mechanics, without the Electrons.” ''Physical Review Letters'' 104 (13): 136403. https://doi.org/10.1103/PhysRevLett.104.136403.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;citeproc_bib_item_3&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;Caro, Miguel A. 2019. “Optimizing Many-Body Atomic Descriptors for Enhanced Computational Performance of Machine Learning Based Interatomic Potentials.” ''Physical Review B'' 100 (2): 024112. https://doi.org/10.1103/PhysRevB.100.024112.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;citeproc_bib_item_4&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;Deringer, Volker L., Albert P. Bartók, Noam Bernstein, David M. Wilkins, Michele Ceriotti, and Gábor Csányi. 2021. “Gaussian Process Regression for Materials and Molecules.” ''Chemical Reviews'' 121 (16): 10073–141. https://doi.org/10.1021/acs.chemrev.1c00022.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;citeproc_bib_item_5&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;El-Machachi, Zakariya, Damyan Frantzov, A. Nijamudheen, Tigany Zarrouk, Miguel A. Caro, and Volker L. Deringer. 2024. “Accelerated First-Principles Exploration of Structure and Reactivity in Graphene Oxide.” arXiv. https://doi.org/10.48550/arXiv.2405.14814.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;citeproc_bib_item_6&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;Golze, Dorothea, Markus Hirvensalo, Patricia Hernández-León, Anja Aarva, Jarkko Etula, Toma Susi, Patrick Rinke, Tomi Laurila, and Miguel A. Caro. 2022. “Accurate Computational Prediction of Core-Electron Binding Energies in Carbon-Based Materials: A Machine-Learning Model Combining Density-Functional Theory and GW.” ''Chemistry of Materials'' 34 (14): 6240–54. https://doi.org/10.1021/acs.chemmater.1c04279.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;citeproc_bib_item_7&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;Muhli, Heikki, Xi Chen, Albert P. Bartók, Patricia Hernández-León, Gábor Csányi, Tapio Ala-Nissila, and Miguel A. Caro. 2021. “Machine Learning Force Fields Based on Local Parametrization of Dispersion Interactions: Application to the Phase Diagram of \&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathrm\\\C\\\\\_\60\\&amp;lt;/math&amp;gt;.” ''Physical Review B'' 104 (5): 054106. https://doi.org/10.1103/PhysRevB.104.054106.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;citeproc_bib_item_8&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;Opletal, George, Timothy C. Petersen, Amanda S. Barnard, and Salvy P. Russo. 2017. “On Reverse Monte Carlo Constraints and Model Reproduction.” ''Journal of Computational Chemistry'' 38 (17): 1547–51. https://doi.org/10.1002/jcc.24799.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;citeproc_bib_item_9&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;Santini, Claudia A., Abu Sebastian, Chiara Marchiori, Vara Prasad Jonnalagadda, Laurent Dellmann, Wabe W. Koelmans, Marta D. Rossell, Christophe P. Rossel, and Evangelos Eleftheriou. 2015. “Oxygenated Amorphous Carbon for Resistive Memory Applications.” ''Nature Communications'' 6 (1): 8600. https://doi.org/10.1038/ncomms9600.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;citeproc_bib_item_10&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;Wang, Yanzhou, Zheyong Fan, Ping Qian, Tapio Ala-Nissila, and Miguel A. Caro. 2022. “Structure and Pore Size Distribution in Nanoporous Carbon.” ''Chemistry of Materials'' 34 (2): 617–28. https://doi.org/10.1021/acs.chemmater.1c03279.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;citeproc_bib_item_11&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;Zarrouk, Tigany, Rina Ibragimova, Albert P. Bartók, and Miguel A. Caro. 2024. “Experiment-Driven Atomistic Materials Modeling: A Case Study Combining X-Ray Photoelectron Spectroscopy and Machine Learning Potentials to Infer the Structure of Oxygen-Rich Amorphous Carbon.” ''Journal of the American Chemical Society'' 146 (21): 14645–59. https://doi.org/10.1021/jacs.4c01897.&lt;/div&gt;</summary>
		<author><name>Tigany Zarrouk</name></author>
		
	</entry>
	<entry>
		<id>https://turbogap.fi/wiki/index.php?title=XPS-optimized_oxygenated_amorphous_carbon&amp;diff=657</id>
		<title>XPS-optimized oxygenated amorphous carbon</title>
		<link rel="alternate" type="text/html" href="https://turbogap.fi/wiki/index.php?title=XPS-optimized_oxygenated_amorphous_carbon&amp;diff=657"/>
		<updated>2024-06-19T10:24:26Z</updated>

		<summary type="html">&lt;p&gt;Tigany Zarrouk: /* Motivation for structural inference */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
&amp;lt;span id=&amp;quot;what-is-turbogap&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
= What is ''TurboGAP'' ? =&lt;br /&gt;
&lt;br /&gt;
* ''TurboGAP'' is a &amp;lt;code&amp;gt;Fortran&amp;lt;/code&amp;gt; atomistic code which uses &amp;lt;u&amp;gt;Gaussian Approximation Potentials&amp;lt;/u&amp;gt; (GAPs).&lt;br /&gt;
* Its specialty are ''SOAP turbo'' descriptors: faster and more accurate than SOAP (Smooth Overlap of Atomic Positions).&lt;br /&gt;
* It's (probably!) the fastest SOAP prediction code, which will be made even faster with ''GPU acceleration'' (ongoing with CSC).&lt;br /&gt;
&lt;br /&gt;
* Through GAP/SOAP predictions, one can perform simulations with ''ab-initio'' accuracy '''at scale'''&lt;br /&gt;
** Molecular Dynamics&lt;br /&gt;
** Grand-Canonical Monte-Carlo simulations&lt;br /&gt;
** Electronic-stopping and spatially-correlated Langevin Dynamics (in-development).&lt;br /&gt;
** '''Prediction/optimization of experimental observables''' (''e.g.'' X-Ray photoelectron spectra ([[#citeproc_bib_item_6|Golze et al. 2022]]; [[#citeproc_bib_item_11|Zarrouk et al. 2024]]), X-ray/Neutron Diffraction and more to come!).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;motivation-for-structural-inference&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Motivation for structural inference =&lt;br /&gt;
&lt;br /&gt;
* We typically want to &amp;lt;u&amp;gt;predict structures&amp;lt;/u&amp;gt;, to make sense of experimental data.&lt;br /&gt;
* We usually pray structures have &amp;lt;u&amp;gt;experimental agreement&amp;lt;/u&amp;gt; (a “bottom-up” approach).&lt;br /&gt;
* What if we can &amp;lt;u&amp;gt;promote agreement&amp;lt;/u&amp;gt; with experimental data?&lt;br /&gt;
* ''Reverse Monte-Carlo'' techniques match experimental data to atomic structure (“top-down” approach).&lt;br /&gt;
** Downsides: “By-hand” constraints&lt;br /&gt;
** Simple experimental observables.&lt;br /&gt;
** Unphysical structures/artifacts ([[#citeproc_bib_item_8|Opletal et al. 2017]])&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Need efficient structure search to find '''agreement''' with '''experimental''' data ''and'' '''ab-inito''' data.&lt;br /&gt;
&lt;br /&gt;
With &amp;lt;u&amp;gt;CO GAP + Core electron binding energy SOAP&amp;lt;/u&amp;gt; model we will perform '''modified (Grand-canonical) Monte-Carlo''' to produce ''experimentally consistent, low energy structures'' of oxygenated amorphous carbon.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:deconvolution_comparison_fill_-3_new.png | 400px]]&lt;br /&gt;
We will do simulations similar to the above, is from our JACS paper. &lt;br /&gt;
&amp;lt;span id=&amp;quot;theory-and-methods&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Theory and Methods =&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;gaussian-approximation-potentials-gap&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
== Gaussian Approximation Potentials (GAP) ==&lt;br /&gt;
&lt;br /&gt;
([[#citeproc_bib_item_2|Bartók et al. 2010]]; [[#citeproc_bib_item_1|Bartók, Kondor, and Csányi 2013]]; [[#citeproc_bib_item_4|Deringer et al. 2021]])&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;u&amp;gt;Assumption&amp;lt;/u&amp;gt;: Total energy is sum of '''local energies'''. &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;E_{\rm total}(\{\mathbf{r}\}) = \sum_i^{N_{\text{atoms}}} \varepsilon^i(\{r\}, \{\xi^{\text{2b}}_i\}, \{\boldsymbol{\xi}^{\text{3b}}_i\}, \boldsymbol{\xi}^{\text{mb}}_i))&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;\begin{align}&lt;br /&gt;
  \varepsilon^i ( &amp;amp;\{r\}, \{\xi^{\text{2b}}_i\}, \{\boldsymbol{\xi}^{\text{3b}}_i\}, \boldsymbol{\xi}^{\text{mb}}_i) =&lt;br /&gt;
   E^{\text{2b}}(\{\xi^{\text{2b}}_i\}) + E^{\text{3b}}(\{\boldsymbol{\xi}^{\text{3b}}_i\}) \nonumber\\&lt;br /&gt;
  &amp;amp; + E^{\text{mb}}(\boldsymbol{\xi}^{\text{mb}}_i)&lt;br /&gt;
  + \sum_{r &amp;lt; r_{\rm cut}^{\rm core}} E^{\text{core}}(r)  \nonumber&lt;br /&gt;
\end{align}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
; Local energy&lt;br /&gt;
: Sum of '''2b, 3b and many-body''' terms.&lt;br /&gt;
; Descriptor &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\xi / \boldsymbol{\xi}&amp;lt;/math&amp;gt;.&lt;br /&gt;
: ''e.g'' &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\{\xi^{\text{2b}}\} = \{r_{ij}\}&amp;lt;/math&amp;gt;, &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\{\boldsymbol{\xi}^{\text{3b}}\} = \{ [ r_{ij}, r_{ik}, r_{kj} ] \}&amp;lt;/math&amp;gt;&lt;br /&gt;
; Local environment&lt;br /&gt;
: A set of descriptors.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;using-descriptors-to-predict-quantities&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== Using descriptors to predict quantities ===&lt;br /&gt;
&lt;br /&gt;
* ''Kernel/basis functions'' &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;k_{ij}(\boldsymbol{\xi}_i, \boldsymbol{\xi}_j)&amp;lt;/math&amp;gt; measure the ''similarity between descriptors''.&lt;br /&gt;
* ''e.g'' Exponential 2b kernel: &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;k^{2b}_{ij}(\xi_i, \xi_j) \equiv k^{2b}_{ij}(r_{i}, r_{j}) = \exp( - (r_{i} - r_{j})^2/2\sigma^2 )&amp;lt;/math&amp;gt;&lt;br /&gt;
* ''Gaussian Process Regression'' (kernel matrix algebra on training set) → ''fitting coefficients'' &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\{\alpha\}&amp;lt;/math&amp;gt;, ([[#citeproc_bib_item_4|Deringer et al. 2021]])&lt;br /&gt;
* ''e.g.'' 2b model trained with &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;N_s&amp;lt;/math&amp;gt; descriptors &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\{\xi\} \in \{\xi_i, \ldots, \xi_{Ns}\}&amp;lt;/math&amp;gt;, the energy for atom with &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;M&amp;lt;/math&amp;gt; pairwise distances in local environment: &amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;E^{2b} = \sum_i^M \left(E^{2b}_0 + \delta^2\sum_j^{N_s}  \alpha_j k^{2b}_{ij}(\xi_i, \xi_j) \right) &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;soap-many-body-descriptor&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== SOAP (many-body) descriptor ===&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;u&amp;gt;SOAP descriptor&amp;lt;/u&amp;gt;: &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\boldsymbol{\xi}_i(\{\mathbf{r}\}_{ &amp;lt; r_{\rm cut}} )&amp;lt;/math&amp;gt;, represents environment of an atom ([[#citeproc_bib_item_2|Bartók et al. 2010]]).&lt;br /&gt;
* &amp;lt;u&amp;gt;Kernel&amp;lt;/u&amp;gt;: &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;k_{ij} = (\boldsymbol{\xi}_i \cdot \boldsymbol{\xi}_j)^{\zeta}&amp;lt;/math&amp;gt; measures &amp;lt;u&amp;gt;similarity of environments&amp;lt;/u&amp;gt;.&lt;br /&gt;
* &amp;lt;u&amp;gt;Fitting coefficients&amp;lt;/u&amp;gt;: &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\alpha_j&amp;lt;/math&amp;gt; result from Gaussian Process Regression.&lt;br /&gt;
* &amp;lt;u&amp;gt;Prediction&amp;lt;/u&amp;gt;: &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;E^{\rm mb}_i(\boldsymbol{\xi}_i) = E^{\rm mb}_0 + \delta^2\sum_j  \alpha_j k_{ij}&amp;lt;/math&amp;gt;&lt;br /&gt;
* For specifics of SOAP turbo, refer to Miguel's paper ([[#citeproc_bib_item_3|Caro 2019]])&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;how-do-we-model-xps&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== How do we model XPS? ==&lt;br /&gt;
&lt;br /&gt;
* XPS (X-ray photoelectron spectroscopy) spectra measure '''core electron binding energies'''.&lt;br /&gt;
* Core electron binding energies ''depend on atomic environment''.&lt;br /&gt;
* SOAP turbo model trained on DFT (&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\Delta\text{KS}&amp;lt;/math&amp;gt;) data with a &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;GW&amp;lt;/math&amp;gt; correction on top ([[#citeproc_bib_item_6|Golze et al. 2022]]).&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\text{CEBE} = ( \Delta KS^0_{\rm extended} + GW_{\rm carved} - \Delta \mathrm{KS}^+_{\rm carved} )&amp;lt;/math&amp;gt;&lt;br /&gt;
* Thermal and instrumental broadening accounted for by a Gaussian with &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\sigma = 0.4\text{ eV}&amp;lt;/math&amp;gt;&lt;br /&gt;
* Can analyse environments which make up spectra.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;prediction-of-local-properties&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Prediction of Local Properties ==&lt;br /&gt;
&lt;br /&gt;
* We can predict an &amp;lt;u&amp;gt;arbitrary number&amp;lt;/u&amp;gt; of ''local properties'' which use SOAP turbo descriptors using ''TurboGAP''.&lt;br /&gt;
* /One can get these for “free”/ if local property models are trained using the same descriptors as atomic energies/forces.&lt;br /&gt;
*; ''Hirshfeld volumes''&lt;br /&gt;
*: gives vdW dispersion via Tkatchenko-Scheffler. &amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; E_{\rm TS} = \sum_i \sum_{j\neq i} C_{6, ij}(v_{i}(\boldsymbol{\xi}_i), v_{j}(\boldsymbol{\xi}_j))\frac{f_{\rm damp}(r_{ij}, \ldots)}{r_{ij}^6} &amp;lt;/math&amp;gt;&lt;br /&gt;
*; ''Core-electron binding energies''&lt;br /&gt;
*: give '''X-ray Photoelectron Spectroscopy''' prediction. &amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; g_{\rm xps}(\varepsilon) = \frac{1}{M} \sum_i \exp\left( -(\varepsilon - \varepsilon_{i}(\boldsymbol{\xi}_i))^2/(2\sigma^2)  \right) &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;how-do-we-marry-experimental-data-and-gap&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
== How do we marry experimental data and GAP? ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* '''Generalized Hamiltonian within Grand-Canonical Monte-Carlo''' scheme.&lt;br /&gt;
* Vary oxygen content with chemical potential, to see motif differences.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;  \textcolor{violet}{ \mathbf{\tilde{g}}_{\rm {pred}}}(\varepsilon)  = \sum_{i} \exp\left(&lt;br /&gt;
-\frac{(\varepsilon - \textcolor{blue}{\varepsilon^{i}_{\rm&lt;br /&gt;
{pred}}(\boldsymbol{\xi}_i)})^2}{2\sigma^2}\right)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; \tilde{E} = E_{\rm GAP} + E_{\rm spectra} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; E_{\rm spectra} =  \frac{1}{2}\gamma \int \,d\varepsilon \left( \textcolor{violet}{ g_{\rm pred}(\varepsilon)} - g_{\rm exp}(\varepsilon)\right)^2&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;p&amp;gt;A simple squared difference, which is a penalty with increases with spectra dissimilarity and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\gamma&amp;lt;/math&amp;gt; is an energy scale.&amp;lt;/p&amp;gt;&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;p&amp;gt;We can do not just XPS but also X-ray/neutron diffraction and pair distribution functions.&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;[[File:xps_gcmc_scheme.png | 400px]]&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;/ul&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* We use the standard acceptance criteria for adding/removing/moving a particle&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; \mathrm{acc}(N \rightarrow N+1) = \mathrm{min}\left[1,&lt;br /&gt;
\frac{V}{\lambda^3 (N+1)} \exp\left\{ - \frac{\tilde{E}(N+1) -&lt;br /&gt;
\tilde{E}(N) - \mu}{k_BT} \right\}     \right] &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; \mathrm{acc}(N \rightarrow N-1) = \mathrm{min}\left[1,&lt;br /&gt;
\frac{\lambda^3 N}{V} \exp\left\{ -\frac{\tilde{E}(N-1) -&lt;br /&gt;
\tilde{E}(N) + \mu}{k_BT} \right\}     \right] &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; \mathrm{acc}_{\rm move} = \mathrm{min }\left[ 1, \exp\left\{ -&lt;br /&gt;
  \frac{\tilde{E}(\mathrm{new}) - \tilde{E}(\mathrm{old})}{k_BT} \right\} \right]&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;usage&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Usage =&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;installing-turbogap&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
== Installing ''TurboGAP'' ==&lt;br /&gt;
&lt;br /&gt;
We can install the ''TurboGAP'' code, found here https://github.com/mcaroba/turbogap through ''recursively cloning'' the main branch&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;git clone --recursive https://github.com/mcaroba/turbogap.git&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
Then we edit this line in the &amp;lt;code&amp;gt;Makefile&amp;lt;/code&amp;gt; to match our system architecture.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;include makefiles/Makefile.Ubuntu_gfortran_mpi&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Then, we make&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;make&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
and then export the path in &amp;lt;code&amp;gt;.bashrc&amp;lt;/code&amp;gt; file&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;export PATH=&amp;quot;~/turbogap/bin:$PATH&amp;quot;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;span id=&amp;quot;what-you-need-for-a-calculation&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
== What you need for a calculation ==&lt;br /&gt;
&lt;br /&gt;
; &amp;lt;code&amp;gt;gap_files/&amp;lt;/code&amp;gt; directory&lt;br /&gt;
: The directory which contains your &amp;lt;code&amp;gt;*.gap&amp;lt;/code&amp;gt;, with alphas (fitting coefficients) and sparse set descriptor files.&lt;br /&gt;
;* Potentials are available from ''TurboGAP'' wiki https://turbogap.fi/wiki/index.php/Potentials&lt;br /&gt;
;* Conversion script from &amp;lt;code&amp;gt;gap_fit .xml&amp;lt;/code&amp;gt; to &amp;lt;code&amp;gt;.gap&amp;lt;/code&amp;gt; can be used &amp;lt;code&amp;gt;turbogap/tools/make_gap_files.py&amp;lt;/code&amp;gt;&lt;br /&gt;
; &amp;lt;code&amp;gt;input&amp;lt;/code&amp;gt; file&lt;br /&gt;
: The file which tells the code what to do&lt;br /&gt;
; &amp;lt;code&amp;gt;*.xyz&amp;lt;/code&amp;gt;&lt;br /&gt;
: An extended xyz format file which contains positions/lattice/velocity information.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;adding-a-local-property-model-for-cebe-prediction&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== Adding a local property model for CEBE prediction ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;  gap_beg soap_turbo&lt;br /&gt;
  n_species = 2&lt;br /&gt;
  species = C O&lt;br /&gt;
  central_species = 1&lt;br /&gt;
... some params ...&lt;br /&gt;
  zeta = 4&lt;br /&gt;
  delta = 0.1&lt;br /&gt;
  desc_sparse = &amp;quot;gap_files/CO.xml.sparseX.GAP_2022_5_19_180_7_17_31_41410&amp;quot;&lt;br /&gt;
  alphas_sparse = &amp;quot;gap_files/alphas_soap_turbo_1.dat&amp;quot;&lt;br /&gt;
  compress_mode = &amp;quot;trivial&amp;quot;&lt;br /&gt;
  has_local_properties = .true.&lt;br /&gt;
  n_local_properties = 1&lt;br /&gt;
  local_property_qs = 'gap_files/core_electron_be.xml.sparseX.GAP_2024_1_26_120_18_36_33_6091'&lt;br /&gt;
  local_property_alphas = 'gap_files/alphas_core_electron_be_1.dat'&lt;br /&gt;
  local_property_labels = 'core_electron_be'&lt;br /&gt;
  local_property_zetas = 2&lt;br /&gt;
  local_property_deltas = 1.0&lt;br /&gt;
  local_property_v0s = 290.0&lt;br /&gt;
  gap_end&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;span id=&amp;quot;conversion-of-gap_fit-.xml-files-to-.gap-format&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== Conversion of &amp;lt;code&amp;gt;gap_fit&amp;lt;/code&amp;gt; &amp;lt;code&amp;gt;*.xml&amp;lt;/code&amp;gt; files to &amp;lt;code&amp;gt;*.gap&amp;lt;/code&amp;gt; format ===&lt;br /&gt;
&lt;br /&gt;
* Then we convert the &amp;lt;code&amp;gt;*.xml&amp;lt;/code&amp;gt; files which result from &amp;lt;code&amp;gt;gap_fit&amp;lt;/code&amp;gt; into the required format for ''TurboGAP''.&lt;br /&gt;
* This is done using the convenience script in &amp;lt;code&amp;gt;turbogap/tools/make_gap_files.py&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;python3 make_gap_files.py {gap_file.xml} {gap_file.gap} {N_local_prop.} \&lt;br /&gt;
              {local_prop1.xml} {local_prop_label1} \&lt;br /&gt;
              {local_prop2.xml} {local_prop_label2}...&lt;br /&gt;
# e.g. let's build a carbon oxygen GAP&lt;br /&gt;
# with core electron binding energy prediction capability.&lt;br /&gt;
python3 make_gap_files.py CO.xml CO.gap 1 \&lt;br /&gt;
        core_electron_be_co.xml core_electron_be&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
* This creates a directory &amp;lt;code&amp;gt;gap_files/&amp;lt;/code&amp;gt; which has&lt;br /&gt;
*# &amp;lt;code&amp;gt;alphas_{descriptor}.dat&amp;lt;/code&amp;gt; which are fitting coefficients for a particular descriptor&lt;br /&gt;
*# &amp;lt;code&amp;gt;qs_{descriptor}.dat&amp;lt;/code&amp;gt; which are the '''sparse set''' descriptors, used for prediction.&lt;br /&gt;
*# &amp;lt;code&amp;gt;alphas_{local_property}.dat&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;qs_{local_property}.dat&amp;lt;/code&amp;gt; for local property prediction.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;running-the-tutorial&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
== Running the Tutorial ==&lt;br /&gt;
&lt;br /&gt;
* Navigate to &amp;lt;code&amp;gt;turbogap/tutorials/xps_optimizaton&amp;lt;/code&amp;gt;&lt;br /&gt;
* Run &amp;lt;code&amp;gt;bash run.sh {calc_type}&amp;lt;/code&amp;gt; where &amp;lt;code&amp;gt;{calc_type}&amp;lt;/code&amp;gt; is either:&lt;br /&gt;
** &amp;lt;code&amp;gt;prediction&amp;lt;/code&amp;gt;&lt;br /&gt;
** &amp;lt;code&amp;gt;standard_gcmc&amp;lt;/code&amp;gt;&lt;br /&gt;
** &amp;lt;code&amp;gt;xps_optimization_gcmc&amp;lt;/code&amp;gt;&lt;br /&gt;
* Note that these simulations have a high chemical potential and (have high &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\gamma&amp;lt;/math&amp;gt; factors), these are just to give a result in a reasonable amount of time. Take care with real simulations.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;core-electron-binding-energy-prediction&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
== Core electron binding energy prediction ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;[mpirun -np N] turbogap predict&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
* We have in our &amp;lt;code&amp;gt;input&amp;lt;/code&amp;gt; file&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre class=&amp;quot;conf&amp;quot;&amp;gt;! Species-specific info&lt;br /&gt;
atoms_file = 'atoms.xyz'&lt;br /&gt;
pot_file = 'gap_files/CO.gap'&lt;br /&gt;
n_species = 2&lt;br /&gt;
species = C O&lt;br /&gt;
masses = 12.01 15.99&lt;br /&gt;
e0 = -.16138053 0.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Output:&lt;br /&gt;
&lt;br /&gt;
; &amp;lt;code&amp;gt;trajectory_out.xyz&amp;lt;/code&amp;gt;&lt;br /&gt;
: which contains atomic positions, local energy and local property arrays for each structure.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt; 512&lt;br /&gt;
Properties=species:S:1:pos:R:3:forces:R:3:local_energy:R:1:core_electron_be:R:1 \&lt;br /&gt;
   Lattice=&amp;quot;...&amp;quot; energy=-4321.582604 energy_soap=-4114.77018429  energy_2b=-124.73820332 energy_3b=0.55261463 \&lt;br /&gt;
   energy_core_pot=0.00000000 energy_vdw=0.00000000 energy_exp=0.00000000 energy_xps=0.00000000 \&lt;br /&gt;
   virial=&amp;quot;...&amp;quot; stress=&amp;quot;...&amp;quot; volume=5372.640346&lt;br /&gt;
   C              4.39625950       7.79414272      11.91703476     \&lt;br /&gt;
                  -0.00176074      -0.00403026       0.00040104    \&lt;br /&gt;
                  -8.32055957 \ # Local energy prediction&lt;br /&gt;
                  283.83841418  # CEBE Prediction&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Withiout specifying Exp. data, Turbogap does not predict the spectra.&lt;br /&gt;
* XPS spectra can simply be calculated from &amp;lt;code&amp;gt;core_electron_be&amp;lt;/code&amp;gt; in &amp;lt;code&amp;gt;trajectory_out.xyz&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;grand-canonical-monte-carlo&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
== (Grand-Canonical) Monte-Carlo ==&lt;br /&gt;
&lt;br /&gt;
* We use &amp;lt;code&amp;gt;mc&amp;lt;/code&amp;gt; mode&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;[mpirun -np N] turbogap mc&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
* ''e.g'' For a &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mu V T&amp;lt;/math&amp;gt; simulation of system in oxygen environment&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre class=&amp;quot;conf&amp;quot;&amp;gt;! Monte-carlo options&lt;br /&gt;
mc_nsteps = 1000                         # Number of Monte-Carlo Steps&lt;br /&gt;
n_mc_types = 3                           # Number of MC move types&lt;br /&gt;
mc_types = 'move' 'insertion' 'removal'  # MC move types (move/insertion/removal/volume/swap/md)&lt;br /&gt;
mc_move_max = 0.5                        # Maximum distance for MC displacement (&amp;amp;quot;move&amp;amp;quot;) type moves&lt;br /&gt;
&lt;br /&gt;
! - GCMC Options&lt;br /&gt;
n_mc_mu = 1              # Number of chemical potentials to add&lt;br /&gt;
mc_mu = 0                # Chemical potential(s) [eV]&lt;br /&gt;
mc_species = 'O'         # GCMC species types&lt;br /&gt;
mc_min_dist = 0.1        # GCMC minimum insertion distance&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Output:&lt;br /&gt;
&lt;br /&gt;
; &amp;lt;code&amp;gt;mc.log&amp;lt;/code&amp;gt;&lt;br /&gt;
: &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;# mc_istep  mc_move  accepted  E_trial              E_current             E_exp_trial          E_exp_current  N_tot_trial  N_mc_species_trial&lt;br /&gt;
       1       move    F       -4321.10376531       -4321.58260476         272.97693282         272.83692252      512  O        0&lt;br /&gt;
       2       move    F       -4321.10017027       -4321.58260476         272.68730901         272.83692252      512  O        0&lt;br /&gt;
       3  insertion    F       -4319.14082561       -4321.58260476         269.49191203         272.83692252      513  O        1&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; &amp;lt;code&amp;gt;mc_all.xyz&amp;lt;/code&amp;gt;&lt;br /&gt;
: xyz file written to every &amp;lt;code&amp;gt;write_xyz = N&amp;lt;/code&amp;gt; steps.&lt;br /&gt;
; &amp;lt;code&amp;gt;mc_current.xyz&amp;lt;/code&amp;gt;&lt;br /&gt;
: xyz file saving current accepted config written to every &amp;lt;code&amp;gt;write_xyz = N&amp;lt;/code&amp;gt; steps.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* If we run &amp;lt;code&amp;gt;bash run.sh standard_gcmc&amp;lt;/code&amp;gt; (may take a few minutes), we can see a prediction of the XPS with oxygen content&lt;br /&gt;
&lt;br /&gt;
[[File:standard_gcmc.png | 800px]]&lt;br /&gt;
&lt;br /&gt;
We see there is a large amount of oxygen inserted due to the large chemical potential for this simulation. This shifts the xps to large binding core electron binding energies, and there is no agreement the final structure with the experimental XPS. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;experimental-observable-optimization&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Experimental Observable Optimization ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;[mpirun -np N] turbogap mc/md&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
* We can specify experimental observables to predict and optimize them using MC or MD. &amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; E_{\rm spectra} = \frac{1}{2} \gamma \int \,d\varepsilon (g_{\rm pred}(\varepsilon) - g_{\rm exp}(\varepsilon))^2  &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre class=&amp;quot;conf&amp;quot;&amp;gt;! Experimental data options&lt;br /&gt;
n_exp = 1                                  # Number of experimental observables&lt;br /&gt;
exp_labels = 'xps'                         # Experimental observable types (xps/xrd/nd/pdf)&lt;br /&gt;
exp_data_files = 'xps_spectra_interp.dat'  # Experimental data files (Note: the range of resulting XPS prediction will be the same as the experimental range.)&lt;br /&gt;
exp_n_samples = 501                        # Number of interpolations samples over the experimental range.&lt;br /&gt;
exp_energy_scales = 100.0                    # Energy scale (gamma) [eV]&lt;br /&gt;
&lt;br /&gt;
# XPS smearing&lt;br /&gt;
xps_sigma = 0.4&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Output:&lt;br /&gt;
&lt;br /&gt;
; &amp;lt;code&amp;gt;xps_prediction.dat&amp;lt;/code&amp;gt;&lt;br /&gt;
: Data file written every &amp;lt;code&amp;gt;write_xyz = N&amp;lt;/code&amp;gt; steps. Separate predictions separated by blank lines.&lt;br /&gt;
; &amp;lt;code&amp;gt;xps_exp.dat&amp;lt;/code&amp;gt;&lt;br /&gt;
: The experimental data fed into ''TurboGAP''.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* If we run &amp;lt;code&amp;gt;bash run.sh xps_optimization_gcmc&amp;lt;/code&amp;gt; (may take a few minutes), we can see a prediction of the XPS with oxygen content&lt;br /&gt;
&lt;br /&gt;
[[File:xps_optimization_gcmc.png | 800px]]&lt;br /&gt;
&lt;br /&gt;
We can observe the significant effect of the energy scale here. The experimental energy decreases quickly, with a concurrent increase in the energy per atom. After spectral agreement, the system is allowed to relax. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;multiple-observables&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Multiple Observables ==&lt;br /&gt;
&lt;br /&gt;
* This is not in the tutorial files, but ''TurboGAP'' allows for we can optimization multiple observables.&lt;br /&gt;
** X-ray diffraction&lt;br /&gt;
** Neutron diffraction&lt;br /&gt;
** Pair distribution function&lt;br /&gt;
** XPS&lt;br /&gt;
* Here we show a fictitious example of XPS and XRD optimization.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre class=&amp;quot;conf&amp;quot;&amp;gt;# Partial PDFs needed for XRD calculation&lt;br /&gt;
pair_distribution_n_samples = 301&lt;br /&gt;
r_range_min = 0.1&lt;br /&gt;
r_range_max = 13.5&lt;br /&gt;
pair_distribution_rcut = 14.1&lt;br /&gt;
&lt;br /&gt;
do_xrd = .true.&lt;br /&gt;
&lt;br /&gt;
# Experimental Data Specification&lt;br /&gt;
n_exp = 2                  # Number of Exp. observables&lt;br /&gt;
exp_labels = 'xps' 'xrd'   # Exp. observable type (xps/xrd/nd/pdf)&lt;br /&gt;
exp_data_files = 'xps_spectra_experiment.dat' 'xrd_CO_experiment.dat'&lt;br /&gt;
exp_n_samples = 301 301 # Number of samples for the experimental data&lt;br /&gt;
exp_energy_scales = 10.0 10.0  # The &amp;amp;quot;gamma&amp;amp;quot; term for each observable&lt;br /&gt;
&lt;br /&gt;
# If using monte-carlo, the experimental energies are added directly to the local energy&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;span id=&amp;quot;applications&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
= Applications =&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;experimental-observable-predictionoptimization&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
== Experimental Observable prediction/optimization ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;deconvolution-analysis&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== Deconvolution analysis ===&lt;br /&gt;
&lt;br /&gt;
* Use subgraph isomorphisms of bonding networks to discern motifs present.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:exp_xps_with_background_high.png | 400px]]&lt;br /&gt;
&lt;br /&gt;
↑ Experimental XPS deconvolution ([[#citeproc_bib_item_9|Santini et al. 2015]])&lt;br /&gt;
&lt;br /&gt;
We see in the experimental deconvolution analysis that sp3 motifs compose the primary XPS peak. The generation of a-COx here was done by physical vapor deposition of graphitic carbon in an oxygen environment. They see a reduction in the number of sp2 bonds. They also claim there is a complete transformation of sp2 to sp3 that is reversible with a short annealing at 500C. &lt;br /&gt;
&lt;br /&gt;
[[File:deconvolution_comparison_fill_-3_new.png| 400px]]&lt;br /&gt;
&lt;br /&gt;
↑ Our XPS deconvolution ([[#citeproc_bib_item_9|Santini et al. 2015]])&lt;br /&gt;
&lt;br /&gt;
However from our deconvolution analysis, we see that this primary peak is composed of sp2 motifs. We can explain why the experimentalists see only sp2 with a simple computational experiment. &lt;br /&gt;
&lt;br /&gt;
We add in oxygen to the bottom layer of a graphene bilayer system to see the influence of oxygen on sp2 core electron binding energies. &lt;br /&gt;
&lt;br /&gt;
[[File:xps_shifts_miguel_first.png| 400px]]&lt;br /&gt;
&lt;br /&gt;
[[File:xps_shifts_miguel_last.png| 400px]]&lt;br /&gt;
&lt;br /&gt;
We see with oxygen content that sp2 motifs are shifted significantly, even past the sp3 reference. Due to the presence of oxygen, there is a shift of sp2 motifs which are not accounted for by the experimental deconvolution references, as these are fixed. This is why the experimental deconvolution did not give what we expect: sp2 carbon that composes the primary XPS peak. &lt;br /&gt;
&amp;lt;span id=&amp;quot;summary&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Summary =&lt;br /&gt;
&lt;br /&gt;
* Machine-learned potentials can be combined with experimental models to give structures which are consistent with both ''ab-inito'' and experimental data.&lt;br /&gt;
* We can generate oxygenated amorphous carbon structures using a CO GAP with XPS prediction using modified GCMC and a “Molecular Augmented Dynamics” method.&lt;br /&gt;
* We can use ''multiple experimental observables''.&lt;br /&gt;
* '''Finding structures which match experimental data allows us to understand specific experimental results.'''&lt;br /&gt;
* Deconvolve experimental XPS exactly.&lt;br /&gt;
* All of this is implemented in the ''TurboGAP'' code.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;references&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
= References =&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;citeproc_bib_item_1&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;Bartók, Albert P., Risi Kondor, and Gábor Csányi. 2013. “On Representing Chemical Environments.” ''Physical Review B'' 87 (18): 184115. https://doi.org/10.1103/PhysRevB.87.184115.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;citeproc_bib_item_2&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;Bartók, Albert P., Mike C. Payne, Risi Kondor, and Gábor Csányi. 2010. “Gaussian Approximation Potentials: The Accuracy of Quantum Mechanics, without the Electrons.” ''Physical Review Letters'' 104 (13): 136403. https://doi.org/10.1103/PhysRevLett.104.136403.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;citeproc_bib_item_3&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;Caro, Miguel A. 2019. “Optimizing Many-Body Atomic Descriptors for Enhanced Computational Performance of Machine Learning Based Interatomic Potentials.” ''Physical Review B'' 100 (2): 024112. https://doi.org/10.1103/PhysRevB.100.024112.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;citeproc_bib_item_4&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;Deringer, Volker L., Albert P. Bartók, Noam Bernstein, David M. Wilkins, Michele Ceriotti, and Gábor Csányi. 2021. “Gaussian Process Regression for Materials and Molecules.” ''Chemical Reviews'' 121 (16): 10073–141. https://doi.org/10.1021/acs.chemrev.1c00022.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;citeproc_bib_item_5&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;El-Machachi, Zakariya, Damyan Frantzov, A. Nijamudheen, Tigany Zarrouk, Miguel A. Caro, and Volker L. Deringer. 2024. “Accelerated First-Principles Exploration of Structure and Reactivity in Graphene Oxide.” arXiv. https://doi.org/10.48550/arXiv.2405.14814.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;citeproc_bib_item_6&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;Golze, Dorothea, Markus Hirvensalo, Patricia Hernández-León, Anja Aarva, Jarkko Etula, Toma Susi, Patrick Rinke, Tomi Laurila, and Miguel A. Caro. 2022. “Accurate Computational Prediction of Core-Electron Binding Energies in Carbon-Based Materials: A Machine-Learning Model Combining Density-Functional Theory and GW.” ''Chemistry of Materials'' 34 (14): 6240–54. https://doi.org/10.1021/acs.chemmater.1c04279.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;citeproc_bib_item_7&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;Muhli, Heikki, Xi Chen, Albert P. Bartók, Patricia Hernández-León, Gábor Csányi, Tapio Ala-Nissila, and Miguel A. Caro. 2021. “Machine Learning Force Fields Based on Local Parametrization of Dispersion Interactions: Application to the Phase Diagram of \&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathrm\\\C\\\\\_\60\\&amp;lt;/math&amp;gt;.” ''Physical Review B'' 104 (5): 054106. https://doi.org/10.1103/PhysRevB.104.054106.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;citeproc_bib_item_8&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;Opletal, George, Timothy C. Petersen, Amanda S. Barnard, and Salvy P. Russo. 2017. “On Reverse Monte Carlo Constraints and Model Reproduction.” ''Journal of Computational Chemistry'' 38 (17): 1547–51. https://doi.org/10.1002/jcc.24799.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;citeproc_bib_item_9&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;Santini, Claudia A., Abu Sebastian, Chiara Marchiori, Vara Prasad Jonnalagadda, Laurent Dellmann, Wabe W. Koelmans, Marta D. Rossell, Christophe P. Rossel, and Evangelos Eleftheriou. 2015. “Oxygenated Amorphous Carbon for Resistive Memory Applications.” ''Nature Communications'' 6 (1): 8600. https://doi.org/10.1038/ncomms9600.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;citeproc_bib_item_10&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;Wang, Yanzhou, Zheyong Fan, Ping Qian, Tapio Ala-Nissila, and Miguel A. Caro. 2022. “Structure and Pore Size Distribution in Nanoporous Carbon.” ''Chemistry of Materials'' 34 (2): 617–28. https://doi.org/10.1021/acs.chemmater.1c03279.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;citeproc_bib_item_11&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;Zarrouk, Tigany, Rina Ibragimova, Albert P. Bartók, and Miguel A. Caro. 2024. “Experiment-Driven Atomistic Materials Modeling: A Case Study Combining X-Ray Photoelectron Spectroscopy and Machine Learning Potentials to Infer the Structure of Oxygen-Rich Amorphous Carbon.” ''Journal of the American Chemical Society'' 146 (21): 14645–59. https://doi.org/10.1021/jacs.4c01897.&lt;/div&gt;</summary>
		<author><name>Tigany Zarrouk</name></author>
		
	</entry>
	<entry>
		<id>https://turbogap.fi/wiki/index.php?title=XPS-optimized_oxygenated_amorphous_carbon&amp;diff=656</id>
		<title>XPS-optimized oxygenated amorphous carbon</title>
		<link rel="alternate" type="text/html" href="https://turbogap.fi/wiki/index.php?title=XPS-optimized_oxygenated_amorphous_carbon&amp;diff=656"/>
		<updated>2024-06-19T09:01:37Z</updated>

		<summary type="html">&lt;p&gt;Tigany Zarrouk: /* Experimental Observable Optimization */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
&amp;lt;span id=&amp;quot;what-is-turbogap&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
= What is ''TurboGAP'' ? =&lt;br /&gt;
&lt;br /&gt;
* ''TurboGAP'' is a &amp;lt;code&amp;gt;Fortran&amp;lt;/code&amp;gt; atomistic code which uses &amp;lt;u&amp;gt;Gaussian Approximation Potentials&amp;lt;/u&amp;gt; (GAPs).&lt;br /&gt;
* Its specialty are ''SOAP turbo'' descriptors: faster and more accurate than SOAP (Smooth Overlap of Atomic Positions).&lt;br /&gt;
* It's (probably!) the fastest SOAP prediction code, which will be made even faster with ''GPU acceleration'' (ongoing with CSC).&lt;br /&gt;
&lt;br /&gt;
* Through GAP/SOAP predictions, one can perform simulations with ''ab-initio'' accuracy '''at scale'''&lt;br /&gt;
** Molecular Dynamics&lt;br /&gt;
** Grand-Canonical Monte-Carlo simulations&lt;br /&gt;
** Electronic-stopping and spatially-correlated Langevin Dynamics (in-development).&lt;br /&gt;
** '''Prediction/optimization of experimental observables''' (''e.g.'' X-Ray photoelectron spectra ([[#citeproc_bib_item_6|Golze et al. 2022]]; [[#citeproc_bib_item_11|Zarrouk et al. 2024]]), X-ray/Neutron Diffraction and more to come!).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;motivation-for-structural-inference&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Motivation for structural inference =&lt;br /&gt;
&lt;br /&gt;
* We typically want to &amp;lt;u&amp;gt;predict structures&amp;lt;/u&amp;gt;, to make sense of experimental data.&lt;br /&gt;
* We usually pray structures have &amp;lt;u&amp;gt;experimental agreement&amp;lt;/u&amp;gt; (a “bottom-up” approach).&lt;br /&gt;
* What if we can &amp;lt;u&amp;gt;promote agreement&amp;lt;/u&amp;gt; with experimental data?&lt;br /&gt;
* ''Reverse Monte-Carlo'' techniques match experimental data to atomic structure (“top-down” approach).&lt;br /&gt;
** Downsides: “By-hand” constraints&lt;br /&gt;
** Simple experimental observables.&lt;br /&gt;
** Unphysical structures/artifacts ([[#citeproc_bib_item_8|Opletal et al. 2017]])&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Need efficient structure search to find '''agreement''' with '''experimental''' data ''and'' '''ab-inito''' data.&lt;br /&gt;
&lt;br /&gt;
With &amp;lt;u&amp;gt;CO GAP + Core electron binding energy SOAP&amp;lt;/u&amp;gt; model we will perform '''modified (Grand-canonical) Monte-Carlo''' to produce ''experimentally consistent, low energy structures'' of oxygenated amorphous carbon.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:deconvolution_comparison_fill_-3_new.png | 400px]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;theory-and-methods&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Theory and Methods =&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;gaussian-approximation-potentials-gap&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
== Gaussian Approximation Potentials (GAP) ==&lt;br /&gt;
&lt;br /&gt;
([[#citeproc_bib_item_2|Bartók et al. 2010]]; [[#citeproc_bib_item_1|Bartók, Kondor, and Csányi 2013]]; [[#citeproc_bib_item_4|Deringer et al. 2021]])&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;u&amp;gt;Assumption&amp;lt;/u&amp;gt;: Total energy is sum of '''local energies'''. &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;E_{\rm total}(\{\mathbf{r}\}) = \sum_i^{N_{\text{atoms}}} \varepsilon^i(\{r\}, \{\xi^{\text{2b}}_i\}, \{\boldsymbol{\xi}^{\text{3b}}_i\}, \boldsymbol{\xi}^{\text{mb}}_i))&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;\begin{align}&lt;br /&gt;
  \varepsilon^i ( &amp;amp;\{r\}, \{\xi^{\text{2b}}_i\}, \{\boldsymbol{\xi}^{\text{3b}}_i\}, \boldsymbol{\xi}^{\text{mb}}_i) =&lt;br /&gt;
   E^{\text{2b}}(\{\xi^{\text{2b}}_i\}) + E^{\text{3b}}(\{\boldsymbol{\xi}^{\text{3b}}_i\}) \nonumber\\&lt;br /&gt;
  &amp;amp; + E^{\text{mb}}(\boldsymbol{\xi}^{\text{mb}}_i)&lt;br /&gt;
  + \sum_{r &amp;lt; r_{\rm cut}^{\rm core}} E^{\text{core}}(r)  \nonumber&lt;br /&gt;
\end{align}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
; Local energy&lt;br /&gt;
: Sum of '''2b, 3b and many-body''' terms.&lt;br /&gt;
; Descriptor &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\xi / \boldsymbol{\xi}&amp;lt;/math&amp;gt;.&lt;br /&gt;
: ''e.g'' &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\{\xi^{\text{2b}}\} = \{r_{ij}\}&amp;lt;/math&amp;gt;, &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\{\boldsymbol{\xi}^{\text{3b}}\} = \{ [ r_{ij}, r_{ik}, r_{kj} ] \}&amp;lt;/math&amp;gt;&lt;br /&gt;
; Local environment&lt;br /&gt;
: A set of descriptors.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;using-descriptors-to-predict-quantities&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== Using descriptors to predict quantities ===&lt;br /&gt;
&lt;br /&gt;
* ''Kernel/basis functions'' &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;k_{ij}(\boldsymbol{\xi}_i, \boldsymbol{\xi}_j)&amp;lt;/math&amp;gt; measure the ''similarity between descriptors''.&lt;br /&gt;
* ''e.g'' Exponential 2b kernel: &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;k^{2b}_{ij}(\xi_i, \xi_j) \equiv k^{2b}_{ij}(r_{i}, r_{j}) = \exp( - (r_{i} - r_{j})^2/2\sigma^2 )&amp;lt;/math&amp;gt;&lt;br /&gt;
* ''Gaussian Process Regression'' (kernel matrix algebra on training set) → ''fitting coefficients'' &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\{\alpha\}&amp;lt;/math&amp;gt;, ([[#citeproc_bib_item_4|Deringer et al. 2021]])&lt;br /&gt;
* ''e.g.'' 2b model trained with &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;N_s&amp;lt;/math&amp;gt; descriptors &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\{\xi\} \in \{\xi_i, \ldots, \xi_{Ns}\}&amp;lt;/math&amp;gt;, the energy for atom with &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;M&amp;lt;/math&amp;gt; pairwise distances in local environment: &amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;E^{2b} = \sum_i^M \left(E^{2b}_0 + \delta^2\sum_j^{N_s}  \alpha_j k^{2b}_{ij}(\xi_i, \xi_j) \right) &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;soap-many-body-descriptor&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== SOAP (many-body) descriptor ===&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;u&amp;gt;SOAP descriptor&amp;lt;/u&amp;gt;: &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\boldsymbol{\xi}_i(\{\mathbf{r}\}_{ &amp;lt; r_{\rm cut}} )&amp;lt;/math&amp;gt;, represents environment of an atom ([[#citeproc_bib_item_2|Bartók et al. 2010]]).&lt;br /&gt;
* &amp;lt;u&amp;gt;Kernel&amp;lt;/u&amp;gt;: &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;k_{ij} = (\boldsymbol{\xi}_i \cdot \boldsymbol{\xi}_j)^{\zeta}&amp;lt;/math&amp;gt; measures &amp;lt;u&amp;gt;similarity of environments&amp;lt;/u&amp;gt;.&lt;br /&gt;
* &amp;lt;u&amp;gt;Fitting coefficients&amp;lt;/u&amp;gt;: &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\alpha_j&amp;lt;/math&amp;gt; result from Gaussian Process Regression.&lt;br /&gt;
* &amp;lt;u&amp;gt;Prediction&amp;lt;/u&amp;gt;: &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;E^{\rm mb}_i(\boldsymbol{\xi}_i) = E^{\rm mb}_0 + \delta^2\sum_j  \alpha_j k_{ij}&amp;lt;/math&amp;gt;&lt;br /&gt;
* For specifics of SOAP turbo, refer to Miguel's paper ([[#citeproc_bib_item_3|Caro 2019]])&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;how-do-we-model-xps&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== How do we model XPS? ==&lt;br /&gt;
&lt;br /&gt;
* XPS (X-ray photoelectron spectroscopy) spectra measure '''core electron binding energies'''.&lt;br /&gt;
* Core electron binding energies ''depend on atomic environment''.&lt;br /&gt;
* SOAP turbo model trained on DFT (&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\Delta\text{KS}&amp;lt;/math&amp;gt;) data with a &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;GW&amp;lt;/math&amp;gt; correction on top ([[#citeproc_bib_item_6|Golze et al. 2022]]).&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\text{CEBE} = ( \Delta KS^0_{\rm extended} + GW_{\rm carved} - \Delta \mathrm{KS}^+_{\rm carved} )&amp;lt;/math&amp;gt;&lt;br /&gt;
* Thermal and instrumental broadening accounted for by a Gaussian with &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\sigma = 0.4\text{ eV}&amp;lt;/math&amp;gt;&lt;br /&gt;
* Can analyse environments which make up spectra.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;prediction-of-local-properties&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Prediction of Local Properties ==&lt;br /&gt;
&lt;br /&gt;
* We can predict an &amp;lt;u&amp;gt;arbitrary number&amp;lt;/u&amp;gt; of ''local properties'' which use SOAP turbo descriptors using ''TurboGAP''.&lt;br /&gt;
* /One can get these for “free”/ if local property models are trained using the same descriptors as atomic energies/forces.&lt;br /&gt;
*; ''Hirshfeld volumes''&lt;br /&gt;
*: gives vdW dispersion via Tkatchenko-Scheffler. &amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; E_{\rm TS} = \sum_i \sum_{j\neq i} C_{6, ij}(v_{i}(\boldsymbol{\xi}_i), v_{j}(\boldsymbol{\xi}_j))\frac{f_{\rm damp}(r_{ij}, \ldots)}{r_{ij}^6} &amp;lt;/math&amp;gt;&lt;br /&gt;
*; ''Core-electron binding energies''&lt;br /&gt;
*: give '''X-ray Photoelectron Spectroscopy''' prediction. &amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; g_{\rm xps}(\varepsilon) = \frac{1}{M} \sum_i \exp\left( -(\varepsilon - \varepsilon_{i}(\boldsymbol{\xi}_i))^2/(2\sigma^2)  \right) &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;how-do-we-marry-experimental-data-and-gap&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
== How do we marry experimental data and GAP? ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* '''Generalized Hamiltonian within Grand-Canonical Monte-Carlo''' scheme.&lt;br /&gt;
* Vary oxygen content with chemical potential, to see motif differences.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;  \textcolor{violet}{ \mathbf{\tilde{g}}_{\rm {pred}}}(\varepsilon)  = \sum_{i} \exp\left(&lt;br /&gt;
-\frac{(\varepsilon - \textcolor{blue}{\varepsilon^{i}_{\rm&lt;br /&gt;
{pred}}(\boldsymbol{\xi}_i)})^2}{2\sigma^2}\right)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; \tilde{E} = E_{\rm GAP} + E_{\rm spectra} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; E_{\rm spectra} =  \frac{1}{2}\gamma \int \,d\varepsilon \left( \textcolor{violet}{ g_{\rm pred}(\varepsilon)} - g_{\rm exp}(\varepsilon)\right)^2&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;p&amp;gt;A simple squared difference, which is a penalty with increases with spectra dissimilarity and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\gamma&amp;lt;/math&amp;gt; is an energy scale.&amp;lt;/p&amp;gt;&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;p&amp;gt;We can do not just XPS but also X-ray/neutron diffraction and pair distribution functions.&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;[[File:xps_gcmc_scheme.png | 400px]]&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;/ul&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* We use the standard acceptance criteria for adding/removing/moving a particle&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; \mathrm{acc}(N \rightarrow N+1) = \mathrm{min}\left[1,&lt;br /&gt;
\frac{V}{\lambda^3 (N+1)} \exp\left\{ - \frac{\tilde{E}(N+1) -&lt;br /&gt;
\tilde{E}(N) - \mu}{k_BT} \right\}     \right] &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; \mathrm{acc}(N \rightarrow N-1) = \mathrm{min}\left[1,&lt;br /&gt;
\frac{\lambda^3 N}{V} \exp\left\{ -\frac{\tilde{E}(N-1) -&lt;br /&gt;
\tilde{E}(N) + \mu}{k_BT} \right\}     \right] &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; \mathrm{acc}_{\rm move} = \mathrm{min }\left[ 1, \exp\left\{ -&lt;br /&gt;
  \frac{\tilde{E}(\mathrm{new}) - \tilde{E}(\mathrm{old})}{k_BT} \right\} \right]&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;usage&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Usage =&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;installing-turbogap&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
== Installing ''TurboGAP'' ==&lt;br /&gt;
&lt;br /&gt;
We can install the ''TurboGAP'' code, found here https://github.com/mcaroba/turbogap through ''recursively cloning'' the main branch&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;git clone --recursive https://github.com/mcaroba/turbogap.git&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
Then we edit this line in the &amp;lt;code&amp;gt;Makefile&amp;lt;/code&amp;gt; to match our system architecture.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;include makefiles/Makefile.Ubuntu_gfortran_mpi&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Then, we make&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;make&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
and then export the path in &amp;lt;code&amp;gt;.bashrc&amp;lt;/code&amp;gt; file&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;export PATH=&amp;quot;~/turbogap/bin:$PATH&amp;quot;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;span id=&amp;quot;what-you-need-for-a-calculation&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
== What you need for a calculation ==&lt;br /&gt;
&lt;br /&gt;
; &amp;lt;code&amp;gt;gap_files/&amp;lt;/code&amp;gt; directory&lt;br /&gt;
: The directory which contains your &amp;lt;code&amp;gt;*.gap&amp;lt;/code&amp;gt;, with alphas (fitting coefficients) and sparse set descriptor files.&lt;br /&gt;
;* Potentials are available from ''TurboGAP'' wiki https://turbogap.fi/wiki/index.php/Potentials&lt;br /&gt;
;* Conversion script from &amp;lt;code&amp;gt;gap_fit .xml&amp;lt;/code&amp;gt; to &amp;lt;code&amp;gt;.gap&amp;lt;/code&amp;gt; can be used &amp;lt;code&amp;gt;turbogap/tools/make_gap_files.py&amp;lt;/code&amp;gt;&lt;br /&gt;
; &amp;lt;code&amp;gt;input&amp;lt;/code&amp;gt; file&lt;br /&gt;
: The file which tells the code what to do&lt;br /&gt;
; &amp;lt;code&amp;gt;*.xyz&amp;lt;/code&amp;gt;&lt;br /&gt;
: An extended xyz format file which contains positions/lattice/velocity information.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;adding-a-local-property-model-for-cebe-prediction&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== Adding a local property model for CEBE prediction ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;  gap_beg soap_turbo&lt;br /&gt;
  n_species = 2&lt;br /&gt;
  species = C O&lt;br /&gt;
  central_species = 1&lt;br /&gt;
... some params ...&lt;br /&gt;
  zeta = 4&lt;br /&gt;
  delta = 0.1&lt;br /&gt;
  desc_sparse = &amp;quot;gap_files/CO.xml.sparseX.GAP_2022_5_19_180_7_17_31_41410&amp;quot;&lt;br /&gt;
  alphas_sparse = &amp;quot;gap_files/alphas_soap_turbo_1.dat&amp;quot;&lt;br /&gt;
  compress_mode = &amp;quot;trivial&amp;quot;&lt;br /&gt;
  has_local_properties = .true.&lt;br /&gt;
  n_local_properties = 1&lt;br /&gt;
  local_property_qs = 'gap_files/core_electron_be.xml.sparseX.GAP_2024_1_26_120_18_36_33_6091'&lt;br /&gt;
  local_property_alphas = 'gap_files/alphas_core_electron_be_1.dat'&lt;br /&gt;
  local_property_labels = 'core_electron_be'&lt;br /&gt;
  local_property_zetas = 2&lt;br /&gt;
  local_property_deltas = 1.0&lt;br /&gt;
  local_property_v0s = 290.0&lt;br /&gt;
  gap_end&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;span id=&amp;quot;conversion-of-gap_fit-.xml-files-to-.gap-format&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== Conversion of &amp;lt;code&amp;gt;gap_fit&amp;lt;/code&amp;gt; &amp;lt;code&amp;gt;*.xml&amp;lt;/code&amp;gt; files to &amp;lt;code&amp;gt;*.gap&amp;lt;/code&amp;gt; format ===&lt;br /&gt;
&lt;br /&gt;
* Then we convert the &amp;lt;code&amp;gt;*.xml&amp;lt;/code&amp;gt; files which result from &amp;lt;code&amp;gt;gap_fit&amp;lt;/code&amp;gt; into the required format for ''TurboGAP''.&lt;br /&gt;
* This is done using the convenience script in &amp;lt;code&amp;gt;turbogap/tools/make_gap_files.py&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;python3 make_gap_files.py {gap_file.xml} {gap_file.gap} {N_local_prop.} \&lt;br /&gt;
              {local_prop1.xml} {local_prop_label1} \&lt;br /&gt;
              {local_prop2.xml} {local_prop_label2}...&lt;br /&gt;
# e.g. let's build a carbon oxygen GAP&lt;br /&gt;
# with core electron binding energy prediction capability.&lt;br /&gt;
python3 make_gap_files.py CO.xml CO.gap 1 \&lt;br /&gt;
        core_electron_be_co.xml core_electron_be&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
* This creates a directory &amp;lt;code&amp;gt;gap_files/&amp;lt;/code&amp;gt; which has&lt;br /&gt;
*# &amp;lt;code&amp;gt;alphas_{descriptor}.dat&amp;lt;/code&amp;gt; which are fitting coefficients for a particular descriptor&lt;br /&gt;
*# &amp;lt;code&amp;gt;qs_{descriptor}.dat&amp;lt;/code&amp;gt; which are the '''sparse set''' descriptors, used for prediction.&lt;br /&gt;
*# &amp;lt;code&amp;gt;alphas_{local_property}.dat&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;qs_{local_property}.dat&amp;lt;/code&amp;gt; for local property prediction.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;running-the-tutorial&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
== Running the Tutorial ==&lt;br /&gt;
&lt;br /&gt;
* Navigate to &amp;lt;code&amp;gt;turbogap/tutorials/xps_optimizaton&amp;lt;/code&amp;gt;&lt;br /&gt;
* Run &amp;lt;code&amp;gt;bash run.sh {calc_type}&amp;lt;/code&amp;gt; where &amp;lt;code&amp;gt;{calc_type}&amp;lt;/code&amp;gt; is either:&lt;br /&gt;
** &amp;lt;code&amp;gt;prediction&amp;lt;/code&amp;gt;&lt;br /&gt;
** &amp;lt;code&amp;gt;standard_gcmc&amp;lt;/code&amp;gt;&lt;br /&gt;
** &amp;lt;code&amp;gt;xps_optimization_gcmc&amp;lt;/code&amp;gt;&lt;br /&gt;
* Note that these simulations have a high chemical potential and (have high &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\gamma&amp;lt;/math&amp;gt; factors), these are just to give a result in a reasonable amount of time. Take care with real simulations.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;core-electron-binding-energy-prediction&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
== Core electron binding energy prediction ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;[mpirun -np N] turbogap predict&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
* We have in our &amp;lt;code&amp;gt;input&amp;lt;/code&amp;gt; file&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre class=&amp;quot;conf&amp;quot;&amp;gt;! Species-specific info&lt;br /&gt;
atoms_file = 'atoms.xyz'&lt;br /&gt;
pot_file = 'gap_files/CO.gap'&lt;br /&gt;
n_species = 2&lt;br /&gt;
species = C O&lt;br /&gt;
masses = 12.01 15.99&lt;br /&gt;
e0 = -.16138053 0.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Output:&lt;br /&gt;
&lt;br /&gt;
; &amp;lt;code&amp;gt;trajectory_out.xyz&amp;lt;/code&amp;gt;&lt;br /&gt;
: which contains atomic positions, local energy and local property arrays for each structure.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt; 512&lt;br /&gt;
Properties=species:S:1:pos:R:3:forces:R:3:local_energy:R:1:core_electron_be:R:1 \&lt;br /&gt;
   Lattice=&amp;quot;...&amp;quot; energy=-4321.582604 energy_soap=-4114.77018429  energy_2b=-124.73820332 energy_3b=0.55261463 \&lt;br /&gt;
   energy_core_pot=0.00000000 energy_vdw=0.00000000 energy_exp=0.00000000 energy_xps=0.00000000 \&lt;br /&gt;
   virial=&amp;quot;...&amp;quot; stress=&amp;quot;...&amp;quot; volume=5372.640346&lt;br /&gt;
   C              4.39625950       7.79414272      11.91703476     \&lt;br /&gt;
                  -0.00176074      -0.00403026       0.00040104    \&lt;br /&gt;
                  -8.32055957 \ # Local energy prediction&lt;br /&gt;
                  283.83841418  # CEBE Prediction&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Withiout specifying Exp. data, Turbogap does not predict the spectra.&lt;br /&gt;
* XPS spectra can simply be calculated from &amp;lt;code&amp;gt;core_electron_be&amp;lt;/code&amp;gt; in &amp;lt;code&amp;gt;trajectory_out.xyz&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;grand-canonical-monte-carlo&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
== (Grand-Canonical) Monte-Carlo ==&lt;br /&gt;
&lt;br /&gt;
* We use &amp;lt;code&amp;gt;mc&amp;lt;/code&amp;gt; mode&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;[mpirun -np N] turbogap mc&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
* ''e.g'' For a &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mu V T&amp;lt;/math&amp;gt; simulation of system in oxygen environment&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre class=&amp;quot;conf&amp;quot;&amp;gt;! Monte-carlo options&lt;br /&gt;
mc_nsteps = 1000                         # Number of Monte-Carlo Steps&lt;br /&gt;
n_mc_types = 3                           # Number of MC move types&lt;br /&gt;
mc_types = 'move' 'insertion' 'removal'  # MC move types (move/insertion/removal/volume/swap/md)&lt;br /&gt;
mc_move_max = 0.5                        # Maximum distance for MC displacement (&amp;amp;quot;move&amp;amp;quot;) type moves&lt;br /&gt;
&lt;br /&gt;
! - GCMC Options&lt;br /&gt;
n_mc_mu = 1              # Number of chemical potentials to add&lt;br /&gt;
mc_mu = 0                # Chemical potential(s) [eV]&lt;br /&gt;
mc_species = 'O'         # GCMC species types&lt;br /&gt;
mc_min_dist = 0.1        # GCMC minimum insertion distance&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Output:&lt;br /&gt;
&lt;br /&gt;
; &amp;lt;code&amp;gt;mc.log&amp;lt;/code&amp;gt;&lt;br /&gt;
: &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;# mc_istep  mc_move  accepted  E_trial              E_current             E_exp_trial          E_exp_current  N_tot_trial  N_mc_species_trial&lt;br /&gt;
       1       move    F       -4321.10376531       -4321.58260476         272.97693282         272.83692252      512  O        0&lt;br /&gt;
       2       move    F       -4321.10017027       -4321.58260476         272.68730901         272.83692252      512  O        0&lt;br /&gt;
       3  insertion    F       -4319.14082561       -4321.58260476         269.49191203         272.83692252      513  O        1&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; &amp;lt;code&amp;gt;mc_all.xyz&amp;lt;/code&amp;gt;&lt;br /&gt;
: xyz file written to every &amp;lt;code&amp;gt;write_xyz = N&amp;lt;/code&amp;gt; steps.&lt;br /&gt;
; &amp;lt;code&amp;gt;mc_current.xyz&amp;lt;/code&amp;gt;&lt;br /&gt;
: xyz file saving current accepted config written to every &amp;lt;code&amp;gt;write_xyz = N&amp;lt;/code&amp;gt; steps.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* If we run &amp;lt;code&amp;gt;bash run.sh standard_gcmc&amp;lt;/code&amp;gt; (may take a few minutes), we can see a prediction of the XPS with oxygen content&lt;br /&gt;
&lt;br /&gt;
[[File:standard_gcmc.png | 800px]]&lt;br /&gt;
&lt;br /&gt;
We see there is a large amount of oxygen inserted due to the large chemical potential for this simulation. This shifts the xps to large binding core electron binding energies, and there is no agreement the final structure with the experimental XPS. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;experimental-observable-optimization&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Experimental Observable Optimization ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;[mpirun -np N] turbogap mc/md&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
* We can specify experimental observables to predict and optimize them using MC or MD. &amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; E_{\rm spectra} = \frac{1}{2} \gamma \int \,d\varepsilon (g_{\rm pred}(\varepsilon) - g_{\rm exp}(\varepsilon))^2  &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre class=&amp;quot;conf&amp;quot;&amp;gt;! Experimental data options&lt;br /&gt;
n_exp = 1                                  # Number of experimental observables&lt;br /&gt;
exp_labels = 'xps'                         # Experimental observable types (xps/xrd/nd/pdf)&lt;br /&gt;
exp_data_files = 'xps_spectra_interp.dat'  # Experimental data files (Note: the range of resulting XPS prediction will be the same as the experimental range.)&lt;br /&gt;
exp_n_samples = 501                        # Number of interpolations samples over the experimental range.&lt;br /&gt;
exp_energy_scales = 100.0                    # Energy scale (gamma) [eV]&lt;br /&gt;
&lt;br /&gt;
# XPS smearing&lt;br /&gt;
xps_sigma = 0.4&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Output:&lt;br /&gt;
&lt;br /&gt;
; &amp;lt;code&amp;gt;xps_prediction.dat&amp;lt;/code&amp;gt;&lt;br /&gt;
: Data file written every &amp;lt;code&amp;gt;write_xyz = N&amp;lt;/code&amp;gt; steps. Separate predictions separated by blank lines.&lt;br /&gt;
; &amp;lt;code&amp;gt;xps_exp.dat&amp;lt;/code&amp;gt;&lt;br /&gt;
: The experimental data fed into ''TurboGAP''.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* If we run &amp;lt;code&amp;gt;bash run.sh xps_optimization_gcmc&amp;lt;/code&amp;gt; (may take a few minutes), we can see a prediction of the XPS with oxygen content&lt;br /&gt;
&lt;br /&gt;
[[File:xps_optimization_gcmc.png | 800px]]&lt;br /&gt;
&lt;br /&gt;
We can observe the significant effect of the energy scale here. The experimental energy decreases quickly, with a concurrent increase in the energy per atom. After spectral agreement, the system is allowed to relax. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;multiple-observables&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Multiple Observables ==&lt;br /&gt;
&lt;br /&gt;
* This is not in the tutorial files, but ''TurboGAP'' allows for we can optimization multiple observables.&lt;br /&gt;
** X-ray diffraction&lt;br /&gt;
** Neutron diffraction&lt;br /&gt;
** Pair distribution function&lt;br /&gt;
** XPS&lt;br /&gt;
* Here we show a fictitious example of XPS and XRD optimization.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre class=&amp;quot;conf&amp;quot;&amp;gt;# Partial PDFs needed for XRD calculation&lt;br /&gt;
pair_distribution_n_samples = 301&lt;br /&gt;
r_range_min = 0.1&lt;br /&gt;
r_range_max = 13.5&lt;br /&gt;
pair_distribution_rcut = 14.1&lt;br /&gt;
&lt;br /&gt;
do_xrd = .true.&lt;br /&gt;
&lt;br /&gt;
# Experimental Data Specification&lt;br /&gt;
n_exp = 2                  # Number of Exp. observables&lt;br /&gt;
exp_labels = 'xps' 'xrd'   # Exp. observable type (xps/xrd/nd/pdf)&lt;br /&gt;
exp_data_files = 'xps_spectra_experiment.dat' 'xrd_CO_experiment.dat'&lt;br /&gt;
exp_n_samples = 301 301 # Number of samples for the experimental data&lt;br /&gt;
exp_energy_scales = 10.0 10.0  # The &amp;amp;quot;gamma&amp;amp;quot; term for each observable&lt;br /&gt;
&lt;br /&gt;
# If using monte-carlo, the experimental energies are added directly to the local energy&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;span id=&amp;quot;applications&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
= Applications =&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;experimental-observable-predictionoptimization&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
== Experimental Observable prediction/optimization ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;deconvolution-analysis&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== Deconvolution analysis ===&lt;br /&gt;
&lt;br /&gt;
* Use subgraph isomorphisms of bonding networks to discern motifs present.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:exp_xps_with_background_high.png | 400px]]&lt;br /&gt;
&lt;br /&gt;
↑ Experimental XPS deconvolution ([[#citeproc_bib_item_9|Santini et al. 2015]])&lt;br /&gt;
&lt;br /&gt;
We see in the experimental deconvolution analysis that sp3 motifs compose the primary XPS peak. The generation of a-COx here was done by physical vapor deposition of graphitic carbon in an oxygen environment. They see a reduction in the number of sp2 bonds. They also claim there is a complete transformation of sp2 to sp3 that is reversible with a short annealing at 500C. &lt;br /&gt;
&lt;br /&gt;
[[File:deconvolution_comparison_fill_-3_new.png| 400px]]&lt;br /&gt;
&lt;br /&gt;
↑ Our XPS deconvolution ([[#citeproc_bib_item_9|Santini et al. 2015]])&lt;br /&gt;
&lt;br /&gt;
However from our deconvolution analysis, we see that this primary peak is composed of sp2 motifs. We can explain why the experimentalists see only sp2 with a simple computational experiment. &lt;br /&gt;
&lt;br /&gt;
We add in oxygen to the bottom layer of a graphene bilayer system to see the influence of oxygen on sp2 core electron binding energies. &lt;br /&gt;
&lt;br /&gt;
[[File:xps_shifts_miguel_first.png| 400px]]&lt;br /&gt;
&lt;br /&gt;
[[File:xps_shifts_miguel_last.png| 400px]]&lt;br /&gt;
&lt;br /&gt;
We see with oxygen content that sp2 motifs are shifted significantly, even past the sp3 reference. Due to the presence of oxygen, there is a shift of sp2 motifs which are not accounted for by the experimental deconvolution references, as these are fixed. This is why the experimental deconvolution did not give what we expect: sp2 carbon that composes the primary XPS peak. &lt;br /&gt;
&amp;lt;span id=&amp;quot;summary&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Summary =&lt;br /&gt;
&lt;br /&gt;
* Machine-learned potentials can be combined with experimental models to give structures which are consistent with both ''ab-inito'' and experimental data.&lt;br /&gt;
* We can generate oxygenated amorphous carbon structures using a CO GAP with XPS prediction using modified GCMC and a “Molecular Augmented Dynamics” method.&lt;br /&gt;
* We can use ''multiple experimental observables''.&lt;br /&gt;
* '''Finding structures which match experimental data allows us to understand specific experimental results.'''&lt;br /&gt;
* Deconvolve experimental XPS exactly.&lt;br /&gt;
* All of this is implemented in the ''TurboGAP'' code.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;references&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
= References =&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;citeproc_bib_item_1&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;Bartók, Albert P., Risi Kondor, and Gábor Csányi. 2013. “On Representing Chemical Environments.” ''Physical Review B'' 87 (18): 184115. https://doi.org/10.1103/PhysRevB.87.184115.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;citeproc_bib_item_2&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;Bartók, Albert P., Mike C. Payne, Risi Kondor, and Gábor Csányi. 2010. “Gaussian Approximation Potentials: The Accuracy of Quantum Mechanics, without the Electrons.” ''Physical Review Letters'' 104 (13): 136403. https://doi.org/10.1103/PhysRevLett.104.136403.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;citeproc_bib_item_3&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;Caro, Miguel A. 2019. “Optimizing Many-Body Atomic Descriptors for Enhanced Computational Performance of Machine Learning Based Interatomic Potentials.” ''Physical Review B'' 100 (2): 024112. https://doi.org/10.1103/PhysRevB.100.024112.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;citeproc_bib_item_4&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;Deringer, Volker L., Albert P. Bartók, Noam Bernstein, David M. Wilkins, Michele Ceriotti, and Gábor Csányi. 2021. “Gaussian Process Regression for Materials and Molecules.” ''Chemical Reviews'' 121 (16): 10073–141. https://doi.org/10.1021/acs.chemrev.1c00022.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;citeproc_bib_item_5&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;El-Machachi, Zakariya, Damyan Frantzov, A. Nijamudheen, Tigany Zarrouk, Miguel A. Caro, and Volker L. Deringer. 2024. “Accelerated First-Principles Exploration of Structure and Reactivity in Graphene Oxide.” arXiv. https://doi.org/10.48550/arXiv.2405.14814.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;citeproc_bib_item_6&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;Golze, Dorothea, Markus Hirvensalo, Patricia Hernández-León, Anja Aarva, Jarkko Etula, Toma Susi, Patrick Rinke, Tomi Laurila, and Miguel A. Caro. 2022. “Accurate Computational Prediction of Core-Electron Binding Energies in Carbon-Based Materials: A Machine-Learning Model Combining Density-Functional Theory and GW.” ''Chemistry of Materials'' 34 (14): 6240–54. https://doi.org/10.1021/acs.chemmater.1c04279.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;citeproc_bib_item_7&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;Muhli, Heikki, Xi Chen, Albert P. Bartók, Patricia Hernández-León, Gábor Csányi, Tapio Ala-Nissila, and Miguel A. Caro. 2021. “Machine Learning Force Fields Based on Local Parametrization of Dispersion Interactions: Application to the Phase Diagram of \&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathrm\\\C\\\\\_\60\\&amp;lt;/math&amp;gt;.” ''Physical Review B'' 104 (5): 054106. https://doi.org/10.1103/PhysRevB.104.054106.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;citeproc_bib_item_8&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;Opletal, George, Timothy C. Petersen, Amanda S. Barnard, and Salvy P. Russo. 2017. “On Reverse Monte Carlo Constraints and Model Reproduction.” ''Journal of Computational Chemistry'' 38 (17): 1547–51. https://doi.org/10.1002/jcc.24799.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;citeproc_bib_item_9&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;Santini, Claudia A., Abu Sebastian, Chiara Marchiori, Vara Prasad Jonnalagadda, Laurent Dellmann, Wabe W. Koelmans, Marta D. Rossell, Christophe P. Rossel, and Evangelos Eleftheriou. 2015. “Oxygenated Amorphous Carbon for Resistive Memory Applications.” ''Nature Communications'' 6 (1): 8600. https://doi.org/10.1038/ncomms9600.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;citeproc_bib_item_10&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;Wang, Yanzhou, Zheyong Fan, Ping Qian, Tapio Ala-Nissila, and Miguel A. Caro. 2022. “Structure and Pore Size Distribution in Nanoporous Carbon.” ''Chemistry of Materials'' 34 (2): 617–28. https://doi.org/10.1021/acs.chemmater.1c03279.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;citeproc_bib_item_11&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;Zarrouk, Tigany, Rina Ibragimova, Albert P. Bartók, and Miguel A. Caro. 2024. “Experiment-Driven Atomistic Materials Modeling: A Case Study Combining X-Ray Photoelectron Spectroscopy and Machine Learning Potentials to Infer the Structure of Oxygen-Rich Amorphous Carbon.” ''Journal of the American Chemical Society'' 146 (21): 14645–59. https://doi.org/10.1021/jacs.4c01897.&lt;/div&gt;</summary>
		<author><name>Tigany Zarrouk</name></author>
		
	</entry>
	<entry>
		<id>https://turbogap.fi/wiki/index.php?title=XPS-optimized_oxygenated_amorphous_carbon&amp;diff=655</id>
		<title>XPS-optimized oxygenated amorphous carbon</title>
		<link rel="alternate" type="text/html" href="https://turbogap.fi/wiki/index.php?title=XPS-optimized_oxygenated_amorphous_carbon&amp;diff=655"/>
		<updated>2024-06-19T08:59:34Z</updated>

		<summary type="html">&lt;p&gt;Tigany Zarrouk: /* (Grand-Canonical) Monte-Carlo */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
&amp;lt;span id=&amp;quot;what-is-turbogap&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
= What is ''TurboGAP'' ? =&lt;br /&gt;
&lt;br /&gt;
* ''TurboGAP'' is a &amp;lt;code&amp;gt;Fortran&amp;lt;/code&amp;gt; atomistic code which uses &amp;lt;u&amp;gt;Gaussian Approximation Potentials&amp;lt;/u&amp;gt; (GAPs).&lt;br /&gt;
* Its specialty are ''SOAP turbo'' descriptors: faster and more accurate than SOAP (Smooth Overlap of Atomic Positions).&lt;br /&gt;
* It's (probably!) the fastest SOAP prediction code, which will be made even faster with ''GPU acceleration'' (ongoing with CSC).&lt;br /&gt;
&lt;br /&gt;
* Through GAP/SOAP predictions, one can perform simulations with ''ab-initio'' accuracy '''at scale'''&lt;br /&gt;
** Molecular Dynamics&lt;br /&gt;
** Grand-Canonical Monte-Carlo simulations&lt;br /&gt;
** Electronic-stopping and spatially-correlated Langevin Dynamics (in-development).&lt;br /&gt;
** '''Prediction/optimization of experimental observables''' (''e.g.'' X-Ray photoelectron spectra ([[#citeproc_bib_item_6|Golze et al. 2022]]; [[#citeproc_bib_item_11|Zarrouk et al. 2024]]), X-ray/Neutron Diffraction and more to come!).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;motivation-for-structural-inference&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Motivation for structural inference =&lt;br /&gt;
&lt;br /&gt;
* We typically want to &amp;lt;u&amp;gt;predict structures&amp;lt;/u&amp;gt;, to make sense of experimental data.&lt;br /&gt;
* We usually pray structures have &amp;lt;u&amp;gt;experimental agreement&amp;lt;/u&amp;gt; (a “bottom-up” approach).&lt;br /&gt;
* What if we can &amp;lt;u&amp;gt;promote agreement&amp;lt;/u&amp;gt; with experimental data?&lt;br /&gt;
* ''Reverse Monte-Carlo'' techniques match experimental data to atomic structure (“top-down” approach).&lt;br /&gt;
** Downsides: “By-hand” constraints&lt;br /&gt;
** Simple experimental observables.&lt;br /&gt;
** Unphysical structures/artifacts ([[#citeproc_bib_item_8|Opletal et al. 2017]])&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Need efficient structure search to find '''agreement''' with '''experimental''' data ''and'' '''ab-inito''' data.&lt;br /&gt;
&lt;br /&gt;
With &amp;lt;u&amp;gt;CO GAP + Core electron binding energy SOAP&amp;lt;/u&amp;gt; model we will perform '''modified (Grand-canonical) Monte-Carlo''' to produce ''experimentally consistent, low energy structures'' of oxygenated amorphous carbon.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:deconvolution_comparison_fill_-3_new.png | 400px]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;theory-and-methods&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Theory and Methods =&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;gaussian-approximation-potentials-gap&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
== Gaussian Approximation Potentials (GAP) ==&lt;br /&gt;
&lt;br /&gt;
([[#citeproc_bib_item_2|Bartók et al. 2010]]; [[#citeproc_bib_item_1|Bartók, Kondor, and Csányi 2013]]; [[#citeproc_bib_item_4|Deringer et al. 2021]])&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;u&amp;gt;Assumption&amp;lt;/u&amp;gt;: Total energy is sum of '''local energies'''. &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;E_{\rm total}(\{\mathbf{r}\}) = \sum_i^{N_{\text{atoms}}} \varepsilon^i(\{r\}, \{\xi^{\text{2b}}_i\}, \{\boldsymbol{\xi}^{\text{3b}}_i\}, \boldsymbol{\xi}^{\text{mb}}_i))&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;\begin{align}&lt;br /&gt;
  \varepsilon^i ( &amp;amp;\{r\}, \{\xi^{\text{2b}}_i\}, \{\boldsymbol{\xi}^{\text{3b}}_i\}, \boldsymbol{\xi}^{\text{mb}}_i) =&lt;br /&gt;
   E^{\text{2b}}(\{\xi^{\text{2b}}_i\}) + E^{\text{3b}}(\{\boldsymbol{\xi}^{\text{3b}}_i\}) \nonumber\\&lt;br /&gt;
  &amp;amp; + E^{\text{mb}}(\boldsymbol{\xi}^{\text{mb}}_i)&lt;br /&gt;
  + \sum_{r &amp;lt; r_{\rm cut}^{\rm core}} E^{\text{core}}(r)  \nonumber&lt;br /&gt;
\end{align}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
; Local energy&lt;br /&gt;
: Sum of '''2b, 3b and many-body''' terms.&lt;br /&gt;
; Descriptor &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\xi / \boldsymbol{\xi}&amp;lt;/math&amp;gt;.&lt;br /&gt;
: ''e.g'' &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\{\xi^{\text{2b}}\} = \{r_{ij}\}&amp;lt;/math&amp;gt;, &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\{\boldsymbol{\xi}^{\text{3b}}\} = \{ [ r_{ij}, r_{ik}, r_{kj} ] \}&amp;lt;/math&amp;gt;&lt;br /&gt;
; Local environment&lt;br /&gt;
: A set of descriptors.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;using-descriptors-to-predict-quantities&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== Using descriptors to predict quantities ===&lt;br /&gt;
&lt;br /&gt;
* ''Kernel/basis functions'' &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;k_{ij}(\boldsymbol{\xi}_i, \boldsymbol{\xi}_j)&amp;lt;/math&amp;gt; measure the ''similarity between descriptors''.&lt;br /&gt;
* ''e.g'' Exponential 2b kernel: &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;k^{2b}_{ij}(\xi_i, \xi_j) \equiv k^{2b}_{ij}(r_{i}, r_{j}) = \exp( - (r_{i} - r_{j})^2/2\sigma^2 )&amp;lt;/math&amp;gt;&lt;br /&gt;
* ''Gaussian Process Regression'' (kernel matrix algebra on training set) → ''fitting coefficients'' &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\{\alpha\}&amp;lt;/math&amp;gt;, ([[#citeproc_bib_item_4|Deringer et al. 2021]])&lt;br /&gt;
* ''e.g.'' 2b model trained with &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;N_s&amp;lt;/math&amp;gt; descriptors &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\{\xi\} \in \{\xi_i, \ldots, \xi_{Ns}\}&amp;lt;/math&amp;gt;, the energy for atom with &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;M&amp;lt;/math&amp;gt; pairwise distances in local environment: &amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;E^{2b} = \sum_i^M \left(E^{2b}_0 + \delta^2\sum_j^{N_s}  \alpha_j k^{2b}_{ij}(\xi_i, \xi_j) \right) &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;soap-many-body-descriptor&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== SOAP (many-body) descriptor ===&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;u&amp;gt;SOAP descriptor&amp;lt;/u&amp;gt;: &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\boldsymbol{\xi}_i(\{\mathbf{r}\}_{ &amp;lt; r_{\rm cut}} )&amp;lt;/math&amp;gt;, represents environment of an atom ([[#citeproc_bib_item_2|Bartók et al. 2010]]).&lt;br /&gt;
* &amp;lt;u&amp;gt;Kernel&amp;lt;/u&amp;gt;: &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;k_{ij} = (\boldsymbol{\xi}_i \cdot \boldsymbol{\xi}_j)^{\zeta}&amp;lt;/math&amp;gt; measures &amp;lt;u&amp;gt;similarity of environments&amp;lt;/u&amp;gt;.&lt;br /&gt;
* &amp;lt;u&amp;gt;Fitting coefficients&amp;lt;/u&amp;gt;: &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\alpha_j&amp;lt;/math&amp;gt; result from Gaussian Process Regression.&lt;br /&gt;
* &amp;lt;u&amp;gt;Prediction&amp;lt;/u&amp;gt;: &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;E^{\rm mb}_i(\boldsymbol{\xi}_i) = E^{\rm mb}_0 + \delta^2\sum_j  \alpha_j k_{ij}&amp;lt;/math&amp;gt;&lt;br /&gt;
* For specifics of SOAP turbo, refer to Miguel's paper ([[#citeproc_bib_item_3|Caro 2019]])&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;how-do-we-model-xps&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== How do we model XPS? ==&lt;br /&gt;
&lt;br /&gt;
* XPS (X-ray photoelectron spectroscopy) spectra measure '''core electron binding energies'''.&lt;br /&gt;
* Core electron binding energies ''depend on atomic environment''.&lt;br /&gt;
* SOAP turbo model trained on DFT (&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\Delta\text{KS}&amp;lt;/math&amp;gt;) data with a &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;GW&amp;lt;/math&amp;gt; correction on top ([[#citeproc_bib_item_6|Golze et al. 2022]]).&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\text{CEBE} = ( \Delta KS^0_{\rm extended} + GW_{\rm carved} - \Delta \mathrm{KS}^+_{\rm carved} )&amp;lt;/math&amp;gt;&lt;br /&gt;
* Thermal and instrumental broadening accounted for by a Gaussian with &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\sigma = 0.4\text{ eV}&amp;lt;/math&amp;gt;&lt;br /&gt;
* Can analyse environments which make up spectra.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;prediction-of-local-properties&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Prediction of Local Properties ==&lt;br /&gt;
&lt;br /&gt;
* We can predict an &amp;lt;u&amp;gt;arbitrary number&amp;lt;/u&amp;gt; of ''local properties'' which use SOAP turbo descriptors using ''TurboGAP''.&lt;br /&gt;
* /One can get these for “free”/ if local property models are trained using the same descriptors as atomic energies/forces.&lt;br /&gt;
*; ''Hirshfeld volumes''&lt;br /&gt;
*: gives vdW dispersion via Tkatchenko-Scheffler. &amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; E_{\rm TS} = \sum_i \sum_{j\neq i} C_{6, ij}(v_{i}(\boldsymbol{\xi}_i), v_{j}(\boldsymbol{\xi}_j))\frac{f_{\rm damp}(r_{ij}, \ldots)}{r_{ij}^6} &amp;lt;/math&amp;gt;&lt;br /&gt;
*; ''Core-electron binding energies''&lt;br /&gt;
*: give '''X-ray Photoelectron Spectroscopy''' prediction. &amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; g_{\rm xps}(\varepsilon) = \frac{1}{M} \sum_i \exp\left( -(\varepsilon - \varepsilon_{i}(\boldsymbol{\xi}_i))^2/(2\sigma^2)  \right) &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;how-do-we-marry-experimental-data-and-gap&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
== How do we marry experimental data and GAP? ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* '''Generalized Hamiltonian within Grand-Canonical Monte-Carlo''' scheme.&lt;br /&gt;
* Vary oxygen content with chemical potential, to see motif differences.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;  \textcolor{violet}{ \mathbf{\tilde{g}}_{\rm {pred}}}(\varepsilon)  = \sum_{i} \exp\left(&lt;br /&gt;
-\frac{(\varepsilon - \textcolor{blue}{\varepsilon^{i}_{\rm&lt;br /&gt;
{pred}}(\boldsymbol{\xi}_i)})^2}{2\sigma^2}\right)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; \tilde{E} = E_{\rm GAP} + E_{\rm spectra} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; E_{\rm spectra} =  \frac{1}{2}\gamma \int \,d\varepsilon \left( \textcolor{violet}{ g_{\rm pred}(\varepsilon)} - g_{\rm exp}(\varepsilon)\right)^2&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;p&amp;gt;A simple squared difference, which is a penalty with increases with spectra dissimilarity and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\gamma&amp;lt;/math&amp;gt; is an energy scale.&amp;lt;/p&amp;gt;&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;p&amp;gt;We can do not just XPS but also X-ray/neutron diffraction and pair distribution functions.&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;[[File:xps_gcmc_scheme.png | 400px]]&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;/ul&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* We use the standard acceptance criteria for adding/removing/moving a particle&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; \mathrm{acc}(N \rightarrow N+1) = \mathrm{min}\left[1,&lt;br /&gt;
\frac{V}{\lambda^3 (N+1)} \exp\left\{ - \frac{\tilde{E}(N+1) -&lt;br /&gt;
\tilde{E}(N) - \mu}{k_BT} \right\}     \right] &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; \mathrm{acc}(N \rightarrow N-1) = \mathrm{min}\left[1,&lt;br /&gt;
\frac{\lambda^3 N}{V} \exp\left\{ -\frac{\tilde{E}(N-1) -&lt;br /&gt;
\tilde{E}(N) + \mu}{k_BT} \right\}     \right] &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; \mathrm{acc}_{\rm move} = \mathrm{min }\left[ 1, \exp\left\{ -&lt;br /&gt;
  \frac{\tilde{E}(\mathrm{new}) - \tilde{E}(\mathrm{old})}{k_BT} \right\} \right]&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;usage&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Usage =&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;installing-turbogap&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
== Installing ''TurboGAP'' ==&lt;br /&gt;
&lt;br /&gt;
We can install the ''TurboGAP'' code, found here https://github.com/mcaroba/turbogap through ''recursively cloning'' the main branch&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;git clone --recursive https://github.com/mcaroba/turbogap.git&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
Then we edit this line in the &amp;lt;code&amp;gt;Makefile&amp;lt;/code&amp;gt; to match our system architecture.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;include makefiles/Makefile.Ubuntu_gfortran_mpi&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Then, we make&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;make&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
and then export the path in &amp;lt;code&amp;gt;.bashrc&amp;lt;/code&amp;gt; file&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;export PATH=&amp;quot;~/turbogap/bin:$PATH&amp;quot;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;span id=&amp;quot;what-you-need-for-a-calculation&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
== What you need for a calculation ==&lt;br /&gt;
&lt;br /&gt;
; &amp;lt;code&amp;gt;gap_files/&amp;lt;/code&amp;gt; directory&lt;br /&gt;
: The directory which contains your &amp;lt;code&amp;gt;*.gap&amp;lt;/code&amp;gt;, with alphas (fitting coefficients) and sparse set descriptor files.&lt;br /&gt;
;* Potentials are available from ''TurboGAP'' wiki https://turbogap.fi/wiki/index.php/Potentials&lt;br /&gt;
;* Conversion script from &amp;lt;code&amp;gt;gap_fit .xml&amp;lt;/code&amp;gt; to &amp;lt;code&amp;gt;.gap&amp;lt;/code&amp;gt; can be used &amp;lt;code&amp;gt;turbogap/tools/make_gap_files.py&amp;lt;/code&amp;gt;&lt;br /&gt;
; &amp;lt;code&amp;gt;input&amp;lt;/code&amp;gt; file&lt;br /&gt;
: The file which tells the code what to do&lt;br /&gt;
; &amp;lt;code&amp;gt;*.xyz&amp;lt;/code&amp;gt;&lt;br /&gt;
: An extended xyz format file which contains positions/lattice/velocity information.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;adding-a-local-property-model-for-cebe-prediction&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== Adding a local property model for CEBE prediction ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;  gap_beg soap_turbo&lt;br /&gt;
  n_species = 2&lt;br /&gt;
  species = C O&lt;br /&gt;
  central_species = 1&lt;br /&gt;
... some params ...&lt;br /&gt;
  zeta = 4&lt;br /&gt;
  delta = 0.1&lt;br /&gt;
  desc_sparse = &amp;quot;gap_files/CO.xml.sparseX.GAP_2022_5_19_180_7_17_31_41410&amp;quot;&lt;br /&gt;
  alphas_sparse = &amp;quot;gap_files/alphas_soap_turbo_1.dat&amp;quot;&lt;br /&gt;
  compress_mode = &amp;quot;trivial&amp;quot;&lt;br /&gt;
  has_local_properties = .true.&lt;br /&gt;
  n_local_properties = 1&lt;br /&gt;
  local_property_qs = 'gap_files/core_electron_be.xml.sparseX.GAP_2024_1_26_120_18_36_33_6091'&lt;br /&gt;
  local_property_alphas = 'gap_files/alphas_core_electron_be_1.dat'&lt;br /&gt;
  local_property_labels = 'core_electron_be'&lt;br /&gt;
  local_property_zetas = 2&lt;br /&gt;
  local_property_deltas = 1.0&lt;br /&gt;
  local_property_v0s = 290.0&lt;br /&gt;
  gap_end&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;span id=&amp;quot;conversion-of-gap_fit-.xml-files-to-.gap-format&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== Conversion of &amp;lt;code&amp;gt;gap_fit&amp;lt;/code&amp;gt; &amp;lt;code&amp;gt;*.xml&amp;lt;/code&amp;gt; files to &amp;lt;code&amp;gt;*.gap&amp;lt;/code&amp;gt; format ===&lt;br /&gt;
&lt;br /&gt;
* Then we convert the &amp;lt;code&amp;gt;*.xml&amp;lt;/code&amp;gt; files which result from &amp;lt;code&amp;gt;gap_fit&amp;lt;/code&amp;gt; into the required format for ''TurboGAP''.&lt;br /&gt;
* This is done using the convenience script in &amp;lt;code&amp;gt;turbogap/tools/make_gap_files.py&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;python3 make_gap_files.py {gap_file.xml} {gap_file.gap} {N_local_prop.} \&lt;br /&gt;
              {local_prop1.xml} {local_prop_label1} \&lt;br /&gt;
              {local_prop2.xml} {local_prop_label2}...&lt;br /&gt;
# e.g. let's build a carbon oxygen GAP&lt;br /&gt;
# with core electron binding energy prediction capability.&lt;br /&gt;
python3 make_gap_files.py CO.xml CO.gap 1 \&lt;br /&gt;
        core_electron_be_co.xml core_electron_be&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
* This creates a directory &amp;lt;code&amp;gt;gap_files/&amp;lt;/code&amp;gt; which has&lt;br /&gt;
*# &amp;lt;code&amp;gt;alphas_{descriptor}.dat&amp;lt;/code&amp;gt; which are fitting coefficients for a particular descriptor&lt;br /&gt;
*# &amp;lt;code&amp;gt;qs_{descriptor}.dat&amp;lt;/code&amp;gt; which are the '''sparse set''' descriptors, used for prediction.&lt;br /&gt;
*# &amp;lt;code&amp;gt;alphas_{local_property}.dat&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;qs_{local_property}.dat&amp;lt;/code&amp;gt; for local property prediction.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;running-the-tutorial&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
== Running the Tutorial ==&lt;br /&gt;
&lt;br /&gt;
* Navigate to &amp;lt;code&amp;gt;turbogap/tutorials/xps_optimizaton&amp;lt;/code&amp;gt;&lt;br /&gt;
* Run &amp;lt;code&amp;gt;bash run.sh {calc_type}&amp;lt;/code&amp;gt; where &amp;lt;code&amp;gt;{calc_type}&amp;lt;/code&amp;gt; is either:&lt;br /&gt;
** &amp;lt;code&amp;gt;prediction&amp;lt;/code&amp;gt;&lt;br /&gt;
** &amp;lt;code&amp;gt;standard_gcmc&amp;lt;/code&amp;gt;&lt;br /&gt;
** &amp;lt;code&amp;gt;xps_optimization_gcmc&amp;lt;/code&amp;gt;&lt;br /&gt;
* Note that these simulations have a high chemical potential and (have high &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\gamma&amp;lt;/math&amp;gt; factors), these are just to give a result in a reasonable amount of time. Take care with real simulations.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;core-electron-binding-energy-prediction&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
== Core electron binding energy prediction ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;[mpirun -np N] turbogap predict&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
* We have in our &amp;lt;code&amp;gt;input&amp;lt;/code&amp;gt; file&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre class=&amp;quot;conf&amp;quot;&amp;gt;! Species-specific info&lt;br /&gt;
atoms_file = 'atoms.xyz'&lt;br /&gt;
pot_file = 'gap_files/CO.gap'&lt;br /&gt;
n_species = 2&lt;br /&gt;
species = C O&lt;br /&gt;
masses = 12.01 15.99&lt;br /&gt;
e0 = -.16138053 0.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Output:&lt;br /&gt;
&lt;br /&gt;
; &amp;lt;code&amp;gt;trajectory_out.xyz&amp;lt;/code&amp;gt;&lt;br /&gt;
: which contains atomic positions, local energy and local property arrays for each structure.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt; 512&lt;br /&gt;
Properties=species:S:1:pos:R:3:forces:R:3:local_energy:R:1:core_electron_be:R:1 \&lt;br /&gt;
   Lattice=&amp;quot;...&amp;quot; energy=-4321.582604 energy_soap=-4114.77018429  energy_2b=-124.73820332 energy_3b=0.55261463 \&lt;br /&gt;
   energy_core_pot=0.00000000 energy_vdw=0.00000000 energy_exp=0.00000000 energy_xps=0.00000000 \&lt;br /&gt;
   virial=&amp;quot;...&amp;quot; stress=&amp;quot;...&amp;quot; volume=5372.640346&lt;br /&gt;
   C              4.39625950       7.79414272      11.91703476     \&lt;br /&gt;
                  -0.00176074      -0.00403026       0.00040104    \&lt;br /&gt;
                  -8.32055957 \ # Local energy prediction&lt;br /&gt;
                  283.83841418  # CEBE Prediction&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Withiout specifying Exp. data, Turbogap does not predict the spectra.&lt;br /&gt;
* XPS spectra can simply be calculated from &amp;lt;code&amp;gt;core_electron_be&amp;lt;/code&amp;gt; in &amp;lt;code&amp;gt;trajectory_out.xyz&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;grand-canonical-monte-carlo&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
== (Grand-Canonical) Monte-Carlo ==&lt;br /&gt;
&lt;br /&gt;
* We use &amp;lt;code&amp;gt;mc&amp;lt;/code&amp;gt; mode&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;[mpirun -np N] turbogap mc&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
* ''e.g'' For a &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mu V T&amp;lt;/math&amp;gt; simulation of system in oxygen environment&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre class=&amp;quot;conf&amp;quot;&amp;gt;! Monte-carlo options&lt;br /&gt;
mc_nsteps = 1000                         # Number of Monte-Carlo Steps&lt;br /&gt;
n_mc_types = 3                           # Number of MC move types&lt;br /&gt;
mc_types = 'move' 'insertion' 'removal'  # MC move types (move/insertion/removal/volume/swap/md)&lt;br /&gt;
mc_move_max = 0.5                        # Maximum distance for MC displacement (&amp;amp;quot;move&amp;amp;quot;) type moves&lt;br /&gt;
&lt;br /&gt;
! - GCMC Options&lt;br /&gt;
n_mc_mu = 1              # Number of chemical potentials to add&lt;br /&gt;
mc_mu = 0                # Chemical potential(s) [eV]&lt;br /&gt;
mc_species = 'O'         # GCMC species types&lt;br /&gt;
mc_min_dist = 0.1        # GCMC minimum insertion distance&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Output:&lt;br /&gt;
&lt;br /&gt;
; &amp;lt;code&amp;gt;mc.log&amp;lt;/code&amp;gt;&lt;br /&gt;
: &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;# mc_istep  mc_move  accepted  E_trial              E_current             E_exp_trial          E_exp_current  N_tot_trial  N_mc_species_trial&lt;br /&gt;
       1       move    F       -4321.10376531       -4321.58260476         272.97693282         272.83692252      512  O        0&lt;br /&gt;
       2       move    F       -4321.10017027       -4321.58260476         272.68730901         272.83692252      512  O        0&lt;br /&gt;
       3  insertion    F       -4319.14082561       -4321.58260476         269.49191203         272.83692252      513  O        1&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; &amp;lt;code&amp;gt;mc_all.xyz&amp;lt;/code&amp;gt;&lt;br /&gt;
: xyz file written to every &amp;lt;code&amp;gt;write_xyz = N&amp;lt;/code&amp;gt; steps.&lt;br /&gt;
; &amp;lt;code&amp;gt;mc_current.xyz&amp;lt;/code&amp;gt;&lt;br /&gt;
: xyz file saving current accepted config written to every &amp;lt;code&amp;gt;write_xyz = N&amp;lt;/code&amp;gt; steps.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* If we run &amp;lt;code&amp;gt;bash run.sh standard_gcmc&amp;lt;/code&amp;gt; (may take a few minutes), we can see a prediction of the XPS with oxygen content&lt;br /&gt;
&lt;br /&gt;
[[File:standard_gcmc.png | 800px]]&lt;br /&gt;
&lt;br /&gt;
We see there is a large amount of oxygen inserted due to the large chemical potential for this simulation. This shifts the xps to large binding core electron binding energies, and there is no agreement the final structure with the experimental XPS. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;experimental-observable-optimization&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Experimental Observable Optimization ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;[mpirun -np N] turbogap mc/md&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
* We can specify experimental observables to predict and optimize them using MC or MD. &amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; E_{\rm spectra} = \frac{1}{2} \gamma \int \,d\varepsilon (g_{\rm pred}(\varepsilon) - g_{\rm exp}(\varepsilon))^2  &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre class=&amp;quot;conf&amp;quot;&amp;gt;! Experimental data options&lt;br /&gt;
n_exp = 1                                  # Number of experimental observables&lt;br /&gt;
exp_labels = 'xps'                         # Experimental observable types (xps/xrd/nd/pdf)&lt;br /&gt;
exp_data_files = 'xps_spectra_interp.dat'  # Experimental data files (Note: the range of resulting XPS prediction will be the same as the experimental range.)&lt;br /&gt;
exp_n_samples = 501                        # Number of interpolations samples over the experimental range.&lt;br /&gt;
exp_energy_scales = 100.0                    # Energy scale (gamma) [eV]&lt;br /&gt;
&lt;br /&gt;
# XPS smearing&lt;br /&gt;
xps_sigma = 0.4&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Output:&lt;br /&gt;
&lt;br /&gt;
; &amp;lt;code&amp;gt;xps_prediction.dat&amp;lt;/code&amp;gt;&lt;br /&gt;
: Data file written every &amp;lt;code&amp;gt;write_xyz = N&amp;lt;/code&amp;gt; steps. Separate predictions separated by blank lines.&lt;br /&gt;
; &amp;lt;code&amp;gt;xps_exp.dat&amp;lt;/code&amp;gt;&lt;br /&gt;
: The experimental data fed into ''TurboGAP''.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* If we run &amp;lt;code&amp;gt;bash run.sh xps_optimization_gcmc&amp;lt;/code&amp;gt; (may take a few minutes), we can see a prediction of the XPS with oxygen content&lt;br /&gt;
&lt;br /&gt;
[[File:xps_optimization_gcmc.png | 800px]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;multiple-observables&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Multiple Observables ==&lt;br /&gt;
&lt;br /&gt;
* This is not in the tutorial files, but ''TurboGAP'' allows for we can optimization multiple observables.&lt;br /&gt;
** X-ray diffraction&lt;br /&gt;
** Neutron diffraction&lt;br /&gt;
** Pair distribution function&lt;br /&gt;
** XPS&lt;br /&gt;
* Here we show a fictitious example of XPS and XRD optimization.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre class=&amp;quot;conf&amp;quot;&amp;gt;# Partial PDFs needed for XRD calculation&lt;br /&gt;
pair_distribution_n_samples = 301&lt;br /&gt;
r_range_min = 0.1&lt;br /&gt;
r_range_max = 13.5&lt;br /&gt;
pair_distribution_rcut = 14.1&lt;br /&gt;
&lt;br /&gt;
do_xrd = .true.&lt;br /&gt;
&lt;br /&gt;
# Experimental Data Specification&lt;br /&gt;
n_exp = 2                  # Number of Exp. observables&lt;br /&gt;
exp_labels = 'xps' 'xrd'   # Exp. observable type (xps/xrd/nd/pdf)&lt;br /&gt;
exp_data_files = 'xps_spectra_experiment.dat' 'xrd_CO_experiment.dat'&lt;br /&gt;
exp_n_samples = 301 301 # Number of samples for the experimental data&lt;br /&gt;
exp_energy_scales = 10.0 10.0  # The &amp;amp;quot;gamma&amp;amp;quot; term for each observable&lt;br /&gt;
&lt;br /&gt;
# If using monte-carlo, the experimental energies are added directly to the local energy&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;span id=&amp;quot;applications&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
= Applications =&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;experimental-observable-predictionoptimization&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
== Experimental Observable prediction/optimization ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;deconvolution-analysis&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== Deconvolution analysis ===&lt;br /&gt;
&lt;br /&gt;
* Use subgraph isomorphisms of bonding networks to discern motifs present.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:exp_xps_with_background_high.png | 400px]]&lt;br /&gt;
&lt;br /&gt;
↑ Experimental XPS deconvolution ([[#citeproc_bib_item_9|Santini et al. 2015]])&lt;br /&gt;
&lt;br /&gt;
We see in the experimental deconvolution analysis that sp3 motifs compose the primary XPS peak. The generation of a-COx here was done by physical vapor deposition of graphitic carbon in an oxygen environment. They see a reduction in the number of sp2 bonds. They also claim there is a complete transformation of sp2 to sp3 that is reversible with a short annealing at 500C. &lt;br /&gt;
&lt;br /&gt;
[[File:deconvolution_comparison_fill_-3_new.png| 400px]]&lt;br /&gt;
&lt;br /&gt;
↑ Our XPS deconvolution ([[#citeproc_bib_item_9|Santini et al. 2015]])&lt;br /&gt;
&lt;br /&gt;
However from our deconvolution analysis, we see that this primary peak is composed of sp2 motifs. We can explain why the experimentalists see only sp2 with a simple computational experiment. &lt;br /&gt;
&lt;br /&gt;
We add in oxygen to the bottom layer of a graphene bilayer system to see the influence of oxygen on sp2 core electron binding energies. &lt;br /&gt;
&lt;br /&gt;
[[File:xps_shifts_miguel_first.png| 400px]]&lt;br /&gt;
&lt;br /&gt;
[[File:xps_shifts_miguel_last.png| 400px]]&lt;br /&gt;
&lt;br /&gt;
We see with oxygen content that sp2 motifs are shifted significantly, even past the sp3 reference. Due to the presence of oxygen, there is a shift of sp2 motifs which are not accounted for by the experimental deconvolution references, as these are fixed. This is why the experimental deconvolution did not give what we expect: sp2 carbon that composes the primary XPS peak. &lt;br /&gt;
&amp;lt;span id=&amp;quot;summary&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Summary =&lt;br /&gt;
&lt;br /&gt;
* Machine-learned potentials can be combined with experimental models to give structures which are consistent with both ''ab-inito'' and experimental data.&lt;br /&gt;
* We can generate oxygenated amorphous carbon structures using a CO GAP with XPS prediction using modified GCMC and a “Molecular Augmented Dynamics” method.&lt;br /&gt;
* We can use ''multiple experimental observables''.&lt;br /&gt;
* '''Finding structures which match experimental data allows us to understand specific experimental results.'''&lt;br /&gt;
* Deconvolve experimental XPS exactly.&lt;br /&gt;
* All of this is implemented in the ''TurboGAP'' code.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;references&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
= References =&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;citeproc_bib_item_1&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;Bartók, Albert P., Risi Kondor, and Gábor Csányi. 2013. “On Representing Chemical Environments.” ''Physical Review B'' 87 (18): 184115. https://doi.org/10.1103/PhysRevB.87.184115.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;citeproc_bib_item_2&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;Bartók, Albert P., Mike C. Payne, Risi Kondor, and Gábor Csányi. 2010. “Gaussian Approximation Potentials: The Accuracy of Quantum Mechanics, without the Electrons.” ''Physical Review Letters'' 104 (13): 136403. https://doi.org/10.1103/PhysRevLett.104.136403.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;citeproc_bib_item_3&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;Caro, Miguel A. 2019. “Optimizing Many-Body Atomic Descriptors for Enhanced Computational Performance of Machine Learning Based Interatomic Potentials.” ''Physical Review B'' 100 (2): 024112. https://doi.org/10.1103/PhysRevB.100.024112.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;citeproc_bib_item_4&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;Deringer, Volker L., Albert P. Bartók, Noam Bernstein, David M. Wilkins, Michele Ceriotti, and Gábor Csányi. 2021. “Gaussian Process Regression for Materials and Molecules.” ''Chemical Reviews'' 121 (16): 10073–141. https://doi.org/10.1021/acs.chemrev.1c00022.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;citeproc_bib_item_5&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;El-Machachi, Zakariya, Damyan Frantzov, A. Nijamudheen, Tigany Zarrouk, Miguel A. Caro, and Volker L. Deringer. 2024. “Accelerated First-Principles Exploration of Structure and Reactivity in Graphene Oxide.” arXiv. https://doi.org/10.48550/arXiv.2405.14814.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;citeproc_bib_item_6&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;Golze, Dorothea, Markus Hirvensalo, Patricia Hernández-León, Anja Aarva, Jarkko Etula, Toma Susi, Patrick Rinke, Tomi Laurila, and Miguel A. Caro. 2022. “Accurate Computational Prediction of Core-Electron Binding Energies in Carbon-Based Materials: A Machine-Learning Model Combining Density-Functional Theory and GW.” ''Chemistry of Materials'' 34 (14): 6240–54. https://doi.org/10.1021/acs.chemmater.1c04279.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;citeproc_bib_item_7&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;Muhli, Heikki, Xi Chen, Albert P. Bartók, Patricia Hernández-León, Gábor Csányi, Tapio Ala-Nissila, and Miguel A. Caro. 2021. “Machine Learning Force Fields Based on Local Parametrization of Dispersion Interactions: Application to the Phase Diagram of \&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathrm\\\C\\\\\_\60\\&amp;lt;/math&amp;gt;.” ''Physical Review B'' 104 (5): 054106. https://doi.org/10.1103/PhysRevB.104.054106.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;citeproc_bib_item_8&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;Opletal, George, Timothy C. Petersen, Amanda S. Barnard, and Salvy P. Russo. 2017. “On Reverse Monte Carlo Constraints and Model Reproduction.” ''Journal of Computational Chemistry'' 38 (17): 1547–51. https://doi.org/10.1002/jcc.24799.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;citeproc_bib_item_9&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;Santini, Claudia A., Abu Sebastian, Chiara Marchiori, Vara Prasad Jonnalagadda, Laurent Dellmann, Wabe W. Koelmans, Marta D. Rossell, Christophe P. Rossel, and Evangelos Eleftheriou. 2015. “Oxygenated Amorphous Carbon for Resistive Memory Applications.” ''Nature Communications'' 6 (1): 8600. https://doi.org/10.1038/ncomms9600.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;citeproc_bib_item_10&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;Wang, Yanzhou, Zheyong Fan, Ping Qian, Tapio Ala-Nissila, and Miguel A. Caro. 2022. “Structure and Pore Size Distribution in Nanoporous Carbon.” ''Chemistry of Materials'' 34 (2): 617–28. https://doi.org/10.1021/acs.chemmater.1c03279.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;citeproc_bib_item_11&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;Zarrouk, Tigany, Rina Ibragimova, Albert P. Bartók, and Miguel A. Caro. 2024. “Experiment-Driven Atomistic Materials Modeling: A Case Study Combining X-Ray Photoelectron Spectroscopy and Machine Learning Potentials to Infer the Structure of Oxygen-Rich Amorphous Carbon.” ''Journal of the American Chemical Society'' 146 (21): 14645–59. https://doi.org/10.1021/jacs.4c01897.&lt;/div&gt;</summary>
		<author><name>Tigany Zarrouk</name></author>
		
	</entry>
	<entry>
		<id>https://turbogap.fi/wiki/index.php?title=XPS-optimized_oxygenated_amorphous_carbon&amp;diff=654</id>
		<title>XPS-optimized oxygenated amorphous carbon</title>
		<link rel="alternate" type="text/html" href="https://turbogap.fi/wiki/index.php?title=XPS-optimized_oxygenated_amorphous_carbon&amp;diff=654"/>
		<updated>2024-06-19T08:57:57Z</updated>

		<summary type="html">&lt;p&gt;Tigany Zarrouk: /* Experimental Observable prediction/optimization */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
&amp;lt;span id=&amp;quot;what-is-turbogap&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
= What is ''TurboGAP'' ? =&lt;br /&gt;
&lt;br /&gt;
* ''TurboGAP'' is a &amp;lt;code&amp;gt;Fortran&amp;lt;/code&amp;gt; atomistic code which uses &amp;lt;u&amp;gt;Gaussian Approximation Potentials&amp;lt;/u&amp;gt; (GAPs).&lt;br /&gt;
* Its specialty are ''SOAP turbo'' descriptors: faster and more accurate than SOAP (Smooth Overlap of Atomic Positions).&lt;br /&gt;
* It's (probably!) the fastest SOAP prediction code, which will be made even faster with ''GPU acceleration'' (ongoing with CSC).&lt;br /&gt;
&lt;br /&gt;
* Through GAP/SOAP predictions, one can perform simulations with ''ab-initio'' accuracy '''at scale'''&lt;br /&gt;
** Molecular Dynamics&lt;br /&gt;
** Grand-Canonical Monte-Carlo simulations&lt;br /&gt;
** Electronic-stopping and spatially-correlated Langevin Dynamics (in-development).&lt;br /&gt;
** '''Prediction/optimization of experimental observables''' (''e.g.'' X-Ray photoelectron spectra ([[#citeproc_bib_item_6|Golze et al. 2022]]; [[#citeproc_bib_item_11|Zarrouk et al. 2024]]), X-ray/Neutron Diffraction and more to come!).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;motivation-for-structural-inference&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Motivation for structural inference =&lt;br /&gt;
&lt;br /&gt;
* We typically want to &amp;lt;u&amp;gt;predict structures&amp;lt;/u&amp;gt;, to make sense of experimental data.&lt;br /&gt;
* We usually pray structures have &amp;lt;u&amp;gt;experimental agreement&amp;lt;/u&amp;gt; (a “bottom-up” approach).&lt;br /&gt;
* What if we can &amp;lt;u&amp;gt;promote agreement&amp;lt;/u&amp;gt; with experimental data?&lt;br /&gt;
* ''Reverse Monte-Carlo'' techniques match experimental data to atomic structure (“top-down” approach).&lt;br /&gt;
** Downsides: “By-hand” constraints&lt;br /&gt;
** Simple experimental observables.&lt;br /&gt;
** Unphysical structures/artifacts ([[#citeproc_bib_item_8|Opletal et al. 2017]])&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Need efficient structure search to find '''agreement''' with '''experimental''' data ''and'' '''ab-inito''' data.&lt;br /&gt;
&lt;br /&gt;
With &amp;lt;u&amp;gt;CO GAP + Core electron binding energy SOAP&amp;lt;/u&amp;gt; model we will perform '''modified (Grand-canonical) Monte-Carlo''' to produce ''experimentally consistent, low energy structures'' of oxygenated amorphous carbon.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:deconvolution_comparison_fill_-3_new.png | 400px]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;theory-and-methods&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Theory and Methods =&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;gaussian-approximation-potentials-gap&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
== Gaussian Approximation Potentials (GAP) ==&lt;br /&gt;
&lt;br /&gt;
([[#citeproc_bib_item_2|Bartók et al. 2010]]; [[#citeproc_bib_item_1|Bartók, Kondor, and Csányi 2013]]; [[#citeproc_bib_item_4|Deringer et al. 2021]])&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;u&amp;gt;Assumption&amp;lt;/u&amp;gt;: Total energy is sum of '''local energies'''. &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;E_{\rm total}(\{\mathbf{r}\}) = \sum_i^{N_{\text{atoms}}} \varepsilon^i(\{r\}, \{\xi^{\text{2b}}_i\}, \{\boldsymbol{\xi}^{\text{3b}}_i\}, \boldsymbol{\xi}^{\text{mb}}_i))&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;\begin{align}&lt;br /&gt;
  \varepsilon^i ( &amp;amp;\{r\}, \{\xi^{\text{2b}}_i\}, \{\boldsymbol{\xi}^{\text{3b}}_i\}, \boldsymbol{\xi}^{\text{mb}}_i) =&lt;br /&gt;
   E^{\text{2b}}(\{\xi^{\text{2b}}_i\}) + E^{\text{3b}}(\{\boldsymbol{\xi}^{\text{3b}}_i\}) \nonumber\\&lt;br /&gt;
  &amp;amp; + E^{\text{mb}}(\boldsymbol{\xi}^{\text{mb}}_i)&lt;br /&gt;
  + \sum_{r &amp;lt; r_{\rm cut}^{\rm core}} E^{\text{core}}(r)  \nonumber&lt;br /&gt;
\end{align}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
; Local energy&lt;br /&gt;
: Sum of '''2b, 3b and many-body''' terms.&lt;br /&gt;
; Descriptor &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\xi / \boldsymbol{\xi}&amp;lt;/math&amp;gt;.&lt;br /&gt;
: ''e.g'' &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\{\xi^{\text{2b}}\} = \{r_{ij}\}&amp;lt;/math&amp;gt;, &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\{\boldsymbol{\xi}^{\text{3b}}\} = \{ [ r_{ij}, r_{ik}, r_{kj} ] \}&amp;lt;/math&amp;gt;&lt;br /&gt;
; Local environment&lt;br /&gt;
: A set of descriptors.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;using-descriptors-to-predict-quantities&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== Using descriptors to predict quantities ===&lt;br /&gt;
&lt;br /&gt;
* ''Kernel/basis functions'' &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;k_{ij}(\boldsymbol{\xi}_i, \boldsymbol{\xi}_j)&amp;lt;/math&amp;gt; measure the ''similarity between descriptors''.&lt;br /&gt;
* ''e.g'' Exponential 2b kernel: &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;k^{2b}_{ij}(\xi_i, \xi_j) \equiv k^{2b}_{ij}(r_{i}, r_{j}) = \exp( - (r_{i} - r_{j})^2/2\sigma^2 )&amp;lt;/math&amp;gt;&lt;br /&gt;
* ''Gaussian Process Regression'' (kernel matrix algebra on training set) → ''fitting coefficients'' &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\{\alpha\}&amp;lt;/math&amp;gt;, ([[#citeproc_bib_item_4|Deringer et al. 2021]])&lt;br /&gt;
* ''e.g.'' 2b model trained with &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;N_s&amp;lt;/math&amp;gt; descriptors &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\{\xi\} \in \{\xi_i, \ldots, \xi_{Ns}\}&amp;lt;/math&amp;gt;, the energy for atom with &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;M&amp;lt;/math&amp;gt; pairwise distances in local environment: &amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;E^{2b} = \sum_i^M \left(E^{2b}_0 + \delta^2\sum_j^{N_s}  \alpha_j k^{2b}_{ij}(\xi_i, \xi_j) \right) &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;soap-many-body-descriptor&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== SOAP (many-body) descriptor ===&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;u&amp;gt;SOAP descriptor&amp;lt;/u&amp;gt;: &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\boldsymbol{\xi}_i(\{\mathbf{r}\}_{ &amp;lt; r_{\rm cut}} )&amp;lt;/math&amp;gt;, represents environment of an atom ([[#citeproc_bib_item_2|Bartók et al. 2010]]).&lt;br /&gt;
* &amp;lt;u&amp;gt;Kernel&amp;lt;/u&amp;gt;: &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;k_{ij} = (\boldsymbol{\xi}_i \cdot \boldsymbol{\xi}_j)^{\zeta}&amp;lt;/math&amp;gt; measures &amp;lt;u&amp;gt;similarity of environments&amp;lt;/u&amp;gt;.&lt;br /&gt;
* &amp;lt;u&amp;gt;Fitting coefficients&amp;lt;/u&amp;gt;: &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\alpha_j&amp;lt;/math&amp;gt; result from Gaussian Process Regression.&lt;br /&gt;
* &amp;lt;u&amp;gt;Prediction&amp;lt;/u&amp;gt;: &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;E^{\rm mb}_i(\boldsymbol{\xi}_i) = E^{\rm mb}_0 + \delta^2\sum_j  \alpha_j k_{ij}&amp;lt;/math&amp;gt;&lt;br /&gt;
* For specifics of SOAP turbo, refer to Miguel's paper ([[#citeproc_bib_item_3|Caro 2019]])&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;how-do-we-model-xps&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== How do we model XPS? ==&lt;br /&gt;
&lt;br /&gt;
* XPS (X-ray photoelectron spectroscopy) spectra measure '''core electron binding energies'''.&lt;br /&gt;
* Core electron binding energies ''depend on atomic environment''.&lt;br /&gt;
* SOAP turbo model trained on DFT (&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\Delta\text{KS}&amp;lt;/math&amp;gt;) data with a &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;GW&amp;lt;/math&amp;gt; correction on top ([[#citeproc_bib_item_6|Golze et al. 2022]]).&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\text{CEBE} = ( \Delta KS^0_{\rm extended} + GW_{\rm carved} - \Delta \mathrm{KS}^+_{\rm carved} )&amp;lt;/math&amp;gt;&lt;br /&gt;
* Thermal and instrumental broadening accounted for by a Gaussian with &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\sigma = 0.4\text{ eV}&amp;lt;/math&amp;gt;&lt;br /&gt;
* Can analyse environments which make up spectra.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;prediction-of-local-properties&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Prediction of Local Properties ==&lt;br /&gt;
&lt;br /&gt;
* We can predict an &amp;lt;u&amp;gt;arbitrary number&amp;lt;/u&amp;gt; of ''local properties'' which use SOAP turbo descriptors using ''TurboGAP''.&lt;br /&gt;
* /One can get these for “free”/ if local property models are trained using the same descriptors as atomic energies/forces.&lt;br /&gt;
*; ''Hirshfeld volumes''&lt;br /&gt;
*: gives vdW dispersion via Tkatchenko-Scheffler. &amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; E_{\rm TS} = \sum_i \sum_{j\neq i} C_{6, ij}(v_{i}(\boldsymbol{\xi}_i), v_{j}(\boldsymbol{\xi}_j))\frac{f_{\rm damp}(r_{ij}, \ldots)}{r_{ij}^6} &amp;lt;/math&amp;gt;&lt;br /&gt;
*; ''Core-electron binding energies''&lt;br /&gt;
*: give '''X-ray Photoelectron Spectroscopy''' prediction. &amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; g_{\rm xps}(\varepsilon) = \frac{1}{M} \sum_i \exp\left( -(\varepsilon - \varepsilon_{i}(\boldsymbol{\xi}_i))^2/(2\sigma^2)  \right) &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;how-do-we-marry-experimental-data-and-gap&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
== How do we marry experimental data and GAP? ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* '''Generalized Hamiltonian within Grand-Canonical Monte-Carlo''' scheme.&lt;br /&gt;
* Vary oxygen content with chemical potential, to see motif differences.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;  \textcolor{violet}{ \mathbf{\tilde{g}}_{\rm {pred}}}(\varepsilon)  = \sum_{i} \exp\left(&lt;br /&gt;
-\frac{(\varepsilon - \textcolor{blue}{\varepsilon^{i}_{\rm&lt;br /&gt;
{pred}}(\boldsymbol{\xi}_i)})^2}{2\sigma^2}\right)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; \tilde{E} = E_{\rm GAP} + E_{\rm spectra} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; E_{\rm spectra} =  \frac{1}{2}\gamma \int \,d\varepsilon \left( \textcolor{violet}{ g_{\rm pred}(\varepsilon)} - g_{\rm exp}(\varepsilon)\right)^2&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;p&amp;gt;A simple squared difference, which is a penalty with increases with spectra dissimilarity and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\gamma&amp;lt;/math&amp;gt; is an energy scale.&amp;lt;/p&amp;gt;&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;p&amp;gt;We can do not just XPS but also X-ray/neutron diffraction and pair distribution functions.&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;[[File:xps_gcmc_scheme.png | 400px]]&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;/ul&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* We use the standard acceptance criteria for adding/removing/moving a particle&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; \mathrm{acc}(N \rightarrow N+1) = \mathrm{min}\left[1,&lt;br /&gt;
\frac{V}{\lambda^3 (N+1)} \exp\left\{ - \frac{\tilde{E}(N+1) -&lt;br /&gt;
\tilde{E}(N) - \mu}{k_BT} \right\}     \right] &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; \mathrm{acc}(N \rightarrow N-1) = \mathrm{min}\left[1,&lt;br /&gt;
\frac{\lambda^3 N}{V} \exp\left\{ -\frac{\tilde{E}(N-1) -&lt;br /&gt;
\tilde{E}(N) + \mu}{k_BT} \right\}     \right] &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; \mathrm{acc}_{\rm move} = \mathrm{min }\left[ 1, \exp\left\{ -&lt;br /&gt;
  \frac{\tilde{E}(\mathrm{new}) - \tilde{E}(\mathrm{old})}{k_BT} \right\} \right]&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;usage&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Usage =&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;installing-turbogap&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
== Installing ''TurboGAP'' ==&lt;br /&gt;
&lt;br /&gt;
We can install the ''TurboGAP'' code, found here https://github.com/mcaroba/turbogap through ''recursively cloning'' the main branch&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;git clone --recursive https://github.com/mcaroba/turbogap.git&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
Then we edit this line in the &amp;lt;code&amp;gt;Makefile&amp;lt;/code&amp;gt; to match our system architecture.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;include makefiles/Makefile.Ubuntu_gfortran_mpi&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Then, we make&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;make&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
and then export the path in &amp;lt;code&amp;gt;.bashrc&amp;lt;/code&amp;gt; file&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;export PATH=&amp;quot;~/turbogap/bin:$PATH&amp;quot;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;span id=&amp;quot;what-you-need-for-a-calculation&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
== What you need for a calculation ==&lt;br /&gt;
&lt;br /&gt;
; &amp;lt;code&amp;gt;gap_files/&amp;lt;/code&amp;gt; directory&lt;br /&gt;
: The directory which contains your &amp;lt;code&amp;gt;*.gap&amp;lt;/code&amp;gt;, with alphas (fitting coefficients) and sparse set descriptor files.&lt;br /&gt;
;* Potentials are available from ''TurboGAP'' wiki https://turbogap.fi/wiki/index.php/Potentials&lt;br /&gt;
;* Conversion script from &amp;lt;code&amp;gt;gap_fit .xml&amp;lt;/code&amp;gt; to &amp;lt;code&amp;gt;.gap&amp;lt;/code&amp;gt; can be used &amp;lt;code&amp;gt;turbogap/tools/make_gap_files.py&amp;lt;/code&amp;gt;&lt;br /&gt;
; &amp;lt;code&amp;gt;input&amp;lt;/code&amp;gt; file&lt;br /&gt;
: The file which tells the code what to do&lt;br /&gt;
; &amp;lt;code&amp;gt;*.xyz&amp;lt;/code&amp;gt;&lt;br /&gt;
: An extended xyz format file which contains positions/lattice/velocity information.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;adding-a-local-property-model-for-cebe-prediction&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== Adding a local property model for CEBE prediction ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;  gap_beg soap_turbo&lt;br /&gt;
  n_species = 2&lt;br /&gt;
  species = C O&lt;br /&gt;
  central_species = 1&lt;br /&gt;
... some params ...&lt;br /&gt;
  zeta = 4&lt;br /&gt;
  delta = 0.1&lt;br /&gt;
  desc_sparse = &amp;quot;gap_files/CO.xml.sparseX.GAP_2022_5_19_180_7_17_31_41410&amp;quot;&lt;br /&gt;
  alphas_sparse = &amp;quot;gap_files/alphas_soap_turbo_1.dat&amp;quot;&lt;br /&gt;
  compress_mode = &amp;quot;trivial&amp;quot;&lt;br /&gt;
  has_local_properties = .true.&lt;br /&gt;
  n_local_properties = 1&lt;br /&gt;
  local_property_qs = 'gap_files/core_electron_be.xml.sparseX.GAP_2024_1_26_120_18_36_33_6091'&lt;br /&gt;
  local_property_alphas = 'gap_files/alphas_core_electron_be_1.dat'&lt;br /&gt;
  local_property_labels = 'core_electron_be'&lt;br /&gt;
  local_property_zetas = 2&lt;br /&gt;
  local_property_deltas = 1.0&lt;br /&gt;
  local_property_v0s = 290.0&lt;br /&gt;
  gap_end&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;span id=&amp;quot;conversion-of-gap_fit-.xml-files-to-.gap-format&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== Conversion of &amp;lt;code&amp;gt;gap_fit&amp;lt;/code&amp;gt; &amp;lt;code&amp;gt;*.xml&amp;lt;/code&amp;gt; files to &amp;lt;code&amp;gt;*.gap&amp;lt;/code&amp;gt; format ===&lt;br /&gt;
&lt;br /&gt;
* Then we convert the &amp;lt;code&amp;gt;*.xml&amp;lt;/code&amp;gt; files which result from &amp;lt;code&amp;gt;gap_fit&amp;lt;/code&amp;gt; into the required format for ''TurboGAP''.&lt;br /&gt;
* This is done using the convenience script in &amp;lt;code&amp;gt;turbogap/tools/make_gap_files.py&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;python3 make_gap_files.py {gap_file.xml} {gap_file.gap} {N_local_prop.} \&lt;br /&gt;
              {local_prop1.xml} {local_prop_label1} \&lt;br /&gt;
              {local_prop2.xml} {local_prop_label2}...&lt;br /&gt;
# e.g. let's build a carbon oxygen GAP&lt;br /&gt;
# with core electron binding energy prediction capability.&lt;br /&gt;
python3 make_gap_files.py CO.xml CO.gap 1 \&lt;br /&gt;
        core_electron_be_co.xml core_electron_be&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
* This creates a directory &amp;lt;code&amp;gt;gap_files/&amp;lt;/code&amp;gt; which has&lt;br /&gt;
*# &amp;lt;code&amp;gt;alphas_{descriptor}.dat&amp;lt;/code&amp;gt; which are fitting coefficients for a particular descriptor&lt;br /&gt;
*# &amp;lt;code&amp;gt;qs_{descriptor}.dat&amp;lt;/code&amp;gt; which are the '''sparse set''' descriptors, used for prediction.&lt;br /&gt;
*# &amp;lt;code&amp;gt;alphas_{local_property}.dat&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;qs_{local_property}.dat&amp;lt;/code&amp;gt; for local property prediction.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;running-the-tutorial&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
== Running the Tutorial ==&lt;br /&gt;
&lt;br /&gt;
* Navigate to &amp;lt;code&amp;gt;turbogap/tutorials/xps_optimizaton&amp;lt;/code&amp;gt;&lt;br /&gt;
* Run &amp;lt;code&amp;gt;bash run.sh {calc_type}&amp;lt;/code&amp;gt; where &amp;lt;code&amp;gt;{calc_type}&amp;lt;/code&amp;gt; is either:&lt;br /&gt;
** &amp;lt;code&amp;gt;prediction&amp;lt;/code&amp;gt;&lt;br /&gt;
** &amp;lt;code&amp;gt;standard_gcmc&amp;lt;/code&amp;gt;&lt;br /&gt;
** &amp;lt;code&amp;gt;xps_optimization_gcmc&amp;lt;/code&amp;gt;&lt;br /&gt;
* Note that these simulations have a high chemical potential and (have high &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\gamma&amp;lt;/math&amp;gt; factors), these are just to give a result in a reasonable amount of time. Take care with real simulations.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;core-electron-binding-energy-prediction&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
== Core electron binding energy prediction ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;[mpirun -np N] turbogap predict&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
* We have in our &amp;lt;code&amp;gt;input&amp;lt;/code&amp;gt; file&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre class=&amp;quot;conf&amp;quot;&amp;gt;! Species-specific info&lt;br /&gt;
atoms_file = 'atoms.xyz'&lt;br /&gt;
pot_file = 'gap_files/CO.gap'&lt;br /&gt;
n_species = 2&lt;br /&gt;
species = C O&lt;br /&gt;
masses = 12.01 15.99&lt;br /&gt;
e0 = -.16138053 0.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Output:&lt;br /&gt;
&lt;br /&gt;
; &amp;lt;code&amp;gt;trajectory_out.xyz&amp;lt;/code&amp;gt;&lt;br /&gt;
: which contains atomic positions, local energy and local property arrays for each structure.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt; 512&lt;br /&gt;
Properties=species:S:1:pos:R:3:forces:R:3:local_energy:R:1:core_electron_be:R:1 \&lt;br /&gt;
   Lattice=&amp;quot;...&amp;quot; energy=-4321.582604 energy_soap=-4114.77018429  energy_2b=-124.73820332 energy_3b=0.55261463 \&lt;br /&gt;
   energy_core_pot=0.00000000 energy_vdw=0.00000000 energy_exp=0.00000000 energy_xps=0.00000000 \&lt;br /&gt;
   virial=&amp;quot;...&amp;quot; stress=&amp;quot;...&amp;quot; volume=5372.640346&lt;br /&gt;
   C              4.39625950       7.79414272      11.91703476     \&lt;br /&gt;
                  -0.00176074      -0.00403026       0.00040104    \&lt;br /&gt;
                  -8.32055957 \ # Local energy prediction&lt;br /&gt;
                  283.83841418  # CEBE Prediction&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Withiout specifying Exp. data, Turbogap does not predict the spectra.&lt;br /&gt;
* XPS spectra can simply be calculated from &amp;lt;code&amp;gt;core_electron_be&amp;lt;/code&amp;gt; in &amp;lt;code&amp;gt;trajectory_out.xyz&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;grand-canonical-monte-carlo&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
== (Grand-Canonical) Monte-Carlo ==&lt;br /&gt;
&lt;br /&gt;
* We use &amp;lt;code&amp;gt;mc&amp;lt;/code&amp;gt; mode&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;[mpirun -np N] turbogap mc&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
* ''e.g'' For a &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mu V T&amp;lt;/math&amp;gt; simulation of system in oxygen environment&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre class=&amp;quot;conf&amp;quot;&amp;gt;! Monte-carlo options&lt;br /&gt;
mc_nsteps = 1000                         # Number of Monte-Carlo Steps&lt;br /&gt;
n_mc_types = 3                           # Number of MC move types&lt;br /&gt;
mc_types = 'move' 'insertion' 'removal'  # MC move types (move/insertion/removal/volume/swap/md)&lt;br /&gt;
mc_move_max = 0.5                        # Maximum distance for MC displacement (&amp;amp;quot;move&amp;amp;quot;) type moves&lt;br /&gt;
&lt;br /&gt;
! - GCMC Options&lt;br /&gt;
n_mc_mu = 1              # Number of chemical potentials to add&lt;br /&gt;
mc_mu = 0                # Chemical potential(s) [eV]&lt;br /&gt;
mc_species = 'O'         # GCMC species types&lt;br /&gt;
mc_min_dist = 0.1        # GCMC minimum insertion distance&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Output:&lt;br /&gt;
&lt;br /&gt;
; &amp;lt;code&amp;gt;mc.log&amp;lt;/code&amp;gt;&lt;br /&gt;
: &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;# mc_istep  mc_move  accepted  E_trial              E_current             E_exp_trial          E_exp_current  N_tot_trial  N_mc_species_trial&lt;br /&gt;
       1       move    F       -4321.10376531       -4321.58260476         272.97693282         272.83692252      512  O        0&lt;br /&gt;
       2       move    F       -4321.10017027       -4321.58260476         272.68730901         272.83692252      512  O        0&lt;br /&gt;
       3  insertion    F       -4319.14082561       -4321.58260476         269.49191203         272.83692252      513  O        1&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; &amp;lt;code&amp;gt;mc_all.xyz&amp;lt;/code&amp;gt;&lt;br /&gt;
: xyz file written to every &amp;lt;code&amp;gt;write_xyz = N&amp;lt;/code&amp;gt; steps.&lt;br /&gt;
; &amp;lt;code&amp;gt;mc_current.xyz&amp;lt;/code&amp;gt;&lt;br /&gt;
: xyz file saving current accepted config written to every &amp;lt;code&amp;gt;write_xyz = N&amp;lt;/code&amp;gt; steps.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* If we run &amp;lt;code&amp;gt;bash run.sh standard_gcmc&amp;lt;/code&amp;gt; (may take a few minutes), we can see a prediction of the XPS with oxygen content&lt;br /&gt;
&lt;br /&gt;
[[File:standard_gcmc.png | 800px]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;experimental-observable-optimization&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Experimental Observable Optimization ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;[mpirun -np N] turbogap mc/md&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
* We can specify experimental observables to predict and optimize them using MC or MD. &amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; E_{\rm spectra} = \frac{1}{2} \gamma \int \,d\varepsilon (g_{\rm pred}(\varepsilon) - g_{\rm exp}(\varepsilon))^2  &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre class=&amp;quot;conf&amp;quot;&amp;gt;! Experimental data options&lt;br /&gt;
n_exp = 1                                  # Number of experimental observables&lt;br /&gt;
exp_labels = 'xps'                         # Experimental observable types (xps/xrd/nd/pdf)&lt;br /&gt;
exp_data_files = 'xps_spectra_interp.dat'  # Experimental data files (Note: the range of resulting XPS prediction will be the same as the experimental range.)&lt;br /&gt;
exp_n_samples = 501                        # Number of interpolations samples over the experimental range.&lt;br /&gt;
exp_energy_scales = 100.0                    # Energy scale (gamma) [eV]&lt;br /&gt;
&lt;br /&gt;
# XPS smearing&lt;br /&gt;
xps_sigma = 0.4&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Output:&lt;br /&gt;
&lt;br /&gt;
; &amp;lt;code&amp;gt;xps_prediction.dat&amp;lt;/code&amp;gt;&lt;br /&gt;
: Data file written every &amp;lt;code&amp;gt;write_xyz = N&amp;lt;/code&amp;gt; steps. Separate predictions separated by blank lines.&lt;br /&gt;
; &amp;lt;code&amp;gt;xps_exp.dat&amp;lt;/code&amp;gt;&lt;br /&gt;
: The experimental data fed into ''TurboGAP''.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* If we run &amp;lt;code&amp;gt;bash run.sh xps_optimization_gcmc&amp;lt;/code&amp;gt; (may take a few minutes), we can see a prediction of the XPS with oxygen content&lt;br /&gt;
&lt;br /&gt;
[[File:xps_optimization_gcmc.png | 800px]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;multiple-observables&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Multiple Observables ==&lt;br /&gt;
&lt;br /&gt;
* This is not in the tutorial files, but ''TurboGAP'' allows for we can optimization multiple observables.&lt;br /&gt;
** X-ray diffraction&lt;br /&gt;
** Neutron diffraction&lt;br /&gt;
** Pair distribution function&lt;br /&gt;
** XPS&lt;br /&gt;
* Here we show a fictitious example of XPS and XRD optimization.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre class=&amp;quot;conf&amp;quot;&amp;gt;# Partial PDFs needed for XRD calculation&lt;br /&gt;
pair_distribution_n_samples = 301&lt;br /&gt;
r_range_min = 0.1&lt;br /&gt;
r_range_max = 13.5&lt;br /&gt;
pair_distribution_rcut = 14.1&lt;br /&gt;
&lt;br /&gt;
do_xrd = .true.&lt;br /&gt;
&lt;br /&gt;
# Experimental Data Specification&lt;br /&gt;
n_exp = 2                  # Number of Exp. observables&lt;br /&gt;
exp_labels = 'xps' 'xrd'   # Exp. observable type (xps/xrd/nd/pdf)&lt;br /&gt;
exp_data_files = 'xps_spectra_experiment.dat' 'xrd_CO_experiment.dat'&lt;br /&gt;
exp_n_samples = 301 301 # Number of samples for the experimental data&lt;br /&gt;
exp_energy_scales = 10.0 10.0  # The &amp;amp;quot;gamma&amp;amp;quot; term for each observable&lt;br /&gt;
&lt;br /&gt;
# If using monte-carlo, the experimental energies are added directly to the local energy&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;span id=&amp;quot;applications&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
= Applications =&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;experimental-observable-predictionoptimization&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
== Experimental Observable prediction/optimization ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;deconvolution-analysis&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== Deconvolution analysis ===&lt;br /&gt;
&lt;br /&gt;
* Use subgraph isomorphisms of bonding networks to discern motifs present.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:exp_xps_with_background_high.png | 400px]]&lt;br /&gt;
&lt;br /&gt;
↑ Experimental XPS deconvolution ([[#citeproc_bib_item_9|Santini et al. 2015]])&lt;br /&gt;
&lt;br /&gt;
We see in the experimental deconvolution analysis that sp3 motifs compose the primary XPS peak. The generation of a-COx here was done by physical vapor deposition of graphitic carbon in an oxygen environment. They see a reduction in the number of sp2 bonds. They also claim there is a complete transformation of sp2 to sp3 that is reversible with a short annealing at 500C. &lt;br /&gt;
&lt;br /&gt;
[[File:deconvolution_comparison_fill_-3_new.png| 400px]]&lt;br /&gt;
&lt;br /&gt;
↑ Our XPS deconvolution ([[#citeproc_bib_item_9|Santini et al. 2015]])&lt;br /&gt;
&lt;br /&gt;
However from our deconvolution analysis, we see that this primary peak is composed of sp2 motifs. We can explain why the experimentalists see only sp2 with a simple computational experiment. &lt;br /&gt;
&lt;br /&gt;
We add in oxygen to the bottom layer of a graphene bilayer system to see the influence of oxygen on sp2 core electron binding energies. &lt;br /&gt;
&lt;br /&gt;
[[File:xps_shifts_miguel_first.png| 400px]]&lt;br /&gt;
&lt;br /&gt;
[[File:xps_shifts_miguel_last.png| 400px]]&lt;br /&gt;
&lt;br /&gt;
We see with oxygen content that sp2 motifs are shifted significantly, even past the sp3 reference. Due to the presence of oxygen, there is a shift of sp2 motifs which are not accounted for by the experimental deconvolution references, as these are fixed. This is why the experimental deconvolution did not give what we expect: sp2 carbon that composes the primary XPS peak. &lt;br /&gt;
&amp;lt;span id=&amp;quot;summary&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Summary =&lt;br /&gt;
&lt;br /&gt;
* Machine-learned potentials can be combined with experimental models to give structures which are consistent with both ''ab-inito'' and experimental data.&lt;br /&gt;
* We can generate oxygenated amorphous carbon structures using a CO GAP with XPS prediction using modified GCMC and a “Molecular Augmented Dynamics” method.&lt;br /&gt;
* We can use ''multiple experimental observables''.&lt;br /&gt;
* '''Finding structures which match experimental data allows us to understand specific experimental results.'''&lt;br /&gt;
* Deconvolve experimental XPS exactly.&lt;br /&gt;
* All of this is implemented in the ''TurboGAP'' code.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;references&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
= References =&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;citeproc_bib_item_1&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;Bartók, Albert P., Risi Kondor, and Gábor Csányi. 2013. “On Representing Chemical Environments.” ''Physical Review B'' 87 (18): 184115. https://doi.org/10.1103/PhysRevB.87.184115.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;citeproc_bib_item_2&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;Bartók, Albert P., Mike C. Payne, Risi Kondor, and Gábor Csányi. 2010. “Gaussian Approximation Potentials: The Accuracy of Quantum Mechanics, without the Electrons.” ''Physical Review Letters'' 104 (13): 136403. https://doi.org/10.1103/PhysRevLett.104.136403.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;citeproc_bib_item_3&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;Caro, Miguel A. 2019. “Optimizing Many-Body Atomic Descriptors for Enhanced Computational Performance of Machine Learning Based Interatomic Potentials.” ''Physical Review B'' 100 (2): 024112. https://doi.org/10.1103/PhysRevB.100.024112.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;citeproc_bib_item_4&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;Deringer, Volker L., Albert P. Bartók, Noam Bernstein, David M. Wilkins, Michele Ceriotti, and Gábor Csányi. 2021. “Gaussian Process Regression for Materials and Molecules.” ''Chemical Reviews'' 121 (16): 10073–141. https://doi.org/10.1021/acs.chemrev.1c00022.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;citeproc_bib_item_5&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;El-Machachi, Zakariya, Damyan Frantzov, A. Nijamudheen, Tigany Zarrouk, Miguel A. Caro, and Volker L. Deringer. 2024. “Accelerated First-Principles Exploration of Structure and Reactivity in Graphene Oxide.” arXiv. https://doi.org/10.48550/arXiv.2405.14814.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;citeproc_bib_item_6&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;Golze, Dorothea, Markus Hirvensalo, Patricia Hernández-León, Anja Aarva, Jarkko Etula, Toma Susi, Patrick Rinke, Tomi Laurila, and Miguel A. Caro. 2022. “Accurate Computational Prediction of Core-Electron Binding Energies in Carbon-Based Materials: A Machine-Learning Model Combining Density-Functional Theory and GW.” ''Chemistry of Materials'' 34 (14): 6240–54. https://doi.org/10.1021/acs.chemmater.1c04279.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;citeproc_bib_item_7&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;Muhli, Heikki, Xi Chen, Albert P. Bartók, Patricia Hernández-León, Gábor Csányi, Tapio Ala-Nissila, and Miguel A. Caro. 2021. “Machine Learning Force Fields Based on Local Parametrization of Dispersion Interactions: Application to the Phase Diagram of \&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathrm\\\C\\\\\_\60\\&amp;lt;/math&amp;gt;.” ''Physical Review B'' 104 (5): 054106. https://doi.org/10.1103/PhysRevB.104.054106.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;citeproc_bib_item_8&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;Opletal, George, Timothy C. Petersen, Amanda S. Barnard, and Salvy P. Russo. 2017. “On Reverse Monte Carlo Constraints and Model Reproduction.” ''Journal of Computational Chemistry'' 38 (17): 1547–51. https://doi.org/10.1002/jcc.24799.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;citeproc_bib_item_9&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;Santini, Claudia A., Abu Sebastian, Chiara Marchiori, Vara Prasad Jonnalagadda, Laurent Dellmann, Wabe W. Koelmans, Marta D. Rossell, Christophe P. Rossel, and Evangelos Eleftheriou. 2015. “Oxygenated Amorphous Carbon for Resistive Memory Applications.” ''Nature Communications'' 6 (1): 8600. https://doi.org/10.1038/ncomms9600.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;citeproc_bib_item_10&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;Wang, Yanzhou, Zheyong Fan, Ping Qian, Tapio Ala-Nissila, and Miguel A. Caro. 2022. “Structure and Pore Size Distribution in Nanoporous Carbon.” ''Chemistry of Materials'' 34 (2): 617–28. https://doi.org/10.1021/acs.chemmater.1c03279.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;citeproc_bib_item_11&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;Zarrouk, Tigany, Rina Ibragimova, Albert P. Bartók, and Miguel A. Caro. 2024. “Experiment-Driven Atomistic Materials Modeling: A Case Study Combining X-Ray Photoelectron Spectroscopy and Machine Learning Potentials to Infer the Structure of Oxygen-Rich Amorphous Carbon.” ''Journal of the American Chemical Society'' 146 (21): 14645–59. https://doi.org/10.1021/jacs.4c01897.&lt;/div&gt;</summary>
		<author><name>Tigany Zarrouk</name></author>
		
	</entry>
	<entry>
		<id>https://turbogap.fi/wiki/index.php?title=XPS-optimized_oxygenated_amorphous_carbon&amp;diff=653</id>
		<title>XPS-optimized oxygenated amorphous carbon</title>
		<link rel="alternate" type="text/html" href="https://turbogap.fi/wiki/index.php?title=XPS-optimized_oxygenated_amorphous_carbon&amp;diff=653"/>
		<updated>2024-06-19T08:22:52Z</updated>

		<summary type="html">&lt;p&gt;Tigany Zarrouk: /* SOAP (many-body) descriptor */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
&amp;lt;span id=&amp;quot;what-is-turbogap&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
= What is ''TurboGAP'' ? =&lt;br /&gt;
&lt;br /&gt;
* ''TurboGAP'' is a &amp;lt;code&amp;gt;Fortran&amp;lt;/code&amp;gt; atomistic code which uses &amp;lt;u&amp;gt;Gaussian Approximation Potentials&amp;lt;/u&amp;gt; (GAPs).&lt;br /&gt;
* Its specialty are ''SOAP turbo'' descriptors: faster and more accurate than SOAP (Smooth Overlap of Atomic Positions).&lt;br /&gt;
* It's (probably!) the fastest SOAP prediction code, which will be made even faster with ''GPU acceleration'' (ongoing with CSC).&lt;br /&gt;
&lt;br /&gt;
* Through GAP/SOAP predictions, one can perform simulations with ''ab-initio'' accuracy '''at scale'''&lt;br /&gt;
** Molecular Dynamics&lt;br /&gt;
** Grand-Canonical Monte-Carlo simulations&lt;br /&gt;
** Electronic-stopping and spatially-correlated Langevin Dynamics (in-development).&lt;br /&gt;
** '''Prediction/optimization of experimental observables''' (''e.g.'' X-Ray photoelectron spectra ([[#citeproc_bib_item_6|Golze et al. 2022]]; [[#citeproc_bib_item_11|Zarrouk et al. 2024]]), X-ray/Neutron Diffraction and more to come!).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;motivation-for-structural-inference&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Motivation for structural inference =&lt;br /&gt;
&lt;br /&gt;
* We typically want to &amp;lt;u&amp;gt;predict structures&amp;lt;/u&amp;gt;, to make sense of experimental data.&lt;br /&gt;
* We usually pray structures have &amp;lt;u&amp;gt;experimental agreement&amp;lt;/u&amp;gt; (a “bottom-up” approach).&lt;br /&gt;
* What if we can &amp;lt;u&amp;gt;promote agreement&amp;lt;/u&amp;gt; with experimental data?&lt;br /&gt;
* ''Reverse Monte-Carlo'' techniques match experimental data to atomic structure (“top-down” approach).&lt;br /&gt;
** Downsides: “By-hand” constraints&lt;br /&gt;
** Simple experimental observables.&lt;br /&gt;
** Unphysical structures/artifacts ([[#citeproc_bib_item_8|Opletal et al. 2017]])&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Need efficient structure search to find '''agreement''' with '''experimental''' data ''and'' '''ab-inito''' data.&lt;br /&gt;
&lt;br /&gt;
With &amp;lt;u&amp;gt;CO GAP + Core electron binding energy SOAP&amp;lt;/u&amp;gt; model we will perform '''modified (Grand-canonical) Monte-Carlo''' to produce ''experimentally consistent, low energy structures'' of oxygenated amorphous carbon.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:deconvolution_comparison_fill_-3_new.png | 400px]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;theory-and-methods&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Theory and Methods =&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;gaussian-approximation-potentials-gap&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
== Gaussian Approximation Potentials (GAP) ==&lt;br /&gt;
&lt;br /&gt;
([[#citeproc_bib_item_2|Bartók et al. 2010]]; [[#citeproc_bib_item_1|Bartók, Kondor, and Csányi 2013]]; [[#citeproc_bib_item_4|Deringer et al. 2021]])&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;u&amp;gt;Assumption&amp;lt;/u&amp;gt;: Total energy is sum of '''local energies'''. &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;E_{\rm total}(\{\mathbf{r}\}) = \sum_i^{N_{\text{atoms}}} \varepsilon^i(\{r\}, \{\xi^{\text{2b}}_i\}, \{\boldsymbol{\xi}^{\text{3b}}_i\}, \boldsymbol{\xi}^{\text{mb}}_i))&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;\begin{align}&lt;br /&gt;
  \varepsilon^i ( &amp;amp;\{r\}, \{\xi^{\text{2b}}_i\}, \{\boldsymbol{\xi}^{\text{3b}}_i\}, \boldsymbol{\xi}^{\text{mb}}_i) =&lt;br /&gt;
   E^{\text{2b}}(\{\xi^{\text{2b}}_i\}) + E^{\text{3b}}(\{\boldsymbol{\xi}^{\text{3b}}_i\}) \nonumber\\&lt;br /&gt;
  &amp;amp; + E^{\text{mb}}(\boldsymbol{\xi}^{\text{mb}}_i)&lt;br /&gt;
  + \sum_{r &amp;lt; r_{\rm cut}^{\rm core}} E^{\text{core}}(r)  \nonumber&lt;br /&gt;
\end{align}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
; Local energy&lt;br /&gt;
: Sum of '''2b, 3b and many-body''' terms.&lt;br /&gt;
; Descriptor &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\xi / \boldsymbol{\xi}&amp;lt;/math&amp;gt;.&lt;br /&gt;
: ''e.g'' &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\{\xi^{\text{2b}}\} = \{r_{ij}\}&amp;lt;/math&amp;gt;, &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\{\boldsymbol{\xi}^{\text{3b}}\} = \{ [ r_{ij}, r_{ik}, r_{kj} ] \}&amp;lt;/math&amp;gt;&lt;br /&gt;
; Local environment&lt;br /&gt;
: A set of descriptors.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;using-descriptors-to-predict-quantities&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== Using descriptors to predict quantities ===&lt;br /&gt;
&lt;br /&gt;
* ''Kernel/basis functions'' &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;k_{ij}(\boldsymbol{\xi}_i, \boldsymbol{\xi}_j)&amp;lt;/math&amp;gt; measure the ''similarity between descriptors''.&lt;br /&gt;
* ''e.g'' Exponential 2b kernel: &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;k^{2b}_{ij}(\xi_i, \xi_j) \equiv k^{2b}_{ij}(r_{i}, r_{j}) = \exp( - (r_{i} - r_{j})^2/2\sigma^2 )&amp;lt;/math&amp;gt;&lt;br /&gt;
* ''Gaussian Process Regression'' (kernel matrix algebra on training set) → ''fitting coefficients'' &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\{\alpha\}&amp;lt;/math&amp;gt;, ([[#citeproc_bib_item_4|Deringer et al. 2021]])&lt;br /&gt;
* ''e.g.'' 2b model trained with &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;N_s&amp;lt;/math&amp;gt; descriptors &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\{\xi\} \in \{\xi_i, \ldots, \xi_{Ns}\}&amp;lt;/math&amp;gt;, the energy for atom with &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;M&amp;lt;/math&amp;gt; pairwise distances in local environment: &amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;E^{2b} = \sum_i^M \left(E^{2b}_0 + \delta^2\sum_j^{N_s}  \alpha_j k^{2b}_{ij}(\xi_i, \xi_j) \right) &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;soap-many-body-descriptor&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== SOAP (many-body) descriptor ===&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;u&amp;gt;SOAP descriptor&amp;lt;/u&amp;gt;: &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\boldsymbol{\xi}_i(\{\mathbf{r}\}_{ &amp;lt; r_{\rm cut}} )&amp;lt;/math&amp;gt;, represents environment of an atom ([[#citeproc_bib_item_2|Bartók et al. 2010]]).&lt;br /&gt;
* &amp;lt;u&amp;gt;Kernel&amp;lt;/u&amp;gt;: &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;k_{ij} = (\boldsymbol{\xi}_i \cdot \boldsymbol{\xi}_j)^{\zeta}&amp;lt;/math&amp;gt; measures &amp;lt;u&amp;gt;similarity of environments&amp;lt;/u&amp;gt;.&lt;br /&gt;
* &amp;lt;u&amp;gt;Fitting coefficients&amp;lt;/u&amp;gt;: &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\alpha_j&amp;lt;/math&amp;gt; result from Gaussian Process Regression.&lt;br /&gt;
* &amp;lt;u&amp;gt;Prediction&amp;lt;/u&amp;gt;: &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;E^{\rm mb}_i(\boldsymbol{\xi}_i) = E^{\rm mb}_0 + \delta^2\sum_j  \alpha_j k_{ij}&amp;lt;/math&amp;gt;&lt;br /&gt;
* For specifics of SOAP turbo, refer to Miguel's paper ([[#citeproc_bib_item_3|Caro 2019]])&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;how-do-we-model-xps&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== How do we model XPS? ==&lt;br /&gt;
&lt;br /&gt;
* XPS (X-ray photoelectron spectroscopy) spectra measure '''core electron binding energies'''.&lt;br /&gt;
* Core electron binding energies ''depend on atomic environment''.&lt;br /&gt;
* SOAP turbo model trained on DFT (&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\Delta\text{KS}&amp;lt;/math&amp;gt;) data with a &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;GW&amp;lt;/math&amp;gt; correction on top ([[#citeproc_bib_item_6|Golze et al. 2022]]).&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\text{CEBE} = ( \Delta KS^0_{\rm extended} + GW_{\rm carved} - \Delta \mathrm{KS}^+_{\rm carved} )&amp;lt;/math&amp;gt;&lt;br /&gt;
* Thermal and instrumental broadening accounted for by a Gaussian with &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\sigma = 0.4\text{ eV}&amp;lt;/math&amp;gt;&lt;br /&gt;
* Can analyse environments which make up spectra.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;prediction-of-local-properties&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Prediction of Local Properties ==&lt;br /&gt;
&lt;br /&gt;
* We can predict an &amp;lt;u&amp;gt;arbitrary number&amp;lt;/u&amp;gt; of ''local properties'' which use SOAP turbo descriptors using ''TurboGAP''.&lt;br /&gt;
* /One can get these for “free”/ if local property models are trained using the same descriptors as atomic energies/forces.&lt;br /&gt;
*; ''Hirshfeld volumes''&lt;br /&gt;
*: gives vdW dispersion via Tkatchenko-Scheffler. &amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; E_{\rm TS} = \sum_i \sum_{j\neq i} C_{6, ij}(v_{i}(\boldsymbol{\xi}_i), v_{j}(\boldsymbol{\xi}_j))\frac{f_{\rm damp}(r_{ij}, \ldots)}{r_{ij}^6} &amp;lt;/math&amp;gt;&lt;br /&gt;
*; ''Core-electron binding energies''&lt;br /&gt;
*: give '''X-ray Photoelectron Spectroscopy''' prediction. &amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; g_{\rm xps}(\varepsilon) = \frac{1}{M} \sum_i \exp\left( -(\varepsilon - \varepsilon_{i}(\boldsymbol{\xi}_i))^2/(2\sigma^2)  \right) &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;how-do-we-marry-experimental-data-and-gap&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
== How do we marry experimental data and GAP? ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* '''Generalized Hamiltonian within Grand-Canonical Monte-Carlo''' scheme.&lt;br /&gt;
* Vary oxygen content with chemical potential, to see motif differences.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;  \textcolor{violet}{ \mathbf{\tilde{g}}_{\rm {pred}}}(\varepsilon)  = \sum_{i} \exp\left(&lt;br /&gt;
-\frac{(\varepsilon - \textcolor{blue}{\varepsilon^{i}_{\rm&lt;br /&gt;
{pred}}(\boldsymbol{\xi}_i)})^2}{2\sigma^2}\right)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; \tilde{E} = E_{\rm GAP} + E_{\rm spectra} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; E_{\rm spectra} =  \frac{1}{2}\gamma \int \,d\varepsilon \left( \textcolor{violet}{ g_{\rm pred}(\varepsilon)} - g_{\rm exp}(\varepsilon)\right)^2&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;p&amp;gt;A simple squared difference, which is a penalty with increases with spectra dissimilarity and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\gamma&amp;lt;/math&amp;gt; is an energy scale.&amp;lt;/p&amp;gt;&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;p&amp;gt;We can do not just XPS but also X-ray/neutron diffraction and pair distribution functions.&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;[[File:xps_gcmc_scheme.png | 400px]]&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;/ul&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* We use the standard acceptance criteria for adding/removing/moving a particle&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; \mathrm{acc}(N \rightarrow N+1) = \mathrm{min}\left[1,&lt;br /&gt;
\frac{V}{\lambda^3 (N+1)} \exp\left\{ - \frac{\tilde{E}(N+1) -&lt;br /&gt;
\tilde{E}(N) - \mu}{k_BT} \right\}     \right] &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; \mathrm{acc}(N \rightarrow N-1) = \mathrm{min}\left[1,&lt;br /&gt;
\frac{\lambda^3 N}{V} \exp\left\{ -\frac{\tilde{E}(N-1) -&lt;br /&gt;
\tilde{E}(N) + \mu}{k_BT} \right\}     \right] &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; \mathrm{acc}_{\rm move} = \mathrm{min }\left[ 1, \exp\left\{ -&lt;br /&gt;
  \frac{\tilde{E}(\mathrm{new}) - \tilde{E}(\mathrm{old})}{k_BT} \right\} \right]&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;usage&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Usage =&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;installing-turbogap&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
== Installing ''TurboGAP'' ==&lt;br /&gt;
&lt;br /&gt;
We can install the ''TurboGAP'' code, found here https://github.com/mcaroba/turbogap through ''recursively cloning'' the main branch&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;git clone --recursive https://github.com/mcaroba/turbogap.git&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
Then we edit this line in the &amp;lt;code&amp;gt;Makefile&amp;lt;/code&amp;gt; to match our system architecture.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;include makefiles/Makefile.Ubuntu_gfortran_mpi&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Then, we make&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;make&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
and then export the path in &amp;lt;code&amp;gt;.bashrc&amp;lt;/code&amp;gt; file&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;export PATH=&amp;quot;~/turbogap/bin:$PATH&amp;quot;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;span id=&amp;quot;what-you-need-for-a-calculation&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
== What you need for a calculation ==&lt;br /&gt;
&lt;br /&gt;
; &amp;lt;code&amp;gt;gap_files/&amp;lt;/code&amp;gt; directory&lt;br /&gt;
: The directory which contains your &amp;lt;code&amp;gt;*.gap&amp;lt;/code&amp;gt;, with alphas (fitting coefficients) and sparse set descriptor files.&lt;br /&gt;
;* Potentials are available from ''TurboGAP'' wiki https://turbogap.fi/wiki/index.php/Potentials&lt;br /&gt;
;* Conversion script from &amp;lt;code&amp;gt;gap_fit .xml&amp;lt;/code&amp;gt; to &amp;lt;code&amp;gt;.gap&amp;lt;/code&amp;gt; can be used &amp;lt;code&amp;gt;turbogap/tools/make_gap_files.py&amp;lt;/code&amp;gt;&lt;br /&gt;
; &amp;lt;code&amp;gt;input&amp;lt;/code&amp;gt; file&lt;br /&gt;
: The file which tells the code what to do&lt;br /&gt;
; &amp;lt;code&amp;gt;*.xyz&amp;lt;/code&amp;gt;&lt;br /&gt;
: An extended xyz format file which contains positions/lattice/velocity information.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;adding-a-local-property-model-for-cebe-prediction&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== Adding a local property model for CEBE prediction ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;  gap_beg soap_turbo&lt;br /&gt;
  n_species = 2&lt;br /&gt;
  species = C O&lt;br /&gt;
  central_species = 1&lt;br /&gt;
... some params ...&lt;br /&gt;
  zeta = 4&lt;br /&gt;
  delta = 0.1&lt;br /&gt;
  desc_sparse = &amp;quot;gap_files/CO.xml.sparseX.GAP_2022_5_19_180_7_17_31_41410&amp;quot;&lt;br /&gt;
  alphas_sparse = &amp;quot;gap_files/alphas_soap_turbo_1.dat&amp;quot;&lt;br /&gt;
  compress_mode = &amp;quot;trivial&amp;quot;&lt;br /&gt;
  has_local_properties = .true.&lt;br /&gt;
  n_local_properties = 1&lt;br /&gt;
  local_property_qs = 'gap_files/core_electron_be.xml.sparseX.GAP_2024_1_26_120_18_36_33_6091'&lt;br /&gt;
  local_property_alphas = 'gap_files/alphas_core_electron_be_1.dat'&lt;br /&gt;
  local_property_labels = 'core_electron_be'&lt;br /&gt;
  local_property_zetas = 2&lt;br /&gt;
  local_property_deltas = 1.0&lt;br /&gt;
  local_property_v0s = 290.0&lt;br /&gt;
  gap_end&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;span id=&amp;quot;conversion-of-gap_fit-.xml-files-to-.gap-format&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== Conversion of &amp;lt;code&amp;gt;gap_fit&amp;lt;/code&amp;gt; &amp;lt;code&amp;gt;*.xml&amp;lt;/code&amp;gt; files to &amp;lt;code&amp;gt;*.gap&amp;lt;/code&amp;gt; format ===&lt;br /&gt;
&lt;br /&gt;
* Then we convert the &amp;lt;code&amp;gt;*.xml&amp;lt;/code&amp;gt; files which result from &amp;lt;code&amp;gt;gap_fit&amp;lt;/code&amp;gt; into the required format for ''TurboGAP''.&lt;br /&gt;
* This is done using the convenience script in &amp;lt;code&amp;gt;turbogap/tools/make_gap_files.py&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;python3 make_gap_files.py {gap_file.xml} {gap_file.gap} {N_local_prop.} \&lt;br /&gt;
              {local_prop1.xml} {local_prop_label1} \&lt;br /&gt;
              {local_prop2.xml} {local_prop_label2}...&lt;br /&gt;
# e.g. let's build a carbon oxygen GAP&lt;br /&gt;
# with core electron binding energy prediction capability.&lt;br /&gt;
python3 make_gap_files.py CO.xml CO.gap 1 \&lt;br /&gt;
        core_electron_be_co.xml core_electron_be&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
* This creates a directory &amp;lt;code&amp;gt;gap_files/&amp;lt;/code&amp;gt; which has&lt;br /&gt;
*# &amp;lt;code&amp;gt;alphas_{descriptor}.dat&amp;lt;/code&amp;gt; which are fitting coefficients for a particular descriptor&lt;br /&gt;
*# &amp;lt;code&amp;gt;qs_{descriptor}.dat&amp;lt;/code&amp;gt; which are the '''sparse set''' descriptors, used for prediction.&lt;br /&gt;
*# &amp;lt;code&amp;gt;alphas_{local_property}.dat&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;qs_{local_property}.dat&amp;lt;/code&amp;gt; for local property prediction.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;running-the-tutorial&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
== Running the Tutorial ==&lt;br /&gt;
&lt;br /&gt;
* Navigate to &amp;lt;code&amp;gt;turbogap/tutorials/xps_optimizaton&amp;lt;/code&amp;gt;&lt;br /&gt;
* Run &amp;lt;code&amp;gt;bash run.sh {calc_type}&amp;lt;/code&amp;gt; where &amp;lt;code&amp;gt;{calc_type}&amp;lt;/code&amp;gt; is either:&lt;br /&gt;
** &amp;lt;code&amp;gt;prediction&amp;lt;/code&amp;gt;&lt;br /&gt;
** &amp;lt;code&amp;gt;standard_gcmc&amp;lt;/code&amp;gt;&lt;br /&gt;
** &amp;lt;code&amp;gt;xps_optimization_gcmc&amp;lt;/code&amp;gt;&lt;br /&gt;
* Note that these simulations have a high chemical potential and (have high &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\gamma&amp;lt;/math&amp;gt; factors), these are just to give a result in a reasonable amount of time. Take care with real simulations.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;core-electron-binding-energy-prediction&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
== Core electron binding energy prediction ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;[mpirun -np N] turbogap predict&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
* We have in our &amp;lt;code&amp;gt;input&amp;lt;/code&amp;gt; file&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre class=&amp;quot;conf&amp;quot;&amp;gt;! Species-specific info&lt;br /&gt;
atoms_file = 'atoms.xyz'&lt;br /&gt;
pot_file = 'gap_files/CO.gap'&lt;br /&gt;
n_species = 2&lt;br /&gt;
species = C O&lt;br /&gt;
masses = 12.01 15.99&lt;br /&gt;
e0 = -.16138053 0.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Output:&lt;br /&gt;
&lt;br /&gt;
; &amp;lt;code&amp;gt;trajectory_out.xyz&amp;lt;/code&amp;gt;&lt;br /&gt;
: which contains atomic positions, local energy and local property arrays for each structure.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt; 512&lt;br /&gt;
Properties=species:S:1:pos:R:3:forces:R:3:local_energy:R:1:core_electron_be:R:1 \&lt;br /&gt;
   Lattice=&amp;quot;...&amp;quot; energy=-4321.582604 energy_soap=-4114.77018429  energy_2b=-124.73820332 energy_3b=0.55261463 \&lt;br /&gt;
   energy_core_pot=0.00000000 energy_vdw=0.00000000 energy_exp=0.00000000 energy_xps=0.00000000 \&lt;br /&gt;
   virial=&amp;quot;...&amp;quot; stress=&amp;quot;...&amp;quot; volume=5372.640346&lt;br /&gt;
   C              4.39625950       7.79414272      11.91703476     \&lt;br /&gt;
                  -0.00176074      -0.00403026       0.00040104    \&lt;br /&gt;
                  -8.32055957 \ # Local energy prediction&lt;br /&gt;
                  283.83841418  # CEBE Prediction&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Withiout specifying Exp. data, Turbogap does not predict the spectra.&lt;br /&gt;
* XPS spectra can simply be calculated from &amp;lt;code&amp;gt;core_electron_be&amp;lt;/code&amp;gt; in &amp;lt;code&amp;gt;trajectory_out.xyz&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;grand-canonical-monte-carlo&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
== (Grand-Canonical) Monte-Carlo ==&lt;br /&gt;
&lt;br /&gt;
* We use &amp;lt;code&amp;gt;mc&amp;lt;/code&amp;gt; mode&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;[mpirun -np N] turbogap mc&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
* ''e.g'' For a &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mu V T&amp;lt;/math&amp;gt; simulation of system in oxygen environment&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre class=&amp;quot;conf&amp;quot;&amp;gt;! Monte-carlo options&lt;br /&gt;
mc_nsteps = 1000                         # Number of Monte-Carlo Steps&lt;br /&gt;
n_mc_types = 3                           # Number of MC move types&lt;br /&gt;
mc_types = 'move' 'insertion' 'removal'  # MC move types (move/insertion/removal/volume/swap/md)&lt;br /&gt;
mc_move_max = 0.5                        # Maximum distance for MC displacement (&amp;amp;quot;move&amp;amp;quot;) type moves&lt;br /&gt;
&lt;br /&gt;
! - GCMC Options&lt;br /&gt;
n_mc_mu = 1              # Number of chemical potentials to add&lt;br /&gt;
mc_mu = 0                # Chemical potential(s) [eV]&lt;br /&gt;
mc_species = 'O'         # GCMC species types&lt;br /&gt;
mc_min_dist = 0.1        # GCMC minimum insertion distance&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Output:&lt;br /&gt;
&lt;br /&gt;
; &amp;lt;code&amp;gt;mc.log&amp;lt;/code&amp;gt;&lt;br /&gt;
: &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;# mc_istep  mc_move  accepted  E_trial              E_current             E_exp_trial          E_exp_current  N_tot_trial  N_mc_species_trial&lt;br /&gt;
       1       move    F       -4321.10376531       -4321.58260476         272.97693282         272.83692252      512  O        0&lt;br /&gt;
       2       move    F       -4321.10017027       -4321.58260476         272.68730901         272.83692252      512  O        0&lt;br /&gt;
       3  insertion    F       -4319.14082561       -4321.58260476         269.49191203         272.83692252      513  O        1&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; &amp;lt;code&amp;gt;mc_all.xyz&amp;lt;/code&amp;gt;&lt;br /&gt;
: xyz file written to every &amp;lt;code&amp;gt;write_xyz = N&amp;lt;/code&amp;gt; steps.&lt;br /&gt;
; &amp;lt;code&amp;gt;mc_current.xyz&amp;lt;/code&amp;gt;&lt;br /&gt;
: xyz file saving current accepted config written to every &amp;lt;code&amp;gt;write_xyz = N&amp;lt;/code&amp;gt; steps.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* If we run &amp;lt;code&amp;gt;bash run.sh standard_gcmc&amp;lt;/code&amp;gt; (may take a few minutes), we can see a prediction of the XPS with oxygen content&lt;br /&gt;
&lt;br /&gt;
[[File:standard_gcmc.png | 800px]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;experimental-observable-optimization&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Experimental Observable Optimization ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;[mpirun -np N] turbogap mc/md&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
* We can specify experimental observables to predict and optimize them using MC or MD. &amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; E_{\rm spectra} = \frac{1}{2} \gamma \int \,d\varepsilon (g_{\rm pred}(\varepsilon) - g_{\rm exp}(\varepsilon))^2  &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre class=&amp;quot;conf&amp;quot;&amp;gt;! Experimental data options&lt;br /&gt;
n_exp = 1                                  # Number of experimental observables&lt;br /&gt;
exp_labels = 'xps'                         # Experimental observable types (xps/xrd/nd/pdf)&lt;br /&gt;
exp_data_files = 'xps_spectra_interp.dat'  # Experimental data files (Note: the range of resulting XPS prediction will be the same as the experimental range.)&lt;br /&gt;
exp_n_samples = 501                        # Number of interpolations samples over the experimental range.&lt;br /&gt;
exp_energy_scales = 100.0                    # Energy scale (gamma) [eV]&lt;br /&gt;
&lt;br /&gt;
# XPS smearing&lt;br /&gt;
xps_sigma = 0.4&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Output:&lt;br /&gt;
&lt;br /&gt;
; &amp;lt;code&amp;gt;xps_prediction.dat&amp;lt;/code&amp;gt;&lt;br /&gt;
: Data file written every &amp;lt;code&amp;gt;write_xyz = N&amp;lt;/code&amp;gt; steps. Separate predictions separated by blank lines.&lt;br /&gt;
; &amp;lt;code&amp;gt;xps_exp.dat&amp;lt;/code&amp;gt;&lt;br /&gt;
: The experimental data fed into ''TurboGAP''.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* If we run &amp;lt;code&amp;gt;bash run.sh xps_optimization_gcmc&amp;lt;/code&amp;gt; (may take a few minutes), we can see a prediction of the XPS with oxygen content&lt;br /&gt;
&lt;br /&gt;
[[File:xps_optimization_gcmc.png | 800px]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;multiple-observables&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Multiple Observables ==&lt;br /&gt;
&lt;br /&gt;
* This is not in the tutorial files, but ''TurboGAP'' allows for we can optimization multiple observables.&lt;br /&gt;
** X-ray diffraction&lt;br /&gt;
** Neutron diffraction&lt;br /&gt;
** Pair distribution function&lt;br /&gt;
** XPS&lt;br /&gt;
* Here we show a fictitious example of XPS and XRD optimization.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre class=&amp;quot;conf&amp;quot;&amp;gt;# Partial PDFs needed for XRD calculation&lt;br /&gt;
pair_distribution_n_samples = 301&lt;br /&gt;
r_range_min = 0.1&lt;br /&gt;
r_range_max = 13.5&lt;br /&gt;
pair_distribution_rcut = 14.1&lt;br /&gt;
&lt;br /&gt;
do_xrd = .true.&lt;br /&gt;
&lt;br /&gt;
# Experimental Data Specification&lt;br /&gt;
n_exp = 2                  # Number of Exp. observables&lt;br /&gt;
exp_labels = 'xps' 'xrd'   # Exp. observable type (xps/xrd/nd/pdf)&lt;br /&gt;
exp_data_files = 'xps_spectra_experiment.dat' 'xrd_CO_experiment.dat'&lt;br /&gt;
exp_n_samples = 301 301 # Number of samples for the experimental data&lt;br /&gt;
exp_energy_scales = 10.0 10.0  # The &amp;amp;quot;gamma&amp;amp;quot; term for each observable&lt;br /&gt;
&lt;br /&gt;
# If using monte-carlo, the experimental energies are added directly to the local energy&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;span id=&amp;quot;applications&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
= Applications =&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;experimental-observable-predictionoptimization&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
== Experimental Observable prediction/optimization ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;deconvolution-analysis&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== Deconvolution analysis ===&lt;br /&gt;
&lt;br /&gt;
* Use subgraph isomorphisms of bonding networks to discern motifs present.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:exp_xps_with_background_high.png | 400px]]&lt;br /&gt;
&lt;br /&gt;
↑ Experimental XPS deconvolution ([[#citeproc_bib_item_9|Santini et al. 2015]])&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:deconvolution_comparison_fill_-3_new.png| 400px]]&lt;br /&gt;
&lt;br /&gt;
↑ Our XPS deconvolution ([[#citeproc_bib_item_9|Santini et al. 2015]])&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:xps_shifts_miguel_first.png| 400px]]&lt;br /&gt;
&lt;br /&gt;
[[File:xps_shifts_miguel_last.png| 400px]]&lt;br /&gt;
&lt;br /&gt;
We see with oxygen content that sp2 motifs are shifted significantly, even past the sp3 reference. This is why the experimental deconvolution did not give what we expect: sp2 carbon that composes the primary XPS peak. &lt;br /&gt;
&amp;lt;span id=&amp;quot;summary&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Summary =&lt;br /&gt;
&lt;br /&gt;
* Machine-learned potentials can be combined with experimental models to give structures which are consistent with both ''ab-inito'' and experimental data.&lt;br /&gt;
* We can generate oxygenated amorphous carbon structures using a CO GAP with XPS prediction using modified GCMC and a “Molecular Augmented Dynamics” method.&lt;br /&gt;
* We can use ''multiple experimental observables''.&lt;br /&gt;
* '''Finding structures which match experimental data allows us to understand specific experimental results.'''&lt;br /&gt;
* Deconvolve experimental XPS exactly.&lt;br /&gt;
* All of this is implemented in the ''TurboGAP'' code.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;references&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
= References =&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;citeproc_bib_item_1&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;Bartók, Albert P., Risi Kondor, and Gábor Csányi. 2013. “On Representing Chemical Environments.” ''Physical Review B'' 87 (18): 184115. https://doi.org/10.1103/PhysRevB.87.184115.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;citeproc_bib_item_2&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;Bartók, Albert P., Mike C. Payne, Risi Kondor, and Gábor Csányi. 2010. “Gaussian Approximation Potentials: The Accuracy of Quantum Mechanics, without the Electrons.” ''Physical Review Letters'' 104 (13): 136403. https://doi.org/10.1103/PhysRevLett.104.136403.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;citeproc_bib_item_3&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;Caro, Miguel A. 2019. “Optimizing Many-Body Atomic Descriptors for Enhanced Computational Performance of Machine Learning Based Interatomic Potentials.” ''Physical Review B'' 100 (2): 024112. https://doi.org/10.1103/PhysRevB.100.024112.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;citeproc_bib_item_4&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;Deringer, Volker L., Albert P. Bartók, Noam Bernstein, David M. Wilkins, Michele Ceriotti, and Gábor Csányi. 2021. “Gaussian Process Regression for Materials and Molecules.” ''Chemical Reviews'' 121 (16): 10073–141. https://doi.org/10.1021/acs.chemrev.1c00022.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;citeproc_bib_item_5&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;El-Machachi, Zakariya, Damyan Frantzov, A. Nijamudheen, Tigany Zarrouk, Miguel A. Caro, and Volker L. Deringer. 2024. “Accelerated First-Principles Exploration of Structure and Reactivity in Graphene Oxide.” arXiv. https://doi.org/10.48550/arXiv.2405.14814.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;citeproc_bib_item_6&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;Golze, Dorothea, Markus Hirvensalo, Patricia Hernández-León, Anja Aarva, Jarkko Etula, Toma Susi, Patrick Rinke, Tomi Laurila, and Miguel A. Caro. 2022. “Accurate Computational Prediction of Core-Electron Binding Energies in Carbon-Based Materials: A Machine-Learning Model Combining Density-Functional Theory and GW.” ''Chemistry of Materials'' 34 (14): 6240–54. https://doi.org/10.1021/acs.chemmater.1c04279.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;citeproc_bib_item_7&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;Muhli, Heikki, Xi Chen, Albert P. Bartók, Patricia Hernández-León, Gábor Csányi, Tapio Ala-Nissila, and Miguel A. Caro. 2021. “Machine Learning Force Fields Based on Local Parametrization of Dispersion Interactions: Application to the Phase Diagram of \&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathrm\\\C\\\\\_\60\\&amp;lt;/math&amp;gt;.” ''Physical Review B'' 104 (5): 054106. https://doi.org/10.1103/PhysRevB.104.054106.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;citeproc_bib_item_8&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;Opletal, George, Timothy C. Petersen, Amanda S. Barnard, and Salvy P. Russo. 2017. “On Reverse Monte Carlo Constraints and Model Reproduction.” ''Journal of Computational Chemistry'' 38 (17): 1547–51. https://doi.org/10.1002/jcc.24799.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;citeproc_bib_item_9&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;Santini, Claudia A., Abu Sebastian, Chiara Marchiori, Vara Prasad Jonnalagadda, Laurent Dellmann, Wabe W. Koelmans, Marta D. Rossell, Christophe P. Rossel, and Evangelos Eleftheriou. 2015. “Oxygenated Amorphous Carbon for Resistive Memory Applications.” ''Nature Communications'' 6 (1): 8600. https://doi.org/10.1038/ncomms9600.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;citeproc_bib_item_10&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;Wang, Yanzhou, Zheyong Fan, Ping Qian, Tapio Ala-Nissila, and Miguel A. Caro. 2022. “Structure and Pore Size Distribution in Nanoporous Carbon.” ''Chemistry of Materials'' 34 (2): 617–28. https://doi.org/10.1021/acs.chemmater.1c03279.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;citeproc_bib_item_11&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;Zarrouk, Tigany, Rina Ibragimova, Albert P. Bartók, and Miguel A. Caro. 2024. “Experiment-Driven Atomistic Materials Modeling: A Case Study Combining X-Ray Photoelectron Spectroscopy and Machine Learning Potentials to Infer the Structure of Oxygen-Rich Amorphous Carbon.” ''Journal of the American Chemical Society'' 146 (21): 14645–59. https://doi.org/10.1021/jacs.4c01897.&lt;/div&gt;</summary>
		<author><name>Tigany Zarrouk</name></author>
		
	</entry>
	<entry>
		<id>https://turbogap.fi/wiki/index.php?title=XPS-optimized_oxygenated_amorphous_carbon&amp;diff=652</id>
		<title>XPS-optimized oxygenated amorphous carbon</title>
		<link rel="alternate" type="text/html" href="https://turbogap.fi/wiki/index.php?title=XPS-optimized_oxygenated_amorphous_carbon&amp;diff=652"/>
		<updated>2024-06-18T19:44:54Z</updated>

		<summary type="html">&lt;p&gt;Tigany Zarrouk: /* Motivation for structural inference */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
&amp;lt;span id=&amp;quot;what-is-turbogap&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
= What is ''TurboGAP'' ? =&lt;br /&gt;
&lt;br /&gt;
* ''TurboGAP'' is a &amp;lt;code&amp;gt;Fortran&amp;lt;/code&amp;gt; atomistic code which uses &amp;lt;u&amp;gt;Gaussian Approximation Potentials&amp;lt;/u&amp;gt; (GAPs).&lt;br /&gt;
* Its specialty are ''SOAP turbo'' descriptors: faster and more accurate than SOAP (Smooth Overlap of Atomic Positions).&lt;br /&gt;
* It's (probably!) the fastest SOAP prediction code, which will be made even faster with ''GPU acceleration'' (ongoing with CSC).&lt;br /&gt;
&lt;br /&gt;
* Through GAP/SOAP predictions, one can perform simulations with ''ab-initio'' accuracy '''at scale'''&lt;br /&gt;
** Molecular Dynamics&lt;br /&gt;
** Grand-Canonical Monte-Carlo simulations&lt;br /&gt;
** Electronic-stopping and spatially-correlated Langevin Dynamics (in-development).&lt;br /&gt;
** '''Prediction/optimization of experimental observables''' (''e.g.'' X-Ray photoelectron spectra ([[#citeproc_bib_item_6|Golze et al. 2022]]; [[#citeproc_bib_item_11|Zarrouk et al. 2024]]), X-ray/Neutron Diffraction and more to come!).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;motivation-for-structural-inference&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Motivation for structural inference =&lt;br /&gt;
&lt;br /&gt;
* We typically want to &amp;lt;u&amp;gt;predict structures&amp;lt;/u&amp;gt;, to make sense of experimental data.&lt;br /&gt;
* We usually pray structures have &amp;lt;u&amp;gt;experimental agreement&amp;lt;/u&amp;gt; (a “bottom-up” approach).&lt;br /&gt;
* What if we can &amp;lt;u&amp;gt;promote agreement&amp;lt;/u&amp;gt; with experimental data?&lt;br /&gt;
* ''Reverse Monte-Carlo'' techniques match experimental data to atomic structure (“top-down” approach).&lt;br /&gt;
** Downsides: “By-hand” constraints&lt;br /&gt;
** Simple experimental observables.&lt;br /&gt;
** Unphysical structures/artifacts ([[#citeproc_bib_item_8|Opletal et al. 2017]])&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Need efficient structure search to find '''agreement''' with '''experimental''' data ''and'' '''ab-inito''' data.&lt;br /&gt;
&lt;br /&gt;
With &amp;lt;u&amp;gt;CO GAP + Core electron binding energy SOAP&amp;lt;/u&amp;gt; model we will perform '''modified (Grand-canonical) Monte-Carlo''' to produce ''experimentally consistent, low energy structures'' of oxygenated amorphous carbon.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:deconvolution_comparison_fill_-3_new.png | 400px]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;theory-and-methods&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Theory and Methods =&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;gaussian-approximation-potentials-gap&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
== Gaussian Approximation Potentials (GAP) ==&lt;br /&gt;
&lt;br /&gt;
([[#citeproc_bib_item_2|Bartók et al. 2010]]; [[#citeproc_bib_item_1|Bartók, Kondor, and Csányi 2013]]; [[#citeproc_bib_item_4|Deringer et al. 2021]])&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;u&amp;gt;Assumption&amp;lt;/u&amp;gt;: Total energy is sum of '''local energies'''. &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;E_{\rm total}(\{\mathbf{r}\}) = \sum_i^{N_{\text{atoms}}} \varepsilon^i(\{r\}, \{\xi^{\text{2b}}_i\}, \{\boldsymbol{\xi}^{\text{3b}}_i\}, \boldsymbol{\xi}^{\text{mb}}_i))&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;\begin{align}&lt;br /&gt;
  \varepsilon^i ( &amp;amp;\{r\}, \{\xi^{\text{2b}}_i\}, \{\boldsymbol{\xi}^{\text{3b}}_i\}, \boldsymbol{\xi}^{\text{mb}}_i) =&lt;br /&gt;
   E^{\text{2b}}(\{\xi^{\text{2b}}_i\}) + E^{\text{3b}}(\{\boldsymbol{\xi}^{\text{3b}}_i\}) \nonumber\\&lt;br /&gt;
  &amp;amp; + E^{\text{mb}}(\boldsymbol{\xi}^{\text{mb}}_i)&lt;br /&gt;
  + \sum_{r &amp;lt; r_{\rm cut}^{\rm core}} E^{\text{core}}(r)  \nonumber&lt;br /&gt;
\end{align}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
; Local energy&lt;br /&gt;
: Sum of '''2b, 3b and many-body''' terms.&lt;br /&gt;
; Descriptor &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\xi / \boldsymbol{\xi}&amp;lt;/math&amp;gt;.&lt;br /&gt;
: ''e.g'' &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\{\xi^{\text{2b}}\} = \{r_{ij}\}&amp;lt;/math&amp;gt;, &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\{\boldsymbol{\xi}^{\text{3b}}\} = \{ [ r_{ij}, r_{ik}, r_{kj} ] \}&amp;lt;/math&amp;gt;&lt;br /&gt;
; Local environment&lt;br /&gt;
: A set of descriptors.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;using-descriptors-to-predict-quantities&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== Using descriptors to predict quantities ===&lt;br /&gt;
&lt;br /&gt;
* ''Kernel/basis functions'' &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;k_{ij}(\boldsymbol{\xi}_i, \boldsymbol{\xi}_j)&amp;lt;/math&amp;gt; measure the ''similarity between descriptors''.&lt;br /&gt;
* ''e.g'' Exponential 2b kernel: &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;k^{2b}_{ij}(\xi_i, \xi_j) \equiv k^{2b}_{ij}(r_{i}, r_{j}) = \exp( - (r_{i} - r_{j})^2/2\sigma^2 )&amp;lt;/math&amp;gt;&lt;br /&gt;
* ''Gaussian Process Regression'' (kernel matrix algebra on training set) → ''fitting coefficients'' &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\{\alpha\}&amp;lt;/math&amp;gt;, ([[#citeproc_bib_item_4|Deringer et al. 2021]])&lt;br /&gt;
* ''e.g.'' 2b model trained with &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;N_s&amp;lt;/math&amp;gt; descriptors &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\{\xi\} \in \{\xi_i, \ldots, \xi_{Ns}\}&amp;lt;/math&amp;gt;, the energy for atom with &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;M&amp;lt;/math&amp;gt; pairwise distances in local environment: &amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;E^{2b} = \sum_i^M \left(E^{2b}_0 + \delta^2\sum_j^{N_s}  \alpha_j k^{2b}_{ij}(\xi_i, \xi_j) \right) &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;soap-many-body-descriptor&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== SOAP (many-body) descriptor ===&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;u&amp;gt;SOAP descriptor&amp;lt;/u&amp;gt;: &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\boldsymbol{\xi}_i(\{\mathbf{r}\}_{ &amp;lt; r_{\rm cut}} )&amp;lt;/math&amp;gt;, represents environment of an atom ([[#citeproc_bib_item_2|Bartók et al. 2010]]).&lt;br /&gt;
* &amp;lt;u&amp;gt;Kernel&amp;lt;/u&amp;gt;: &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;k_{ij} = (\boldsymbol{\xi}_i \cdot \boldsymbol{\xi}_j)^{\zeta}&amp;lt;/math&amp;gt; measures &amp;lt;u&amp;gt;similarity of environments&amp;lt;/u&amp;gt;.&lt;br /&gt;
* &amp;lt;u&amp;gt;Fitting coefficients&amp;lt;/u&amp;gt;: &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\alpha_j&amp;lt;/math&amp;gt; result from Gaussian Process Regression.&lt;br /&gt;
* &amp;lt;u&amp;gt;Prediction&amp;lt;/u&amp;gt;: &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;E^{\rm mb}_i(\boldsymbol{\xi}_i) = E^{\rm mb}_0 + \delta^2\sum_j  \alpha_j k_{ij}&amp;lt;/math&amp;gt;&lt;br /&gt;
* For specifics of SOAP turbo, refer to Miguel's paper ([[#citeproc_bib_item_3|Caro 2019]])&lt;br /&gt;
&lt;br /&gt;
← SOAP expansion.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
← Interpolation of DFT PES ([[#citeproc_bib_item_4|Deringer et al. 2021]])&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;how-do-we-model-xps&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
== How do we model XPS? ==&lt;br /&gt;
&lt;br /&gt;
* XPS (X-ray photoelectron spectroscopy) spectra measure '''core electron binding energies'''.&lt;br /&gt;
* Core electron binding energies ''depend on atomic environment''.&lt;br /&gt;
* SOAP turbo model trained on DFT (&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\Delta\text{KS}&amp;lt;/math&amp;gt;) data with a &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;GW&amp;lt;/math&amp;gt; correction on top ([[#citeproc_bib_item_6|Golze et al. 2022]]).&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\text{CEBE} = ( \Delta KS^0_{\rm extended} + GW_{\rm carved} - \Delta \mathrm{KS}^+_{\rm carved} )&amp;lt;/math&amp;gt;&lt;br /&gt;
* Thermal and instrumental broadening accounted for by a Gaussian with &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\sigma = 0.4\text{ eV}&amp;lt;/math&amp;gt;&lt;br /&gt;
* Can analyse environments which make up spectra.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;prediction-of-local-properties&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Prediction of Local Properties ==&lt;br /&gt;
&lt;br /&gt;
* We can predict an &amp;lt;u&amp;gt;arbitrary number&amp;lt;/u&amp;gt; of ''local properties'' which use SOAP turbo descriptors using ''TurboGAP''.&lt;br /&gt;
* /One can get these for “free”/ if local property models are trained using the same descriptors as atomic energies/forces.&lt;br /&gt;
*; ''Hirshfeld volumes''&lt;br /&gt;
*: gives vdW dispersion via Tkatchenko-Scheffler. &amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; E_{\rm TS} = \sum_i \sum_{j\neq i} C_{6, ij}(v_{i}(\boldsymbol{\xi}_i), v_{j}(\boldsymbol{\xi}_j))\frac{f_{\rm damp}(r_{ij}, \ldots)}{r_{ij}^6} &amp;lt;/math&amp;gt;&lt;br /&gt;
*; ''Core-electron binding energies''&lt;br /&gt;
*: give '''X-ray Photoelectron Spectroscopy''' prediction. &amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; g_{\rm xps}(\varepsilon) = \frac{1}{M} \sum_i \exp\left( -(\varepsilon - \varepsilon_{i}(\boldsymbol{\xi}_i))^2/(2\sigma^2)  \right) &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;how-do-we-marry-experimental-data-and-gap&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
== How do we marry experimental data and GAP? ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* '''Generalized Hamiltonian within Grand-Canonical Monte-Carlo''' scheme.&lt;br /&gt;
* Vary oxygen content with chemical potential, to see motif differences.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;  \textcolor{violet}{ \mathbf{\tilde{g}}_{\rm {pred}}}(\varepsilon)  = \sum_{i} \exp\left(&lt;br /&gt;
-\frac{(\varepsilon - \textcolor{blue}{\varepsilon^{i}_{\rm&lt;br /&gt;
{pred}}(\boldsymbol{\xi}_i)})^2}{2\sigma^2}\right)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; \tilde{E} = E_{\rm GAP} + E_{\rm spectra} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; E_{\rm spectra} =  \frac{1}{2}\gamma \int \,d\varepsilon \left( \textcolor{violet}{ g_{\rm pred}(\varepsilon)} - g_{\rm exp}(\varepsilon)\right)^2&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;p&amp;gt;A simple squared difference, which is a penalty with increases with spectra dissimilarity and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\gamma&amp;lt;/math&amp;gt; is an energy scale.&amp;lt;/p&amp;gt;&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;p&amp;gt;We can do not just XPS but also X-ray/neutron diffraction and pair distribution functions.&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;[[File:xps_gcmc_scheme.png | 400px]]&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;/ul&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* We use the standard acceptance criteria for adding/removing/moving a particle&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; \mathrm{acc}(N \rightarrow N+1) = \mathrm{min}\left[1,&lt;br /&gt;
\frac{V}{\lambda^3 (N+1)} \exp\left\{ - \frac{\tilde{E}(N+1) -&lt;br /&gt;
\tilde{E}(N) - \mu}{k_BT} \right\}     \right] &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; \mathrm{acc}(N \rightarrow N-1) = \mathrm{min}\left[1,&lt;br /&gt;
\frac{\lambda^3 N}{V} \exp\left\{ -\frac{\tilde{E}(N-1) -&lt;br /&gt;
\tilde{E}(N) + \mu}{k_BT} \right\}     \right] &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; \mathrm{acc}_{\rm move} = \mathrm{min }\left[ 1, \exp\left\{ -&lt;br /&gt;
  \frac{\tilde{E}(\mathrm{new}) - \tilde{E}(\mathrm{old})}{k_BT} \right\} \right]&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;usage&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Usage =&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;installing-turbogap&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
== Installing ''TurboGAP'' ==&lt;br /&gt;
&lt;br /&gt;
We can install the ''TurboGAP'' code, found here https://github.com/mcaroba/turbogap through ''recursively cloning'' the main branch&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;git clone --recursive https://github.com/mcaroba/turbogap.git&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
Then we edit this line in the &amp;lt;code&amp;gt;Makefile&amp;lt;/code&amp;gt; to match our system architecture.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;include makefiles/Makefile.Ubuntu_gfortran_mpi&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Then, we make&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;make&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
and then export the path in &amp;lt;code&amp;gt;.bashrc&amp;lt;/code&amp;gt; file&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;export PATH=&amp;quot;~/turbogap/bin:$PATH&amp;quot;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;span id=&amp;quot;what-you-need-for-a-calculation&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
== What you need for a calculation ==&lt;br /&gt;
&lt;br /&gt;
; &amp;lt;code&amp;gt;gap_files/&amp;lt;/code&amp;gt; directory&lt;br /&gt;
: The directory which contains your &amp;lt;code&amp;gt;*.gap&amp;lt;/code&amp;gt;, with alphas (fitting coefficients) and sparse set descriptor files.&lt;br /&gt;
;* Potentials are available from ''TurboGAP'' wiki https://turbogap.fi/wiki/index.php/Potentials&lt;br /&gt;
;* Conversion script from &amp;lt;code&amp;gt;gap_fit .xml&amp;lt;/code&amp;gt; to &amp;lt;code&amp;gt;.gap&amp;lt;/code&amp;gt; can be used &amp;lt;code&amp;gt;turbogap/tools/make_gap_files.py&amp;lt;/code&amp;gt;&lt;br /&gt;
; &amp;lt;code&amp;gt;input&amp;lt;/code&amp;gt; file&lt;br /&gt;
: The file which tells the code what to do&lt;br /&gt;
; &amp;lt;code&amp;gt;*.xyz&amp;lt;/code&amp;gt;&lt;br /&gt;
: An extended xyz format file which contains positions/lattice/velocity information.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;adding-a-local-property-model-for-cebe-prediction&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== Adding a local property model for CEBE prediction ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;  gap_beg soap_turbo&lt;br /&gt;
  n_species = 2&lt;br /&gt;
  species = C O&lt;br /&gt;
  central_species = 1&lt;br /&gt;
... some params ...&lt;br /&gt;
  zeta = 4&lt;br /&gt;
  delta = 0.1&lt;br /&gt;
  desc_sparse = &amp;quot;gap_files/CO.xml.sparseX.GAP_2022_5_19_180_7_17_31_41410&amp;quot;&lt;br /&gt;
  alphas_sparse = &amp;quot;gap_files/alphas_soap_turbo_1.dat&amp;quot;&lt;br /&gt;
  compress_mode = &amp;quot;trivial&amp;quot;&lt;br /&gt;
  has_local_properties = .true.&lt;br /&gt;
  n_local_properties = 1&lt;br /&gt;
  local_property_qs = 'gap_files/core_electron_be.xml.sparseX.GAP_2024_1_26_120_18_36_33_6091'&lt;br /&gt;
  local_property_alphas = 'gap_files/alphas_core_electron_be_1.dat'&lt;br /&gt;
  local_property_labels = 'core_electron_be'&lt;br /&gt;
  local_property_zetas = 2&lt;br /&gt;
  local_property_deltas = 1.0&lt;br /&gt;
  local_property_v0s = 290.0&lt;br /&gt;
  gap_end&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;span id=&amp;quot;conversion-of-gap_fit-.xml-files-to-.gap-format&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== Conversion of &amp;lt;code&amp;gt;gap_fit&amp;lt;/code&amp;gt; &amp;lt;code&amp;gt;*.xml&amp;lt;/code&amp;gt; files to &amp;lt;code&amp;gt;*.gap&amp;lt;/code&amp;gt; format ===&lt;br /&gt;
&lt;br /&gt;
* Then we convert the &amp;lt;code&amp;gt;*.xml&amp;lt;/code&amp;gt; files which result from &amp;lt;code&amp;gt;gap_fit&amp;lt;/code&amp;gt; into the required format for ''TurboGAP''.&lt;br /&gt;
* This is done using the convenience script in &amp;lt;code&amp;gt;turbogap/tools/make_gap_files.py&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;python3 make_gap_files.py {gap_file.xml} {gap_file.gap} {N_local_prop.} \&lt;br /&gt;
              {local_prop1.xml} {local_prop_label1} \&lt;br /&gt;
              {local_prop2.xml} {local_prop_label2}...&lt;br /&gt;
# e.g. let's build a carbon oxygen GAP&lt;br /&gt;
# with core electron binding energy prediction capability.&lt;br /&gt;
python3 make_gap_files.py CO.xml CO.gap 1 \&lt;br /&gt;
        core_electron_be_co.xml core_electron_be&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
* This creates a directory &amp;lt;code&amp;gt;gap_files/&amp;lt;/code&amp;gt; which has&lt;br /&gt;
*# &amp;lt;code&amp;gt;alphas_{descriptor}.dat&amp;lt;/code&amp;gt; which are fitting coefficients for a particular descriptor&lt;br /&gt;
*# &amp;lt;code&amp;gt;qs_{descriptor}.dat&amp;lt;/code&amp;gt; which are the '''sparse set''' descriptors, used for prediction.&lt;br /&gt;
*# &amp;lt;code&amp;gt;alphas_{local_property}.dat&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;qs_{local_property}.dat&amp;lt;/code&amp;gt; for local property prediction.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;running-the-tutorial&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
== Running the Tutorial ==&lt;br /&gt;
&lt;br /&gt;
* Navigate to &amp;lt;code&amp;gt;turbogap/tutorials/xps_optimizaton&amp;lt;/code&amp;gt;&lt;br /&gt;
* Run &amp;lt;code&amp;gt;bash run.sh {calc_type}&amp;lt;/code&amp;gt; where &amp;lt;code&amp;gt;{calc_type}&amp;lt;/code&amp;gt; is either:&lt;br /&gt;
** &amp;lt;code&amp;gt;prediction&amp;lt;/code&amp;gt;&lt;br /&gt;
** &amp;lt;code&amp;gt;standard_gcmc&amp;lt;/code&amp;gt;&lt;br /&gt;
** &amp;lt;code&amp;gt;xps_optimization_gcmc&amp;lt;/code&amp;gt;&lt;br /&gt;
* Note that these simulations have a high chemical potential and (have high &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\gamma&amp;lt;/math&amp;gt; factors), these are just to give a result in a reasonable amount of time. Take care with real simulations.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;core-electron-binding-energy-prediction&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
== Core electron binding energy prediction ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;[mpirun -np N] turbogap predict&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
* We have in our &amp;lt;code&amp;gt;input&amp;lt;/code&amp;gt; file&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre class=&amp;quot;conf&amp;quot;&amp;gt;! Species-specific info&lt;br /&gt;
atoms_file = 'atoms.xyz'&lt;br /&gt;
pot_file = 'gap_files/CO.gap'&lt;br /&gt;
n_species = 2&lt;br /&gt;
species = C O&lt;br /&gt;
masses = 12.01 15.99&lt;br /&gt;
e0 = -.16138053 0.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Output:&lt;br /&gt;
&lt;br /&gt;
; &amp;lt;code&amp;gt;trajectory_out.xyz&amp;lt;/code&amp;gt;&lt;br /&gt;
: which contains atomic positions, local energy and local property arrays for each structure.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt; 512&lt;br /&gt;
Properties=species:S:1:pos:R:3:forces:R:3:local_energy:R:1:core_electron_be:R:1 \&lt;br /&gt;
   Lattice=&amp;quot;...&amp;quot; energy=-4321.582604 energy_soap=-4114.77018429  energy_2b=-124.73820332 energy_3b=0.55261463 \&lt;br /&gt;
   energy_core_pot=0.00000000 energy_vdw=0.00000000 energy_exp=0.00000000 energy_xps=0.00000000 \&lt;br /&gt;
   virial=&amp;quot;...&amp;quot; stress=&amp;quot;...&amp;quot; volume=5372.640346&lt;br /&gt;
   C              4.39625950       7.79414272      11.91703476     \&lt;br /&gt;
                  -0.00176074      -0.00403026       0.00040104    \&lt;br /&gt;
                  -8.32055957 \ # Local energy prediction&lt;br /&gt;
                  283.83841418  # CEBE Prediction&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Withiout specifying Exp. data, Turbogap does not predict the spectra.&lt;br /&gt;
* XPS spectra can simply be calculated from &amp;lt;code&amp;gt;core_electron_be&amp;lt;/code&amp;gt; in &amp;lt;code&amp;gt;trajectory_out.xyz&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;grand-canonical-monte-carlo&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
== (Grand-Canonical) Monte-Carlo ==&lt;br /&gt;
&lt;br /&gt;
* We use &amp;lt;code&amp;gt;mc&amp;lt;/code&amp;gt; mode&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;[mpirun -np N] turbogap mc&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
* ''e.g'' For a &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mu V T&amp;lt;/math&amp;gt; simulation of system in oxygen environment&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre class=&amp;quot;conf&amp;quot;&amp;gt;! Monte-carlo options&lt;br /&gt;
mc_nsteps = 1000                         # Number of Monte-Carlo Steps&lt;br /&gt;
n_mc_types = 3                           # Number of MC move types&lt;br /&gt;
mc_types = 'move' 'insertion' 'removal'  # MC move types (move/insertion/removal/volume/swap/md)&lt;br /&gt;
mc_move_max = 0.5                        # Maximum distance for MC displacement (&amp;amp;quot;move&amp;amp;quot;) type moves&lt;br /&gt;
&lt;br /&gt;
! - GCMC Options&lt;br /&gt;
n_mc_mu = 1              # Number of chemical potentials to add&lt;br /&gt;
mc_mu = 0                # Chemical potential(s) [eV]&lt;br /&gt;
mc_species = 'O'         # GCMC species types&lt;br /&gt;
mc_min_dist = 0.1        # GCMC minimum insertion distance&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Output:&lt;br /&gt;
&lt;br /&gt;
; &amp;lt;code&amp;gt;mc.log&amp;lt;/code&amp;gt;&lt;br /&gt;
: &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;# mc_istep  mc_move  accepted  E_trial              E_current             E_exp_trial          E_exp_current  N_tot_trial  N_mc_species_trial&lt;br /&gt;
       1       move    F       -4321.10376531       -4321.58260476         272.97693282         272.83692252      512  O        0&lt;br /&gt;
       2       move    F       -4321.10017027       -4321.58260476         272.68730901         272.83692252      512  O        0&lt;br /&gt;
       3  insertion    F       -4319.14082561       -4321.58260476         269.49191203         272.83692252      513  O        1&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; &amp;lt;code&amp;gt;mc_all.xyz&amp;lt;/code&amp;gt;&lt;br /&gt;
: xyz file written to every &amp;lt;code&amp;gt;write_xyz = N&amp;lt;/code&amp;gt; steps.&lt;br /&gt;
; &amp;lt;code&amp;gt;mc_current.xyz&amp;lt;/code&amp;gt;&lt;br /&gt;
: xyz file saving current accepted config written to every &amp;lt;code&amp;gt;write_xyz = N&amp;lt;/code&amp;gt; steps.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* If we run &amp;lt;code&amp;gt;bash run.sh standard_gcmc&amp;lt;/code&amp;gt; (may take a few minutes), we can see a prediction of the XPS with oxygen content&lt;br /&gt;
&lt;br /&gt;
[[File:standard_gcmc.png | 800px]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;experimental-observable-optimization&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Experimental Observable Optimization ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;[mpirun -np N] turbogap mc/md&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
* We can specify experimental observables to predict and optimize them using MC or MD. &amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; E_{\rm spectra} = \frac{1}{2} \gamma \int \,d\varepsilon (g_{\rm pred}(\varepsilon) - g_{\rm exp}(\varepsilon))^2  &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre class=&amp;quot;conf&amp;quot;&amp;gt;! Experimental data options&lt;br /&gt;
n_exp = 1                                  # Number of experimental observables&lt;br /&gt;
exp_labels = 'xps'                         # Experimental observable types (xps/xrd/nd/pdf)&lt;br /&gt;
exp_data_files = 'xps_spectra_interp.dat'  # Experimental data files (Note: the range of resulting XPS prediction will be the same as the experimental range.)&lt;br /&gt;
exp_n_samples = 501                        # Number of interpolations samples over the experimental range.&lt;br /&gt;
exp_energy_scales = 100.0                    # Energy scale (gamma) [eV]&lt;br /&gt;
&lt;br /&gt;
# XPS smearing&lt;br /&gt;
xps_sigma = 0.4&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Output:&lt;br /&gt;
&lt;br /&gt;
; &amp;lt;code&amp;gt;xps_prediction.dat&amp;lt;/code&amp;gt;&lt;br /&gt;
: Data file written every &amp;lt;code&amp;gt;write_xyz = N&amp;lt;/code&amp;gt; steps. Separate predictions separated by blank lines.&lt;br /&gt;
; &amp;lt;code&amp;gt;xps_exp.dat&amp;lt;/code&amp;gt;&lt;br /&gt;
: The experimental data fed into ''TurboGAP''.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* If we run &amp;lt;code&amp;gt;bash run.sh xps_optimization_gcmc&amp;lt;/code&amp;gt; (may take a few minutes), we can see a prediction of the XPS with oxygen content&lt;br /&gt;
&lt;br /&gt;
[[File:xps_optimization_gcmc.png | 800px]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;multiple-observables&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Multiple Observables ==&lt;br /&gt;
&lt;br /&gt;
* This is not in the tutorial files, but ''TurboGAP'' allows for we can optimization multiple observables.&lt;br /&gt;
** X-ray diffraction&lt;br /&gt;
** Neutron diffraction&lt;br /&gt;
** Pair distribution function&lt;br /&gt;
** XPS&lt;br /&gt;
* Here we show a fictitious example of XPS and XRD optimization.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre class=&amp;quot;conf&amp;quot;&amp;gt;# Partial PDFs needed for XRD calculation&lt;br /&gt;
pair_distribution_n_samples = 301&lt;br /&gt;
r_range_min = 0.1&lt;br /&gt;
r_range_max = 13.5&lt;br /&gt;
pair_distribution_rcut = 14.1&lt;br /&gt;
&lt;br /&gt;
do_xrd = .true.&lt;br /&gt;
&lt;br /&gt;
# Experimental Data Specification&lt;br /&gt;
n_exp = 2                  # Number of Exp. observables&lt;br /&gt;
exp_labels = 'xps' 'xrd'   # Exp. observable type (xps/xrd/nd/pdf)&lt;br /&gt;
exp_data_files = 'xps_spectra_experiment.dat' 'xrd_CO_experiment.dat'&lt;br /&gt;
exp_n_samples = 301 301 # Number of samples for the experimental data&lt;br /&gt;
exp_energy_scales = 10.0 10.0  # The &amp;amp;quot;gamma&amp;amp;quot; term for each observable&lt;br /&gt;
&lt;br /&gt;
# If using monte-carlo, the experimental energies are added directly to the local energy&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;span id=&amp;quot;applications&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
= Applications =&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;experimental-observable-predictionoptimization&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
== Experimental Observable prediction/optimization ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;deconvolution-analysis&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== Deconvolution analysis ===&lt;br /&gt;
&lt;br /&gt;
* Use subgraph isomorphisms of bonding networks to discern motifs present.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:exp_xps_with_background_high.png | 400px]]&lt;br /&gt;
&lt;br /&gt;
↑ Experimental XPS deconvolution ([[#citeproc_bib_item_9|Santini et al. 2015]])&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:deconvolution_comparison_fill_-3_new.png| 400px]]&lt;br /&gt;
&lt;br /&gt;
↑ Our XPS deconvolution ([[#citeproc_bib_item_9|Santini et al. 2015]])&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:xps_shifts_miguel_first.png| 400px]]&lt;br /&gt;
&lt;br /&gt;
[[File:xps_shifts_miguel_last.png| 400px]]&lt;br /&gt;
&lt;br /&gt;
We see with oxygen content that sp2 motifs are shifted significantly, even past the sp3 reference. This is why the experimental deconvolution did not give what we expect: sp2 carbon that composes the primary XPS peak. &lt;br /&gt;
&amp;lt;span id=&amp;quot;summary&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Summary =&lt;br /&gt;
&lt;br /&gt;
* Machine-learned potentials can be combined with experimental models to give structures which are consistent with both ''ab-inito'' and experimental data.&lt;br /&gt;
* We can generate oxygenated amorphous carbon structures using a CO GAP with XPS prediction using modified GCMC and a “Molecular Augmented Dynamics” method.&lt;br /&gt;
* We can use ''multiple experimental observables''.&lt;br /&gt;
* '''Finding structures which match experimental data allows us to understand specific experimental results.'''&lt;br /&gt;
* Deconvolve experimental XPS exactly.&lt;br /&gt;
* All of this is implemented in the ''TurboGAP'' code.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;references&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
= References =&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;citeproc_bib_item_1&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;Bartók, Albert P., Risi Kondor, and Gábor Csányi. 2013. “On Representing Chemical Environments.” ''Physical Review B'' 87 (18): 184115. https://doi.org/10.1103/PhysRevB.87.184115.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;citeproc_bib_item_2&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;Bartók, Albert P., Mike C. Payne, Risi Kondor, and Gábor Csányi. 2010. “Gaussian Approximation Potentials: The Accuracy of Quantum Mechanics, without the Electrons.” ''Physical Review Letters'' 104 (13): 136403. https://doi.org/10.1103/PhysRevLett.104.136403.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;citeproc_bib_item_3&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;Caro, Miguel A. 2019. “Optimizing Many-Body Atomic Descriptors for Enhanced Computational Performance of Machine Learning Based Interatomic Potentials.” ''Physical Review B'' 100 (2): 024112. https://doi.org/10.1103/PhysRevB.100.024112.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;citeproc_bib_item_4&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;Deringer, Volker L., Albert P. Bartók, Noam Bernstein, David M. Wilkins, Michele Ceriotti, and Gábor Csányi. 2021. “Gaussian Process Regression for Materials and Molecules.” ''Chemical Reviews'' 121 (16): 10073–141. https://doi.org/10.1021/acs.chemrev.1c00022.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;citeproc_bib_item_5&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;El-Machachi, Zakariya, Damyan Frantzov, A. Nijamudheen, Tigany Zarrouk, Miguel A. Caro, and Volker L. Deringer. 2024. “Accelerated First-Principles Exploration of Structure and Reactivity in Graphene Oxide.” arXiv. https://doi.org/10.48550/arXiv.2405.14814.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;citeproc_bib_item_6&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;Golze, Dorothea, Markus Hirvensalo, Patricia Hernández-León, Anja Aarva, Jarkko Etula, Toma Susi, Patrick Rinke, Tomi Laurila, and Miguel A. Caro. 2022. “Accurate Computational Prediction of Core-Electron Binding Energies in Carbon-Based Materials: A Machine-Learning Model Combining Density-Functional Theory and GW.” ''Chemistry of Materials'' 34 (14): 6240–54. https://doi.org/10.1021/acs.chemmater.1c04279.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;citeproc_bib_item_7&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;Muhli, Heikki, Xi Chen, Albert P. Bartók, Patricia Hernández-León, Gábor Csányi, Tapio Ala-Nissila, and Miguel A. Caro. 2021. “Machine Learning Force Fields Based on Local Parametrization of Dispersion Interactions: Application to the Phase Diagram of \&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathrm\\\C\\\\\_\60\\&amp;lt;/math&amp;gt;.” ''Physical Review B'' 104 (5): 054106. https://doi.org/10.1103/PhysRevB.104.054106.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;citeproc_bib_item_8&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;Opletal, George, Timothy C. Petersen, Amanda S. Barnard, and Salvy P. Russo. 2017. “On Reverse Monte Carlo Constraints and Model Reproduction.” ''Journal of Computational Chemistry'' 38 (17): 1547–51. https://doi.org/10.1002/jcc.24799.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;citeproc_bib_item_9&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;Santini, Claudia A., Abu Sebastian, Chiara Marchiori, Vara Prasad Jonnalagadda, Laurent Dellmann, Wabe W. Koelmans, Marta D. Rossell, Christophe P. Rossel, and Evangelos Eleftheriou. 2015. “Oxygenated Amorphous Carbon for Resistive Memory Applications.” ''Nature Communications'' 6 (1): 8600. https://doi.org/10.1038/ncomms9600.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;citeproc_bib_item_10&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;Wang, Yanzhou, Zheyong Fan, Ping Qian, Tapio Ala-Nissila, and Miguel A. Caro. 2022. “Structure and Pore Size Distribution in Nanoporous Carbon.” ''Chemistry of Materials'' 34 (2): 617–28. https://doi.org/10.1021/acs.chemmater.1c03279.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;citeproc_bib_item_11&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;Zarrouk, Tigany, Rina Ibragimova, Albert P. Bartók, and Miguel A. Caro. 2024. “Experiment-Driven Atomistic Materials Modeling: A Case Study Combining X-Ray Photoelectron Spectroscopy and Machine Learning Potentials to Infer the Structure of Oxygen-Rich Amorphous Carbon.” ''Journal of the American Chemical Society'' 146 (21): 14645–59. https://doi.org/10.1021/jacs.4c01897.&lt;/div&gt;</summary>
		<author><name>Tigany Zarrouk</name></author>
		
	</entry>
	<entry>
		<id>https://turbogap.fi/wiki/index.php?title=XPS-optimized_oxygenated_amorphous_carbon&amp;diff=651</id>
		<title>XPS-optimized oxygenated amorphous carbon</title>
		<link rel="alternate" type="text/html" href="https://turbogap.fi/wiki/index.php?title=XPS-optimized_oxygenated_amorphous_carbon&amp;diff=651"/>
		<updated>2024-06-18T19:43:11Z</updated>

		<summary type="html">&lt;p&gt;Tigany Zarrouk: /* Deconvolution analysis */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
&amp;lt;span id=&amp;quot;what-is-turbogap&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
= What is ''TurboGAP'' ? =&lt;br /&gt;
&lt;br /&gt;
* ''TurboGAP'' is a &amp;lt;code&amp;gt;Fortran&amp;lt;/code&amp;gt; atomistic code which uses &amp;lt;u&amp;gt;Gaussian Approximation Potentials&amp;lt;/u&amp;gt; (GAPs).&lt;br /&gt;
* Its specialty are ''SOAP turbo'' descriptors: faster and more accurate than SOAP (Smooth Overlap of Atomic Positions).&lt;br /&gt;
* It's (probably!) the fastest SOAP prediction code, which will be made even faster with ''GPU acceleration'' (ongoing with CSC).&lt;br /&gt;
&lt;br /&gt;
* Through GAP/SOAP predictions, one can perform simulations with ''ab-initio'' accuracy '''at scale'''&lt;br /&gt;
** Molecular Dynamics&lt;br /&gt;
** Grand-Canonical Monte-Carlo simulations&lt;br /&gt;
** Electronic-stopping and spatially-correlated Langevin Dynamics (in-development).&lt;br /&gt;
** '''Prediction/optimization of experimental observables''' (''e.g.'' X-Ray photoelectron spectra ([[#citeproc_bib_item_6|Golze et al. 2022]]; [[#citeproc_bib_item_11|Zarrouk et al. 2024]]), X-ray/Neutron Diffraction and more to come!).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;motivation-for-structural-inference&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Motivation for structural inference =&lt;br /&gt;
&lt;br /&gt;
* We typically want to &amp;lt;u&amp;gt;predict structures&amp;lt;/u&amp;gt;, to make sense of experimental data.&lt;br /&gt;
* We usually pray structures have &amp;lt;u&amp;gt;experimental agreement&amp;lt;/u&amp;gt; (a “bottom-up” approach).&lt;br /&gt;
* What if we can &amp;lt;u&amp;gt;promote agreement&amp;lt;/u&amp;gt; with experimental data?&lt;br /&gt;
* ''Reverse Monte-Carlo'' techniques match experimental data to atomic structure (“top-down” approach).&lt;br /&gt;
** Downsides: “By-hand” constraints&lt;br /&gt;
** Simple experimental observables.&lt;br /&gt;
** Unphysical structures/artifacts ([[#citeproc_bib_item_8|Opletal et al. 2017]])&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Need efficient structure search to find '''agreement''' with '''experimental''' data ''and'' '''ab-inito''' data.&lt;br /&gt;
&lt;br /&gt;
# With &amp;lt;u&amp;gt;CO GAP + Core electron binding energy SOAP&amp;lt;/u&amp;gt; model we will perform '''modified (Grand-canonical) Monte-Carlo''' to produce ''experimentally consistent, low energy structures'' of oxygenated amorphous carbon.&lt;br /&gt;
# I will further show preliminary work on *“Molecular Augmented Dynamics”*: generate forces from experimental deviation, to match experimental spectra via MD.&lt;br /&gt;
&lt;br /&gt;
[[File:deconvolution_comparison_fill_-3_new.png | 400px]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;theory-and-methods&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Theory and Methods =&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;gaussian-approximation-potentials-gap&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
== Gaussian Approximation Potentials (GAP) ==&lt;br /&gt;
&lt;br /&gt;
([[#citeproc_bib_item_2|Bartók et al. 2010]]; [[#citeproc_bib_item_1|Bartók, Kondor, and Csányi 2013]]; [[#citeproc_bib_item_4|Deringer et al. 2021]])&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;u&amp;gt;Assumption&amp;lt;/u&amp;gt;: Total energy is sum of '''local energies'''. &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;E_{\rm total}(\{\mathbf{r}\}) = \sum_i^{N_{\text{atoms}}} \varepsilon^i(\{r\}, \{\xi^{\text{2b}}_i\}, \{\boldsymbol{\xi}^{\text{3b}}_i\}, \boldsymbol{\xi}^{\text{mb}}_i))&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;\begin{align}&lt;br /&gt;
  \varepsilon^i ( &amp;amp;\{r\}, \{\xi^{\text{2b}}_i\}, \{\boldsymbol{\xi}^{\text{3b}}_i\}, \boldsymbol{\xi}^{\text{mb}}_i) =&lt;br /&gt;
   E^{\text{2b}}(\{\xi^{\text{2b}}_i\}) + E^{\text{3b}}(\{\boldsymbol{\xi}^{\text{3b}}_i\}) \nonumber\\&lt;br /&gt;
  &amp;amp; + E^{\text{mb}}(\boldsymbol{\xi}^{\text{mb}}_i)&lt;br /&gt;
  + \sum_{r &amp;lt; r_{\rm cut}^{\rm core}} E^{\text{core}}(r)  \nonumber&lt;br /&gt;
\end{align}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
; Local energy&lt;br /&gt;
: Sum of '''2b, 3b and many-body''' terms.&lt;br /&gt;
; Descriptor &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\xi / \boldsymbol{\xi}&amp;lt;/math&amp;gt;.&lt;br /&gt;
: ''e.g'' &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\{\xi^{\text{2b}}\} = \{r_{ij}\}&amp;lt;/math&amp;gt;, &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\{\boldsymbol{\xi}^{\text{3b}}\} = \{ [ r_{ij}, r_{ik}, r_{kj} ] \}&amp;lt;/math&amp;gt;&lt;br /&gt;
; Local environment&lt;br /&gt;
: A set of descriptors.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;using-descriptors-to-predict-quantities&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== Using descriptors to predict quantities ===&lt;br /&gt;
&lt;br /&gt;
* ''Kernel/basis functions'' &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;k_{ij}(\boldsymbol{\xi}_i, \boldsymbol{\xi}_j)&amp;lt;/math&amp;gt; measure the ''similarity between descriptors''.&lt;br /&gt;
* ''e.g'' Exponential 2b kernel: &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;k^{2b}_{ij}(\xi_i, \xi_j) \equiv k^{2b}_{ij}(r_{i}, r_{j}) = \exp( - (r_{i} - r_{j})^2/2\sigma^2 )&amp;lt;/math&amp;gt;&lt;br /&gt;
* ''Gaussian Process Regression'' (kernel matrix algebra on training set) → ''fitting coefficients'' &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\{\alpha\}&amp;lt;/math&amp;gt;, ([[#citeproc_bib_item_4|Deringer et al. 2021]])&lt;br /&gt;
* ''e.g.'' 2b model trained with &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;N_s&amp;lt;/math&amp;gt; descriptors &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\{\xi\} \in \{\xi_i, \ldots, \xi_{Ns}\}&amp;lt;/math&amp;gt;, the energy for atom with &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;M&amp;lt;/math&amp;gt; pairwise distances in local environment: &amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;E^{2b} = \sum_i^M \left(E^{2b}_0 + \delta^2\sum_j^{N_s}  \alpha_j k^{2b}_{ij}(\xi_i, \xi_j) \right) &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;soap-many-body-descriptor&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== SOAP (many-body) descriptor ===&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;u&amp;gt;SOAP descriptor&amp;lt;/u&amp;gt;: &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\boldsymbol{\xi}_i(\{\mathbf{r}\}_{ &amp;lt; r_{\rm cut}} )&amp;lt;/math&amp;gt;, represents environment of an atom ([[#citeproc_bib_item_2|Bartók et al. 2010]]).&lt;br /&gt;
* &amp;lt;u&amp;gt;Kernel&amp;lt;/u&amp;gt;: &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;k_{ij} = (\boldsymbol{\xi}_i \cdot \boldsymbol{\xi}_j)^{\zeta}&amp;lt;/math&amp;gt; measures &amp;lt;u&amp;gt;similarity of environments&amp;lt;/u&amp;gt;.&lt;br /&gt;
* &amp;lt;u&amp;gt;Fitting coefficients&amp;lt;/u&amp;gt;: &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\alpha_j&amp;lt;/math&amp;gt; result from Gaussian Process Regression.&lt;br /&gt;
* &amp;lt;u&amp;gt;Prediction&amp;lt;/u&amp;gt;: &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;E^{\rm mb}_i(\boldsymbol{\xi}_i) = E^{\rm mb}_0 + \delta^2\sum_j  \alpha_j k_{ij}&amp;lt;/math&amp;gt;&lt;br /&gt;
* For specifics of SOAP turbo, refer to Miguel's paper ([[#citeproc_bib_item_3|Caro 2019]])&lt;br /&gt;
&lt;br /&gt;
← SOAP expansion.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
← Interpolation of DFT PES ([[#citeproc_bib_item_4|Deringer et al. 2021]])&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;how-do-we-model-xps&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
== How do we model XPS? ==&lt;br /&gt;
&lt;br /&gt;
* XPS (X-ray photoelectron spectroscopy) spectra measure '''core electron binding energies'''.&lt;br /&gt;
* Core electron binding energies ''depend on atomic environment''.&lt;br /&gt;
* SOAP turbo model trained on DFT (&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\Delta\text{KS}&amp;lt;/math&amp;gt;) data with a &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;GW&amp;lt;/math&amp;gt; correction on top ([[#citeproc_bib_item_6|Golze et al. 2022]]).&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\text{CEBE} = ( \Delta KS^0_{\rm extended} + GW_{\rm carved} - \Delta \mathrm{KS}^+_{\rm carved} )&amp;lt;/math&amp;gt;&lt;br /&gt;
* Thermal and instrumental broadening accounted for by a Gaussian with &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\sigma = 0.4\text{ eV}&amp;lt;/math&amp;gt;&lt;br /&gt;
* Can analyse environments which make up spectra.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;prediction-of-local-properties&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Prediction of Local Properties ==&lt;br /&gt;
&lt;br /&gt;
* We can predict an &amp;lt;u&amp;gt;arbitrary number&amp;lt;/u&amp;gt; of ''local properties'' which use SOAP turbo descriptors using ''TurboGAP''.&lt;br /&gt;
* /One can get these for “free”/ if local property models are trained using the same descriptors as atomic energies/forces.&lt;br /&gt;
*; ''Hirshfeld volumes''&lt;br /&gt;
*: gives vdW dispersion via Tkatchenko-Scheffler. &amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; E_{\rm TS} = \sum_i \sum_{j\neq i} C_{6, ij}(v_{i}(\boldsymbol{\xi}_i), v_{j}(\boldsymbol{\xi}_j))\frac{f_{\rm damp}(r_{ij}, \ldots)}{r_{ij}^6} &amp;lt;/math&amp;gt;&lt;br /&gt;
*; ''Core-electron binding energies''&lt;br /&gt;
*: give '''X-ray Photoelectron Spectroscopy''' prediction. &amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; g_{\rm xps}(\varepsilon) = \frac{1}{M} \sum_i \exp\left( -(\varepsilon - \varepsilon_{i}(\boldsymbol{\xi}_i))^2/(2\sigma^2)  \right) &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;how-do-we-marry-experimental-data-and-gap&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
== How do we marry experimental data and GAP? ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* '''Generalized Hamiltonian within Grand-Canonical Monte-Carlo''' scheme.&lt;br /&gt;
* Vary oxygen content with chemical potential, to see motif differences.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;  \textcolor{violet}{ \mathbf{\tilde{g}}_{\rm {pred}}}(\varepsilon)  = \sum_{i} \exp\left(&lt;br /&gt;
-\frac{(\varepsilon - \textcolor{blue}{\varepsilon^{i}_{\rm&lt;br /&gt;
{pred}}(\boldsymbol{\xi}_i)})^2}{2\sigma^2}\right)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; \tilde{E} = E_{\rm GAP} + E_{\rm spectra} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; E_{\rm spectra} =  \frac{1}{2}\gamma \int \,d\varepsilon \left( \textcolor{violet}{ g_{\rm pred}(\varepsilon)} - g_{\rm exp}(\varepsilon)\right)^2&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;p&amp;gt;A simple squared difference, which is a penalty with increases with spectra dissimilarity and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\gamma&amp;lt;/math&amp;gt; is an energy scale.&amp;lt;/p&amp;gt;&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;p&amp;gt;We can do not just XPS but also X-ray/neutron diffraction and pair distribution functions.&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;[[File:xps_gcmc_scheme.png | 400px]]&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;/ul&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* We use the standard acceptance criteria for adding/removing/moving a particle&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; \mathrm{acc}(N \rightarrow N+1) = \mathrm{min}\left[1,&lt;br /&gt;
\frac{V}{\lambda^3 (N+1)} \exp\left\{ - \frac{\tilde{E}(N+1) -&lt;br /&gt;
\tilde{E}(N) - \mu}{k_BT} \right\}     \right] &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; \mathrm{acc}(N \rightarrow N-1) = \mathrm{min}\left[1,&lt;br /&gt;
\frac{\lambda^3 N}{V} \exp\left\{ -\frac{\tilde{E}(N-1) -&lt;br /&gt;
\tilde{E}(N) + \mu}{k_BT} \right\}     \right] &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; \mathrm{acc}_{\rm move} = \mathrm{min }\left[ 1, \exp\left\{ -&lt;br /&gt;
  \frac{\tilde{E}(\mathrm{new}) - \tilde{E}(\mathrm{old})}{k_BT} \right\} \right]&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;usage&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Usage =&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;installing-turbogap&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
== Installing ''TurboGAP'' ==&lt;br /&gt;
&lt;br /&gt;
We can install the ''TurboGAP'' code, found here https://github.com/mcaroba/turbogap through ''recursively cloning'' the main branch&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;git clone --recursive https://github.com/mcaroba/turbogap.git&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
Then we edit this line in the &amp;lt;code&amp;gt;Makefile&amp;lt;/code&amp;gt; to match our system architecture.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;include makefiles/Makefile.Ubuntu_gfortran_mpi&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Then, we make&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;make&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
and then export the path in &amp;lt;code&amp;gt;.bashrc&amp;lt;/code&amp;gt; file&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;export PATH=&amp;quot;~/turbogap/bin:$PATH&amp;quot;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;span id=&amp;quot;what-you-need-for-a-calculation&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
== What you need for a calculation ==&lt;br /&gt;
&lt;br /&gt;
; &amp;lt;code&amp;gt;gap_files/&amp;lt;/code&amp;gt; directory&lt;br /&gt;
: The directory which contains your &amp;lt;code&amp;gt;*.gap&amp;lt;/code&amp;gt;, with alphas (fitting coefficients) and sparse set descriptor files.&lt;br /&gt;
;* Potentials are available from ''TurboGAP'' wiki https://turbogap.fi/wiki/index.php/Potentials&lt;br /&gt;
;* Conversion script from &amp;lt;code&amp;gt;gap_fit .xml&amp;lt;/code&amp;gt; to &amp;lt;code&amp;gt;.gap&amp;lt;/code&amp;gt; can be used &amp;lt;code&amp;gt;turbogap/tools/make_gap_files.py&amp;lt;/code&amp;gt;&lt;br /&gt;
; &amp;lt;code&amp;gt;input&amp;lt;/code&amp;gt; file&lt;br /&gt;
: The file which tells the code what to do&lt;br /&gt;
; &amp;lt;code&amp;gt;*.xyz&amp;lt;/code&amp;gt;&lt;br /&gt;
: An extended xyz format file which contains positions/lattice/velocity information.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;adding-a-local-property-model-for-cebe-prediction&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== Adding a local property model for CEBE prediction ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;  gap_beg soap_turbo&lt;br /&gt;
  n_species = 2&lt;br /&gt;
  species = C O&lt;br /&gt;
  central_species = 1&lt;br /&gt;
... some params ...&lt;br /&gt;
  zeta = 4&lt;br /&gt;
  delta = 0.1&lt;br /&gt;
  desc_sparse = &amp;quot;gap_files/CO.xml.sparseX.GAP_2022_5_19_180_7_17_31_41410&amp;quot;&lt;br /&gt;
  alphas_sparse = &amp;quot;gap_files/alphas_soap_turbo_1.dat&amp;quot;&lt;br /&gt;
  compress_mode = &amp;quot;trivial&amp;quot;&lt;br /&gt;
  has_local_properties = .true.&lt;br /&gt;
  n_local_properties = 1&lt;br /&gt;
  local_property_qs = 'gap_files/core_electron_be.xml.sparseX.GAP_2024_1_26_120_18_36_33_6091'&lt;br /&gt;
  local_property_alphas = 'gap_files/alphas_core_electron_be_1.dat'&lt;br /&gt;
  local_property_labels = 'core_electron_be'&lt;br /&gt;
  local_property_zetas = 2&lt;br /&gt;
  local_property_deltas = 1.0&lt;br /&gt;
  local_property_v0s = 290.0&lt;br /&gt;
  gap_end&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;span id=&amp;quot;conversion-of-gap_fit-.xml-files-to-.gap-format&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== Conversion of &amp;lt;code&amp;gt;gap_fit&amp;lt;/code&amp;gt; &amp;lt;code&amp;gt;*.xml&amp;lt;/code&amp;gt; files to &amp;lt;code&amp;gt;*.gap&amp;lt;/code&amp;gt; format ===&lt;br /&gt;
&lt;br /&gt;
* Then we convert the &amp;lt;code&amp;gt;*.xml&amp;lt;/code&amp;gt; files which result from &amp;lt;code&amp;gt;gap_fit&amp;lt;/code&amp;gt; into the required format for ''TurboGAP''.&lt;br /&gt;
* This is done using the convenience script in &amp;lt;code&amp;gt;turbogap/tools/make_gap_files.py&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;python3 make_gap_files.py {gap_file.xml} {gap_file.gap} {N_local_prop.} \&lt;br /&gt;
              {local_prop1.xml} {local_prop_label1} \&lt;br /&gt;
              {local_prop2.xml} {local_prop_label2}...&lt;br /&gt;
# e.g. let's build a carbon oxygen GAP&lt;br /&gt;
# with core electron binding energy prediction capability.&lt;br /&gt;
python3 make_gap_files.py CO.xml CO.gap 1 \&lt;br /&gt;
        core_electron_be_co.xml core_electron_be&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
* This creates a directory &amp;lt;code&amp;gt;gap_files/&amp;lt;/code&amp;gt; which has&lt;br /&gt;
*# &amp;lt;code&amp;gt;alphas_{descriptor}.dat&amp;lt;/code&amp;gt; which are fitting coefficients for a particular descriptor&lt;br /&gt;
*# &amp;lt;code&amp;gt;qs_{descriptor}.dat&amp;lt;/code&amp;gt; which are the '''sparse set''' descriptors, used for prediction.&lt;br /&gt;
*# &amp;lt;code&amp;gt;alphas_{local_property}.dat&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;qs_{local_property}.dat&amp;lt;/code&amp;gt; for local property prediction.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;running-the-tutorial&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
== Running the Tutorial ==&lt;br /&gt;
&lt;br /&gt;
* Navigate to &amp;lt;code&amp;gt;turbogap/tutorials/xps_optimizaton&amp;lt;/code&amp;gt;&lt;br /&gt;
* Run &amp;lt;code&amp;gt;bash run.sh {calc_type}&amp;lt;/code&amp;gt; where &amp;lt;code&amp;gt;{calc_type}&amp;lt;/code&amp;gt; is either:&lt;br /&gt;
** &amp;lt;code&amp;gt;prediction&amp;lt;/code&amp;gt;&lt;br /&gt;
** &amp;lt;code&amp;gt;standard_gcmc&amp;lt;/code&amp;gt;&lt;br /&gt;
** &amp;lt;code&amp;gt;xps_optimization_gcmc&amp;lt;/code&amp;gt;&lt;br /&gt;
* Note that these simulations have a high chemical potential and (have high &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\gamma&amp;lt;/math&amp;gt; factors), these are just to give a result in a reasonable amount of time. Take care with real simulations.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;core-electron-binding-energy-prediction&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
== Core electron binding energy prediction ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;[mpirun -np N] turbogap predict&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
* We have in our &amp;lt;code&amp;gt;input&amp;lt;/code&amp;gt; file&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre class=&amp;quot;conf&amp;quot;&amp;gt;! Species-specific info&lt;br /&gt;
atoms_file = 'atoms.xyz'&lt;br /&gt;
pot_file = 'gap_files/CO.gap'&lt;br /&gt;
n_species = 2&lt;br /&gt;
species = C O&lt;br /&gt;
masses = 12.01 15.99&lt;br /&gt;
e0 = -.16138053 0.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Output:&lt;br /&gt;
&lt;br /&gt;
; &amp;lt;code&amp;gt;trajectory_out.xyz&amp;lt;/code&amp;gt;&lt;br /&gt;
: which contains atomic positions, local energy and local property arrays for each structure.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt; 512&lt;br /&gt;
Properties=species:S:1:pos:R:3:forces:R:3:local_energy:R:1:core_electron_be:R:1 \&lt;br /&gt;
   Lattice=&amp;quot;...&amp;quot; energy=-4321.582604 energy_soap=-4114.77018429  energy_2b=-124.73820332 energy_3b=0.55261463 \&lt;br /&gt;
   energy_core_pot=0.00000000 energy_vdw=0.00000000 energy_exp=0.00000000 energy_xps=0.00000000 \&lt;br /&gt;
   virial=&amp;quot;...&amp;quot; stress=&amp;quot;...&amp;quot; volume=5372.640346&lt;br /&gt;
   C              4.39625950       7.79414272      11.91703476     \&lt;br /&gt;
                  -0.00176074      -0.00403026       0.00040104    \&lt;br /&gt;
                  -8.32055957 \ # Local energy prediction&lt;br /&gt;
                  283.83841418  # CEBE Prediction&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Withiout specifying Exp. data, Turbogap does not predict the spectra.&lt;br /&gt;
* XPS spectra can simply be calculated from &amp;lt;code&amp;gt;core_electron_be&amp;lt;/code&amp;gt; in &amp;lt;code&amp;gt;trajectory_out.xyz&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;grand-canonical-monte-carlo&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
== (Grand-Canonical) Monte-Carlo ==&lt;br /&gt;
&lt;br /&gt;
* We use &amp;lt;code&amp;gt;mc&amp;lt;/code&amp;gt; mode&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;[mpirun -np N] turbogap mc&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
* ''e.g'' For a &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mu V T&amp;lt;/math&amp;gt; simulation of system in oxygen environment&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre class=&amp;quot;conf&amp;quot;&amp;gt;! Monte-carlo options&lt;br /&gt;
mc_nsteps = 1000                         # Number of Monte-Carlo Steps&lt;br /&gt;
n_mc_types = 3                           # Number of MC move types&lt;br /&gt;
mc_types = 'move' 'insertion' 'removal'  # MC move types (move/insertion/removal/volume/swap/md)&lt;br /&gt;
mc_move_max = 0.5                        # Maximum distance for MC displacement (&amp;amp;quot;move&amp;amp;quot;) type moves&lt;br /&gt;
&lt;br /&gt;
! - GCMC Options&lt;br /&gt;
n_mc_mu = 1              # Number of chemical potentials to add&lt;br /&gt;
mc_mu = 0                # Chemical potential(s) [eV]&lt;br /&gt;
mc_species = 'O'         # GCMC species types&lt;br /&gt;
mc_min_dist = 0.1        # GCMC minimum insertion distance&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Output:&lt;br /&gt;
&lt;br /&gt;
; &amp;lt;code&amp;gt;mc.log&amp;lt;/code&amp;gt;&lt;br /&gt;
: &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;# mc_istep  mc_move  accepted  E_trial              E_current             E_exp_trial          E_exp_current  N_tot_trial  N_mc_species_trial&lt;br /&gt;
       1       move    F       -4321.10376531       -4321.58260476         272.97693282         272.83692252      512  O        0&lt;br /&gt;
       2       move    F       -4321.10017027       -4321.58260476         272.68730901         272.83692252      512  O        0&lt;br /&gt;
       3  insertion    F       -4319.14082561       -4321.58260476         269.49191203         272.83692252      513  O        1&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; &amp;lt;code&amp;gt;mc_all.xyz&amp;lt;/code&amp;gt;&lt;br /&gt;
: xyz file written to every &amp;lt;code&amp;gt;write_xyz = N&amp;lt;/code&amp;gt; steps.&lt;br /&gt;
; &amp;lt;code&amp;gt;mc_current.xyz&amp;lt;/code&amp;gt;&lt;br /&gt;
: xyz file saving current accepted config written to every &amp;lt;code&amp;gt;write_xyz = N&amp;lt;/code&amp;gt; steps.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* If we run &amp;lt;code&amp;gt;bash run.sh standard_gcmc&amp;lt;/code&amp;gt; (may take a few minutes), we can see a prediction of the XPS with oxygen content&lt;br /&gt;
&lt;br /&gt;
[[File:standard_gcmc.png | 800px]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;experimental-observable-optimization&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Experimental Observable Optimization ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;[mpirun -np N] turbogap mc/md&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
* We can specify experimental observables to predict and optimize them using MC or MD. &amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; E_{\rm spectra} = \frac{1}{2} \gamma \int \,d\varepsilon (g_{\rm pred}(\varepsilon) - g_{\rm exp}(\varepsilon))^2  &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre class=&amp;quot;conf&amp;quot;&amp;gt;! Experimental data options&lt;br /&gt;
n_exp = 1                                  # Number of experimental observables&lt;br /&gt;
exp_labels = 'xps'                         # Experimental observable types (xps/xrd/nd/pdf)&lt;br /&gt;
exp_data_files = 'xps_spectra_interp.dat'  # Experimental data files (Note: the range of resulting XPS prediction will be the same as the experimental range.)&lt;br /&gt;
exp_n_samples = 501                        # Number of interpolations samples over the experimental range.&lt;br /&gt;
exp_energy_scales = 100.0                    # Energy scale (gamma) [eV]&lt;br /&gt;
&lt;br /&gt;
# XPS smearing&lt;br /&gt;
xps_sigma = 0.4&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Output:&lt;br /&gt;
&lt;br /&gt;
; &amp;lt;code&amp;gt;xps_prediction.dat&amp;lt;/code&amp;gt;&lt;br /&gt;
: Data file written every &amp;lt;code&amp;gt;write_xyz = N&amp;lt;/code&amp;gt; steps. Separate predictions separated by blank lines.&lt;br /&gt;
; &amp;lt;code&amp;gt;xps_exp.dat&amp;lt;/code&amp;gt;&lt;br /&gt;
: The experimental data fed into ''TurboGAP''.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* If we run &amp;lt;code&amp;gt;bash run.sh xps_optimization_gcmc&amp;lt;/code&amp;gt; (may take a few minutes), we can see a prediction of the XPS with oxygen content&lt;br /&gt;
&lt;br /&gt;
[[File:xps_optimization_gcmc.png | 800px]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;multiple-observables&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Multiple Observables ==&lt;br /&gt;
&lt;br /&gt;
* This is not in the tutorial files, but ''TurboGAP'' allows for we can optimization multiple observables.&lt;br /&gt;
** X-ray diffraction&lt;br /&gt;
** Neutron diffraction&lt;br /&gt;
** Pair distribution function&lt;br /&gt;
** XPS&lt;br /&gt;
* Here we show a fictitious example of XPS and XRD optimization.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre class=&amp;quot;conf&amp;quot;&amp;gt;# Partial PDFs needed for XRD calculation&lt;br /&gt;
pair_distribution_n_samples = 301&lt;br /&gt;
r_range_min = 0.1&lt;br /&gt;
r_range_max = 13.5&lt;br /&gt;
pair_distribution_rcut = 14.1&lt;br /&gt;
&lt;br /&gt;
do_xrd = .true.&lt;br /&gt;
&lt;br /&gt;
# Experimental Data Specification&lt;br /&gt;
n_exp = 2                  # Number of Exp. observables&lt;br /&gt;
exp_labels = 'xps' 'xrd'   # Exp. observable type (xps/xrd/nd/pdf)&lt;br /&gt;
exp_data_files = 'xps_spectra_experiment.dat' 'xrd_CO_experiment.dat'&lt;br /&gt;
exp_n_samples = 301 301 # Number of samples for the experimental data&lt;br /&gt;
exp_energy_scales = 10.0 10.0  # The &amp;amp;quot;gamma&amp;amp;quot; term for each observable&lt;br /&gt;
&lt;br /&gt;
# If using monte-carlo, the experimental energies are added directly to the local energy&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;span id=&amp;quot;applications&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
= Applications =&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;experimental-observable-predictionoptimization&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
== Experimental Observable prediction/optimization ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;deconvolution-analysis&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== Deconvolution analysis ===&lt;br /&gt;
&lt;br /&gt;
* Use subgraph isomorphisms of bonding networks to discern motifs present.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:exp_xps_with_background_high.png | 400px]]&lt;br /&gt;
&lt;br /&gt;
↑ Experimental XPS deconvolution ([[#citeproc_bib_item_9|Santini et al. 2015]])&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:deconvolution_comparison_fill_-3_new.png| 400px]]&lt;br /&gt;
&lt;br /&gt;
↑ Our XPS deconvolution ([[#citeproc_bib_item_9|Santini et al. 2015]])&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:xps_shifts_miguel_first.png| 400px]]&lt;br /&gt;
&lt;br /&gt;
[[File:xps_shifts_miguel_last.png| 400px]]&lt;br /&gt;
&lt;br /&gt;
We see with oxygen content that sp2 motifs are shifted significantly, even past the sp3 reference. This is why the experimental deconvolution did not give what we expect: sp2 carbon that composes the primary XPS peak. &lt;br /&gt;
&amp;lt;span id=&amp;quot;summary&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Summary =&lt;br /&gt;
&lt;br /&gt;
* Machine-learned potentials can be combined with experimental models to give structures which are consistent with both ''ab-inito'' and experimental data.&lt;br /&gt;
* We can generate oxygenated amorphous carbon structures using a CO GAP with XPS prediction using modified GCMC and a “Molecular Augmented Dynamics” method.&lt;br /&gt;
* We can use ''multiple experimental observables''.&lt;br /&gt;
* '''Finding structures which match experimental data allows us to understand specific experimental results.'''&lt;br /&gt;
* Deconvolve experimental XPS exactly.&lt;br /&gt;
* All of this is implemented in the ''TurboGAP'' code.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;references&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
= References =&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;citeproc_bib_item_1&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;Bartók, Albert P., Risi Kondor, and Gábor Csányi. 2013. “On Representing Chemical Environments.” ''Physical Review B'' 87 (18): 184115. https://doi.org/10.1103/PhysRevB.87.184115.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;citeproc_bib_item_2&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;Bartók, Albert P., Mike C. Payne, Risi Kondor, and Gábor Csányi. 2010. “Gaussian Approximation Potentials: The Accuracy of Quantum Mechanics, without the Electrons.” ''Physical Review Letters'' 104 (13): 136403. https://doi.org/10.1103/PhysRevLett.104.136403.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;citeproc_bib_item_3&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;Caro, Miguel A. 2019. “Optimizing Many-Body Atomic Descriptors for Enhanced Computational Performance of Machine Learning Based Interatomic Potentials.” ''Physical Review B'' 100 (2): 024112. https://doi.org/10.1103/PhysRevB.100.024112.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;citeproc_bib_item_4&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;Deringer, Volker L., Albert P. Bartók, Noam Bernstein, David M. Wilkins, Michele Ceriotti, and Gábor Csányi. 2021. “Gaussian Process Regression for Materials and Molecules.” ''Chemical Reviews'' 121 (16): 10073–141. https://doi.org/10.1021/acs.chemrev.1c00022.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;citeproc_bib_item_5&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;El-Machachi, Zakariya, Damyan Frantzov, A. Nijamudheen, Tigany Zarrouk, Miguel A. Caro, and Volker L. Deringer. 2024. “Accelerated First-Principles Exploration of Structure and Reactivity in Graphene Oxide.” arXiv. https://doi.org/10.48550/arXiv.2405.14814.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;citeproc_bib_item_6&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;Golze, Dorothea, Markus Hirvensalo, Patricia Hernández-León, Anja Aarva, Jarkko Etula, Toma Susi, Patrick Rinke, Tomi Laurila, and Miguel A. Caro. 2022. “Accurate Computational Prediction of Core-Electron Binding Energies in Carbon-Based Materials: A Machine-Learning Model Combining Density-Functional Theory and GW.” ''Chemistry of Materials'' 34 (14): 6240–54. https://doi.org/10.1021/acs.chemmater.1c04279.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;citeproc_bib_item_7&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;Muhli, Heikki, Xi Chen, Albert P. Bartók, Patricia Hernández-León, Gábor Csányi, Tapio Ala-Nissila, and Miguel A. Caro. 2021. “Machine Learning Force Fields Based on Local Parametrization of Dispersion Interactions: Application to the Phase Diagram of \&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathrm\\\C\\\\\_\60\\&amp;lt;/math&amp;gt;.” ''Physical Review B'' 104 (5): 054106. https://doi.org/10.1103/PhysRevB.104.054106.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;citeproc_bib_item_8&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;Opletal, George, Timothy C. Petersen, Amanda S. Barnard, and Salvy P. Russo. 2017. “On Reverse Monte Carlo Constraints and Model Reproduction.” ''Journal of Computational Chemistry'' 38 (17): 1547–51. https://doi.org/10.1002/jcc.24799.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;citeproc_bib_item_9&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;Santini, Claudia A., Abu Sebastian, Chiara Marchiori, Vara Prasad Jonnalagadda, Laurent Dellmann, Wabe W. Koelmans, Marta D. Rossell, Christophe P. Rossel, and Evangelos Eleftheriou. 2015. “Oxygenated Amorphous Carbon for Resistive Memory Applications.” ''Nature Communications'' 6 (1): 8600. https://doi.org/10.1038/ncomms9600.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;citeproc_bib_item_10&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;Wang, Yanzhou, Zheyong Fan, Ping Qian, Tapio Ala-Nissila, and Miguel A. Caro. 2022. “Structure and Pore Size Distribution in Nanoporous Carbon.” ''Chemistry of Materials'' 34 (2): 617–28. https://doi.org/10.1021/acs.chemmater.1c03279.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;citeproc_bib_item_11&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;Zarrouk, Tigany, Rina Ibragimova, Albert P. Bartók, and Miguel A. Caro. 2024. “Experiment-Driven Atomistic Materials Modeling: A Case Study Combining X-Ray Photoelectron Spectroscopy and Machine Learning Potentials to Infer the Structure of Oxygen-Rich Amorphous Carbon.” ''Journal of the American Chemical Society'' 146 (21): 14645–59. https://doi.org/10.1021/jacs.4c01897.&lt;/div&gt;</summary>
		<author><name>Tigany Zarrouk</name></author>
		
	</entry>
	<entry>
		<id>https://turbogap.fi/wiki/index.php?title=XPS-optimized_oxygenated_amorphous_carbon&amp;diff=650</id>
		<title>XPS-optimized oxygenated amorphous carbon</title>
		<link rel="alternate" type="text/html" href="https://turbogap.fi/wiki/index.php?title=XPS-optimized_oxygenated_amorphous_carbon&amp;diff=650"/>
		<updated>2024-06-18T19:42:27Z</updated>

		<summary type="html">&lt;p&gt;Tigany Zarrouk: /* What is TurboGAP ? */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
&amp;lt;span id=&amp;quot;what-is-turbogap&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
= What is ''TurboGAP'' ? =&lt;br /&gt;
&lt;br /&gt;
* ''TurboGAP'' is a &amp;lt;code&amp;gt;Fortran&amp;lt;/code&amp;gt; atomistic code which uses &amp;lt;u&amp;gt;Gaussian Approximation Potentials&amp;lt;/u&amp;gt; (GAPs).&lt;br /&gt;
* Its specialty are ''SOAP turbo'' descriptors: faster and more accurate than SOAP (Smooth Overlap of Atomic Positions).&lt;br /&gt;
* It's (probably!) the fastest SOAP prediction code, which will be made even faster with ''GPU acceleration'' (ongoing with CSC).&lt;br /&gt;
&lt;br /&gt;
* Through GAP/SOAP predictions, one can perform simulations with ''ab-initio'' accuracy '''at scale'''&lt;br /&gt;
** Molecular Dynamics&lt;br /&gt;
** Grand-Canonical Monte-Carlo simulations&lt;br /&gt;
** Electronic-stopping and spatially-correlated Langevin Dynamics (in-development).&lt;br /&gt;
** '''Prediction/optimization of experimental observables''' (''e.g.'' X-Ray photoelectron spectra ([[#citeproc_bib_item_6|Golze et al. 2022]]; [[#citeproc_bib_item_11|Zarrouk et al. 2024]]), X-ray/Neutron Diffraction and more to come!).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;motivation-for-structural-inference&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Motivation for structural inference =&lt;br /&gt;
&lt;br /&gt;
* We typically want to &amp;lt;u&amp;gt;predict structures&amp;lt;/u&amp;gt;, to make sense of experimental data.&lt;br /&gt;
* We usually pray structures have &amp;lt;u&amp;gt;experimental agreement&amp;lt;/u&amp;gt; (a “bottom-up” approach).&lt;br /&gt;
* What if we can &amp;lt;u&amp;gt;promote agreement&amp;lt;/u&amp;gt; with experimental data?&lt;br /&gt;
* ''Reverse Monte-Carlo'' techniques match experimental data to atomic structure (“top-down” approach).&lt;br /&gt;
** Downsides: “By-hand” constraints&lt;br /&gt;
** Simple experimental observables.&lt;br /&gt;
** Unphysical structures/artifacts ([[#citeproc_bib_item_8|Opletal et al. 2017]])&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Need efficient structure search to find '''agreement''' with '''experimental''' data ''and'' '''ab-inito''' data.&lt;br /&gt;
&lt;br /&gt;
# With &amp;lt;u&amp;gt;CO GAP + Core electron binding energy SOAP&amp;lt;/u&amp;gt; model we will perform '''modified (Grand-canonical) Monte-Carlo''' to produce ''experimentally consistent, low energy structures'' of oxygenated amorphous carbon.&lt;br /&gt;
# I will further show preliminary work on *“Molecular Augmented Dynamics”*: generate forces from experimental deviation, to match experimental spectra via MD.&lt;br /&gt;
&lt;br /&gt;
[[File:deconvolution_comparison_fill_-3_new.png | 400px]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;theory-and-methods&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Theory and Methods =&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;gaussian-approximation-potentials-gap&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
== Gaussian Approximation Potentials (GAP) ==&lt;br /&gt;
&lt;br /&gt;
([[#citeproc_bib_item_2|Bartók et al. 2010]]; [[#citeproc_bib_item_1|Bartók, Kondor, and Csányi 2013]]; [[#citeproc_bib_item_4|Deringer et al. 2021]])&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;u&amp;gt;Assumption&amp;lt;/u&amp;gt;: Total energy is sum of '''local energies'''. &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;E_{\rm total}(\{\mathbf{r}\}) = \sum_i^{N_{\text{atoms}}} \varepsilon^i(\{r\}, \{\xi^{\text{2b}}_i\}, \{\boldsymbol{\xi}^{\text{3b}}_i\}, \boldsymbol{\xi}^{\text{mb}}_i))&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;\begin{align}&lt;br /&gt;
  \varepsilon^i ( &amp;amp;\{r\}, \{\xi^{\text{2b}}_i\}, \{\boldsymbol{\xi}^{\text{3b}}_i\}, \boldsymbol{\xi}^{\text{mb}}_i) =&lt;br /&gt;
   E^{\text{2b}}(\{\xi^{\text{2b}}_i\}) + E^{\text{3b}}(\{\boldsymbol{\xi}^{\text{3b}}_i\}) \nonumber\\&lt;br /&gt;
  &amp;amp; + E^{\text{mb}}(\boldsymbol{\xi}^{\text{mb}}_i)&lt;br /&gt;
  + \sum_{r &amp;lt; r_{\rm cut}^{\rm core}} E^{\text{core}}(r)  \nonumber&lt;br /&gt;
\end{align}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
; Local energy&lt;br /&gt;
: Sum of '''2b, 3b and many-body''' terms.&lt;br /&gt;
; Descriptor &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\xi / \boldsymbol{\xi}&amp;lt;/math&amp;gt;.&lt;br /&gt;
: ''e.g'' &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\{\xi^{\text{2b}}\} = \{r_{ij}\}&amp;lt;/math&amp;gt;, &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\{\boldsymbol{\xi}^{\text{3b}}\} = \{ [ r_{ij}, r_{ik}, r_{kj} ] \}&amp;lt;/math&amp;gt;&lt;br /&gt;
; Local environment&lt;br /&gt;
: A set of descriptors.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;using-descriptors-to-predict-quantities&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== Using descriptors to predict quantities ===&lt;br /&gt;
&lt;br /&gt;
* ''Kernel/basis functions'' &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;k_{ij}(\boldsymbol{\xi}_i, \boldsymbol{\xi}_j)&amp;lt;/math&amp;gt; measure the ''similarity between descriptors''.&lt;br /&gt;
* ''e.g'' Exponential 2b kernel: &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;k^{2b}_{ij}(\xi_i, \xi_j) \equiv k^{2b}_{ij}(r_{i}, r_{j}) = \exp( - (r_{i} - r_{j})^2/2\sigma^2 )&amp;lt;/math&amp;gt;&lt;br /&gt;
* ''Gaussian Process Regression'' (kernel matrix algebra on training set) → ''fitting coefficients'' &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\{\alpha\}&amp;lt;/math&amp;gt;, ([[#citeproc_bib_item_4|Deringer et al. 2021]])&lt;br /&gt;
* ''e.g.'' 2b model trained with &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;N_s&amp;lt;/math&amp;gt; descriptors &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\{\xi\} \in \{\xi_i, \ldots, \xi_{Ns}\}&amp;lt;/math&amp;gt;, the energy for atom with &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;M&amp;lt;/math&amp;gt; pairwise distances in local environment: &amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;E^{2b} = \sum_i^M \left(E^{2b}_0 + \delta^2\sum_j^{N_s}  \alpha_j k^{2b}_{ij}(\xi_i, \xi_j) \right) &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;soap-many-body-descriptor&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== SOAP (many-body) descriptor ===&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;u&amp;gt;SOAP descriptor&amp;lt;/u&amp;gt;: &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\boldsymbol{\xi}_i(\{\mathbf{r}\}_{ &amp;lt; r_{\rm cut}} )&amp;lt;/math&amp;gt;, represents environment of an atom ([[#citeproc_bib_item_2|Bartók et al. 2010]]).&lt;br /&gt;
* &amp;lt;u&amp;gt;Kernel&amp;lt;/u&amp;gt;: &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;k_{ij} = (\boldsymbol{\xi}_i \cdot \boldsymbol{\xi}_j)^{\zeta}&amp;lt;/math&amp;gt; measures &amp;lt;u&amp;gt;similarity of environments&amp;lt;/u&amp;gt;.&lt;br /&gt;
* &amp;lt;u&amp;gt;Fitting coefficients&amp;lt;/u&amp;gt;: &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\alpha_j&amp;lt;/math&amp;gt; result from Gaussian Process Regression.&lt;br /&gt;
* &amp;lt;u&amp;gt;Prediction&amp;lt;/u&amp;gt;: &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;E^{\rm mb}_i(\boldsymbol{\xi}_i) = E^{\rm mb}_0 + \delta^2\sum_j  \alpha_j k_{ij}&amp;lt;/math&amp;gt;&lt;br /&gt;
* For specifics of SOAP turbo, refer to Miguel's paper ([[#citeproc_bib_item_3|Caro 2019]])&lt;br /&gt;
&lt;br /&gt;
← SOAP expansion.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
← Interpolation of DFT PES ([[#citeproc_bib_item_4|Deringer et al. 2021]])&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;how-do-we-model-xps&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
== How do we model XPS? ==&lt;br /&gt;
&lt;br /&gt;
* XPS (X-ray photoelectron spectroscopy) spectra measure '''core electron binding energies'''.&lt;br /&gt;
* Core electron binding energies ''depend on atomic environment''.&lt;br /&gt;
* SOAP turbo model trained on DFT (&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\Delta\text{KS}&amp;lt;/math&amp;gt;) data with a &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;GW&amp;lt;/math&amp;gt; correction on top ([[#citeproc_bib_item_6|Golze et al. 2022]]).&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\text{CEBE} = ( \Delta KS^0_{\rm extended} + GW_{\rm carved} - \Delta \mathrm{KS}^+_{\rm carved} )&amp;lt;/math&amp;gt;&lt;br /&gt;
* Thermal and instrumental broadening accounted for by a Gaussian with &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\sigma = 0.4\text{ eV}&amp;lt;/math&amp;gt;&lt;br /&gt;
* Can analyse environments which make up spectra.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;prediction-of-local-properties&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Prediction of Local Properties ==&lt;br /&gt;
&lt;br /&gt;
* We can predict an &amp;lt;u&amp;gt;arbitrary number&amp;lt;/u&amp;gt; of ''local properties'' which use SOAP turbo descriptors using ''TurboGAP''.&lt;br /&gt;
* /One can get these for “free”/ if local property models are trained using the same descriptors as atomic energies/forces.&lt;br /&gt;
*; ''Hirshfeld volumes''&lt;br /&gt;
*: gives vdW dispersion via Tkatchenko-Scheffler. &amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; E_{\rm TS} = \sum_i \sum_{j\neq i} C_{6, ij}(v_{i}(\boldsymbol{\xi}_i), v_{j}(\boldsymbol{\xi}_j))\frac{f_{\rm damp}(r_{ij}, \ldots)}{r_{ij}^6} &amp;lt;/math&amp;gt;&lt;br /&gt;
*; ''Core-electron binding energies''&lt;br /&gt;
*: give '''X-ray Photoelectron Spectroscopy''' prediction. &amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; g_{\rm xps}(\varepsilon) = \frac{1}{M} \sum_i \exp\left( -(\varepsilon - \varepsilon_{i}(\boldsymbol{\xi}_i))^2/(2\sigma^2)  \right) &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;how-do-we-marry-experimental-data-and-gap&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
== How do we marry experimental data and GAP? ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* '''Generalized Hamiltonian within Grand-Canonical Monte-Carlo''' scheme.&lt;br /&gt;
* Vary oxygen content with chemical potential, to see motif differences.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;  \textcolor{violet}{ \mathbf{\tilde{g}}_{\rm {pred}}}(\varepsilon)  = \sum_{i} \exp\left(&lt;br /&gt;
-\frac{(\varepsilon - \textcolor{blue}{\varepsilon^{i}_{\rm&lt;br /&gt;
{pred}}(\boldsymbol{\xi}_i)})^2}{2\sigma^2}\right)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; \tilde{E} = E_{\rm GAP} + E_{\rm spectra} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; E_{\rm spectra} =  \frac{1}{2}\gamma \int \,d\varepsilon \left( \textcolor{violet}{ g_{\rm pred}(\varepsilon)} - g_{\rm exp}(\varepsilon)\right)^2&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;p&amp;gt;A simple squared difference, which is a penalty with increases with spectra dissimilarity and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\gamma&amp;lt;/math&amp;gt; is an energy scale.&amp;lt;/p&amp;gt;&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;p&amp;gt;We can do not just XPS but also X-ray/neutron diffraction and pair distribution functions.&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;[[File:xps_gcmc_scheme.png | 400px]]&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;/ul&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* We use the standard acceptance criteria for adding/removing/moving a particle&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; \mathrm{acc}(N \rightarrow N+1) = \mathrm{min}\left[1,&lt;br /&gt;
\frac{V}{\lambda^3 (N+1)} \exp\left\{ - \frac{\tilde{E}(N+1) -&lt;br /&gt;
\tilde{E}(N) - \mu}{k_BT} \right\}     \right] &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; \mathrm{acc}(N \rightarrow N-1) = \mathrm{min}\left[1,&lt;br /&gt;
\frac{\lambda^3 N}{V} \exp\left\{ -\frac{\tilde{E}(N-1) -&lt;br /&gt;
\tilde{E}(N) + \mu}{k_BT} \right\}     \right] &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; \mathrm{acc}_{\rm move} = \mathrm{min }\left[ 1, \exp\left\{ -&lt;br /&gt;
  \frac{\tilde{E}(\mathrm{new}) - \tilde{E}(\mathrm{old})}{k_BT} \right\} \right]&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;usage&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Usage =&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;installing-turbogap&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
== Installing ''TurboGAP'' ==&lt;br /&gt;
&lt;br /&gt;
We can install the ''TurboGAP'' code, found here https://github.com/mcaroba/turbogap through ''recursively cloning'' the main branch&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;git clone --recursive https://github.com/mcaroba/turbogap.git&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
Then we edit this line in the &amp;lt;code&amp;gt;Makefile&amp;lt;/code&amp;gt; to match our system architecture.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;include makefiles/Makefile.Ubuntu_gfortran_mpi&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Then, we make&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;make&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
and then export the path in &amp;lt;code&amp;gt;.bashrc&amp;lt;/code&amp;gt; file&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;export PATH=&amp;quot;~/turbogap/bin:$PATH&amp;quot;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;span id=&amp;quot;what-you-need-for-a-calculation&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
== What you need for a calculation ==&lt;br /&gt;
&lt;br /&gt;
; &amp;lt;code&amp;gt;gap_files/&amp;lt;/code&amp;gt; directory&lt;br /&gt;
: The directory which contains your &amp;lt;code&amp;gt;*.gap&amp;lt;/code&amp;gt;, with alphas (fitting coefficients) and sparse set descriptor files.&lt;br /&gt;
;* Potentials are available from ''TurboGAP'' wiki https://turbogap.fi/wiki/index.php/Potentials&lt;br /&gt;
;* Conversion script from &amp;lt;code&amp;gt;gap_fit .xml&amp;lt;/code&amp;gt; to &amp;lt;code&amp;gt;.gap&amp;lt;/code&amp;gt; can be used &amp;lt;code&amp;gt;turbogap/tools/make_gap_files.py&amp;lt;/code&amp;gt;&lt;br /&gt;
; &amp;lt;code&amp;gt;input&amp;lt;/code&amp;gt; file&lt;br /&gt;
: The file which tells the code what to do&lt;br /&gt;
; &amp;lt;code&amp;gt;*.xyz&amp;lt;/code&amp;gt;&lt;br /&gt;
: An extended xyz format file which contains positions/lattice/velocity information.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;adding-a-local-property-model-for-cebe-prediction&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== Adding a local property model for CEBE prediction ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;  gap_beg soap_turbo&lt;br /&gt;
  n_species = 2&lt;br /&gt;
  species = C O&lt;br /&gt;
  central_species = 1&lt;br /&gt;
... some params ...&lt;br /&gt;
  zeta = 4&lt;br /&gt;
  delta = 0.1&lt;br /&gt;
  desc_sparse = &amp;quot;gap_files/CO.xml.sparseX.GAP_2022_5_19_180_7_17_31_41410&amp;quot;&lt;br /&gt;
  alphas_sparse = &amp;quot;gap_files/alphas_soap_turbo_1.dat&amp;quot;&lt;br /&gt;
  compress_mode = &amp;quot;trivial&amp;quot;&lt;br /&gt;
  has_local_properties = .true.&lt;br /&gt;
  n_local_properties = 1&lt;br /&gt;
  local_property_qs = 'gap_files/core_electron_be.xml.sparseX.GAP_2024_1_26_120_18_36_33_6091'&lt;br /&gt;
  local_property_alphas = 'gap_files/alphas_core_electron_be_1.dat'&lt;br /&gt;
  local_property_labels = 'core_electron_be'&lt;br /&gt;
  local_property_zetas = 2&lt;br /&gt;
  local_property_deltas = 1.0&lt;br /&gt;
  local_property_v0s = 290.0&lt;br /&gt;
  gap_end&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;span id=&amp;quot;conversion-of-gap_fit-.xml-files-to-.gap-format&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== Conversion of &amp;lt;code&amp;gt;gap_fit&amp;lt;/code&amp;gt; &amp;lt;code&amp;gt;*.xml&amp;lt;/code&amp;gt; files to &amp;lt;code&amp;gt;*.gap&amp;lt;/code&amp;gt; format ===&lt;br /&gt;
&lt;br /&gt;
* Then we convert the &amp;lt;code&amp;gt;*.xml&amp;lt;/code&amp;gt; files which result from &amp;lt;code&amp;gt;gap_fit&amp;lt;/code&amp;gt; into the required format for ''TurboGAP''.&lt;br /&gt;
* This is done using the convenience script in &amp;lt;code&amp;gt;turbogap/tools/make_gap_files.py&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;python3 make_gap_files.py {gap_file.xml} {gap_file.gap} {N_local_prop.} \&lt;br /&gt;
              {local_prop1.xml} {local_prop_label1} \&lt;br /&gt;
              {local_prop2.xml} {local_prop_label2}...&lt;br /&gt;
# e.g. let's build a carbon oxygen GAP&lt;br /&gt;
# with core electron binding energy prediction capability.&lt;br /&gt;
python3 make_gap_files.py CO.xml CO.gap 1 \&lt;br /&gt;
        core_electron_be_co.xml core_electron_be&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
* This creates a directory &amp;lt;code&amp;gt;gap_files/&amp;lt;/code&amp;gt; which has&lt;br /&gt;
*# &amp;lt;code&amp;gt;alphas_{descriptor}.dat&amp;lt;/code&amp;gt; which are fitting coefficients for a particular descriptor&lt;br /&gt;
*# &amp;lt;code&amp;gt;qs_{descriptor}.dat&amp;lt;/code&amp;gt; which are the '''sparse set''' descriptors, used for prediction.&lt;br /&gt;
*# &amp;lt;code&amp;gt;alphas_{local_property}.dat&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;qs_{local_property}.dat&amp;lt;/code&amp;gt; for local property prediction.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;running-the-tutorial&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
== Running the Tutorial ==&lt;br /&gt;
&lt;br /&gt;
* Navigate to &amp;lt;code&amp;gt;turbogap/tutorials/xps_optimizaton&amp;lt;/code&amp;gt;&lt;br /&gt;
* Run &amp;lt;code&amp;gt;bash run.sh {calc_type}&amp;lt;/code&amp;gt; where &amp;lt;code&amp;gt;{calc_type}&amp;lt;/code&amp;gt; is either:&lt;br /&gt;
** &amp;lt;code&amp;gt;prediction&amp;lt;/code&amp;gt;&lt;br /&gt;
** &amp;lt;code&amp;gt;standard_gcmc&amp;lt;/code&amp;gt;&lt;br /&gt;
** &amp;lt;code&amp;gt;xps_optimization_gcmc&amp;lt;/code&amp;gt;&lt;br /&gt;
* Note that these simulations have a high chemical potential and (have high &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\gamma&amp;lt;/math&amp;gt; factors), these are just to give a result in a reasonable amount of time. Take care with real simulations.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;core-electron-binding-energy-prediction&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
== Core electron binding energy prediction ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;[mpirun -np N] turbogap predict&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
* We have in our &amp;lt;code&amp;gt;input&amp;lt;/code&amp;gt; file&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre class=&amp;quot;conf&amp;quot;&amp;gt;! Species-specific info&lt;br /&gt;
atoms_file = 'atoms.xyz'&lt;br /&gt;
pot_file = 'gap_files/CO.gap'&lt;br /&gt;
n_species = 2&lt;br /&gt;
species = C O&lt;br /&gt;
masses = 12.01 15.99&lt;br /&gt;
e0 = -.16138053 0.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Output:&lt;br /&gt;
&lt;br /&gt;
; &amp;lt;code&amp;gt;trajectory_out.xyz&amp;lt;/code&amp;gt;&lt;br /&gt;
: which contains atomic positions, local energy and local property arrays for each structure.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt; 512&lt;br /&gt;
Properties=species:S:1:pos:R:3:forces:R:3:local_energy:R:1:core_electron_be:R:1 \&lt;br /&gt;
   Lattice=&amp;quot;...&amp;quot; energy=-4321.582604 energy_soap=-4114.77018429  energy_2b=-124.73820332 energy_3b=0.55261463 \&lt;br /&gt;
   energy_core_pot=0.00000000 energy_vdw=0.00000000 energy_exp=0.00000000 energy_xps=0.00000000 \&lt;br /&gt;
   virial=&amp;quot;...&amp;quot; stress=&amp;quot;...&amp;quot; volume=5372.640346&lt;br /&gt;
   C              4.39625950       7.79414272      11.91703476     \&lt;br /&gt;
                  -0.00176074      -0.00403026       0.00040104    \&lt;br /&gt;
                  -8.32055957 \ # Local energy prediction&lt;br /&gt;
                  283.83841418  # CEBE Prediction&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Withiout specifying Exp. data, Turbogap does not predict the spectra.&lt;br /&gt;
* XPS spectra can simply be calculated from &amp;lt;code&amp;gt;core_electron_be&amp;lt;/code&amp;gt; in &amp;lt;code&amp;gt;trajectory_out.xyz&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;grand-canonical-monte-carlo&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
== (Grand-Canonical) Monte-Carlo ==&lt;br /&gt;
&lt;br /&gt;
* We use &amp;lt;code&amp;gt;mc&amp;lt;/code&amp;gt; mode&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;[mpirun -np N] turbogap mc&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
* ''e.g'' For a &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mu V T&amp;lt;/math&amp;gt; simulation of system in oxygen environment&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre class=&amp;quot;conf&amp;quot;&amp;gt;! Monte-carlo options&lt;br /&gt;
mc_nsteps = 1000                         # Number of Monte-Carlo Steps&lt;br /&gt;
n_mc_types = 3                           # Number of MC move types&lt;br /&gt;
mc_types = 'move' 'insertion' 'removal'  # MC move types (move/insertion/removal/volume/swap/md)&lt;br /&gt;
mc_move_max = 0.5                        # Maximum distance for MC displacement (&amp;amp;quot;move&amp;amp;quot;) type moves&lt;br /&gt;
&lt;br /&gt;
! - GCMC Options&lt;br /&gt;
n_mc_mu = 1              # Number of chemical potentials to add&lt;br /&gt;
mc_mu = 0                # Chemical potential(s) [eV]&lt;br /&gt;
mc_species = 'O'         # GCMC species types&lt;br /&gt;
mc_min_dist = 0.1        # GCMC minimum insertion distance&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Output:&lt;br /&gt;
&lt;br /&gt;
; &amp;lt;code&amp;gt;mc.log&amp;lt;/code&amp;gt;&lt;br /&gt;
: &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;# mc_istep  mc_move  accepted  E_trial              E_current             E_exp_trial          E_exp_current  N_tot_trial  N_mc_species_trial&lt;br /&gt;
       1       move    F       -4321.10376531       -4321.58260476         272.97693282         272.83692252      512  O        0&lt;br /&gt;
       2       move    F       -4321.10017027       -4321.58260476         272.68730901         272.83692252      512  O        0&lt;br /&gt;
       3  insertion    F       -4319.14082561       -4321.58260476         269.49191203         272.83692252      513  O        1&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; &amp;lt;code&amp;gt;mc_all.xyz&amp;lt;/code&amp;gt;&lt;br /&gt;
: xyz file written to every &amp;lt;code&amp;gt;write_xyz = N&amp;lt;/code&amp;gt; steps.&lt;br /&gt;
; &amp;lt;code&amp;gt;mc_current.xyz&amp;lt;/code&amp;gt;&lt;br /&gt;
: xyz file saving current accepted config written to every &amp;lt;code&amp;gt;write_xyz = N&amp;lt;/code&amp;gt; steps.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* If we run &amp;lt;code&amp;gt;bash run.sh standard_gcmc&amp;lt;/code&amp;gt; (may take a few minutes), we can see a prediction of the XPS with oxygen content&lt;br /&gt;
&lt;br /&gt;
[[File:standard_gcmc.png | 800px]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;experimental-observable-optimization&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Experimental Observable Optimization ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;[mpirun -np N] turbogap mc/md&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
* We can specify experimental observables to predict and optimize them using MC or MD. &amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; E_{\rm spectra} = \frac{1}{2} \gamma \int \,d\varepsilon (g_{\rm pred}(\varepsilon) - g_{\rm exp}(\varepsilon))^2  &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre class=&amp;quot;conf&amp;quot;&amp;gt;! Experimental data options&lt;br /&gt;
n_exp = 1                                  # Number of experimental observables&lt;br /&gt;
exp_labels = 'xps'                         # Experimental observable types (xps/xrd/nd/pdf)&lt;br /&gt;
exp_data_files = 'xps_spectra_interp.dat'  # Experimental data files (Note: the range of resulting XPS prediction will be the same as the experimental range.)&lt;br /&gt;
exp_n_samples = 501                        # Number of interpolations samples over the experimental range.&lt;br /&gt;
exp_energy_scales = 100.0                    # Energy scale (gamma) [eV]&lt;br /&gt;
&lt;br /&gt;
# XPS smearing&lt;br /&gt;
xps_sigma = 0.4&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Output:&lt;br /&gt;
&lt;br /&gt;
; &amp;lt;code&amp;gt;xps_prediction.dat&amp;lt;/code&amp;gt;&lt;br /&gt;
: Data file written every &amp;lt;code&amp;gt;write_xyz = N&amp;lt;/code&amp;gt; steps. Separate predictions separated by blank lines.&lt;br /&gt;
; &amp;lt;code&amp;gt;xps_exp.dat&amp;lt;/code&amp;gt;&lt;br /&gt;
: The experimental data fed into ''TurboGAP''.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* If we run &amp;lt;code&amp;gt;bash run.sh xps_optimization_gcmc&amp;lt;/code&amp;gt; (may take a few minutes), we can see a prediction of the XPS with oxygen content&lt;br /&gt;
&lt;br /&gt;
[[File:xps_optimization_gcmc.png | 800px]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;multiple-observables&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Multiple Observables ==&lt;br /&gt;
&lt;br /&gt;
* This is not in the tutorial files, but ''TurboGAP'' allows for we can optimization multiple observables.&lt;br /&gt;
** X-ray diffraction&lt;br /&gt;
** Neutron diffraction&lt;br /&gt;
** Pair distribution function&lt;br /&gt;
** XPS&lt;br /&gt;
* Here we show a fictitious example of XPS and XRD optimization.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre class=&amp;quot;conf&amp;quot;&amp;gt;# Partial PDFs needed for XRD calculation&lt;br /&gt;
pair_distribution_n_samples = 301&lt;br /&gt;
r_range_min = 0.1&lt;br /&gt;
r_range_max = 13.5&lt;br /&gt;
pair_distribution_rcut = 14.1&lt;br /&gt;
&lt;br /&gt;
do_xrd = .true.&lt;br /&gt;
&lt;br /&gt;
# Experimental Data Specification&lt;br /&gt;
n_exp = 2                  # Number of Exp. observables&lt;br /&gt;
exp_labels = 'xps' 'xrd'   # Exp. observable type (xps/xrd/nd/pdf)&lt;br /&gt;
exp_data_files = 'xps_spectra_experiment.dat' 'xrd_CO_experiment.dat'&lt;br /&gt;
exp_n_samples = 301 301 # Number of samples for the experimental data&lt;br /&gt;
exp_energy_scales = 10.0 10.0  # The &amp;amp;quot;gamma&amp;amp;quot; term for each observable&lt;br /&gt;
&lt;br /&gt;
# If using monte-carlo, the experimental energies are added directly to the local energy&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;span id=&amp;quot;applications&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
= Applications =&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;experimental-observable-predictionoptimization&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
== Experimental Observable prediction/optimization ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;deconvolution-analysis&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== Deconvolution analysis ===&lt;br /&gt;
&lt;br /&gt;
* Use subgraph isomorphisms of bonding networks to discern motifs present.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:exp_xps_with_background_high.png]]&lt;br /&gt;
&lt;br /&gt;
↑ Experimental XPS deconvolution ([[#citeproc_bib_item_9|Santini et al. 2015]])&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:deconvolution_comparison_fill_-3_new.png]]&lt;br /&gt;
&lt;br /&gt;
↑ Our XPS deconvolution ([[#citeproc_bib_item_9|Santini et al. 2015]])&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:xps_shifts_miguel_first.png]]&lt;br /&gt;
&lt;br /&gt;
[[File:xps_shifts_miguel_last.png]]&lt;br /&gt;
&lt;br /&gt;
We see with oxygen content that sp2 motifs are shifted significantly, even past the sp3 reference. This is why the experimental deconvolution did not give what we expect: sp2 carbon that composes the primary XPS peak. &lt;br /&gt;
&amp;lt;span id=&amp;quot;summary&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Summary =&lt;br /&gt;
&lt;br /&gt;
* Machine-learned potentials can be combined with experimental models to give structures which are consistent with both ''ab-inito'' and experimental data.&lt;br /&gt;
* We can generate oxygenated amorphous carbon structures using a CO GAP with XPS prediction using modified GCMC and a “Molecular Augmented Dynamics” method.&lt;br /&gt;
* We can use ''multiple experimental observables''.&lt;br /&gt;
* '''Finding structures which match experimental data allows us to understand specific experimental results.'''&lt;br /&gt;
* Deconvolve experimental XPS exactly.&lt;br /&gt;
* All of this is implemented in the ''TurboGAP'' code.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;references&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
= References =&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;citeproc_bib_item_1&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;Bartók, Albert P., Risi Kondor, and Gábor Csányi. 2013. “On Representing Chemical Environments.” ''Physical Review B'' 87 (18): 184115. https://doi.org/10.1103/PhysRevB.87.184115.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;citeproc_bib_item_2&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;Bartók, Albert P., Mike C. Payne, Risi Kondor, and Gábor Csányi. 2010. “Gaussian Approximation Potentials: The Accuracy of Quantum Mechanics, without the Electrons.” ''Physical Review Letters'' 104 (13): 136403. https://doi.org/10.1103/PhysRevLett.104.136403.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;citeproc_bib_item_3&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;Caro, Miguel A. 2019. “Optimizing Many-Body Atomic Descriptors for Enhanced Computational Performance of Machine Learning Based Interatomic Potentials.” ''Physical Review B'' 100 (2): 024112. https://doi.org/10.1103/PhysRevB.100.024112.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;citeproc_bib_item_4&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;Deringer, Volker L., Albert P. Bartók, Noam Bernstein, David M. Wilkins, Michele Ceriotti, and Gábor Csányi. 2021. “Gaussian Process Regression for Materials and Molecules.” ''Chemical Reviews'' 121 (16): 10073–141. https://doi.org/10.1021/acs.chemrev.1c00022.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;citeproc_bib_item_5&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;El-Machachi, Zakariya, Damyan Frantzov, A. Nijamudheen, Tigany Zarrouk, Miguel A. Caro, and Volker L. Deringer. 2024. “Accelerated First-Principles Exploration of Structure and Reactivity in Graphene Oxide.” arXiv. https://doi.org/10.48550/arXiv.2405.14814.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;citeproc_bib_item_6&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;Golze, Dorothea, Markus Hirvensalo, Patricia Hernández-León, Anja Aarva, Jarkko Etula, Toma Susi, Patrick Rinke, Tomi Laurila, and Miguel A. Caro. 2022. “Accurate Computational Prediction of Core-Electron Binding Energies in Carbon-Based Materials: A Machine-Learning Model Combining Density-Functional Theory and GW.” ''Chemistry of Materials'' 34 (14): 6240–54. https://doi.org/10.1021/acs.chemmater.1c04279.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;citeproc_bib_item_7&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;Muhli, Heikki, Xi Chen, Albert P. Bartók, Patricia Hernández-León, Gábor Csányi, Tapio Ala-Nissila, and Miguel A. Caro. 2021. “Machine Learning Force Fields Based on Local Parametrization of Dispersion Interactions: Application to the Phase Diagram of \&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathrm\\\C\\\\\_\60\\&amp;lt;/math&amp;gt;.” ''Physical Review B'' 104 (5): 054106. https://doi.org/10.1103/PhysRevB.104.054106.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;citeproc_bib_item_8&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;Opletal, George, Timothy C. Petersen, Amanda S. Barnard, and Salvy P. Russo. 2017. “On Reverse Monte Carlo Constraints and Model Reproduction.” ''Journal of Computational Chemistry'' 38 (17): 1547–51. https://doi.org/10.1002/jcc.24799.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;citeproc_bib_item_9&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;Santini, Claudia A., Abu Sebastian, Chiara Marchiori, Vara Prasad Jonnalagadda, Laurent Dellmann, Wabe W. Koelmans, Marta D. Rossell, Christophe P. Rossel, and Evangelos Eleftheriou. 2015. “Oxygenated Amorphous Carbon for Resistive Memory Applications.” ''Nature Communications'' 6 (1): 8600. https://doi.org/10.1038/ncomms9600.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;citeproc_bib_item_10&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;Wang, Yanzhou, Zheyong Fan, Ping Qian, Tapio Ala-Nissila, and Miguel A. Caro. 2022. “Structure and Pore Size Distribution in Nanoporous Carbon.” ''Chemistry of Materials'' 34 (2): 617–28. https://doi.org/10.1021/acs.chemmater.1c03279.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;citeproc_bib_item_11&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;Zarrouk, Tigany, Rina Ibragimova, Albert P. Bartók, and Miguel A. Caro. 2024. “Experiment-Driven Atomistic Materials Modeling: A Case Study Combining X-Ray Photoelectron Spectroscopy and Machine Learning Potentials to Infer the Structure of Oxygen-Rich Amorphous Carbon.” ''Journal of the American Chemical Society'' 146 (21): 14645–59. https://doi.org/10.1021/jacs.4c01897.&lt;/div&gt;</summary>
		<author><name>Tigany Zarrouk</name></author>
		
	</entry>
	<entry>
		<id>https://turbogap.fi/wiki/index.php?title=XPS-optimized_oxygenated_amorphous_carbon&amp;diff=649</id>
		<title>XPS-optimized oxygenated amorphous carbon</title>
		<link rel="alternate" type="text/html" href="https://turbogap.fi/wiki/index.php?title=XPS-optimized_oxygenated_amorphous_carbon&amp;diff=649"/>
		<updated>2024-06-18T19:42:02Z</updated>

		<summary type="html">&lt;p&gt;Tigany Zarrouk: /* Experimental Observable Optimization */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
&amp;lt;span id=&amp;quot;what-is-turbogap&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
= What is ''TurboGAP'' ? =&lt;br /&gt;
&lt;br /&gt;
* ''TurboGAP'' is a &amp;lt;code&amp;gt;Fortran&amp;lt;/code&amp;gt; atomistic code which uses &amp;lt;u&amp;gt;Gaussian Approximation Potentials&amp;lt;/u&amp;gt; (GAPs).&lt;br /&gt;
* Its specialty are ''SOAP turbo'' descriptors: faster and more accurate than SOAP (Smooth Overlap of Atomic Positions).&lt;br /&gt;
* It's (probably!) the fastest SOAP prediction code, which will be made even faster with ''GPU acceleration'' (ongoing with CSC).&lt;br /&gt;
&lt;br /&gt;
[[File:images/Turbogap_logo.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* Through GAP/SOAP predictions, one can perform simulations with ''ab-initio'' accuracy '''at scale'''&lt;br /&gt;
** Molecular Dynamics&lt;br /&gt;
** Grand-Canonical Monte-Carlo simulations&lt;br /&gt;
** Electronic-stopping and spatially-correlated Langevin Dynamics (in-development).&lt;br /&gt;
** '''Prediction/optimization of experimental observables''' (''e.g.'' X-Ray photoelectron spectra ([[#citeproc_bib_item_6|Golze et al. 2022]]; [[#citeproc_bib_item_11|Zarrouk et al. 2024]]), X-ray/Neutron Diffraction and more to come!).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;motivation-for-structural-inference&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
= Motivation for structural inference =&lt;br /&gt;
&lt;br /&gt;
* We typically want to &amp;lt;u&amp;gt;predict structures&amp;lt;/u&amp;gt;, to make sense of experimental data.&lt;br /&gt;
* We usually pray structures have &amp;lt;u&amp;gt;experimental agreement&amp;lt;/u&amp;gt; (a “bottom-up” approach).&lt;br /&gt;
* What if we can &amp;lt;u&amp;gt;promote agreement&amp;lt;/u&amp;gt; with experimental data?&lt;br /&gt;
* ''Reverse Monte-Carlo'' techniques match experimental data to atomic structure (“top-down” approach).&lt;br /&gt;
** Downsides: “By-hand” constraints&lt;br /&gt;
** Simple experimental observables.&lt;br /&gt;
** Unphysical structures/artifacts ([[#citeproc_bib_item_8|Opletal et al. 2017]])&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Need efficient structure search to find '''agreement''' with '''experimental''' data ''and'' '''ab-inito''' data.&lt;br /&gt;
&lt;br /&gt;
# With &amp;lt;u&amp;gt;CO GAP + Core electron binding energy SOAP&amp;lt;/u&amp;gt; model we will perform '''modified (Grand-canonical) Monte-Carlo''' to produce ''experimentally consistent, low energy structures'' of oxygenated amorphous carbon.&lt;br /&gt;
# I will further show preliminary work on *“Molecular Augmented Dynamics”*: generate forces from experimental deviation, to match experimental spectra via MD.&lt;br /&gt;
&lt;br /&gt;
[[File:deconvolution_comparison_fill_-3_new.png | 400px]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;theory-and-methods&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Theory and Methods =&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;gaussian-approximation-potentials-gap&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
== Gaussian Approximation Potentials (GAP) ==&lt;br /&gt;
&lt;br /&gt;
([[#citeproc_bib_item_2|Bartók et al. 2010]]; [[#citeproc_bib_item_1|Bartók, Kondor, and Csányi 2013]]; [[#citeproc_bib_item_4|Deringer et al. 2021]])&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;u&amp;gt;Assumption&amp;lt;/u&amp;gt;: Total energy is sum of '''local energies'''. &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;E_{\rm total}(\{\mathbf{r}\}) = \sum_i^{N_{\text{atoms}}} \varepsilon^i(\{r\}, \{\xi^{\text{2b}}_i\}, \{\boldsymbol{\xi}^{\text{3b}}_i\}, \boldsymbol{\xi}^{\text{mb}}_i))&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;\begin{align}&lt;br /&gt;
  \varepsilon^i ( &amp;amp;\{r\}, \{\xi^{\text{2b}}_i\}, \{\boldsymbol{\xi}^{\text{3b}}_i\}, \boldsymbol{\xi}^{\text{mb}}_i) =&lt;br /&gt;
   E^{\text{2b}}(\{\xi^{\text{2b}}_i\}) + E^{\text{3b}}(\{\boldsymbol{\xi}^{\text{3b}}_i\}) \nonumber\\&lt;br /&gt;
  &amp;amp; + E^{\text{mb}}(\boldsymbol{\xi}^{\text{mb}}_i)&lt;br /&gt;
  + \sum_{r &amp;lt; r_{\rm cut}^{\rm core}} E^{\text{core}}(r)  \nonumber&lt;br /&gt;
\end{align}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
; Local energy&lt;br /&gt;
: Sum of '''2b, 3b and many-body''' terms.&lt;br /&gt;
; Descriptor &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\xi / \boldsymbol{\xi}&amp;lt;/math&amp;gt;.&lt;br /&gt;
: ''e.g'' &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\{\xi^{\text{2b}}\} = \{r_{ij}\}&amp;lt;/math&amp;gt;, &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\{\boldsymbol{\xi}^{\text{3b}}\} = \{ [ r_{ij}, r_{ik}, r_{kj} ] \}&amp;lt;/math&amp;gt;&lt;br /&gt;
; Local environment&lt;br /&gt;
: A set of descriptors.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;using-descriptors-to-predict-quantities&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== Using descriptors to predict quantities ===&lt;br /&gt;
&lt;br /&gt;
* ''Kernel/basis functions'' &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;k_{ij}(\boldsymbol{\xi}_i, \boldsymbol{\xi}_j)&amp;lt;/math&amp;gt; measure the ''similarity between descriptors''.&lt;br /&gt;
* ''e.g'' Exponential 2b kernel: &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;k^{2b}_{ij}(\xi_i, \xi_j) \equiv k^{2b}_{ij}(r_{i}, r_{j}) = \exp( - (r_{i} - r_{j})^2/2\sigma^2 )&amp;lt;/math&amp;gt;&lt;br /&gt;
* ''Gaussian Process Regression'' (kernel matrix algebra on training set) → ''fitting coefficients'' &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\{\alpha\}&amp;lt;/math&amp;gt;, ([[#citeproc_bib_item_4|Deringer et al. 2021]])&lt;br /&gt;
* ''e.g.'' 2b model trained with &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;N_s&amp;lt;/math&amp;gt; descriptors &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\{\xi\} \in \{\xi_i, \ldots, \xi_{Ns}\}&amp;lt;/math&amp;gt;, the energy for atom with &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;M&amp;lt;/math&amp;gt; pairwise distances in local environment: &amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;E^{2b} = \sum_i^M \left(E^{2b}_0 + \delta^2\sum_j^{N_s}  \alpha_j k^{2b}_{ij}(\xi_i, \xi_j) \right) &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;soap-many-body-descriptor&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== SOAP (many-body) descriptor ===&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;u&amp;gt;SOAP descriptor&amp;lt;/u&amp;gt;: &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\boldsymbol{\xi}_i(\{\mathbf{r}\}_{ &amp;lt; r_{\rm cut}} )&amp;lt;/math&amp;gt;, represents environment of an atom ([[#citeproc_bib_item_2|Bartók et al. 2010]]).&lt;br /&gt;
* &amp;lt;u&amp;gt;Kernel&amp;lt;/u&amp;gt;: &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;k_{ij} = (\boldsymbol{\xi}_i \cdot \boldsymbol{\xi}_j)^{\zeta}&amp;lt;/math&amp;gt; measures &amp;lt;u&amp;gt;similarity of environments&amp;lt;/u&amp;gt;.&lt;br /&gt;
* &amp;lt;u&amp;gt;Fitting coefficients&amp;lt;/u&amp;gt;: &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\alpha_j&amp;lt;/math&amp;gt; result from Gaussian Process Regression.&lt;br /&gt;
* &amp;lt;u&amp;gt;Prediction&amp;lt;/u&amp;gt;: &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;E^{\rm mb}_i(\boldsymbol{\xi}_i) = E^{\rm mb}_0 + \delta^2\sum_j  \alpha_j k_{ij}&amp;lt;/math&amp;gt;&lt;br /&gt;
* For specifics of SOAP turbo, refer to Miguel's paper ([[#citeproc_bib_item_3|Caro 2019]])&lt;br /&gt;
&lt;br /&gt;
← SOAP expansion.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
← Interpolation of DFT PES ([[#citeproc_bib_item_4|Deringer et al. 2021]])&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;how-do-we-model-xps&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
== How do we model XPS? ==&lt;br /&gt;
&lt;br /&gt;
* XPS (X-ray photoelectron spectroscopy) spectra measure '''core electron binding energies'''.&lt;br /&gt;
* Core electron binding energies ''depend on atomic environment''.&lt;br /&gt;
* SOAP turbo model trained on DFT (&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\Delta\text{KS}&amp;lt;/math&amp;gt;) data with a &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;GW&amp;lt;/math&amp;gt; correction on top ([[#citeproc_bib_item_6|Golze et al. 2022]]).&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\text{CEBE} = ( \Delta KS^0_{\rm extended} + GW_{\rm carved} - \Delta \mathrm{KS}^+_{\rm carved} )&amp;lt;/math&amp;gt;&lt;br /&gt;
* Thermal and instrumental broadening accounted for by a Gaussian with &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\sigma = 0.4\text{ eV}&amp;lt;/math&amp;gt;&lt;br /&gt;
* Can analyse environments which make up spectra.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;prediction-of-local-properties&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Prediction of Local Properties ==&lt;br /&gt;
&lt;br /&gt;
* We can predict an &amp;lt;u&amp;gt;arbitrary number&amp;lt;/u&amp;gt; of ''local properties'' which use SOAP turbo descriptors using ''TurboGAP''.&lt;br /&gt;
* /One can get these for “free”/ if local property models are trained using the same descriptors as atomic energies/forces.&lt;br /&gt;
*; ''Hirshfeld volumes''&lt;br /&gt;
*: gives vdW dispersion via Tkatchenko-Scheffler. &amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; E_{\rm TS} = \sum_i \sum_{j\neq i} C_{6, ij}(v_{i}(\boldsymbol{\xi}_i), v_{j}(\boldsymbol{\xi}_j))\frac{f_{\rm damp}(r_{ij}, \ldots)}{r_{ij}^6} &amp;lt;/math&amp;gt;&lt;br /&gt;
*; ''Core-electron binding energies''&lt;br /&gt;
*: give '''X-ray Photoelectron Spectroscopy''' prediction. &amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; g_{\rm xps}(\varepsilon) = \frac{1}{M} \sum_i \exp\left( -(\varepsilon - \varepsilon_{i}(\boldsymbol{\xi}_i))^2/(2\sigma^2)  \right) &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;how-do-we-marry-experimental-data-and-gap&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
== How do we marry experimental data and GAP? ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* '''Generalized Hamiltonian within Grand-Canonical Monte-Carlo''' scheme.&lt;br /&gt;
* Vary oxygen content with chemical potential, to see motif differences.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;  \textcolor{violet}{ \mathbf{\tilde{g}}_{\rm {pred}}}(\varepsilon)  = \sum_{i} \exp\left(&lt;br /&gt;
-\frac{(\varepsilon - \textcolor{blue}{\varepsilon^{i}_{\rm&lt;br /&gt;
{pred}}(\boldsymbol{\xi}_i)})^2}{2\sigma^2}\right)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; \tilde{E} = E_{\rm GAP} + E_{\rm spectra} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; E_{\rm spectra} =  \frac{1}{2}\gamma \int \,d\varepsilon \left( \textcolor{violet}{ g_{\rm pred}(\varepsilon)} - g_{\rm exp}(\varepsilon)\right)^2&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;p&amp;gt;A simple squared difference, which is a penalty with increases with spectra dissimilarity and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\gamma&amp;lt;/math&amp;gt; is an energy scale.&amp;lt;/p&amp;gt;&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;p&amp;gt;We can do not just XPS but also X-ray/neutron diffraction and pair distribution functions.&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;[[File:xps_gcmc_scheme.png | 400px]]&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;/ul&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* We use the standard acceptance criteria for adding/removing/moving a particle&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; \mathrm{acc}(N \rightarrow N+1) = \mathrm{min}\left[1,&lt;br /&gt;
\frac{V}{\lambda^3 (N+1)} \exp\left\{ - \frac{\tilde{E}(N+1) -&lt;br /&gt;
\tilde{E}(N) - \mu}{k_BT} \right\}     \right] &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; \mathrm{acc}(N \rightarrow N-1) = \mathrm{min}\left[1,&lt;br /&gt;
\frac{\lambda^3 N}{V} \exp\left\{ -\frac{\tilde{E}(N-1) -&lt;br /&gt;
\tilde{E}(N) + \mu}{k_BT} \right\}     \right] &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; \mathrm{acc}_{\rm move} = \mathrm{min }\left[ 1, \exp\left\{ -&lt;br /&gt;
  \frac{\tilde{E}(\mathrm{new}) - \tilde{E}(\mathrm{old})}{k_BT} \right\} \right]&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;usage&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Usage =&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;installing-turbogap&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
== Installing ''TurboGAP'' ==&lt;br /&gt;
&lt;br /&gt;
We can install the ''TurboGAP'' code, found here https://github.com/mcaroba/turbogap through ''recursively cloning'' the main branch&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;git clone --recursive https://github.com/mcaroba/turbogap.git&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
Then we edit this line in the &amp;lt;code&amp;gt;Makefile&amp;lt;/code&amp;gt; to match our system architecture.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;include makefiles/Makefile.Ubuntu_gfortran_mpi&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Then, we make&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;make&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
and then export the path in &amp;lt;code&amp;gt;.bashrc&amp;lt;/code&amp;gt; file&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;export PATH=&amp;quot;~/turbogap/bin:$PATH&amp;quot;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;span id=&amp;quot;what-you-need-for-a-calculation&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
== What you need for a calculation ==&lt;br /&gt;
&lt;br /&gt;
; &amp;lt;code&amp;gt;gap_files/&amp;lt;/code&amp;gt; directory&lt;br /&gt;
: The directory which contains your &amp;lt;code&amp;gt;*.gap&amp;lt;/code&amp;gt;, with alphas (fitting coefficients) and sparse set descriptor files.&lt;br /&gt;
;* Potentials are available from ''TurboGAP'' wiki https://turbogap.fi/wiki/index.php/Potentials&lt;br /&gt;
;* Conversion script from &amp;lt;code&amp;gt;gap_fit .xml&amp;lt;/code&amp;gt; to &amp;lt;code&amp;gt;.gap&amp;lt;/code&amp;gt; can be used &amp;lt;code&amp;gt;turbogap/tools/make_gap_files.py&amp;lt;/code&amp;gt;&lt;br /&gt;
; &amp;lt;code&amp;gt;input&amp;lt;/code&amp;gt; file&lt;br /&gt;
: The file which tells the code what to do&lt;br /&gt;
; &amp;lt;code&amp;gt;*.xyz&amp;lt;/code&amp;gt;&lt;br /&gt;
: An extended xyz format file which contains positions/lattice/velocity information.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;adding-a-local-property-model-for-cebe-prediction&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== Adding a local property model for CEBE prediction ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;  gap_beg soap_turbo&lt;br /&gt;
  n_species = 2&lt;br /&gt;
  species = C O&lt;br /&gt;
  central_species = 1&lt;br /&gt;
... some params ...&lt;br /&gt;
  zeta = 4&lt;br /&gt;
  delta = 0.1&lt;br /&gt;
  desc_sparse = &amp;quot;gap_files/CO.xml.sparseX.GAP_2022_5_19_180_7_17_31_41410&amp;quot;&lt;br /&gt;
  alphas_sparse = &amp;quot;gap_files/alphas_soap_turbo_1.dat&amp;quot;&lt;br /&gt;
  compress_mode = &amp;quot;trivial&amp;quot;&lt;br /&gt;
  has_local_properties = .true.&lt;br /&gt;
  n_local_properties = 1&lt;br /&gt;
  local_property_qs = 'gap_files/core_electron_be.xml.sparseX.GAP_2024_1_26_120_18_36_33_6091'&lt;br /&gt;
  local_property_alphas = 'gap_files/alphas_core_electron_be_1.dat'&lt;br /&gt;
  local_property_labels = 'core_electron_be'&lt;br /&gt;
  local_property_zetas = 2&lt;br /&gt;
  local_property_deltas = 1.0&lt;br /&gt;
  local_property_v0s = 290.0&lt;br /&gt;
  gap_end&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;span id=&amp;quot;conversion-of-gap_fit-.xml-files-to-.gap-format&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== Conversion of &amp;lt;code&amp;gt;gap_fit&amp;lt;/code&amp;gt; &amp;lt;code&amp;gt;*.xml&amp;lt;/code&amp;gt; files to &amp;lt;code&amp;gt;*.gap&amp;lt;/code&amp;gt; format ===&lt;br /&gt;
&lt;br /&gt;
* Then we convert the &amp;lt;code&amp;gt;*.xml&amp;lt;/code&amp;gt; files which result from &amp;lt;code&amp;gt;gap_fit&amp;lt;/code&amp;gt; into the required format for ''TurboGAP''.&lt;br /&gt;
* This is done using the convenience script in &amp;lt;code&amp;gt;turbogap/tools/make_gap_files.py&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;python3 make_gap_files.py {gap_file.xml} {gap_file.gap} {N_local_prop.} \&lt;br /&gt;
              {local_prop1.xml} {local_prop_label1} \&lt;br /&gt;
              {local_prop2.xml} {local_prop_label2}...&lt;br /&gt;
# e.g. let's build a carbon oxygen GAP&lt;br /&gt;
# with core electron binding energy prediction capability.&lt;br /&gt;
python3 make_gap_files.py CO.xml CO.gap 1 \&lt;br /&gt;
        core_electron_be_co.xml core_electron_be&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
* This creates a directory &amp;lt;code&amp;gt;gap_files/&amp;lt;/code&amp;gt; which has&lt;br /&gt;
*# &amp;lt;code&amp;gt;alphas_{descriptor}.dat&amp;lt;/code&amp;gt; which are fitting coefficients for a particular descriptor&lt;br /&gt;
*# &amp;lt;code&amp;gt;qs_{descriptor}.dat&amp;lt;/code&amp;gt; which are the '''sparse set''' descriptors, used for prediction.&lt;br /&gt;
*# &amp;lt;code&amp;gt;alphas_{local_property}.dat&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;qs_{local_property}.dat&amp;lt;/code&amp;gt; for local property prediction.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;running-the-tutorial&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
== Running the Tutorial ==&lt;br /&gt;
&lt;br /&gt;
* Navigate to &amp;lt;code&amp;gt;turbogap/tutorials/xps_optimizaton&amp;lt;/code&amp;gt;&lt;br /&gt;
* Run &amp;lt;code&amp;gt;bash run.sh {calc_type}&amp;lt;/code&amp;gt; where &amp;lt;code&amp;gt;{calc_type}&amp;lt;/code&amp;gt; is either:&lt;br /&gt;
** &amp;lt;code&amp;gt;prediction&amp;lt;/code&amp;gt;&lt;br /&gt;
** &amp;lt;code&amp;gt;standard_gcmc&amp;lt;/code&amp;gt;&lt;br /&gt;
** &amp;lt;code&amp;gt;xps_optimization_gcmc&amp;lt;/code&amp;gt;&lt;br /&gt;
* Note that these simulations have a high chemical potential and (have high &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\gamma&amp;lt;/math&amp;gt; factors), these are just to give a result in a reasonable amount of time. Take care with real simulations.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;core-electron-binding-energy-prediction&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
== Core electron binding energy prediction ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;[mpirun -np N] turbogap predict&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
* We have in our &amp;lt;code&amp;gt;input&amp;lt;/code&amp;gt; file&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre class=&amp;quot;conf&amp;quot;&amp;gt;! Species-specific info&lt;br /&gt;
atoms_file = 'atoms.xyz'&lt;br /&gt;
pot_file = 'gap_files/CO.gap'&lt;br /&gt;
n_species = 2&lt;br /&gt;
species = C O&lt;br /&gt;
masses = 12.01 15.99&lt;br /&gt;
e0 = -.16138053 0.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Output:&lt;br /&gt;
&lt;br /&gt;
; &amp;lt;code&amp;gt;trajectory_out.xyz&amp;lt;/code&amp;gt;&lt;br /&gt;
: which contains atomic positions, local energy and local property arrays for each structure.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt; 512&lt;br /&gt;
Properties=species:S:1:pos:R:3:forces:R:3:local_energy:R:1:core_electron_be:R:1 \&lt;br /&gt;
   Lattice=&amp;quot;...&amp;quot; energy=-4321.582604 energy_soap=-4114.77018429  energy_2b=-124.73820332 energy_3b=0.55261463 \&lt;br /&gt;
   energy_core_pot=0.00000000 energy_vdw=0.00000000 energy_exp=0.00000000 energy_xps=0.00000000 \&lt;br /&gt;
   virial=&amp;quot;...&amp;quot; stress=&amp;quot;...&amp;quot; volume=5372.640346&lt;br /&gt;
   C              4.39625950       7.79414272      11.91703476     \&lt;br /&gt;
                  -0.00176074      -0.00403026       0.00040104    \&lt;br /&gt;
                  -8.32055957 \ # Local energy prediction&lt;br /&gt;
                  283.83841418  # CEBE Prediction&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Withiout specifying Exp. data, Turbogap does not predict the spectra.&lt;br /&gt;
* XPS spectra can simply be calculated from &amp;lt;code&amp;gt;core_electron_be&amp;lt;/code&amp;gt; in &amp;lt;code&amp;gt;trajectory_out.xyz&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;grand-canonical-monte-carlo&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
== (Grand-Canonical) Monte-Carlo ==&lt;br /&gt;
&lt;br /&gt;
* We use &amp;lt;code&amp;gt;mc&amp;lt;/code&amp;gt; mode&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;[mpirun -np N] turbogap mc&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
* ''e.g'' For a &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mu V T&amp;lt;/math&amp;gt; simulation of system in oxygen environment&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre class=&amp;quot;conf&amp;quot;&amp;gt;! Monte-carlo options&lt;br /&gt;
mc_nsteps = 1000                         # Number of Monte-Carlo Steps&lt;br /&gt;
n_mc_types = 3                           # Number of MC move types&lt;br /&gt;
mc_types = 'move' 'insertion' 'removal'  # MC move types (move/insertion/removal/volume/swap/md)&lt;br /&gt;
mc_move_max = 0.5                        # Maximum distance for MC displacement (&amp;amp;quot;move&amp;amp;quot;) type moves&lt;br /&gt;
&lt;br /&gt;
! - GCMC Options&lt;br /&gt;
n_mc_mu = 1              # Number of chemical potentials to add&lt;br /&gt;
mc_mu = 0                # Chemical potential(s) [eV]&lt;br /&gt;
mc_species = 'O'         # GCMC species types&lt;br /&gt;
mc_min_dist = 0.1        # GCMC minimum insertion distance&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Output:&lt;br /&gt;
&lt;br /&gt;
; &amp;lt;code&amp;gt;mc.log&amp;lt;/code&amp;gt;&lt;br /&gt;
: &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;# mc_istep  mc_move  accepted  E_trial              E_current             E_exp_trial          E_exp_current  N_tot_trial  N_mc_species_trial&lt;br /&gt;
       1       move    F       -4321.10376531       -4321.58260476         272.97693282         272.83692252      512  O        0&lt;br /&gt;
       2       move    F       -4321.10017027       -4321.58260476         272.68730901         272.83692252      512  O        0&lt;br /&gt;
       3  insertion    F       -4319.14082561       -4321.58260476         269.49191203         272.83692252      513  O        1&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; &amp;lt;code&amp;gt;mc_all.xyz&amp;lt;/code&amp;gt;&lt;br /&gt;
: xyz file written to every &amp;lt;code&amp;gt;write_xyz = N&amp;lt;/code&amp;gt; steps.&lt;br /&gt;
; &amp;lt;code&amp;gt;mc_current.xyz&amp;lt;/code&amp;gt;&lt;br /&gt;
: xyz file saving current accepted config written to every &amp;lt;code&amp;gt;write_xyz = N&amp;lt;/code&amp;gt; steps.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* If we run &amp;lt;code&amp;gt;bash run.sh standard_gcmc&amp;lt;/code&amp;gt; (may take a few minutes), we can see a prediction of the XPS with oxygen content&lt;br /&gt;
&lt;br /&gt;
[[File:standard_gcmc.png | 800px]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;experimental-observable-optimization&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Experimental Observable Optimization ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;[mpirun -np N] turbogap mc/md&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
* We can specify experimental observables to predict and optimize them using MC or MD. &amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; E_{\rm spectra} = \frac{1}{2} \gamma \int \,d\varepsilon (g_{\rm pred}(\varepsilon) - g_{\rm exp}(\varepsilon))^2  &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre class=&amp;quot;conf&amp;quot;&amp;gt;! Experimental data options&lt;br /&gt;
n_exp = 1                                  # Number of experimental observables&lt;br /&gt;
exp_labels = 'xps'                         # Experimental observable types (xps/xrd/nd/pdf)&lt;br /&gt;
exp_data_files = 'xps_spectra_interp.dat'  # Experimental data files (Note: the range of resulting XPS prediction will be the same as the experimental range.)&lt;br /&gt;
exp_n_samples = 501                        # Number of interpolations samples over the experimental range.&lt;br /&gt;
exp_energy_scales = 100.0                    # Energy scale (gamma) [eV]&lt;br /&gt;
&lt;br /&gt;
# XPS smearing&lt;br /&gt;
xps_sigma = 0.4&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Output:&lt;br /&gt;
&lt;br /&gt;
; &amp;lt;code&amp;gt;xps_prediction.dat&amp;lt;/code&amp;gt;&lt;br /&gt;
: Data file written every &amp;lt;code&amp;gt;write_xyz = N&amp;lt;/code&amp;gt; steps. Separate predictions separated by blank lines.&lt;br /&gt;
; &amp;lt;code&amp;gt;xps_exp.dat&amp;lt;/code&amp;gt;&lt;br /&gt;
: The experimental data fed into ''TurboGAP''.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* If we run &amp;lt;code&amp;gt;bash run.sh xps_optimization_gcmc&amp;lt;/code&amp;gt; (may take a few minutes), we can see a prediction of the XPS with oxygen content&lt;br /&gt;
&lt;br /&gt;
[[File:xps_optimization_gcmc.png | 800px]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;multiple-observables&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Multiple Observables ==&lt;br /&gt;
&lt;br /&gt;
* This is not in the tutorial files, but ''TurboGAP'' allows for we can optimization multiple observables.&lt;br /&gt;
** X-ray diffraction&lt;br /&gt;
** Neutron diffraction&lt;br /&gt;
** Pair distribution function&lt;br /&gt;
** XPS&lt;br /&gt;
* Here we show a fictitious example of XPS and XRD optimization.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre class=&amp;quot;conf&amp;quot;&amp;gt;# Partial PDFs needed for XRD calculation&lt;br /&gt;
pair_distribution_n_samples = 301&lt;br /&gt;
r_range_min = 0.1&lt;br /&gt;
r_range_max = 13.5&lt;br /&gt;
pair_distribution_rcut = 14.1&lt;br /&gt;
&lt;br /&gt;
do_xrd = .true.&lt;br /&gt;
&lt;br /&gt;
# Experimental Data Specification&lt;br /&gt;
n_exp = 2                  # Number of Exp. observables&lt;br /&gt;
exp_labels = 'xps' 'xrd'   # Exp. observable type (xps/xrd/nd/pdf)&lt;br /&gt;
exp_data_files = 'xps_spectra_experiment.dat' 'xrd_CO_experiment.dat'&lt;br /&gt;
exp_n_samples = 301 301 # Number of samples for the experimental data&lt;br /&gt;
exp_energy_scales = 10.0 10.0  # The &amp;amp;quot;gamma&amp;amp;quot; term for each observable&lt;br /&gt;
&lt;br /&gt;
# If using monte-carlo, the experimental energies are added directly to the local energy&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;span id=&amp;quot;applications&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
= Applications =&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;experimental-observable-predictionoptimization&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
== Experimental Observable prediction/optimization ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;deconvolution-analysis&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== Deconvolution analysis ===&lt;br /&gt;
&lt;br /&gt;
* Use subgraph isomorphisms of bonding networks to discern motifs present.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:exp_xps_with_background_high.png]]&lt;br /&gt;
&lt;br /&gt;
↑ Experimental XPS deconvolution ([[#citeproc_bib_item_9|Santini et al. 2015]])&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:deconvolution_comparison_fill_-3_new.png]]&lt;br /&gt;
&lt;br /&gt;
↑ Our XPS deconvolution ([[#citeproc_bib_item_9|Santini et al. 2015]])&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:xps_shifts_miguel_first.png]]&lt;br /&gt;
&lt;br /&gt;
[[File:xps_shifts_miguel_last.png]]&lt;br /&gt;
&lt;br /&gt;
We see with oxygen content that sp2 motifs are shifted significantly, even past the sp3 reference. This is why the experimental deconvolution did not give what we expect: sp2 carbon that composes the primary XPS peak. &lt;br /&gt;
&amp;lt;span id=&amp;quot;summary&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Summary =&lt;br /&gt;
&lt;br /&gt;
* Machine-learned potentials can be combined with experimental models to give structures which are consistent with both ''ab-inito'' and experimental data.&lt;br /&gt;
* We can generate oxygenated amorphous carbon structures using a CO GAP with XPS prediction using modified GCMC and a “Molecular Augmented Dynamics” method.&lt;br /&gt;
* We can use ''multiple experimental observables''.&lt;br /&gt;
* '''Finding structures which match experimental data allows us to understand specific experimental results.'''&lt;br /&gt;
* Deconvolve experimental XPS exactly.&lt;br /&gt;
* All of this is implemented in the ''TurboGAP'' code.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;references&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
= References =&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;citeproc_bib_item_1&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;Bartók, Albert P., Risi Kondor, and Gábor Csányi. 2013. “On Representing Chemical Environments.” ''Physical Review B'' 87 (18): 184115. https://doi.org/10.1103/PhysRevB.87.184115.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;citeproc_bib_item_2&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;Bartók, Albert P., Mike C. Payne, Risi Kondor, and Gábor Csányi. 2010. “Gaussian Approximation Potentials: The Accuracy of Quantum Mechanics, without the Electrons.” ''Physical Review Letters'' 104 (13): 136403. https://doi.org/10.1103/PhysRevLett.104.136403.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;citeproc_bib_item_3&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;Caro, Miguel A. 2019. “Optimizing Many-Body Atomic Descriptors for Enhanced Computational Performance of Machine Learning Based Interatomic Potentials.” ''Physical Review B'' 100 (2): 024112. https://doi.org/10.1103/PhysRevB.100.024112.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;citeproc_bib_item_4&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;Deringer, Volker L., Albert P. Bartók, Noam Bernstein, David M. Wilkins, Michele Ceriotti, and Gábor Csányi. 2021. “Gaussian Process Regression for Materials and Molecules.” ''Chemical Reviews'' 121 (16): 10073–141. https://doi.org/10.1021/acs.chemrev.1c00022.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;citeproc_bib_item_5&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;El-Machachi, Zakariya, Damyan Frantzov, A. Nijamudheen, Tigany Zarrouk, Miguel A. Caro, and Volker L. Deringer. 2024. “Accelerated First-Principles Exploration of Structure and Reactivity in Graphene Oxide.” arXiv. https://doi.org/10.48550/arXiv.2405.14814.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;citeproc_bib_item_6&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;Golze, Dorothea, Markus Hirvensalo, Patricia Hernández-León, Anja Aarva, Jarkko Etula, Toma Susi, Patrick Rinke, Tomi Laurila, and Miguel A. Caro. 2022. “Accurate Computational Prediction of Core-Electron Binding Energies in Carbon-Based Materials: A Machine-Learning Model Combining Density-Functional Theory and GW.” ''Chemistry of Materials'' 34 (14): 6240–54. https://doi.org/10.1021/acs.chemmater.1c04279.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;citeproc_bib_item_7&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;Muhli, Heikki, Xi Chen, Albert P. Bartók, Patricia Hernández-León, Gábor Csányi, Tapio Ala-Nissila, and Miguel A. Caro. 2021. “Machine Learning Force Fields Based on Local Parametrization of Dispersion Interactions: Application to the Phase Diagram of \&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathrm\\\C\\\\\_\60\\&amp;lt;/math&amp;gt;.” ''Physical Review B'' 104 (5): 054106. https://doi.org/10.1103/PhysRevB.104.054106.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;citeproc_bib_item_8&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;Opletal, George, Timothy C. Petersen, Amanda S. Barnard, and Salvy P. Russo. 2017. “On Reverse Monte Carlo Constraints and Model Reproduction.” ''Journal of Computational Chemistry'' 38 (17): 1547–51. https://doi.org/10.1002/jcc.24799.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;citeproc_bib_item_9&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;Santini, Claudia A., Abu Sebastian, Chiara Marchiori, Vara Prasad Jonnalagadda, Laurent Dellmann, Wabe W. Koelmans, Marta D. Rossell, Christophe P. Rossel, and Evangelos Eleftheriou. 2015. “Oxygenated Amorphous Carbon for Resistive Memory Applications.” ''Nature Communications'' 6 (1): 8600. https://doi.org/10.1038/ncomms9600.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;citeproc_bib_item_10&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;Wang, Yanzhou, Zheyong Fan, Ping Qian, Tapio Ala-Nissila, and Miguel A. Caro. 2022. “Structure and Pore Size Distribution in Nanoporous Carbon.” ''Chemistry of Materials'' 34 (2): 617–28. https://doi.org/10.1021/acs.chemmater.1c03279.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;citeproc_bib_item_11&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;Zarrouk, Tigany, Rina Ibragimova, Albert P. Bartók, and Miguel A. Caro. 2024. “Experiment-Driven Atomistic Materials Modeling: A Case Study Combining X-Ray Photoelectron Spectroscopy and Machine Learning Potentials to Infer the Structure of Oxygen-Rich Amorphous Carbon.” ''Journal of the American Chemical Society'' 146 (21): 14645–59. https://doi.org/10.1021/jacs.4c01897.&lt;/div&gt;</summary>
		<author><name>Tigany Zarrouk</name></author>
		
	</entry>
	<entry>
		<id>https://turbogap.fi/wiki/index.php?title=XPS-optimized_oxygenated_amorphous_carbon&amp;diff=648</id>
		<title>XPS-optimized oxygenated amorphous carbon</title>
		<link rel="alternate" type="text/html" href="https://turbogap.fi/wiki/index.php?title=XPS-optimized_oxygenated_amorphous_carbon&amp;diff=648"/>
		<updated>2024-06-18T19:41:43Z</updated>

		<summary type="html">&lt;p&gt;Tigany Zarrouk: /* (Grand-Canonical) Monte-Carlo */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
&amp;lt;span id=&amp;quot;what-is-turbogap&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
= What is ''TurboGAP'' ? =&lt;br /&gt;
&lt;br /&gt;
* ''TurboGAP'' is a &amp;lt;code&amp;gt;Fortran&amp;lt;/code&amp;gt; atomistic code which uses &amp;lt;u&amp;gt;Gaussian Approximation Potentials&amp;lt;/u&amp;gt; (GAPs).&lt;br /&gt;
* Its specialty are ''SOAP turbo'' descriptors: faster and more accurate than SOAP (Smooth Overlap of Atomic Positions).&lt;br /&gt;
* It's (probably!) the fastest SOAP prediction code, which will be made even faster with ''GPU acceleration'' (ongoing with CSC).&lt;br /&gt;
&lt;br /&gt;
[[File:images/Turbogap_logo.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* Through GAP/SOAP predictions, one can perform simulations with ''ab-initio'' accuracy '''at scale'''&lt;br /&gt;
** Molecular Dynamics&lt;br /&gt;
** Grand-Canonical Monte-Carlo simulations&lt;br /&gt;
** Electronic-stopping and spatially-correlated Langevin Dynamics (in-development).&lt;br /&gt;
** '''Prediction/optimization of experimental observables''' (''e.g.'' X-Ray photoelectron spectra ([[#citeproc_bib_item_6|Golze et al. 2022]]; [[#citeproc_bib_item_11|Zarrouk et al. 2024]]), X-ray/Neutron Diffraction and more to come!).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;motivation-for-structural-inference&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
= Motivation for structural inference =&lt;br /&gt;
&lt;br /&gt;
* We typically want to &amp;lt;u&amp;gt;predict structures&amp;lt;/u&amp;gt;, to make sense of experimental data.&lt;br /&gt;
* We usually pray structures have &amp;lt;u&amp;gt;experimental agreement&amp;lt;/u&amp;gt; (a “bottom-up” approach).&lt;br /&gt;
* What if we can &amp;lt;u&amp;gt;promote agreement&amp;lt;/u&amp;gt; with experimental data?&lt;br /&gt;
* ''Reverse Monte-Carlo'' techniques match experimental data to atomic structure (“top-down” approach).&lt;br /&gt;
** Downsides: “By-hand” constraints&lt;br /&gt;
** Simple experimental observables.&lt;br /&gt;
** Unphysical structures/artifacts ([[#citeproc_bib_item_8|Opletal et al. 2017]])&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Need efficient structure search to find '''agreement''' with '''experimental''' data ''and'' '''ab-inito''' data.&lt;br /&gt;
&lt;br /&gt;
# With &amp;lt;u&amp;gt;CO GAP + Core electron binding energy SOAP&amp;lt;/u&amp;gt; model we will perform '''modified (Grand-canonical) Monte-Carlo''' to produce ''experimentally consistent, low energy structures'' of oxygenated amorphous carbon.&lt;br /&gt;
# I will further show preliminary work on *“Molecular Augmented Dynamics”*: generate forces from experimental deviation, to match experimental spectra via MD.&lt;br /&gt;
&lt;br /&gt;
[[File:deconvolution_comparison_fill_-3_new.png | 400px]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;theory-and-methods&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Theory and Methods =&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;gaussian-approximation-potentials-gap&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
== Gaussian Approximation Potentials (GAP) ==&lt;br /&gt;
&lt;br /&gt;
([[#citeproc_bib_item_2|Bartók et al. 2010]]; [[#citeproc_bib_item_1|Bartók, Kondor, and Csányi 2013]]; [[#citeproc_bib_item_4|Deringer et al. 2021]])&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;u&amp;gt;Assumption&amp;lt;/u&amp;gt;: Total energy is sum of '''local energies'''. &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;E_{\rm total}(\{\mathbf{r}\}) = \sum_i^{N_{\text{atoms}}} \varepsilon^i(\{r\}, \{\xi^{\text{2b}}_i\}, \{\boldsymbol{\xi}^{\text{3b}}_i\}, \boldsymbol{\xi}^{\text{mb}}_i))&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;\begin{align}&lt;br /&gt;
  \varepsilon^i ( &amp;amp;\{r\}, \{\xi^{\text{2b}}_i\}, \{\boldsymbol{\xi}^{\text{3b}}_i\}, \boldsymbol{\xi}^{\text{mb}}_i) =&lt;br /&gt;
   E^{\text{2b}}(\{\xi^{\text{2b}}_i\}) + E^{\text{3b}}(\{\boldsymbol{\xi}^{\text{3b}}_i\}) \nonumber\\&lt;br /&gt;
  &amp;amp; + E^{\text{mb}}(\boldsymbol{\xi}^{\text{mb}}_i)&lt;br /&gt;
  + \sum_{r &amp;lt; r_{\rm cut}^{\rm core}} E^{\text{core}}(r)  \nonumber&lt;br /&gt;
\end{align}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
; Local energy&lt;br /&gt;
: Sum of '''2b, 3b and many-body''' terms.&lt;br /&gt;
; Descriptor &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\xi / \boldsymbol{\xi}&amp;lt;/math&amp;gt;.&lt;br /&gt;
: ''e.g'' &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\{\xi^{\text{2b}}\} = \{r_{ij}\}&amp;lt;/math&amp;gt;, &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\{\boldsymbol{\xi}^{\text{3b}}\} = \{ [ r_{ij}, r_{ik}, r_{kj} ] \}&amp;lt;/math&amp;gt;&lt;br /&gt;
; Local environment&lt;br /&gt;
: A set of descriptors.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;using-descriptors-to-predict-quantities&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== Using descriptors to predict quantities ===&lt;br /&gt;
&lt;br /&gt;
* ''Kernel/basis functions'' &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;k_{ij}(\boldsymbol{\xi}_i, \boldsymbol{\xi}_j)&amp;lt;/math&amp;gt; measure the ''similarity between descriptors''.&lt;br /&gt;
* ''e.g'' Exponential 2b kernel: &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;k^{2b}_{ij}(\xi_i, \xi_j) \equiv k^{2b}_{ij}(r_{i}, r_{j}) = \exp( - (r_{i} - r_{j})^2/2\sigma^2 )&amp;lt;/math&amp;gt;&lt;br /&gt;
* ''Gaussian Process Regression'' (kernel matrix algebra on training set) → ''fitting coefficients'' &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\{\alpha\}&amp;lt;/math&amp;gt;, ([[#citeproc_bib_item_4|Deringer et al. 2021]])&lt;br /&gt;
* ''e.g.'' 2b model trained with &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;N_s&amp;lt;/math&amp;gt; descriptors &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\{\xi\} \in \{\xi_i, \ldots, \xi_{Ns}\}&amp;lt;/math&amp;gt;, the energy for atom with &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;M&amp;lt;/math&amp;gt; pairwise distances in local environment: &amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;E^{2b} = \sum_i^M \left(E^{2b}_0 + \delta^2\sum_j^{N_s}  \alpha_j k^{2b}_{ij}(\xi_i, \xi_j) \right) &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;soap-many-body-descriptor&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== SOAP (many-body) descriptor ===&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;u&amp;gt;SOAP descriptor&amp;lt;/u&amp;gt;: &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\boldsymbol{\xi}_i(\{\mathbf{r}\}_{ &amp;lt; r_{\rm cut}} )&amp;lt;/math&amp;gt;, represents environment of an atom ([[#citeproc_bib_item_2|Bartók et al. 2010]]).&lt;br /&gt;
* &amp;lt;u&amp;gt;Kernel&amp;lt;/u&amp;gt;: &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;k_{ij} = (\boldsymbol{\xi}_i \cdot \boldsymbol{\xi}_j)^{\zeta}&amp;lt;/math&amp;gt; measures &amp;lt;u&amp;gt;similarity of environments&amp;lt;/u&amp;gt;.&lt;br /&gt;
* &amp;lt;u&amp;gt;Fitting coefficients&amp;lt;/u&amp;gt;: &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\alpha_j&amp;lt;/math&amp;gt; result from Gaussian Process Regression.&lt;br /&gt;
* &amp;lt;u&amp;gt;Prediction&amp;lt;/u&amp;gt;: &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;E^{\rm mb}_i(\boldsymbol{\xi}_i) = E^{\rm mb}_0 + \delta^2\sum_j  \alpha_j k_{ij}&amp;lt;/math&amp;gt;&lt;br /&gt;
* For specifics of SOAP turbo, refer to Miguel's paper ([[#citeproc_bib_item_3|Caro 2019]])&lt;br /&gt;
&lt;br /&gt;
← SOAP expansion.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
← Interpolation of DFT PES ([[#citeproc_bib_item_4|Deringer et al. 2021]])&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;how-do-we-model-xps&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
== How do we model XPS? ==&lt;br /&gt;
&lt;br /&gt;
* XPS (X-ray photoelectron spectroscopy) spectra measure '''core electron binding energies'''.&lt;br /&gt;
* Core electron binding energies ''depend on atomic environment''.&lt;br /&gt;
* SOAP turbo model trained on DFT (&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\Delta\text{KS}&amp;lt;/math&amp;gt;) data with a &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;GW&amp;lt;/math&amp;gt; correction on top ([[#citeproc_bib_item_6|Golze et al. 2022]]).&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\text{CEBE} = ( \Delta KS^0_{\rm extended} + GW_{\rm carved} - \Delta \mathrm{KS}^+_{\rm carved} )&amp;lt;/math&amp;gt;&lt;br /&gt;
* Thermal and instrumental broadening accounted for by a Gaussian with &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\sigma = 0.4\text{ eV}&amp;lt;/math&amp;gt;&lt;br /&gt;
* Can analyse environments which make up spectra.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;prediction-of-local-properties&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Prediction of Local Properties ==&lt;br /&gt;
&lt;br /&gt;
* We can predict an &amp;lt;u&amp;gt;arbitrary number&amp;lt;/u&amp;gt; of ''local properties'' which use SOAP turbo descriptors using ''TurboGAP''.&lt;br /&gt;
* /One can get these for “free”/ if local property models are trained using the same descriptors as atomic energies/forces.&lt;br /&gt;
*; ''Hirshfeld volumes''&lt;br /&gt;
*: gives vdW dispersion via Tkatchenko-Scheffler. &amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; E_{\rm TS} = \sum_i \sum_{j\neq i} C_{6, ij}(v_{i}(\boldsymbol{\xi}_i), v_{j}(\boldsymbol{\xi}_j))\frac{f_{\rm damp}(r_{ij}, \ldots)}{r_{ij}^6} &amp;lt;/math&amp;gt;&lt;br /&gt;
*; ''Core-electron binding energies''&lt;br /&gt;
*: give '''X-ray Photoelectron Spectroscopy''' prediction. &amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; g_{\rm xps}(\varepsilon) = \frac{1}{M} \sum_i \exp\left( -(\varepsilon - \varepsilon_{i}(\boldsymbol{\xi}_i))^2/(2\sigma^2)  \right) &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;how-do-we-marry-experimental-data-and-gap&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
== How do we marry experimental data and GAP? ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* '''Generalized Hamiltonian within Grand-Canonical Monte-Carlo''' scheme.&lt;br /&gt;
* Vary oxygen content with chemical potential, to see motif differences.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;  \textcolor{violet}{ \mathbf{\tilde{g}}_{\rm {pred}}}(\varepsilon)  = \sum_{i} \exp\left(&lt;br /&gt;
-\frac{(\varepsilon - \textcolor{blue}{\varepsilon^{i}_{\rm&lt;br /&gt;
{pred}}(\boldsymbol{\xi}_i)})^2}{2\sigma^2}\right)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; \tilde{E} = E_{\rm GAP} + E_{\rm spectra} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; E_{\rm spectra} =  \frac{1}{2}\gamma \int \,d\varepsilon \left( \textcolor{violet}{ g_{\rm pred}(\varepsilon)} - g_{\rm exp}(\varepsilon)\right)^2&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;p&amp;gt;A simple squared difference, which is a penalty with increases with spectra dissimilarity and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\gamma&amp;lt;/math&amp;gt; is an energy scale.&amp;lt;/p&amp;gt;&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;p&amp;gt;We can do not just XPS but also X-ray/neutron diffraction and pair distribution functions.&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;[[File:xps_gcmc_scheme.png | 400px]]&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;/ul&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* We use the standard acceptance criteria for adding/removing/moving a particle&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; \mathrm{acc}(N \rightarrow N+1) = \mathrm{min}\left[1,&lt;br /&gt;
\frac{V}{\lambda^3 (N+1)} \exp\left\{ - \frac{\tilde{E}(N+1) -&lt;br /&gt;
\tilde{E}(N) - \mu}{k_BT} \right\}     \right] &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; \mathrm{acc}(N \rightarrow N-1) = \mathrm{min}\left[1,&lt;br /&gt;
\frac{\lambda^3 N}{V} \exp\left\{ -\frac{\tilde{E}(N-1) -&lt;br /&gt;
\tilde{E}(N) + \mu}{k_BT} \right\}     \right] &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; \mathrm{acc}_{\rm move} = \mathrm{min }\left[ 1, \exp\left\{ -&lt;br /&gt;
  \frac{\tilde{E}(\mathrm{new}) - \tilde{E}(\mathrm{old})}{k_BT} \right\} \right]&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;usage&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Usage =&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;installing-turbogap&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
== Installing ''TurboGAP'' ==&lt;br /&gt;
&lt;br /&gt;
We can install the ''TurboGAP'' code, found here https://github.com/mcaroba/turbogap through ''recursively cloning'' the main branch&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;git clone --recursive https://github.com/mcaroba/turbogap.git&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
Then we edit this line in the &amp;lt;code&amp;gt;Makefile&amp;lt;/code&amp;gt; to match our system architecture.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;include makefiles/Makefile.Ubuntu_gfortran_mpi&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Then, we make&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;make&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
and then export the path in &amp;lt;code&amp;gt;.bashrc&amp;lt;/code&amp;gt; file&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;export PATH=&amp;quot;~/turbogap/bin:$PATH&amp;quot;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;span id=&amp;quot;what-you-need-for-a-calculation&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
== What you need for a calculation ==&lt;br /&gt;
&lt;br /&gt;
; &amp;lt;code&amp;gt;gap_files/&amp;lt;/code&amp;gt; directory&lt;br /&gt;
: The directory which contains your &amp;lt;code&amp;gt;*.gap&amp;lt;/code&amp;gt;, with alphas (fitting coefficients) and sparse set descriptor files.&lt;br /&gt;
;* Potentials are available from ''TurboGAP'' wiki https://turbogap.fi/wiki/index.php/Potentials&lt;br /&gt;
;* Conversion script from &amp;lt;code&amp;gt;gap_fit .xml&amp;lt;/code&amp;gt; to &amp;lt;code&amp;gt;.gap&amp;lt;/code&amp;gt; can be used &amp;lt;code&amp;gt;turbogap/tools/make_gap_files.py&amp;lt;/code&amp;gt;&lt;br /&gt;
; &amp;lt;code&amp;gt;input&amp;lt;/code&amp;gt; file&lt;br /&gt;
: The file which tells the code what to do&lt;br /&gt;
; &amp;lt;code&amp;gt;*.xyz&amp;lt;/code&amp;gt;&lt;br /&gt;
: An extended xyz format file which contains positions/lattice/velocity information.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;adding-a-local-property-model-for-cebe-prediction&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== Adding a local property model for CEBE prediction ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;  gap_beg soap_turbo&lt;br /&gt;
  n_species = 2&lt;br /&gt;
  species = C O&lt;br /&gt;
  central_species = 1&lt;br /&gt;
... some params ...&lt;br /&gt;
  zeta = 4&lt;br /&gt;
  delta = 0.1&lt;br /&gt;
  desc_sparse = &amp;quot;gap_files/CO.xml.sparseX.GAP_2022_5_19_180_7_17_31_41410&amp;quot;&lt;br /&gt;
  alphas_sparse = &amp;quot;gap_files/alphas_soap_turbo_1.dat&amp;quot;&lt;br /&gt;
  compress_mode = &amp;quot;trivial&amp;quot;&lt;br /&gt;
  has_local_properties = .true.&lt;br /&gt;
  n_local_properties = 1&lt;br /&gt;
  local_property_qs = 'gap_files/core_electron_be.xml.sparseX.GAP_2024_1_26_120_18_36_33_6091'&lt;br /&gt;
  local_property_alphas = 'gap_files/alphas_core_electron_be_1.dat'&lt;br /&gt;
  local_property_labels = 'core_electron_be'&lt;br /&gt;
  local_property_zetas = 2&lt;br /&gt;
  local_property_deltas = 1.0&lt;br /&gt;
  local_property_v0s = 290.0&lt;br /&gt;
  gap_end&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;span id=&amp;quot;conversion-of-gap_fit-.xml-files-to-.gap-format&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== Conversion of &amp;lt;code&amp;gt;gap_fit&amp;lt;/code&amp;gt; &amp;lt;code&amp;gt;*.xml&amp;lt;/code&amp;gt; files to &amp;lt;code&amp;gt;*.gap&amp;lt;/code&amp;gt; format ===&lt;br /&gt;
&lt;br /&gt;
* Then we convert the &amp;lt;code&amp;gt;*.xml&amp;lt;/code&amp;gt; files which result from &amp;lt;code&amp;gt;gap_fit&amp;lt;/code&amp;gt; into the required format for ''TurboGAP''.&lt;br /&gt;
* This is done using the convenience script in &amp;lt;code&amp;gt;turbogap/tools/make_gap_files.py&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;python3 make_gap_files.py {gap_file.xml} {gap_file.gap} {N_local_prop.} \&lt;br /&gt;
              {local_prop1.xml} {local_prop_label1} \&lt;br /&gt;
              {local_prop2.xml} {local_prop_label2}...&lt;br /&gt;
# e.g. let's build a carbon oxygen GAP&lt;br /&gt;
# with core electron binding energy prediction capability.&lt;br /&gt;
python3 make_gap_files.py CO.xml CO.gap 1 \&lt;br /&gt;
        core_electron_be_co.xml core_electron_be&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
* This creates a directory &amp;lt;code&amp;gt;gap_files/&amp;lt;/code&amp;gt; which has&lt;br /&gt;
*# &amp;lt;code&amp;gt;alphas_{descriptor}.dat&amp;lt;/code&amp;gt; which are fitting coefficients for a particular descriptor&lt;br /&gt;
*# &amp;lt;code&amp;gt;qs_{descriptor}.dat&amp;lt;/code&amp;gt; which are the '''sparse set''' descriptors, used for prediction.&lt;br /&gt;
*# &amp;lt;code&amp;gt;alphas_{local_property}.dat&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;qs_{local_property}.dat&amp;lt;/code&amp;gt; for local property prediction.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;running-the-tutorial&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
== Running the Tutorial ==&lt;br /&gt;
&lt;br /&gt;
* Navigate to &amp;lt;code&amp;gt;turbogap/tutorials/xps_optimizaton&amp;lt;/code&amp;gt;&lt;br /&gt;
* Run &amp;lt;code&amp;gt;bash run.sh {calc_type}&amp;lt;/code&amp;gt; where &amp;lt;code&amp;gt;{calc_type}&amp;lt;/code&amp;gt; is either:&lt;br /&gt;
** &amp;lt;code&amp;gt;prediction&amp;lt;/code&amp;gt;&lt;br /&gt;
** &amp;lt;code&amp;gt;standard_gcmc&amp;lt;/code&amp;gt;&lt;br /&gt;
** &amp;lt;code&amp;gt;xps_optimization_gcmc&amp;lt;/code&amp;gt;&lt;br /&gt;
* Note that these simulations have a high chemical potential and (have high &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\gamma&amp;lt;/math&amp;gt; factors), these are just to give a result in a reasonable amount of time. Take care with real simulations.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;core-electron-binding-energy-prediction&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
== Core electron binding energy prediction ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;[mpirun -np N] turbogap predict&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
* We have in our &amp;lt;code&amp;gt;input&amp;lt;/code&amp;gt; file&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre class=&amp;quot;conf&amp;quot;&amp;gt;! Species-specific info&lt;br /&gt;
atoms_file = 'atoms.xyz'&lt;br /&gt;
pot_file = 'gap_files/CO.gap'&lt;br /&gt;
n_species = 2&lt;br /&gt;
species = C O&lt;br /&gt;
masses = 12.01 15.99&lt;br /&gt;
e0 = -.16138053 0.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Output:&lt;br /&gt;
&lt;br /&gt;
; &amp;lt;code&amp;gt;trajectory_out.xyz&amp;lt;/code&amp;gt;&lt;br /&gt;
: which contains atomic positions, local energy and local property arrays for each structure.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt; 512&lt;br /&gt;
Properties=species:S:1:pos:R:3:forces:R:3:local_energy:R:1:core_electron_be:R:1 \&lt;br /&gt;
   Lattice=&amp;quot;...&amp;quot; energy=-4321.582604 energy_soap=-4114.77018429  energy_2b=-124.73820332 energy_3b=0.55261463 \&lt;br /&gt;
   energy_core_pot=0.00000000 energy_vdw=0.00000000 energy_exp=0.00000000 energy_xps=0.00000000 \&lt;br /&gt;
   virial=&amp;quot;...&amp;quot; stress=&amp;quot;...&amp;quot; volume=5372.640346&lt;br /&gt;
   C              4.39625950       7.79414272      11.91703476     \&lt;br /&gt;
                  -0.00176074      -0.00403026       0.00040104    \&lt;br /&gt;
                  -8.32055957 \ # Local energy prediction&lt;br /&gt;
                  283.83841418  # CEBE Prediction&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Withiout specifying Exp. data, Turbogap does not predict the spectra.&lt;br /&gt;
* XPS spectra can simply be calculated from &amp;lt;code&amp;gt;core_electron_be&amp;lt;/code&amp;gt; in &amp;lt;code&amp;gt;trajectory_out.xyz&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;grand-canonical-monte-carlo&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
== (Grand-Canonical) Monte-Carlo ==&lt;br /&gt;
&lt;br /&gt;
* We use &amp;lt;code&amp;gt;mc&amp;lt;/code&amp;gt; mode&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;[mpirun -np N] turbogap mc&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
* ''e.g'' For a &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mu V T&amp;lt;/math&amp;gt; simulation of system in oxygen environment&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre class=&amp;quot;conf&amp;quot;&amp;gt;! Monte-carlo options&lt;br /&gt;
mc_nsteps = 1000                         # Number of Monte-Carlo Steps&lt;br /&gt;
n_mc_types = 3                           # Number of MC move types&lt;br /&gt;
mc_types = 'move' 'insertion' 'removal'  # MC move types (move/insertion/removal/volume/swap/md)&lt;br /&gt;
mc_move_max = 0.5                        # Maximum distance for MC displacement (&amp;amp;quot;move&amp;amp;quot;) type moves&lt;br /&gt;
&lt;br /&gt;
! - GCMC Options&lt;br /&gt;
n_mc_mu = 1              # Number of chemical potentials to add&lt;br /&gt;
mc_mu = 0                # Chemical potential(s) [eV]&lt;br /&gt;
mc_species = 'O'         # GCMC species types&lt;br /&gt;
mc_min_dist = 0.1        # GCMC minimum insertion distance&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Output:&lt;br /&gt;
&lt;br /&gt;
; &amp;lt;code&amp;gt;mc.log&amp;lt;/code&amp;gt;&lt;br /&gt;
: &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;# mc_istep  mc_move  accepted  E_trial              E_current             E_exp_trial          E_exp_current  N_tot_trial  N_mc_species_trial&lt;br /&gt;
       1       move    F       -4321.10376531       -4321.58260476         272.97693282         272.83692252      512  O        0&lt;br /&gt;
       2       move    F       -4321.10017027       -4321.58260476         272.68730901         272.83692252      512  O        0&lt;br /&gt;
       3  insertion    F       -4319.14082561       -4321.58260476         269.49191203         272.83692252      513  O        1&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; &amp;lt;code&amp;gt;mc_all.xyz&amp;lt;/code&amp;gt;&lt;br /&gt;
: xyz file written to every &amp;lt;code&amp;gt;write_xyz = N&amp;lt;/code&amp;gt; steps.&lt;br /&gt;
; &amp;lt;code&amp;gt;mc_current.xyz&amp;lt;/code&amp;gt;&lt;br /&gt;
: xyz file saving current accepted config written to every &amp;lt;code&amp;gt;write_xyz = N&amp;lt;/code&amp;gt; steps.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* If we run &amp;lt;code&amp;gt;bash run.sh standard_gcmc&amp;lt;/code&amp;gt; (may take a few minutes), we can see a prediction of the XPS with oxygen content&lt;br /&gt;
&lt;br /&gt;
[[File:standard_gcmc.png | 800px]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;experimental-observable-optimization&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Experimental Observable Optimization ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;[mpirun -np N] turbogap mc/md&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
* We can specify experimental observables to predict and optimize them using MC or MD. &amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; E_{\rm spectra} = \frac{1}{2} \gamma \int \,d\varepsilon (g_{\rm pred}(\varepsilon) - g_{\rm exp}(\varepsilon))^2  &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre class=&amp;quot;conf&amp;quot;&amp;gt;! Experimental data options&lt;br /&gt;
n_exp = 1                                  # Number of experimental observables&lt;br /&gt;
exp_labels = 'xps'                         # Experimental observable types (xps/xrd/nd/pdf)&lt;br /&gt;
exp_data_files = 'xps_spectra_interp.dat'  # Experimental data files (Note: the range of resulting XPS prediction will be the same as the experimental range.)&lt;br /&gt;
exp_n_samples = 501                        # Number of interpolations samples over the experimental range.&lt;br /&gt;
exp_energy_scales = 100.0                    # Energy scale (gamma) [eV]&lt;br /&gt;
&lt;br /&gt;
# XPS smearing&lt;br /&gt;
xps_sigma = 0.4&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Output:&lt;br /&gt;
&lt;br /&gt;
; &amp;lt;code&amp;gt;xps_prediction.dat&amp;lt;/code&amp;gt;&lt;br /&gt;
: Data file written every &amp;lt;code&amp;gt;write_xyz = N&amp;lt;/code&amp;gt; steps. Separate predictions separated by blank lines.&lt;br /&gt;
; &amp;lt;code&amp;gt;xps_exp.dat&amp;lt;/code&amp;gt;&lt;br /&gt;
: The experimental data fed into ''TurboGAP''.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* If we run &amp;lt;code&amp;gt;bash run.sh xps_optimization_gcmc&amp;lt;/code&amp;gt; (may take a few minutes), we can see a prediction of the XPS with oxygen content&lt;br /&gt;
&lt;br /&gt;
[[File:xps_optimization_gcmc.png]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;multiple-observables&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
== Multiple Observables ==&lt;br /&gt;
&lt;br /&gt;
* This is not in the tutorial files, but ''TurboGAP'' allows for we can optimization multiple observables.&lt;br /&gt;
** X-ray diffraction&lt;br /&gt;
** Neutron diffraction&lt;br /&gt;
** Pair distribution function&lt;br /&gt;
** XPS&lt;br /&gt;
* Here we show a fictitious example of XPS and XRD optimization.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre class=&amp;quot;conf&amp;quot;&amp;gt;# Partial PDFs needed for XRD calculation&lt;br /&gt;
pair_distribution_n_samples = 301&lt;br /&gt;
r_range_min = 0.1&lt;br /&gt;
r_range_max = 13.5&lt;br /&gt;
pair_distribution_rcut = 14.1&lt;br /&gt;
&lt;br /&gt;
do_xrd = .true.&lt;br /&gt;
&lt;br /&gt;
# Experimental Data Specification&lt;br /&gt;
n_exp = 2                  # Number of Exp. observables&lt;br /&gt;
exp_labels = 'xps' 'xrd'   # Exp. observable type (xps/xrd/nd/pdf)&lt;br /&gt;
exp_data_files = 'xps_spectra_experiment.dat' 'xrd_CO_experiment.dat'&lt;br /&gt;
exp_n_samples = 301 301 # Number of samples for the experimental data&lt;br /&gt;
exp_energy_scales = 10.0 10.0  # The &amp;amp;quot;gamma&amp;amp;quot; term for each observable&lt;br /&gt;
&lt;br /&gt;
# If using monte-carlo, the experimental energies are added directly to the local energy&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;span id=&amp;quot;applications&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
= Applications =&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;experimental-observable-predictionoptimization&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
== Experimental Observable prediction/optimization ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;deconvolution-analysis&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== Deconvolution analysis ===&lt;br /&gt;
&lt;br /&gt;
* Use subgraph isomorphisms of bonding networks to discern motifs present.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:exp_xps_with_background_high.png]]&lt;br /&gt;
&lt;br /&gt;
↑ Experimental XPS deconvolution ([[#citeproc_bib_item_9|Santini et al. 2015]])&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:deconvolution_comparison_fill_-3_new.png]]&lt;br /&gt;
&lt;br /&gt;
↑ Our XPS deconvolution ([[#citeproc_bib_item_9|Santini et al. 2015]])&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:xps_shifts_miguel_first.png]]&lt;br /&gt;
&lt;br /&gt;
[[File:xps_shifts_miguel_last.png]]&lt;br /&gt;
&lt;br /&gt;
We see with oxygen content that sp2 motifs are shifted significantly, even past the sp3 reference. This is why the experimental deconvolution did not give what we expect: sp2 carbon that composes the primary XPS peak. &lt;br /&gt;
&amp;lt;span id=&amp;quot;summary&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Summary =&lt;br /&gt;
&lt;br /&gt;
* Machine-learned potentials can be combined with experimental models to give structures which are consistent with both ''ab-inito'' and experimental data.&lt;br /&gt;
* We can generate oxygenated amorphous carbon structures using a CO GAP with XPS prediction using modified GCMC and a “Molecular Augmented Dynamics” method.&lt;br /&gt;
* We can use ''multiple experimental observables''.&lt;br /&gt;
* '''Finding structures which match experimental data allows us to understand specific experimental results.'''&lt;br /&gt;
* Deconvolve experimental XPS exactly.&lt;br /&gt;
* All of this is implemented in the ''TurboGAP'' code.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;references&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
= References =&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;citeproc_bib_item_1&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;Bartók, Albert P., Risi Kondor, and Gábor Csányi. 2013. “On Representing Chemical Environments.” ''Physical Review B'' 87 (18): 184115. https://doi.org/10.1103/PhysRevB.87.184115.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;citeproc_bib_item_2&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;Bartók, Albert P., Mike C. Payne, Risi Kondor, and Gábor Csányi. 2010. “Gaussian Approximation Potentials: The Accuracy of Quantum Mechanics, without the Electrons.” ''Physical Review Letters'' 104 (13): 136403. https://doi.org/10.1103/PhysRevLett.104.136403.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;citeproc_bib_item_3&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;Caro, Miguel A. 2019. “Optimizing Many-Body Atomic Descriptors for Enhanced Computational Performance of Machine Learning Based Interatomic Potentials.” ''Physical Review B'' 100 (2): 024112. https://doi.org/10.1103/PhysRevB.100.024112.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;citeproc_bib_item_4&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;Deringer, Volker L., Albert P. Bartók, Noam Bernstein, David M. Wilkins, Michele Ceriotti, and Gábor Csányi. 2021. “Gaussian Process Regression for Materials and Molecules.” ''Chemical Reviews'' 121 (16): 10073–141. https://doi.org/10.1021/acs.chemrev.1c00022.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;citeproc_bib_item_5&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;El-Machachi, Zakariya, Damyan Frantzov, A. Nijamudheen, Tigany Zarrouk, Miguel A. Caro, and Volker L. Deringer. 2024. “Accelerated First-Principles Exploration of Structure and Reactivity in Graphene Oxide.” arXiv. https://doi.org/10.48550/arXiv.2405.14814.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;citeproc_bib_item_6&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;Golze, Dorothea, Markus Hirvensalo, Patricia Hernández-León, Anja Aarva, Jarkko Etula, Toma Susi, Patrick Rinke, Tomi Laurila, and Miguel A. Caro. 2022. “Accurate Computational Prediction of Core-Electron Binding Energies in Carbon-Based Materials: A Machine-Learning Model Combining Density-Functional Theory and GW.” ''Chemistry of Materials'' 34 (14): 6240–54. https://doi.org/10.1021/acs.chemmater.1c04279.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;citeproc_bib_item_7&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;Muhli, Heikki, Xi Chen, Albert P. Bartók, Patricia Hernández-León, Gábor Csányi, Tapio Ala-Nissila, and Miguel A. Caro. 2021. “Machine Learning Force Fields Based on Local Parametrization of Dispersion Interactions: Application to the Phase Diagram of \&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathrm\\\C\\\\\_\60\\&amp;lt;/math&amp;gt;.” ''Physical Review B'' 104 (5): 054106. https://doi.org/10.1103/PhysRevB.104.054106.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;citeproc_bib_item_8&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;Opletal, George, Timothy C. Petersen, Amanda S. Barnard, and Salvy P. Russo. 2017. “On Reverse Monte Carlo Constraints and Model Reproduction.” ''Journal of Computational Chemistry'' 38 (17): 1547–51. https://doi.org/10.1002/jcc.24799.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;citeproc_bib_item_9&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;Santini, Claudia A., Abu Sebastian, Chiara Marchiori, Vara Prasad Jonnalagadda, Laurent Dellmann, Wabe W. Koelmans, Marta D. Rossell, Christophe P. Rossel, and Evangelos Eleftheriou. 2015. “Oxygenated Amorphous Carbon for Resistive Memory Applications.” ''Nature Communications'' 6 (1): 8600. https://doi.org/10.1038/ncomms9600.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;citeproc_bib_item_10&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;Wang, Yanzhou, Zheyong Fan, Ping Qian, Tapio Ala-Nissila, and Miguel A. Caro. 2022. “Structure and Pore Size Distribution in Nanoporous Carbon.” ''Chemistry of Materials'' 34 (2): 617–28. https://doi.org/10.1021/acs.chemmater.1c03279.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;citeproc_bib_item_11&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;Zarrouk, Tigany, Rina Ibragimova, Albert P. Bartók, and Miguel A. Caro. 2024. “Experiment-Driven Atomistic Materials Modeling: A Case Study Combining X-Ray Photoelectron Spectroscopy and Machine Learning Potentials to Infer the Structure of Oxygen-Rich Amorphous Carbon.” ''Journal of the American Chemical Society'' 146 (21): 14645–59. https://doi.org/10.1021/jacs.4c01897.&lt;/div&gt;</summary>
		<author><name>Tigany Zarrouk</name></author>
		
	</entry>
	<entry>
		<id>https://turbogap.fi/wiki/index.php?title=XPS-optimized_oxygenated_amorphous_carbon&amp;diff=647</id>
		<title>XPS-optimized oxygenated amorphous carbon</title>
		<link rel="alternate" type="text/html" href="https://turbogap.fi/wiki/index.php?title=XPS-optimized_oxygenated_amorphous_carbon&amp;diff=647"/>
		<updated>2024-06-18T19:41:19Z</updated>

		<summary type="html">&lt;p&gt;Tigany Zarrouk: /* How do we marry experimental data and GAP? */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
&amp;lt;span id=&amp;quot;what-is-turbogap&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
= What is ''TurboGAP'' ? =&lt;br /&gt;
&lt;br /&gt;
* ''TurboGAP'' is a &amp;lt;code&amp;gt;Fortran&amp;lt;/code&amp;gt; atomistic code which uses &amp;lt;u&amp;gt;Gaussian Approximation Potentials&amp;lt;/u&amp;gt; (GAPs).&lt;br /&gt;
* Its specialty are ''SOAP turbo'' descriptors: faster and more accurate than SOAP (Smooth Overlap of Atomic Positions).&lt;br /&gt;
* It's (probably!) the fastest SOAP prediction code, which will be made even faster with ''GPU acceleration'' (ongoing with CSC).&lt;br /&gt;
&lt;br /&gt;
[[File:images/Turbogap_logo.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* Through GAP/SOAP predictions, one can perform simulations with ''ab-initio'' accuracy '''at scale'''&lt;br /&gt;
** Molecular Dynamics&lt;br /&gt;
** Grand-Canonical Monte-Carlo simulations&lt;br /&gt;
** Electronic-stopping and spatially-correlated Langevin Dynamics (in-development).&lt;br /&gt;
** '''Prediction/optimization of experimental observables''' (''e.g.'' X-Ray photoelectron spectra ([[#citeproc_bib_item_6|Golze et al. 2022]]; [[#citeproc_bib_item_11|Zarrouk et al. 2024]]), X-ray/Neutron Diffraction and more to come!).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;motivation-for-structural-inference&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
= Motivation for structural inference =&lt;br /&gt;
&lt;br /&gt;
* We typically want to &amp;lt;u&amp;gt;predict structures&amp;lt;/u&amp;gt;, to make sense of experimental data.&lt;br /&gt;
* We usually pray structures have &amp;lt;u&amp;gt;experimental agreement&amp;lt;/u&amp;gt; (a “bottom-up” approach).&lt;br /&gt;
* What if we can &amp;lt;u&amp;gt;promote agreement&amp;lt;/u&amp;gt; with experimental data?&lt;br /&gt;
* ''Reverse Monte-Carlo'' techniques match experimental data to atomic structure (“top-down” approach).&lt;br /&gt;
** Downsides: “By-hand” constraints&lt;br /&gt;
** Simple experimental observables.&lt;br /&gt;
** Unphysical structures/artifacts ([[#citeproc_bib_item_8|Opletal et al. 2017]])&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Need efficient structure search to find '''agreement''' with '''experimental''' data ''and'' '''ab-inito''' data.&lt;br /&gt;
&lt;br /&gt;
# With &amp;lt;u&amp;gt;CO GAP + Core electron binding energy SOAP&amp;lt;/u&amp;gt; model we will perform '''modified (Grand-canonical) Monte-Carlo''' to produce ''experimentally consistent, low energy structures'' of oxygenated amorphous carbon.&lt;br /&gt;
# I will further show preliminary work on *“Molecular Augmented Dynamics”*: generate forces from experimental deviation, to match experimental spectra via MD.&lt;br /&gt;
&lt;br /&gt;
[[File:deconvolution_comparison_fill_-3_new.png | 400px]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;theory-and-methods&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Theory and Methods =&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;gaussian-approximation-potentials-gap&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
== Gaussian Approximation Potentials (GAP) ==&lt;br /&gt;
&lt;br /&gt;
([[#citeproc_bib_item_2|Bartók et al. 2010]]; [[#citeproc_bib_item_1|Bartók, Kondor, and Csányi 2013]]; [[#citeproc_bib_item_4|Deringer et al. 2021]])&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;u&amp;gt;Assumption&amp;lt;/u&amp;gt;: Total energy is sum of '''local energies'''. &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;E_{\rm total}(\{\mathbf{r}\}) = \sum_i^{N_{\text{atoms}}} \varepsilon^i(\{r\}, \{\xi^{\text{2b}}_i\}, \{\boldsymbol{\xi}^{\text{3b}}_i\}, \boldsymbol{\xi}^{\text{mb}}_i))&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;\begin{align}&lt;br /&gt;
  \varepsilon^i ( &amp;amp;\{r\}, \{\xi^{\text{2b}}_i\}, \{\boldsymbol{\xi}^{\text{3b}}_i\}, \boldsymbol{\xi}^{\text{mb}}_i) =&lt;br /&gt;
   E^{\text{2b}}(\{\xi^{\text{2b}}_i\}) + E^{\text{3b}}(\{\boldsymbol{\xi}^{\text{3b}}_i\}) \nonumber\\&lt;br /&gt;
  &amp;amp; + E^{\text{mb}}(\boldsymbol{\xi}^{\text{mb}}_i)&lt;br /&gt;
  + \sum_{r &amp;lt; r_{\rm cut}^{\rm core}} E^{\text{core}}(r)  \nonumber&lt;br /&gt;
\end{align}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
; Local energy&lt;br /&gt;
: Sum of '''2b, 3b and many-body''' terms.&lt;br /&gt;
; Descriptor &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\xi / \boldsymbol{\xi}&amp;lt;/math&amp;gt;.&lt;br /&gt;
: ''e.g'' &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\{\xi^{\text{2b}}\} = \{r_{ij}\}&amp;lt;/math&amp;gt;, &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\{\boldsymbol{\xi}^{\text{3b}}\} = \{ [ r_{ij}, r_{ik}, r_{kj} ] \}&amp;lt;/math&amp;gt;&lt;br /&gt;
; Local environment&lt;br /&gt;
: A set of descriptors.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;using-descriptors-to-predict-quantities&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== Using descriptors to predict quantities ===&lt;br /&gt;
&lt;br /&gt;
* ''Kernel/basis functions'' &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;k_{ij}(\boldsymbol{\xi}_i, \boldsymbol{\xi}_j)&amp;lt;/math&amp;gt; measure the ''similarity between descriptors''.&lt;br /&gt;
* ''e.g'' Exponential 2b kernel: &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;k^{2b}_{ij}(\xi_i, \xi_j) \equiv k^{2b}_{ij}(r_{i}, r_{j}) = \exp( - (r_{i} - r_{j})^2/2\sigma^2 )&amp;lt;/math&amp;gt;&lt;br /&gt;
* ''Gaussian Process Regression'' (kernel matrix algebra on training set) → ''fitting coefficients'' &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\{\alpha\}&amp;lt;/math&amp;gt;, ([[#citeproc_bib_item_4|Deringer et al. 2021]])&lt;br /&gt;
* ''e.g.'' 2b model trained with &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;N_s&amp;lt;/math&amp;gt; descriptors &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\{\xi\} \in \{\xi_i, \ldots, \xi_{Ns}\}&amp;lt;/math&amp;gt;, the energy for atom with &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;M&amp;lt;/math&amp;gt; pairwise distances in local environment: &amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;E^{2b} = \sum_i^M \left(E^{2b}_0 + \delta^2\sum_j^{N_s}  \alpha_j k^{2b}_{ij}(\xi_i, \xi_j) \right) &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;soap-many-body-descriptor&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== SOAP (many-body) descriptor ===&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;u&amp;gt;SOAP descriptor&amp;lt;/u&amp;gt;: &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\boldsymbol{\xi}_i(\{\mathbf{r}\}_{ &amp;lt; r_{\rm cut}} )&amp;lt;/math&amp;gt;, represents environment of an atom ([[#citeproc_bib_item_2|Bartók et al. 2010]]).&lt;br /&gt;
* &amp;lt;u&amp;gt;Kernel&amp;lt;/u&amp;gt;: &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;k_{ij} = (\boldsymbol{\xi}_i \cdot \boldsymbol{\xi}_j)^{\zeta}&amp;lt;/math&amp;gt; measures &amp;lt;u&amp;gt;similarity of environments&amp;lt;/u&amp;gt;.&lt;br /&gt;
* &amp;lt;u&amp;gt;Fitting coefficients&amp;lt;/u&amp;gt;: &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\alpha_j&amp;lt;/math&amp;gt; result from Gaussian Process Regression.&lt;br /&gt;
* &amp;lt;u&amp;gt;Prediction&amp;lt;/u&amp;gt;: &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;E^{\rm mb}_i(\boldsymbol{\xi}_i) = E^{\rm mb}_0 + \delta^2\sum_j  \alpha_j k_{ij}&amp;lt;/math&amp;gt;&lt;br /&gt;
* For specifics of SOAP turbo, refer to Miguel's paper ([[#citeproc_bib_item_3|Caro 2019]])&lt;br /&gt;
&lt;br /&gt;
← SOAP expansion.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
← Interpolation of DFT PES ([[#citeproc_bib_item_4|Deringer et al. 2021]])&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;how-do-we-model-xps&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
== How do we model XPS? ==&lt;br /&gt;
&lt;br /&gt;
* XPS (X-ray photoelectron spectroscopy) spectra measure '''core electron binding energies'''.&lt;br /&gt;
* Core electron binding energies ''depend on atomic environment''.&lt;br /&gt;
* SOAP turbo model trained on DFT (&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\Delta\text{KS}&amp;lt;/math&amp;gt;) data with a &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;GW&amp;lt;/math&amp;gt; correction on top ([[#citeproc_bib_item_6|Golze et al. 2022]]).&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\text{CEBE} = ( \Delta KS^0_{\rm extended} + GW_{\rm carved} - \Delta \mathrm{KS}^+_{\rm carved} )&amp;lt;/math&amp;gt;&lt;br /&gt;
* Thermal and instrumental broadening accounted for by a Gaussian with &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\sigma = 0.4\text{ eV}&amp;lt;/math&amp;gt;&lt;br /&gt;
* Can analyse environments which make up spectra.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;prediction-of-local-properties&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Prediction of Local Properties ==&lt;br /&gt;
&lt;br /&gt;
* We can predict an &amp;lt;u&amp;gt;arbitrary number&amp;lt;/u&amp;gt; of ''local properties'' which use SOAP turbo descriptors using ''TurboGAP''.&lt;br /&gt;
* /One can get these for “free”/ if local property models are trained using the same descriptors as atomic energies/forces.&lt;br /&gt;
*; ''Hirshfeld volumes''&lt;br /&gt;
*: gives vdW dispersion via Tkatchenko-Scheffler. &amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; E_{\rm TS} = \sum_i \sum_{j\neq i} C_{6, ij}(v_{i}(\boldsymbol{\xi}_i), v_{j}(\boldsymbol{\xi}_j))\frac{f_{\rm damp}(r_{ij}, \ldots)}{r_{ij}^6} &amp;lt;/math&amp;gt;&lt;br /&gt;
*; ''Core-electron binding energies''&lt;br /&gt;
*: give '''X-ray Photoelectron Spectroscopy''' prediction. &amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; g_{\rm xps}(\varepsilon) = \frac{1}{M} \sum_i \exp\left( -(\varepsilon - \varepsilon_{i}(\boldsymbol{\xi}_i))^2/(2\sigma^2)  \right) &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;how-do-we-marry-experimental-data-and-gap&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
== How do we marry experimental data and GAP? ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* '''Generalized Hamiltonian within Grand-Canonical Monte-Carlo''' scheme.&lt;br /&gt;
* Vary oxygen content with chemical potential, to see motif differences.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;  \textcolor{violet}{ \mathbf{\tilde{g}}_{\rm {pred}}}(\varepsilon)  = \sum_{i} \exp\left(&lt;br /&gt;
-\frac{(\varepsilon - \textcolor{blue}{\varepsilon^{i}_{\rm&lt;br /&gt;
{pred}}(\boldsymbol{\xi}_i)})^2}{2\sigma^2}\right)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; \tilde{E} = E_{\rm GAP} + E_{\rm spectra} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; E_{\rm spectra} =  \frac{1}{2}\gamma \int \,d\varepsilon \left( \textcolor{violet}{ g_{\rm pred}(\varepsilon)} - g_{\rm exp}(\varepsilon)\right)^2&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;p&amp;gt;A simple squared difference, which is a penalty with increases with spectra dissimilarity and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\gamma&amp;lt;/math&amp;gt; is an energy scale.&amp;lt;/p&amp;gt;&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;p&amp;gt;We can do not just XPS but also X-ray/neutron diffraction and pair distribution functions.&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;[[File:xps_gcmc_scheme.png | 400px]]&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;/ul&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* We use the standard acceptance criteria for adding/removing/moving a particle&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; \mathrm{acc}(N \rightarrow N+1) = \mathrm{min}\left[1,&lt;br /&gt;
\frac{V}{\lambda^3 (N+1)} \exp\left\{ - \frac{\tilde{E}(N+1) -&lt;br /&gt;
\tilde{E}(N) - \mu}{k_BT} \right\}     \right] &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; \mathrm{acc}(N \rightarrow N-1) = \mathrm{min}\left[1,&lt;br /&gt;
\frac{\lambda^3 N}{V} \exp\left\{ -\frac{\tilde{E}(N-1) -&lt;br /&gt;
\tilde{E}(N) + \mu}{k_BT} \right\}     \right] &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; \mathrm{acc}_{\rm move} = \mathrm{min }\left[ 1, \exp\left\{ -&lt;br /&gt;
  \frac{\tilde{E}(\mathrm{new}) - \tilde{E}(\mathrm{old})}{k_BT} \right\} \right]&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;usage&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Usage =&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;installing-turbogap&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
== Installing ''TurboGAP'' ==&lt;br /&gt;
&lt;br /&gt;
We can install the ''TurboGAP'' code, found here https://github.com/mcaroba/turbogap through ''recursively cloning'' the main branch&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;git clone --recursive https://github.com/mcaroba/turbogap.git&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
Then we edit this line in the &amp;lt;code&amp;gt;Makefile&amp;lt;/code&amp;gt; to match our system architecture.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;include makefiles/Makefile.Ubuntu_gfortran_mpi&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Then, we make&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;make&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
and then export the path in &amp;lt;code&amp;gt;.bashrc&amp;lt;/code&amp;gt; file&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;export PATH=&amp;quot;~/turbogap/bin:$PATH&amp;quot;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;span id=&amp;quot;what-you-need-for-a-calculation&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
== What you need for a calculation ==&lt;br /&gt;
&lt;br /&gt;
; &amp;lt;code&amp;gt;gap_files/&amp;lt;/code&amp;gt; directory&lt;br /&gt;
: The directory which contains your &amp;lt;code&amp;gt;*.gap&amp;lt;/code&amp;gt;, with alphas (fitting coefficients) and sparse set descriptor files.&lt;br /&gt;
;* Potentials are available from ''TurboGAP'' wiki https://turbogap.fi/wiki/index.php/Potentials&lt;br /&gt;
;* Conversion script from &amp;lt;code&amp;gt;gap_fit .xml&amp;lt;/code&amp;gt; to &amp;lt;code&amp;gt;.gap&amp;lt;/code&amp;gt; can be used &amp;lt;code&amp;gt;turbogap/tools/make_gap_files.py&amp;lt;/code&amp;gt;&lt;br /&gt;
; &amp;lt;code&amp;gt;input&amp;lt;/code&amp;gt; file&lt;br /&gt;
: The file which tells the code what to do&lt;br /&gt;
; &amp;lt;code&amp;gt;*.xyz&amp;lt;/code&amp;gt;&lt;br /&gt;
: An extended xyz format file which contains positions/lattice/velocity information.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;adding-a-local-property-model-for-cebe-prediction&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== Adding a local property model for CEBE prediction ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;  gap_beg soap_turbo&lt;br /&gt;
  n_species = 2&lt;br /&gt;
  species = C O&lt;br /&gt;
  central_species = 1&lt;br /&gt;
... some params ...&lt;br /&gt;
  zeta = 4&lt;br /&gt;
  delta = 0.1&lt;br /&gt;
  desc_sparse = &amp;quot;gap_files/CO.xml.sparseX.GAP_2022_5_19_180_7_17_31_41410&amp;quot;&lt;br /&gt;
  alphas_sparse = &amp;quot;gap_files/alphas_soap_turbo_1.dat&amp;quot;&lt;br /&gt;
  compress_mode = &amp;quot;trivial&amp;quot;&lt;br /&gt;
  has_local_properties = .true.&lt;br /&gt;
  n_local_properties = 1&lt;br /&gt;
  local_property_qs = 'gap_files/core_electron_be.xml.sparseX.GAP_2024_1_26_120_18_36_33_6091'&lt;br /&gt;
  local_property_alphas = 'gap_files/alphas_core_electron_be_1.dat'&lt;br /&gt;
  local_property_labels = 'core_electron_be'&lt;br /&gt;
  local_property_zetas = 2&lt;br /&gt;
  local_property_deltas = 1.0&lt;br /&gt;
  local_property_v0s = 290.0&lt;br /&gt;
  gap_end&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;span id=&amp;quot;conversion-of-gap_fit-.xml-files-to-.gap-format&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== Conversion of &amp;lt;code&amp;gt;gap_fit&amp;lt;/code&amp;gt; &amp;lt;code&amp;gt;*.xml&amp;lt;/code&amp;gt; files to &amp;lt;code&amp;gt;*.gap&amp;lt;/code&amp;gt; format ===&lt;br /&gt;
&lt;br /&gt;
* Then we convert the &amp;lt;code&amp;gt;*.xml&amp;lt;/code&amp;gt; files which result from &amp;lt;code&amp;gt;gap_fit&amp;lt;/code&amp;gt; into the required format for ''TurboGAP''.&lt;br /&gt;
* This is done using the convenience script in &amp;lt;code&amp;gt;turbogap/tools/make_gap_files.py&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;python3 make_gap_files.py {gap_file.xml} {gap_file.gap} {N_local_prop.} \&lt;br /&gt;
              {local_prop1.xml} {local_prop_label1} \&lt;br /&gt;
              {local_prop2.xml} {local_prop_label2}...&lt;br /&gt;
# e.g. let's build a carbon oxygen GAP&lt;br /&gt;
# with core electron binding energy prediction capability.&lt;br /&gt;
python3 make_gap_files.py CO.xml CO.gap 1 \&lt;br /&gt;
        core_electron_be_co.xml core_electron_be&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
* This creates a directory &amp;lt;code&amp;gt;gap_files/&amp;lt;/code&amp;gt; which has&lt;br /&gt;
*# &amp;lt;code&amp;gt;alphas_{descriptor}.dat&amp;lt;/code&amp;gt; which are fitting coefficients for a particular descriptor&lt;br /&gt;
*# &amp;lt;code&amp;gt;qs_{descriptor}.dat&amp;lt;/code&amp;gt; which are the '''sparse set''' descriptors, used for prediction.&lt;br /&gt;
*# &amp;lt;code&amp;gt;alphas_{local_property}.dat&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;qs_{local_property}.dat&amp;lt;/code&amp;gt; for local property prediction.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;running-the-tutorial&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
== Running the Tutorial ==&lt;br /&gt;
&lt;br /&gt;
* Navigate to &amp;lt;code&amp;gt;turbogap/tutorials/xps_optimizaton&amp;lt;/code&amp;gt;&lt;br /&gt;
* Run &amp;lt;code&amp;gt;bash run.sh {calc_type}&amp;lt;/code&amp;gt; where &amp;lt;code&amp;gt;{calc_type}&amp;lt;/code&amp;gt; is either:&lt;br /&gt;
** &amp;lt;code&amp;gt;prediction&amp;lt;/code&amp;gt;&lt;br /&gt;
** &amp;lt;code&amp;gt;standard_gcmc&amp;lt;/code&amp;gt;&lt;br /&gt;
** &amp;lt;code&amp;gt;xps_optimization_gcmc&amp;lt;/code&amp;gt;&lt;br /&gt;
* Note that these simulations have a high chemical potential and (have high &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\gamma&amp;lt;/math&amp;gt; factors), these are just to give a result in a reasonable amount of time. Take care with real simulations.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;core-electron-binding-energy-prediction&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
== Core electron binding energy prediction ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;[mpirun -np N] turbogap predict&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
* We have in our &amp;lt;code&amp;gt;input&amp;lt;/code&amp;gt; file&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre class=&amp;quot;conf&amp;quot;&amp;gt;! Species-specific info&lt;br /&gt;
atoms_file = 'atoms.xyz'&lt;br /&gt;
pot_file = 'gap_files/CO.gap'&lt;br /&gt;
n_species = 2&lt;br /&gt;
species = C O&lt;br /&gt;
masses = 12.01 15.99&lt;br /&gt;
e0 = -.16138053 0.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Output:&lt;br /&gt;
&lt;br /&gt;
; &amp;lt;code&amp;gt;trajectory_out.xyz&amp;lt;/code&amp;gt;&lt;br /&gt;
: which contains atomic positions, local energy and local property arrays for each structure.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt; 512&lt;br /&gt;
Properties=species:S:1:pos:R:3:forces:R:3:local_energy:R:1:core_electron_be:R:1 \&lt;br /&gt;
   Lattice=&amp;quot;...&amp;quot; energy=-4321.582604 energy_soap=-4114.77018429  energy_2b=-124.73820332 energy_3b=0.55261463 \&lt;br /&gt;
   energy_core_pot=0.00000000 energy_vdw=0.00000000 energy_exp=0.00000000 energy_xps=0.00000000 \&lt;br /&gt;
   virial=&amp;quot;...&amp;quot; stress=&amp;quot;...&amp;quot; volume=5372.640346&lt;br /&gt;
   C              4.39625950       7.79414272      11.91703476     \&lt;br /&gt;
                  -0.00176074      -0.00403026       0.00040104    \&lt;br /&gt;
                  -8.32055957 \ # Local energy prediction&lt;br /&gt;
                  283.83841418  # CEBE Prediction&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Withiout specifying Exp. data, Turbogap does not predict the spectra.&lt;br /&gt;
* XPS spectra can simply be calculated from &amp;lt;code&amp;gt;core_electron_be&amp;lt;/code&amp;gt; in &amp;lt;code&amp;gt;trajectory_out.xyz&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;grand-canonical-monte-carlo&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
== (Grand-Canonical) Monte-Carlo ==&lt;br /&gt;
&lt;br /&gt;
* We use &amp;lt;code&amp;gt;mc&amp;lt;/code&amp;gt; mode&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;[mpirun -np N] turbogap mc&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
* ''e.g'' For a &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mu V T&amp;lt;/math&amp;gt; simulation of system in oxygen environment&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre class=&amp;quot;conf&amp;quot;&amp;gt;! Monte-carlo options&lt;br /&gt;
mc_nsteps = 1000                         # Number of Monte-Carlo Steps&lt;br /&gt;
n_mc_types = 3                           # Number of MC move types&lt;br /&gt;
mc_types = 'move' 'insertion' 'removal'  # MC move types (move/insertion/removal/volume/swap/md)&lt;br /&gt;
mc_move_max = 0.5                        # Maximum distance for MC displacement (&amp;amp;quot;move&amp;amp;quot;) type moves&lt;br /&gt;
&lt;br /&gt;
! - GCMC Options&lt;br /&gt;
n_mc_mu = 1              # Number of chemical potentials to add&lt;br /&gt;
mc_mu = 0                # Chemical potential(s) [eV]&lt;br /&gt;
mc_species = 'O'         # GCMC species types&lt;br /&gt;
mc_min_dist = 0.1        # GCMC minimum insertion distance&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Output:&lt;br /&gt;
&lt;br /&gt;
; &amp;lt;code&amp;gt;mc.log&amp;lt;/code&amp;gt;&lt;br /&gt;
: &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;# mc_istep  mc_move  accepted  E_trial              E_current             E_exp_trial          E_exp_current  N_tot_trial  N_mc_species_trial&lt;br /&gt;
       1       move    F       -4321.10376531       -4321.58260476         272.97693282         272.83692252      512  O        0&lt;br /&gt;
       2       move    F       -4321.10017027       -4321.58260476         272.68730901         272.83692252      512  O        0&lt;br /&gt;
       3  insertion    F       -4319.14082561       -4321.58260476         269.49191203         272.83692252      513  O        1&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; &amp;lt;code&amp;gt;mc_all.xyz&amp;lt;/code&amp;gt;&lt;br /&gt;
: xyz file written to every &amp;lt;code&amp;gt;write_xyz = N&amp;lt;/code&amp;gt; steps.&lt;br /&gt;
; &amp;lt;code&amp;gt;mc_current.xyz&amp;lt;/code&amp;gt;&lt;br /&gt;
: xyz file saving current accepted config written to every &amp;lt;code&amp;gt;write_xyz = N&amp;lt;/code&amp;gt; steps.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* If we run &amp;lt;code&amp;gt;bash run.sh standard_gcmc&amp;lt;/code&amp;gt; (may take a few minutes), we can see a prediction of the XPS with oxygen content&lt;br /&gt;
&lt;br /&gt;
[[File:standard_gcmc.png]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;experimental-observable-optimization&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
== Experimental Observable Optimization ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;[mpirun -np N] turbogap mc/md&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
* We can specify experimental observables to predict and optimize them using MC or MD. &amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; E_{\rm spectra} = \frac{1}{2} \gamma \int \,d\varepsilon (g_{\rm pred}(\varepsilon) - g_{\rm exp}(\varepsilon))^2  &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre class=&amp;quot;conf&amp;quot;&amp;gt;! Experimental data options&lt;br /&gt;
n_exp = 1                                  # Number of experimental observables&lt;br /&gt;
exp_labels = 'xps'                         # Experimental observable types (xps/xrd/nd/pdf)&lt;br /&gt;
exp_data_files = 'xps_spectra_interp.dat'  # Experimental data files (Note: the range of resulting XPS prediction will be the same as the experimental range.)&lt;br /&gt;
exp_n_samples = 501                        # Number of interpolations samples over the experimental range.&lt;br /&gt;
exp_energy_scales = 100.0                    # Energy scale (gamma) [eV]&lt;br /&gt;
&lt;br /&gt;
# XPS smearing&lt;br /&gt;
xps_sigma = 0.4&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Output:&lt;br /&gt;
&lt;br /&gt;
; &amp;lt;code&amp;gt;xps_prediction.dat&amp;lt;/code&amp;gt;&lt;br /&gt;
: Data file written every &amp;lt;code&amp;gt;write_xyz = N&amp;lt;/code&amp;gt; steps. Separate predictions separated by blank lines.&lt;br /&gt;
; &amp;lt;code&amp;gt;xps_exp.dat&amp;lt;/code&amp;gt;&lt;br /&gt;
: The experimental data fed into ''TurboGAP''.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* If we run &amp;lt;code&amp;gt;bash run.sh xps_optimization_gcmc&amp;lt;/code&amp;gt; (may take a few minutes), we can see a prediction of the XPS with oxygen content&lt;br /&gt;
&lt;br /&gt;
[[File:xps_optimization_gcmc.png]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;multiple-observables&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
== Multiple Observables ==&lt;br /&gt;
&lt;br /&gt;
* This is not in the tutorial files, but ''TurboGAP'' allows for we can optimization multiple observables.&lt;br /&gt;
** X-ray diffraction&lt;br /&gt;
** Neutron diffraction&lt;br /&gt;
** Pair distribution function&lt;br /&gt;
** XPS&lt;br /&gt;
* Here we show a fictitious example of XPS and XRD optimization.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre class=&amp;quot;conf&amp;quot;&amp;gt;# Partial PDFs needed for XRD calculation&lt;br /&gt;
pair_distribution_n_samples = 301&lt;br /&gt;
r_range_min = 0.1&lt;br /&gt;
r_range_max = 13.5&lt;br /&gt;
pair_distribution_rcut = 14.1&lt;br /&gt;
&lt;br /&gt;
do_xrd = .true.&lt;br /&gt;
&lt;br /&gt;
# Experimental Data Specification&lt;br /&gt;
n_exp = 2                  # Number of Exp. observables&lt;br /&gt;
exp_labels = 'xps' 'xrd'   # Exp. observable type (xps/xrd/nd/pdf)&lt;br /&gt;
exp_data_files = 'xps_spectra_experiment.dat' 'xrd_CO_experiment.dat'&lt;br /&gt;
exp_n_samples = 301 301 # Number of samples for the experimental data&lt;br /&gt;
exp_energy_scales = 10.0 10.0  # The &amp;amp;quot;gamma&amp;amp;quot; term for each observable&lt;br /&gt;
&lt;br /&gt;
# If using monte-carlo, the experimental energies are added directly to the local energy&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;span id=&amp;quot;applications&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
= Applications =&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;experimental-observable-predictionoptimization&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
== Experimental Observable prediction/optimization ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;deconvolution-analysis&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== Deconvolution analysis ===&lt;br /&gt;
&lt;br /&gt;
* Use subgraph isomorphisms of bonding networks to discern motifs present.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:exp_xps_with_background_high.png]]&lt;br /&gt;
&lt;br /&gt;
↑ Experimental XPS deconvolution ([[#citeproc_bib_item_9|Santini et al. 2015]])&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:deconvolution_comparison_fill_-3_new.png]]&lt;br /&gt;
&lt;br /&gt;
↑ Our XPS deconvolution ([[#citeproc_bib_item_9|Santini et al. 2015]])&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:xps_shifts_miguel_first.png]]&lt;br /&gt;
&lt;br /&gt;
[[File:xps_shifts_miguel_last.png]]&lt;br /&gt;
&lt;br /&gt;
We see with oxygen content that sp2 motifs are shifted significantly, even past the sp3 reference. This is why the experimental deconvolution did not give what we expect: sp2 carbon that composes the primary XPS peak. &lt;br /&gt;
&amp;lt;span id=&amp;quot;summary&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Summary =&lt;br /&gt;
&lt;br /&gt;
* Machine-learned potentials can be combined with experimental models to give structures which are consistent with both ''ab-inito'' and experimental data.&lt;br /&gt;
* We can generate oxygenated amorphous carbon structures using a CO GAP with XPS prediction using modified GCMC and a “Molecular Augmented Dynamics” method.&lt;br /&gt;
* We can use ''multiple experimental observables''.&lt;br /&gt;
* '''Finding structures which match experimental data allows us to understand specific experimental results.'''&lt;br /&gt;
* Deconvolve experimental XPS exactly.&lt;br /&gt;
* All of this is implemented in the ''TurboGAP'' code.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;references&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
= References =&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;citeproc_bib_item_1&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;Bartók, Albert P., Risi Kondor, and Gábor Csányi. 2013. “On Representing Chemical Environments.” ''Physical Review B'' 87 (18): 184115. https://doi.org/10.1103/PhysRevB.87.184115.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;citeproc_bib_item_2&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;Bartók, Albert P., Mike C. Payne, Risi Kondor, and Gábor Csányi. 2010. “Gaussian Approximation Potentials: The Accuracy of Quantum Mechanics, without the Electrons.” ''Physical Review Letters'' 104 (13): 136403. https://doi.org/10.1103/PhysRevLett.104.136403.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;citeproc_bib_item_3&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;Caro, Miguel A. 2019. “Optimizing Many-Body Atomic Descriptors for Enhanced Computational Performance of Machine Learning Based Interatomic Potentials.” ''Physical Review B'' 100 (2): 024112. https://doi.org/10.1103/PhysRevB.100.024112.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;citeproc_bib_item_4&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;Deringer, Volker L., Albert P. Bartók, Noam Bernstein, David M. Wilkins, Michele Ceriotti, and Gábor Csányi. 2021. “Gaussian Process Regression for Materials and Molecules.” ''Chemical Reviews'' 121 (16): 10073–141. https://doi.org/10.1021/acs.chemrev.1c00022.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;citeproc_bib_item_5&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;El-Machachi, Zakariya, Damyan Frantzov, A. Nijamudheen, Tigany Zarrouk, Miguel A. Caro, and Volker L. Deringer. 2024. “Accelerated First-Principles Exploration of Structure and Reactivity in Graphene Oxide.” arXiv. https://doi.org/10.48550/arXiv.2405.14814.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;citeproc_bib_item_6&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;Golze, Dorothea, Markus Hirvensalo, Patricia Hernández-León, Anja Aarva, Jarkko Etula, Toma Susi, Patrick Rinke, Tomi Laurila, and Miguel A. Caro. 2022. “Accurate Computational Prediction of Core-Electron Binding Energies in Carbon-Based Materials: A Machine-Learning Model Combining Density-Functional Theory and GW.” ''Chemistry of Materials'' 34 (14): 6240–54. https://doi.org/10.1021/acs.chemmater.1c04279.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;citeproc_bib_item_7&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;Muhli, Heikki, Xi Chen, Albert P. Bartók, Patricia Hernández-León, Gábor Csányi, Tapio Ala-Nissila, and Miguel A. Caro. 2021. “Machine Learning Force Fields Based on Local Parametrization of Dispersion Interactions: Application to the Phase Diagram of \&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathrm\\\C\\\\\_\60\\&amp;lt;/math&amp;gt;.” ''Physical Review B'' 104 (5): 054106. https://doi.org/10.1103/PhysRevB.104.054106.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;citeproc_bib_item_8&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;Opletal, George, Timothy C. Petersen, Amanda S. Barnard, and Salvy P. Russo. 2017. “On Reverse Monte Carlo Constraints and Model Reproduction.” ''Journal of Computational Chemistry'' 38 (17): 1547–51. https://doi.org/10.1002/jcc.24799.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;citeproc_bib_item_9&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;Santini, Claudia A., Abu Sebastian, Chiara Marchiori, Vara Prasad Jonnalagadda, Laurent Dellmann, Wabe W. Koelmans, Marta D. Rossell, Christophe P. Rossel, and Evangelos Eleftheriou. 2015. “Oxygenated Amorphous Carbon for Resistive Memory Applications.” ''Nature Communications'' 6 (1): 8600. https://doi.org/10.1038/ncomms9600.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;citeproc_bib_item_10&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;Wang, Yanzhou, Zheyong Fan, Ping Qian, Tapio Ala-Nissila, and Miguel A. Caro. 2022. “Structure and Pore Size Distribution in Nanoporous Carbon.” ''Chemistry of Materials'' 34 (2): 617–28. https://doi.org/10.1021/acs.chemmater.1c03279.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;citeproc_bib_item_11&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;Zarrouk, Tigany, Rina Ibragimova, Albert P. Bartók, and Miguel A. Caro. 2024. “Experiment-Driven Atomistic Materials Modeling: A Case Study Combining X-Ray Photoelectron Spectroscopy and Machine Learning Potentials to Infer the Structure of Oxygen-Rich Amorphous Carbon.” ''Journal of the American Chemical Society'' 146 (21): 14645–59. https://doi.org/10.1021/jacs.4c01897.&lt;/div&gt;</summary>
		<author><name>Tigany Zarrouk</name></author>
		
	</entry>
	<entry>
		<id>https://turbogap.fi/wiki/index.php?title=XPS-optimized_oxygenated_amorphous_carbon&amp;diff=646</id>
		<title>XPS-optimized oxygenated amorphous carbon</title>
		<link rel="alternate" type="text/html" href="https://turbogap.fi/wiki/index.php?title=XPS-optimized_oxygenated_amorphous_carbon&amp;diff=646"/>
		<updated>2024-06-18T19:41:04Z</updated>

		<summary type="html">&lt;p&gt;Tigany Zarrouk: /* Motivation for structural inference */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
&amp;lt;span id=&amp;quot;what-is-turbogap&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
= What is ''TurboGAP'' ? =&lt;br /&gt;
&lt;br /&gt;
* ''TurboGAP'' is a &amp;lt;code&amp;gt;Fortran&amp;lt;/code&amp;gt; atomistic code which uses &amp;lt;u&amp;gt;Gaussian Approximation Potentials&amp;lt;/u&amp;gt; (GAPs).&lt;br /&gt;
* Its specialty are ''SOAP turbo'' descriptors: faster and more accurate than SOAP (Smooth Overlap of Atomic Positions).&lt;br /&gt;
* It's (probably!) the fastest SOAP prediction code, which will be made even faster with ''GPU acceleration'' (ongoing with CSC).&lt;br /&gt;
&lt;br /&gt;
[[File:images/Turbogap_logo.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* Through GAP/SOAP predictions, one can perform simulations with ''ab-initio'' accuracy '''at scale'''&lt;br /&gt;
** Molecular Dynamics&lt;br /&gt;
** Grand-Canonical Monte-Carlo simulations&lt;br /&gt;
** Electronic-stopping and spatially-correlated Langevin Dynamics (in-development).&lt;br /&gt;
** '''Prediction/optimization of experimental observables''' (''e.g.'' X-Ray photoelectron spectra ([[#citeproc_bib_item_6|Golze et al. 2022]]; [[#citeproc_bib_item_11|Zarrouk et al. 2024]]), X-ray/Neutron Diffraction and more to come!).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;motivation-for-structural-inference&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
= Motivation for structural inference =&lt;br /&gt;
&lt;br /&gt;
* We typically want to &amp;lt;u&amp;gt;predict structures&amp;lt;/u&amp;gt;, to make sense of experimental data.&lt;br /&gt;
* We usually pray structures have &amp;lt;u&amp;gt;experimental agreement&amp;lt;/u&amp;gt; (a “bottom-up” approach).&lt;br /&gt;
* What if we can &amp;lt;u&amp;gt;promote agreement&amp;lt;/u&amp;gt; with experimental data?&lt;br /&gt;
* ''Reverse Monte-Carlo'' techniques match experimental data to atomic structure (“top-down” approach).&lt;br /&gt;
** Downsides: “By-hand” constraints&lt;br /&gt;
** Simple experimental observables.&lt;br /&gt;
** Unphysical structures/artifacts ([[#citeproc_bib_item_8|Opletal et al. 2017]])&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Need efficient structure search to find '''agreement''' with '''experimental''' data ''and'' '''ab-inito''' data.&lt;br /&gt;
&lt;br /&gt;
# With &amp;lt;u&amp;gt;CO GAP + Core electron binding energy SOAP&amp;lt;/u&amp;gt; model we will perform '''modified (Grand-canonical) Monte-Carlo''' to produce ''experimentally consistent, low energy structures'' of oxygenated amorphous carbon.&lt;br /&gt;
# I will further show preliminary work on *“Molecular Augmented Dynamics”*: generate forces from experimental deviation, to match experimental spectra via MD.&lt;br /&gt;
&lt;br /&gt;
[[File:deconvolution_comparison_fill_-3_new.png | 400px]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;theory-and-methods&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Theory and Methods =&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;gaussian-approximation-potentials-gap&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
== Gaussian Approximation Potentials (GAP) ==&lt;br /&gt;
&lt;br /&gt;
([[#citeproc_bib_item_2|Bartók et al. 2010]]; [[#citeproc_bib_item_1|Bartók, Kondor, and Csányi 2013]]; [[#citeproc_bib_item_4|Deringer et al. 2021]])&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;u&amp;gt;Assumption&amp;lt;/u&amp;gt;: Total energy is sum of '''local energies'''. &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;E_{\rm total}(\{\mathbf{r}\}) = \sum_i^{N_{\text{atoms}}} \varepsilon^i(\{r\}, \{\xi^{\text{2b}}_i\}, \{\boldsymbol{\xi}^{\text{3b}}_i\}, \boldsymbol{\xi}^{\text{mb}}_i))&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;\begin{align}&lt;br /&gt;
  \varepsilon^i ( &amp;amp;\{r\}, \{\xi^{\text{2b}}_i\}, \{\boldsymbol{\xi}^{\text{3b}}_i\}, \boldsymbol{\xi}^{\text{mb}}_i) =&lt;br /&gt;
   E^{\text{2b}}(\{\xi^{\text{2b}}_i\}) + E^{\text{3b}}(\{\boldsymbol{\xi}^{\text{3b}}_i\}) \nonumber\\&lt;br /&gt;
  &amp;amp; + E^{\text{mb}}(\boldsymbol{\xi}^{\text{mb}}_i)&lt;br /&gt;
  + \sum_{r &amp;lt; r_{\rm cut}^{\rm core}} E^{\text{core}}(r)  \nonumber&lt;br /&gt;
\end{align}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
; Local energy&lt;br /&gt;
: Sum of '''2b, 3b and many-body''' terms.&lt;br /&gt;
; Descriptor &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\xi / \boldsymbol{\xi}&amp;lt;/math&amp;gt;.&lt;br /&gt;
: ''e.g'' &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\{\xi^{\text{2b}}\} = \{r_{ij}\}&amp;lt;/math&amp;gt;, &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\{\boldsymbol{\xi}^{\text{3b}}\} = \{ [ r_{ij}, r_{ik}, r_{kj} ] \}&amp;lt;/math&amp;gt;&lt;br /&gt;
; Local environment&lt;br /&gt;
: A set of descriptors.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;using-descriptors-to-predict-quantities&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== Using descriptors to predict quantities ===&lt;br /&gt;
&lt;br /&gt;
* ''Kernel/basis functions'' &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;k_{ij}(\boldsymbol{\xi}_i, \boldsymbol{\xi}_j)&amp;lt;/math&amp;gt; measure the ''similarity between descriptors''.&lt;br /&gt;
* ''e.g'' Exponential 2b kernel: &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;k^{2b}_{ij}(\xi_i, \xi_j) \equiv k^{2b}_{ij}(r_{i}, r_{j}) = \exp( - (r_{i} - r_{j})^2/2\sigma^2 )&amp;lt;/math&amp;gt;&lt;br /&gt;
* ''Gaussian Process Regression'' (kernel matrix algebra on training set) → ''fitting coefficients'' &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\{\alpha\}&amp;lt;/math&amp;gt;, ([[#citeproc_bib_item_4|Deringer et al. 2021]])&lt;br /&gt;
* ''e.g.'' 2b model trained with &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;N_s&amp;lt;/math&amp;gt; descriptors &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\{\xi\} \in \{\xi_i, \ldots, \xi_{Ns}\}&amp;lt;/math&amp;gt;, the energy for atom with &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;M&amp;lt;/math&amp;gt; pairwise distances in local environment: &amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;E^{2b} = \sum_i^M \left(E^{2b}_0 + \delta^2\sum_j^{N_s}  \alpha_j k^{2b}_{ij}(\xi_i, \xi_j) \right) &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;soap-many-body-descriptor&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== SOAP (many-body) descriptor ===&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;u&amp;gt;SOAP descriptor&amp;lt;/u&amp;gt;: &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\boldsymbol{\xi}_i(\{\mathbf{r}\}_{ &amp;lt; r_{\rm cut}} )&amp;lt;/math&amp;gt;, represents environment of an atom ([[#citeproc_bib_item_2|Bartók et al. 2010]]).&lt;br /&gt;
* &amp;lt;u&amp;gt;Kernel&amp;lt;/u&amp;gt;: &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;k_{ij} = (\boldsymbol{\xi}_i \cdot \boldsymbol{\xi}_j)^{\zeta}&amp;lt;/math&amp;gt; measures &amp;lt;u&amp;gt;similarity of environments&amp;lt;/u&amp;gt;.&lt;br /&gt;
* &amp;lt;u&amp;gt;Fitting coefficients&amp;lt;/u&amp;gt;: &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\alpha_j&amp;lt;/math&amp;gt; result from Gaussian Process Regression.&lt;br /&gt;
* &amp;lt;u&amp;gt;Prediction&amp;lt;/u&amp;gt;: &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;E^{\rm mb}_i(\boldsymbol{\xi}_i) = E^{\rm mb}_0 + \delta^2\sum_j  \alpha_j k_{ij}&amp;lt;/math&amp;gt;&lt;br /&gt;
* For specifics of SOAP turbo, refer to Miguel's paper ([[#citeproc_bib_item_3|Caro 2019]])&lt;br /&gt;
&lt;br /&gt;
← SOAP expansion.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
← Interpolation of DFT PES ([[#citeproc_bib_item_4|Deringer et al. 2021]])&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;how-do-we-model-xps&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
== How do we model XPS? ==&lt;br /&gt;
&lt;br /&gt;
* XPS (X-ray photoelectron spectroscopy) spectra measure '''core electron binding energies'''.&lt;br /&gt;
* Core electron binding energies ''depend on atomic environment''.&lt;br /&gt;
* SOAP turbo model trained on DFT (&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\Delta\text{KS}&amp;lt;/math&amp;gt;) data with a &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;GW&amp;lt;/math&amp;gt; correction on top ([[#citeproc_bib_item_6|Golze et al. 2022]]).&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\text{CEBE} = ( \Delta KS^0_{\rm extended} + GW_{\rm carved} - \Delta \mathrm{KS}^+_{\rm carved} )&amp;lt;/math&amp;gt;&lt;br /&gt;
* Thermal and instrumental broadening accounted for by a Gaussian with &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\sigma = 0.4\text{ eV}&amp;lt;/math&amp;gt;&lt;br /&gt;
* Can analyse environments which make up spectra.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;prediction-of-local-properties&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Prediction of Local Properties ==&lt;br /&gt;
&lt;br /&gt;
* We can predict an &amp;lt;u&amp;gt;arbitrary number&amp;lt;/u&amp;gt; of ''local properties'' which use SOAP turbo descriptors using ''TurboGAP''.&lt;br /&gt;
* /One can get these for “free”/ if local property models are trained using the same descriptors as atomic energies/forces.&lt;br /&gt;
*; ''Hirshfeld volumes''&lt;br /&gt;
*: gives vdW dispersion via Tkatchenko-Scheffler. &amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; E_{\rm TS} = \sum_i \sum_{j\neq i} C_{6, ij}(v_{i}(\boldsymbol{\xi}_i), v_{j}(\boldsymbol{\xi}_j))\frac{f_{\rm damp}(r_{ij}, \ldots)}{r_{ij}^6} &amp;lt;/math&amp;gt;&lt;br /&gt;
*; ''Core-electron binding energies''&lt;br /&gt;
*: give '''X-ray Photoelectron Spectroscopy''' prediction. &amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; g_{\rm xps}(\varepsilon) = \frac{1}{M} \sum_i \exp\left( -(\varepsilon - \varepsilon_{i}(\boldsymbol{\xi}_i))^2/(2\sigma^2)  \right) &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;how-do-we-marry-experimental-data-and-gap&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
== How do we marry experimental data and GAP? ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* '''Generalized Hamiltonian within Grand-Canonical Monte-Carlo''' scheme.&lt;br /&gt;
* Vary oxygen content with chemical potential, to see motif differences.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;  \textcolor{violet}{ \mathbf{\tilde{g}}_{\rm {pred}}}(\varepsilon)  = \sum_{i} \exp\left(&lt;br /&gt;
-\frac{(\varepsilon - \textcolor{blue}{\varepsilon^{i}_{\rm&lt;br /&gt;
{pred}}(\boldsymbol{\xi}_i)})^2}{2\sigma^2}\right)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; \tilde{E} = E_{\rm GAP} + E_{\rm spectra} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; E_{\rm spectra} =  \frac{1}{2}\gamma \int \,d\varepsilon \left( \textcolor{violet}{ g_{\rm pred}(\varepsilon)} - g_{\rm exp}(\varepsilon)\right)^2&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;p&amp;gt;A simple squared difference, which is a penalty with increases with spectra dissimilarity and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\gamma&amp;lt;/math&amp;gt; is an energy scale.&amp;lt;/p&amp;gt;&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;p&amp;gt;We can do not just XPS but also X-ray/neutron diffraction and pair distribution functions.&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;[[File:xps_gcmc_scheme.png]]&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;/ul&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* We use the standard acceptance criteria for adding/removing/moving a particle&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; \mathrm{acc}(N \rightarrow N+1) = \mathrm{min}\left[1,&lt;br /&gt;
\frac{V}{\lambda^3 (N+1)} \exp\left\{ - \frac{\tilde{E}(N+1) -&lt;br /&gt;
\tilde{E}(N) - \mu}{k_BT} \right\}     \right] &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; \mathrm{acc}(N \rightarrow N-1) = \mathrm{min}\left[1,&lt;br /&gt;
\frac{\lambda^3 N}{V} \exp\left\{ -\frac{\tilde{E}(N-1) -&lt;br /&gt;
\tilde{E}(N) + \mu}{k_BT} \right\}     \right] &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; \mathrm{acc}_{\rm move} = \mathrm{min }\left[ 1, \exp\left\{ -&lt;br /&gt;
  \frac{\tilde{E}(\mathrm{new}) - \tilde{E}(\mathrm{old})}{k_BT} \right\} \right]&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;usage&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
= Usage =&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;installing-turbogap&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
== Installing ''TurboGAP'' ==&lt;br /&gt;
&lt;br /&gt;
We can install the ''TurboGAP'' code, found here https://github.com/mcaroba/turbogap through ''recursively cloning'' the main branch&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;git clone --recursive https://github.com/mcaroba/turbogap.git&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
Then we edit this line in the &amp;lt;code&amp;gt;Makefile&amp;lt;/code&amp;gt; to match our system architecture.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;include makefiles/Makefile.Ubuntu_gfortran_mpi&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Then, we make&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;make&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
and then export the path in &amp;lt;code&amp;gt;.bashrc&amp;lt;/code&amp;gt; file&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;export PATH=&amp;quot;~/turbogap/bin:$PATH&amp;quot;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;span id=&amp;quot;what-you-need-for-a-calculation&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
== What you need for a calculation ==&lt;br /&gt;
&lt;br /&gt;
; &amp;lt;code&amp;gt;gap_files/&amp;lt;/code&amp;gt; directory&lt;br /&gt;
: The directory which contains your &amp;lt;code&amp;gt;*.gap&amp;lt;/code&amp;gt;, with alphas (fitting coefficients) and sparse set descriptor files.&lt;br /&gt;
;* Potentials are available from ''TurboGAP'' wiki https://turbogap.fi/wiki/index.php/Potentials&lt;br /&gt;
;* Conversion script from &amp;lt;code&amp;gt;gap_fit .xml&amp;lt;/code&amp;gt; to &amp;lt;code&amp;gt;.gap&amp;lt;/code&amp;gt; can be used &amp;lt;code&amp;gt;turbogap/tools/make_gap_files.py&amp;lt;/code&amp;gt;&lt;br /&gt;
; &amp;lt;code&amp;gt;input&amp;lt;/code&amp;gt; file&lt;br /&gt;
: The file which tells the code what to do&lt;br /&gt;
; &amp;lt;code&amp;gt;*.xyz&amp;lt;/code&amp;gt;&lt;br /&gt;
: An extended xyz format file which contains positions/lattice/velocity information.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;adding-a-local-property-model-for-cebe-prediction&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== Adding a local property model for CEBE prediction ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;  gap_beg soap_turbo&lt;br /&gt;
  n_species = 2&lt;br /&gt;
  species = C O&lt;br /&gt;
  central_species = 1&lt;br /&gt;
... some params ...&lt;br /&gt;
  zeta = 4&lt;br /&gt;
  delta = 0.1&lt;br /&gt;
  desc_sparse = &amp;quot;gap_files/CO.xml.sparseX.GAP_2022_5_19_180_7_17_31_41410&amp;quot;&lt;br /&gt;
  alphas_sparse = &amp;quot;gap_files/alphas_soap_turbo_1.dat&amp;quot;&lt;br /&gt;
  compress_mode = &amp;quot;trivial&amp;quot;&lt;br /&gt;
  has_local_properties = .true.&lt;br /&gt;
  n_local_properties = 1&lt;br /&gt;
  local_property_qs = 'gap_files/core_electron_be.xml.sparseX.GAP_2024_1_26_120_18_36_33_6091'&lt;br /&gt;
  local_property_alphas = 'gap_files/alphas_core_electron_be_1.dat'&lt;br /&gt;
  local_property_labels = 'core_electron_be'&lt;br /&gt;
  local_property_zetas = 2&lt;br /&gt;
  local_property_deltas = 1.0&lt;br /&gt;
  local_property_v0s = 290.0&lt;br /&gt;
  gap_end&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;span id=&amp;quot;conversion-of-gap_fit-.xml-files-to-.gap-format&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== Conversion of &amp;lt;code&amp;gt;gap_fit&amp;lt;/code&amp;gt; &amp;lt;code&amp;gt;*.xml&amp;lt;/code&amp;gt; files to &amp;lt;code&amp;gt;*.gap&amp;lt;/code&amp;gt; format ===&lt;br /&gt;
&lt;br /&gt;
* Then we convert the &amp;lt;code&amp;gt;*.xml&amp;lt;/code&amp;gt; files which result from &amp;lt;code&amp;gt;gap_fit&amp;lt;/code&amp;gt; into the required format for ''TurboGAP''.&lt;br /&gt;
* This is done using the convenience script in &amp;lt;code&amp;gt;turbogap/tools/make_gap_files.py&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;python3 make_gap_files.py {gap_file.xml} {gap_file.gap} {N_local_prop.} \&lt;br /&gt;
              {local_prop1.xml} {local_prop_label1} \&lt;br /&gt;
              {local_prop2.xml} {local_prop_label2}...&lt;br /&gt;
# e.g. let's build a carbon oxygen GAP&lt;br /&gt;
# with core electron binding energy prediction capability.&lt;br /&gt;
python3 make_gap_files.py CO.xml CO.gap 1 \&lt;br /&gt;
        core_electron_be_co.xml core_electron_be&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
* This creates a directory &amp;lt;code&amp;gt;gap_files/&amp;lt;/code&amp;gt; which has&lt;br /&gt;
*# &amp;lt;code&amp;gt;alphas_{descriptor}.dat&amp;lt;/code&amp;gt; which are fitting coefficients for a particular descriptor&lt;br /&gt;
*# &amp;lt;code&amp;gt;qs_{descriptor}.dat&amp;lt;/code&amp;gt; which are the '''sparse set''' descriptors, used for prediction.&lt;br /&gt;
*# &amp;lt;code&amp;gt;alphas_{local_property}.dat&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;qs_{local_property}.dat&amp;lt;/code&amp;gt; for local property prediction.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;running-the-tutorial&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
== Running the Tutorial ==&lt;br /&gt;
&lt;br /&gt;
* Navigate to &amp;lt;code&amp;gt;turbogap/tutorials/xps_optimizaton&amp;lt;/code&amp;gt;&lt;br /&gt;
* Run &amp;lt;code&amp;gt;bash run.sh {calc_type}&amp;lt;/code&amp;gt; where &amp;lt;code&amp;gt;{calc_type}&amp;lt;/code&amp;gt; is either:&lt;br /&gt;
** &amp;lt;code&amp;gt;prediction&amp;lt;/code&amp;gt;&lt;br /&gt;
** &amp;lt;code&amp;gt;standard_gcmc&amp;lt;/code&amp;gt;&lt;br /&gt;
** &amp;lt;code&amp;gt;xps_optimization_gcmc&amp;lt;/code&amp;gt;&lt;br /&gt;
* Note that these simulations have a high chemical potential and (have high &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\gamma&amp;lt;/math&amp;gt; factors), these are just to give a result in a reasonable amount of time. Take care with real simulations.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;core-electron-binding-energy-prediction&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
== Core electron binding energy prediction ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;[mpirun -np N] turbogap predict&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
* We have in our &amp;lt;code&amp;gt;input&amp;lt;/code&amp;gt; file&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre class=&amp;quot;conf&amp;quot;&amp;gt;! Species-specific info&lt;br /&gt;
atoms_file = 'atoms.xyz'&lt;br /&gt;
pot_file = 'gap_files/CO.gap'&lt;br /&gt;
n_species = 2&lt;br /&gt;
species = C O&lt;br /&gt;
masses = 12.01 15.99&lt;br /&gt;
e0 = -.16138053 0.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Output:&lt;br /&gt;
&lt;br /&gt;
; &amp;lt;code&amp;gt;trajectory_out.xyz&amp;lt;/code&amp;gt;&lt;br /&gt;
: which contains atomic positions, local energy and local property arrays for each structure.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt; 512&lt;br /&gt;
Properties=species:S:1:pos:R:3:forces:R:3:local_energy:R:1:core_electron_be:R:1 \&lt;br /&gt;
   Lattice=&amp;quot;...&amp;quot; energy=-4321.582604 energy_soap=-4114.77018429  energy_2b=-124.73820332 energy_3b=0.55261463 \&lt;br /&gt;
   energy_core_pot=0.00000000 energy_vdw=0.00000000 energy_exp=0.00000000 energy_xps=0.00000000 \&lt;br /&gt;
   virial=&amp;quot;...&amp;quot; stress=&amp;quot;...&amp;quot; volume=5372.640346&lt;br /&gt;
   C              4.39625950       7.79414272      11.91703476     \&lt;br /&gt;
                  -0.00176074      -0.00403026       0.00040104    \&lt;br /&gt;
                  -8.32055957 \ # Local energy prediction&lt;br /&gt;
                  283.83841418  # CEBE Prediction&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Withiout specifying Exp. data, Turbogap does not predict the spectra.&lt;br /&gt;
* XPS spectra can simply be calculated from &amp;lt;code&amp;gt;core_electron_be&amp;lt;/code&amp;gt; in &amp;lt;code&amp;gt;trajectory_out.xyz&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;grand-canonical-monte-carlo&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
== (Grand-Canonical) Monte-Carlo ==&lt;br /&gt;
&lt;br /&gt;
* We use &amp;lt;code&amp;gt;mc&amp;lt;/code&amp;gt; mode&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;[mpirun -np N] turbogap mc&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
* ''e.g'' For a &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mu V T&amp;lt;/math&amp;gt; simulation of system in oxygen environment&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre class=&amp;quot;conf&amp;quot;&amp;gt;! Monte-carlo options&lt;br /&gt;
mc_nsteps = 1000                         # Number of Monte-Carlo Steps&lt;br /&gt;
n_mc_types = 3                           # Number of MC move types&lt;br /&gt;
mc_types = 'move' 'insertion' 'removal'  # MC move types (move/insertion/removal/volume/swap/md)&lt;br /&gt;
mc_move_max = 0.5                        # Maximum distance for MC displacement (&amp;amp;quot;move&amp;amp;quot;) type moves&lt;br /&gt;
&lt;br /&gt;
! - GCMC Options&lt;br /&gt;
n_mc_mu = 1              # Number of chemical potentials to add&lt;br /&gt;
mc_mu = 0                # Chemical potential(s) [eV]&lt;br /&gt;
mc_species = 'O'         # GCMC species types&lt;br /&gt;
mc_min_dist = 0.1        # GCMC minimum insertion distance&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Output:&lt;br /&gt;
&lt;br /&gt;
; &amp;lt;code&amp;gt;mc.log&amp;lt;/code&amp;gt;&lt;br /&gt;
: &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;# mc_istep  mc_move  accepted  E_trial              E_current             E_exp_trial          E_exp_current  N_tot_trial  N_mc_species_trial&lt;br /&gt;
       1       move    F       -4321.10376531       -4321.58260476         272.97693282         272.83692252      512  O        0&lt;br /&gt;
       2       move    F       -4321.10017027       -4321.58260476         272.68730901         272.83692252      512  O        0&lt;br /&gt;
       3  insertion    F       -4319.14082561       -4321.58260476         269.49191203         272.83692252      513  O        1&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; &amp;lt;code&amp;gt;mc_all.xyz&amp;lt;/code&amp;gt;&lt;br /&gt;
: xyz file written to every &amp;lt;code&amp;gt;write_xyz = N&amp;lt;/code&amp;gt; steps.&lt;br /&gt;
; &amp;lt;code&amp;gt;mc_current.xyz&amp;lt;/code&amp;gt;&lt;br /&gt;
: xyz file saving current accepted config written to every &amp;lt;code&amp;gt;write_xyz = N&amp;lt;/code&amp;gt; steps.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* If we run &amp;lt;code&amp;gt;bash run.sh standard_gcmc&amp;lt;/code&amp;gt; (may take a few minutes), we can see a prediction of the XPS with oxygen content&lt;br /&gt;
&lt;br /&gt;
[[File:standard_gcmc.png]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;experimental-observable-optimization&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
== Experimental Observable Optimization ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;[mpirun -np N] turbogap mc/md&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
* We can specify experimental observables to predict and optimize them using MC or MD. &amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; E_{\rm spectra} = \frac{1}{2} \gamma \int \,d\varepsilon (g_{\rm pred}(\varepsilon) - g_{\rm exp}(\varepsilon))^2  &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre class=&amp;quot;conf&amp;quot;&amp;gt;! Experimental data options&lt;br /&gt;
n_exp = 1                                  # Number of experimental observables&lt;br /&gt;
exp_labels = 'xps'                         # Experimental observable types (xps/xrd/nd/pdf)&lt;br /&gt;
exp_data_files = 'xps_spectra_interp.dat'  # Experimental data files (Note: the range of resulting XPS prediction will be the same as the experimental range.)&lt;br /&gt;
exp_n_samples = 501                        # Number of interpolations samples over the experimental range.&lt;br /&gt;
exp_energy_scales = 100.0                    # Energy scale (gamma) [eV]&lt;br /&gt;
&lt;br /&gt;
# XPS smearing&lt;br /&gt;
xps_sigma = 0.4&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Output:&lt;br /&gt;
&lt;br /&gt;
; &amp;lt;code&amp;gt;xps_prediction.dat&amp;lt;/code&amp;gt;&lt;br /&gt;
: Data file written every &amp;lt;code&amp;gt;write_xyz = N&amp;lt;/code&amp;gt; steps. Separate predictions separated by blank lines.&lt;br /&gt;
; &amp;lt;code&amp;gt;xps_exp.dat&amp;lt;/code&amp;gt;&lt;br /&gt;
: The experimental data fed into ''TurboGAP''.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* If we run &amp;lt;code&amp;gt;bash run.sh xps_optimization_gcmc&amp;lt;/code&amp;gt; (may take a few minutes), we can see a prediction of the XPS with oxygen content&lt;br /&gt;
&lt;br /&gt;
[[File:xps_optimization_gcmc.png]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;multiple-observables&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
== Multiple Observables ==&lt;br /&gt;
&lt;br /&gt;
* This is not in the tutorial files, but ''TurboGAP'' allows for we can optimization multiple observables.&lt;br /&gt;
** X-ray diffraction&lt;br /&gt;
** Neutron diffraction&lt;br /&gt;
** Pair distribution function&lt;br /&gt;
** XPS&lt;br /&gt;
* Here we show a fictitious example of XPS and XRD optimization.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre class=&amp;quot;conf&amp;quot;&amp;gt;# Partial PDFs needed for XRD calculation&lt;br /&gt;
pair_distribution_n_samples = 301&lt;br /&gt;
r_range_min = 0.1&lt;br /&gt;
r_range_max = 13.5&lt;br /&gt;
pair_distribution_rcut = 14.1&lt;br /&gt;
&lt;br /&gt;
do_xrd = .true.&lt;br /&gt;
&lt;br /&gt;
# Experimental Data Specification&lt;br /&gt;
n_exp = 2                  # Number of Exp. observables&lt;br /&gt;
exp_labels = 'xps' 'xrd'   # Exp. observable type (xps/xrd/nd/pdf)&lt;br /&gt;
exp_data_files = 'xps_spectra_experiment.dat' 'xrd_CO_experiment.dat'&lt;br /&gt;
exp_n_samples = 301 301 # Number of samples for the experimental data&lt;br /&gt;
exp_energy_scales = 10.0 10.0  # The &amp;amp;quot;gamma&amp;amp;quot; term for each observable&lt;br /&gt;
&lt;br /&gt;
# If using monte-carlo, the experimental energies are added directly to the local energy&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;span id=&amp;quot;applications&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
= Applications =&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;experimental-observable-predictionoptimization&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
== Experimental Observable prediction/optimization ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;deconvolution-analysis&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== Deconvolution analysis ===&lt;br /&gt;
&lt;br /&gt;
* Use subgraph isomorphisms of bonding networks to discern motifs present.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:exp_xps_with_background_high.png]]&lt;br /&gt;
&lt;br /&gt;
↑ Experimental XPS deconvolution ([[#citeproc_bib_item_9|Santini et al. 2015]])&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:deconvolution_comparison_fill_-3_new.png]]&lt;br /&gt;
&lt;br /&gt;
↑ Our XPS deconvolution ([[#citeproc_bib_item_9|Santini et al. 2015]])&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:xps_shifts_miguel_first.png]]&lt;br /&gt;
&lt;br /&gt;
[[File:xps_shifts_miguel_last.png]]&lt;br /&gt;
&lt;br /&gt;
We see with oxygen content that sp2 motifs are shifted significantly, even past the sp3 reference. This is why the experimental deconvolution did not give what we expect: sp2 carbon that composes the primary XPS peak. &lt;br /&gt;
&amp;lt;span id=&amp;quot;summary&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Summary =&lt;br /&gt;
&lt;br /&gt;
* Machine-learned potentials can be combined with experimental models to give structures which are consistent with both ''ab-inito'' and experimental data.&lt;br /&gt;
* We can generate oxygenated amorphous carbon structures using a CO GAP with XPS prediction using modified GCMC and a “Molecular Augmented Dynamics” method.&lt;br /&gt;
* We can use ''multiple experimental observables''.&lt;br /&gt;
* '''Finding structures which match experimental data allows us to understand specific experimental results.'''&lt;br /&gt;
* Deconvolve experimental XPS exactly.&lt;br /&gt;
* All of this is implemented in the ''TurboGAP'' code.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;references&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
= References =&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;citeproc_bib_item_1&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;Bartók, Albert P., Risi Kondor, and Gábor Csányi. 2013. “On Representing Chemical Environments.” ''Physical Review B'' 87 (18): 184115. https://doi.org/10.1103/PhysRevB.87.184115.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;citeproc_bib_item_2&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;Bartók, Albert P., Mike C. Payne, Risi Kondor, and Gábor Csányi. 2010. “Gaussian Approximation Potentials: The Accuracy of Quantum Mechanics, without the Electrons.” ''Physical Review Letters'' 104 (13): 136403. https://doi.org/10.1103/PhysRevLett.104.136403.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;citeproc_bib_item_3&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;Caro, Miguel A. 2019. “Optimizing Many-Body Atomic Descriptors for Enhanced Computational Performance of Machine Learning Based Interatomic Potentials.” ''Physical Review B'' 100 (2): 024112. https://doi.org/10.1103/PhysRevB.100.024112.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;citeproc_bib_item_4&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;Deringer, Volker L., Albert P. Bartók, Noam Bernstein, David M. Wilkins, Michele Ceriotti, and Gábor Csányi. 2021. “Gaussian Process Regression for Materials and Molecules.” ''Chemical Reviews'' 121 (16): 10073–141. https://doi.org/10.1021/acs.chemrev.1c00022.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;citeproc_bib_item_5&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;El-Machachi, Zakariya, Damyan Frantzov, A. Nijamudheen, Tigany Zarrouk, Miguel A. Caro, and Volker L. Deringer. 2024. “Accelerated First-Principles Exploration of Structure and Reactivity in Graphene Oxide.” arXiv. https://doi.org/10.48550/arXiv.2405.14814.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;citeproc_bib_item_6&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;Golze, Dorothea, Markus Hirvensalo, Patricia Hernández-León, Anja Aarva, Jarkko Etula, Toma Susi, Patrick Rinke, Tomi Laurila, and Miguel A. Caro. 2022. “Accurate Computational Prediction of Core-Electron Binding Energies in Carbon-Based Materials: A Machine-Learning Model Combining Density-Functional Theory and GW.” ''Chemistry of Materials'' 34 (14): 6240–54. https://doi.org/10.1021/acs.chemmater.1c04279.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;citeproc_bib_item_7&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;Muhli, Heikki, Xi Chen, Albert P. Bartók, Patricia Hernández-León, Gábor Csányi, Tapio Ala-Nissila, and Miguel A. Caro. 2021. “Machine Learning Force Fields Based on Local Parametrization of Dispersion Interactions: Application to the Phase Diagram of \&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathrm\\\C\\\\\_\60\\&amp;lt;/math&amp;gt;.” ''Physical Review B'' 104 (5): 054106. https://doi.org/10.1103/PhysRevB.104.054106.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;citeproc_bib_item_8&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;Opletal, George, Timothy C. Petersen, Amanda S. Barnard, and Salvy P. Russo. 2017. “On Reverse Monte Carlo Constraints and Model Reproduction.” ''Journal of Computational Chemistry'' 38 (17): 1547–51. https://doi.org/10.1002/jcc.24799.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;citeproc_bib_item_9&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;Santini, Claudia A., Abu Sebastian, Chiara Marchiori, Vara Prasad Jonnalagadda, Laurent Dellmann, Wabe W. Koelmans, Marta D. Rossell, Christophe P. Rossel, and Evangelos Eleftheriou. 2015. “Oxygenated Amorphous Carbon for Resistive Memory Applications.” ''Nature Communications'' 6 (1): 8600. https://doi.org/10.1038/ncomms9600.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;citeproc_bib_item_10&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;Wang, Yanzhou, Zheyong Fan, Ping Qian, Tapio Ala-Nissila, and Miguel A. Caro. 2022. “Structure and Pore Size Distribution in Nanoporous Carbon.” ''Chemistry of Materials'' 34 (2): 617–28. https://doi.org/10.1021/acs.chemmater.1c03279.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;citeproc_bib_item_11&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;Zarrouk, Tigany, Rina Ibragimova, Albert P. Bartók, and Miguel A. Caro. 2024. “Experiment-Driven Atomistic Materials Modeling: A Case Study Combining X-Ray Photoelectron Spectroscopy and Machine Learning Potentials to Infer the Structure of Oxygen-Rich Amorphous Carbon.” ''Journal of the American Chemical Society'' 146 (21): 14645–59. https://doi.org/10.1021/jacs.4c01897.&lt;/div&gt;</summary>
		<author><name>Tigany Zarrouk</name></author>
		
	</entry>
	<entry>
		<id>https://turbogap.fi/wiki/index.php?title=XPS-optimized_oxygenated_amorphous_carbon&amp;diff=645</id>
		<title>XPS-optimized oxygenated amorphous carbon</title>
		<link rel="alternate" type="text/html" href="https://turbogap.fi/wiki/index.php?title=XPS-optimized_oxygenated_amorphous_carbon&amp;diff=645"/>
		<updated>2024-06-18T19:39:08Z</updated>

		<summary type="html">&lt;p&gt;Tigany Zarrouk: /* How do we model XPS? */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
&amp;lt;span id=&amp;quot;what-is-turbogap&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
= What is ''TurboGAP'' ? =&lt;br /&gt;
&lt;br /&gt;
* ''TurboGAP'' is a &amp;lt;code&amp;gt;Fortran&amp;lt;/code&amp;gt; atomistic code which uses &amp;lt;u&amp;gt;Gaussian Approximation Potentials&amp;lt;/u&amp;gt; (GAPs).&lt;br /&gt;
* Its specialty are ''SOAP turbo'' descriptors: faster and more accurate than SOAP (Smooth Overlap of Atomic Positions).&lt;br /&gt;
* It's (probably!) the fastest SOAP prediction code, which will be made even faster with ''GPU acceleration'' (ongoing with CSC).&lt;br /&gt;
&lt;br /&gt;
[[File:images/Turbogap_logo.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* Through GAP/SOAP predictions, one can perform simulations with ''ab-initio'' accuracy '''at scale'''&lt;br /&gt;
** Molecular Dynamics&lt;br /&gt;
** Grand-Canonical Monte-Carlo simulations&lt;br /&gt;
** Electronic-stopping and spatially-correlated Langevin Dynamics (in-development).&lt;br /&gt;
** '''Prediction/optimization of experimental observables''' (''e.g.'' X-Ray photoelectron spectra ([[#citeproc_bib_item_6|Golze et al. 2022]]; [[#citeproc_bib_item_11|Zarrouk et al. 2024]]), X-ray/Neutron Diffraction and more to come!).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;motivation-for-structural-inference&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
= Motivation for structural inference =&lt;br /&gt;
&lt;br /&gt;
* We typically want to &amp;lt;u&amp;gt;predict structures&amp;lt;/u&amp;gt;, to make sense of experimental data.&lt;br /&gt;
* We usually pray structures have &amp;lt;u&amp;gt;experimental agreement&amp;lt;/u&amp;gt; (a “bottom-up” approach).&lt;br /&gt;
* What if we can &amp;lt;u&amp;gt;promote agreement&amp;lt;/u&amp;gt; with experimental data?&lt;br /&gt;
* ''Reverse Monte-Carlo'' techniques match experimental data to atomic structure (“top-down” approach).&lt;br /&gt;
** Downsides: “By-hand” constraints&lt;br /&gt;
** Simple experimental observables.&lt;br /&gt;
** Unphysical structures/artifacts ([[#citeproc_bib_item_8|Opletal et al. 2017]])&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Need efficient structure search to find '''agreement''' with '''experimental''' data ''and'' '''ab-inito''' data.&lt;br /&gt;
&lt;br /&gt;
# With &amp;lt;u&amp;gt;CO GAP + Core electron binding energy SOAP&amp;lt;/u&amp;gt; model we will perform '''modified (Grand-canonical) Monte-Carlo''' to produce ''experimentally consistent, low energy structures'' of oxygenated amorphous carbon.&lt;br /&gt;
# I will further show preliminary work on *“Molecular Augmented Dynamics”*: generate forces from experimental deviation, to match experimental spectra via MD.&lt;br /&gt;
&lt;br /&gt;
[[File:deconvolution_comparison_fill_-3_new.png]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;theory-and-methods&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
= Theory and Methods =&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;gaussian-approximation-potentials-gap&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
== Gaussian Approximation Potentials (GAP) ==&lt;br /&gt;
&lt;br /&gt;
([[#citeproc_bib_item_2|Bartók et al. 2010]]; [[#citeproc_bib_item_1|Bartók, Kondor, and Csányi 2013]]; [[#citeproc_bib_item_4|Deringer et al. 2021]])&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;u&amp;gt;Assumption&amp;lt;/u&amp;gt;: Total energy is sum of '''local energies'''. &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;E_{\rm total}(\{\mathbf{r}\}) = \sum_i^{N_{\text{atoms}}} \varepsilon^i(\{r\}, \{\xi^{\text{2b}}_i\}, \{\boldsymbol{\xi}^{\text{3b}}_i\}, \boldsymbol{\xi}^{\text{mb}}_i))&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;\begin{align}&lt;br /&gt;
  \varepsilon^i ( &amp;amp;\{r\}, \{\xi^{\text{2b}}_i\}, \{\boldsymbol{\xi}^{\text{3b}}_i\}, \boldsymbol{\xi}^{\text{mb}}_i) =&lt;br /&gt;
   E^{\text{2b}}(\{\xi^{\text{2b}}_i\}) + E^{\text{3b}}(\{\boldsymbol{\xi}^{\text{3b}}_i\}) \nonumber\\&lt;br /&gt;
  &amp;amp; + E^{\text{mb}}(\boldsymbol{\xi}^{\text{mb}}_i)&lt;br /&gt;
  + \sum_{r &amp;lt; r_{\rm cut}^{\rm core}} E^{\text{core}}(r)  \nonumber&lt;br /&gt;
\end{align}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
; Local energy&lt;br /&gt;
: Sum of '''2b, 3b and many-body''' terms.&lt;br /&gt;
; Descriptor &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\xi / \boldsymbol{\xi}&amp;lt;/math&amp;gt;.&lt;br /&gt;
: ''e.g'' &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\{\xi^{\text{2b}}\} = \{r_{ij}\}&amp;lt;/math&amp;gt;, &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\{\boldsymbol{\xi}^{\text{3b}}\} = \{ [ r_{ij}, r_{ik}, r_{kj} ] \}&amp;lt;/math&amp;gt;&lt;br /&gt;
; Local environment&lt;br /&gt;
: A set of descriptors.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;using-descriptors-to-predict-quantities&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== Using descriptors to predict quantities ===&lt;br /&gt;
&lt;br /&gt;
* ''Kernel/basis functions'' &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;k_{ij}(\boldsymbol{\xi}_i, \boldsymbol{\xi}_j)&amp;lt;/math&amp;gt; measure the ''similarity between descriptors''.&lt;br /&gt;
* ''e.g'' Exponential 2b kernel: &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;k^{2b}_{ij}(\xi_i, \xi_j) \equiv k^{2b}_{ij}(r_{i}, r_{j}) = \exp( - (r_{i} - r_{j})^2/2\sigma^2 )&amp;lt;/math&amp;gt;&lt;br /&gt;
* ''Gaussian Process Regression'' (kernel matrix algebra on training set) → ''fitting coefficients'' &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\{\alpha\}&amp;lt;/math&amp;gt;, ([[#citeproc_bib_item_4|Deringer et al. 2021]])&lt;br /&gt;
* ''e.g.'' 2b model trained with &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;N_s&amp;lt;/math&amp;gt; descriptors &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\{\xi\} \in \{\xi_i, \ldots, \xi_{Ns}\}&amp;lt;/math&amp;gt;, the energy for atom with &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;M&amp;lt;/math&amp;gt; pairwise distances in local environment: &amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;E^{2b} = \sum_i^M \left(E^{2b}_0 + \delta^2\sum_j^{N_s}  \alpha_j k^{2b}_{ij}(\xi_i, \xi_j) \right) &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;soap-many-body-descriptor&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== SOAP (many-body) descriptor ===&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;u&amp;gt;SOAP descriptor&amp;lt;/u&amp;gt;: &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\boldsymbol{\xi}_i(\{\mathbf{r}\}_{ &amp;lt; r_{\rm cut}} )&amp;lt;/math&amp;gt;, represents environment of an atom ([[#citeproc_bib_item_2|Bartók et al. 2010]]).&lt;br /&gt;
* &amp;lt;u&amp;gt;Kernel&amp;lt;/u&amp;gt;: &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;k_{ij} = (\boldsymbol{\xi}_i \cdot \boldsymbol{\xi}_j)^{\zeta}&amp;lt;/math&amp;gt; measures &amp;lt;u&amp;gt;similarity of environments&amp;lt;/u&amp;gt;.&lt;br /&gt;
* &amp;lt;u&amp;gt;Fitting coefficients&amp;lt;/u&amp;gt;: &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\alpha_j&amp;lt;/math&amp;gt; result from Gaussian Process Regression.&lt;br /&gt;
* &amp;lt;u&amp;gt;Prediction&amp;lt;/u&amp;gt;: &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;E^{\rm mb}_i(\boldsymbol{\xi}_i) = E^{\rm mb}_0 + \delta^2\sum_j  \alpha_j k_{ij}&amp;lt;/math&amp;gt;&lt;br /&gt;
* For specifics of SOAP turbo, refer to Miguel's paper ([[#citeproc_bib_item_3|Caro 2019]])&lt;br /&gt;
&lt;br /&gt;
← SOAP expansion.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
← Interpolation of DFT PES ([[#citeproc_bib_item_4|Deringer et al. 2021]])&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;how-do-we-model-xps&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
== How do we model XPS? ==&lt;br /&gt;
&lt;br /&gt;
* XPS (X-ray photoelectron spectroscopy) spectra measure '''core electron binding energies'''.&lt;br /&gt;
* Core electron binding energies ''depend on atomic environment''.&lt;br /&gt;
* SOAP turbo model trained on DFT (&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\Delta\text{KS}&amp;lt;/math&amp;gt;) data with a &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;GW&amp;lt;/math&amp;gt; correction on top ([[#citeproc_bib_item_6|Golze et al. 2022]]).&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\text{CEBE} = ( \Delta KS^0_{\rm extended} + GW_{\rm carved} - \Delta \mathrm{KS}^+_{\rm carved} )&amp;lt;/math&amp;gt;&lt;br /&gt;
* Thermal and instrumental broadening accounted for by a Gaussian with &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\sigma = 0.4\text{ eV}&amp;lt;/math&amp;gt;&lt;br /&gt;
* Can analyse environments which make up spectra.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;prediction-of-local-properties&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Prediction of Local Properties ==&lt;br /&gt;
&lt;br /&gt;
* We can predict an &amp;lt;u&amp;gt;arbitrary number&amp;lt;/u&amp;gt; of ''local properties'' which use SOAP turbo descriptors using ''TurboGAP''.&lt;br /&gt;
* /One can get these for “free”/ if local property models are trained using the same descriptors as atomic energies/forces.&lt;br /&gt;
*; ''Hirshfeld volumes''&lt;br /&gt;
*: gives vdW dispersion via Tkatchenko-Scheffler. &amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; E_{\rm TS} = \sum_i \sum_{j\neq i} C_{6, ij}(v_{i}(\boldsymbol{\xi}_i), v_{j}(\boldsymbol{\xi}_j))\frac{f_{\rm damp}(r_{ij}, \ldots)}{r_{ij}^6} &amp;lt;/math&amp;gt;&lt;br /&gt;
*; ''Core-electron binding energies''&lt;br /&gt;
*: give '''X-ray Photoelectron Spectroscopy''' prediction. &amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; g_{\rm xps}(\varepsilon) = \frac{1}{M} \sum_i \exp\left( -(\varepsilon - \varepsilon_{i}(\boldsymbol{\xi}_i))^2/(2\sigma^2)  \right) &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;how-do-we-marry-experimental-data-and-gap&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
== How do we marry experimental data and GAP? ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* '''Generalized Hamiltonian within Grand-Canonical Monte-Carlo''' scheme.&lt;br /&gt;
* Vary oxygen content with chemical potential, to see motif differences.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;  \textcolor{violet}{ \mathbf{\tilde{g}}_{\rm {pred}}}(\varepsilon)  = \sum_{i} \exp\left(&lt;br /&gt;
-\frac{(\varepsilon - \textcolor{blue}{\varepsilon^{i}_{\rm&lt;br /&gt;
{pred}}(\boldsymbol{\xi}_i)})^2}{2\sigma^2}\right)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; \tilde{E} = E_{\rm GAP} + E_{\rm spectra} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; E_{\rm spectra} =  \frac{1}{2}\gamma \int \,d\varepsilon \left( \textcolor{violet}{ g_{\rm pred}(\varepsilon)} - g_{\rm exp}(\varepsilon)\right)^2&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;p&amp;gt;A simple squared difference, which is a penalty with increases with spectra dissimilarity and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\gamma&amp;lt;/math&amp;gt; is an energy scale.&amp;lt;/p&amp;gt;&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;p&amp;gt;We can do not just XPS but also X-ray/neutron diffraction and pair distribution functions.&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;[[File:xps_gcmc_scheme.png]]&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;/ul&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* We use the standard acceptance criteria for adding/removing/moving a particle&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; \mathrm{acc}(N \rightarrow N+1) = \mathrm{min}\left[1,&lt;br /&gt;
\frac{V}{\lambda^3 (N+1)} \exp\left\{ - \frac{\tilde{E}(N+1) -&lt;br /&gt;
\tilde{E}(N) - \mu}{k_BT} \right\}     \right] &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; \mathrm{acc}(N \rightarrow N-1) = \mathrm{min}\left[1,&lt;br /&gt;
\frac{\lambda^3 N}{V} \exp\left\{ -\frac{\tilde{E}(N-1) -&lt;br /&gt;
\tilde{E}(N) + \mu}{k_BT} \right\}     \right] &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; \mathrm{acc}_{\rm move} = \mathrm{min }\left[ 1, \exp\left\{ -&lt;br /&gt;
  \frac{\tilde{E}(\mathrm{new}) - \tilde{E}(\mathrm{old})}{k_BT} \right\} \right]&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;usage&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
= Usage =&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;installing-turbogap&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
== Installing ''TurboGAP'' ==&lt;br /&gt;
&lt;br /&gt;
We can install the ''TurboGAP'' code, found here https://github.com/mcaroba/turbogap through ''recursively cloning'' the main branch&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;git clone --recursive https://github.com/mcaroba/turbogap.git&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
Then we edit this line in the &amp;lt;code&amp;gt;Makefile&amp;lt;/code&amp;gt; to match our system architecture.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;include makefiles/Makefile.Ubuntu_gfortran_mpi&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Then, we make&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;make&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
and then export the path in &amp;lt;code&amp;gt;.bashrc&amp;lt;/code&amp;gt; file&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;export PATH=&amp;quot;~/turbogap/bin:$PATH&amp;quot;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;span id=&amp;quot;what-you-need-for-a-calculation&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
== What you need for a calculation ==&lt;br /&gt;
&lt;br /&gt;
; &amp;lt;code&amp;gt;gap_files/&amp;lt;/code&amp;gt; directory&lt;br /&gt;
: The directory which contains your &amp;lt;code&amp;gt;*.gap&amp;lt;/code&amp;gt;, with alphas (fitting coefficients) and sparse set descriptor files.&lt;br /&gt;
;* Potentials are available from ''TurboGAP'' wiki https://turbogap.fi/wiki/index.php/Potentials&lt;br /&gt;
;* Conversion script from &amp;lt;code&amp;gt;gap_fit .xml&amp;lt;/code&amp;gt; to &amp;lt;code&amp;gt;.gap&amp;lt;/code&amp;gt; can be used &amp;lt;code&amp;gt;turbogap/tools/make_gap_files.py&amp;lt;/code&amp;gt;&lt;br /&gt;
; &amp;lt;code&amp;gt;input&amp;lt;/code&amp;gt; file&lt;br /&gt;
: The file which tells the code what to do&lt;br /&gt;
; &amp;lt;code&amp;gt;*.xyz&amp;lt;/code&amp;gt;&lt;br /&gt;
: An extended xyz format file which contains positions/lattice/velocity information.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;adding-a-local-property-model-for-cebe-prediction&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== Adding a local property model for CEBE prediction ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;  gap_beg soap_turbo&lt;br /&gt;
  n_species = 2&lt;br /&gt;
  species = C O&lt;br /&gt;
  central_species = 1&lt;br /&gt;
... some params ...&lt;br /&gt;
  zeta = 4&lt;br /&gt;
  delta = 0.1&lt;br /&gt;
  desc_sparse = &amp;quot;gap_files/CO.xml.sparseX.GAP_2022_5_19_180_7_17_31_41410&amp;quot;&lt;br /&gt;
  alphas_sparse = &amp;quot;gap_files/alphas_soap_turbo_1.dat&amp;quot;&lt;br /&gt;
  compress_mode = &amp;quot;trivial&amp;quot;&lt;br /&gt;
  has_local_properties = .true.&lt;br /&gt;
  n_local_properties = 1&lt;br /&gt;
  local_property_qs = 'gap_files/core_electron_be.xml.sparseX.GAP_2024_1_26_120_18_36_33_6091'&lt;br /&gt;
  local_property_alphas = 'gap_files/alphas_core_electron_be_1.dat'&lt;br /&gt;
  local_property_labels = 'core_electron_be'&lt;br /&gt;
  local_property_zetas = 2&lt;br /&gt;
  local_property_deltas = 1.0&lt;br /&gt;
  local_property_v0s = 290.0&lt;br /&gt;
  gap_end&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;span id=&amp;quot;conversion-of-gap_fit-.xml-files-to-.gap-format&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== Conversion of &amp;lt;code&amp;gt;gap_fit&amp;lt;/code&amp;gt; &amp;lt;code&amp;gt;*.xml&amp;lt;/code&amp;gt; files to &amp;lt;code&amp;gt;*.gap&amp;lt;/code&amp;gt; format ===&lt;br /&gt;
&lt;br /&gt;
* Then we convert the &amp;lt;code&amp;gt;*.xml&amp;lt;/code&amp;gt; files which result from &amp;lt;code&amp;gt;gap_fit&amp;lt;/code&amp;gt; into the required format for ''TurboGAP''.&lt;br /&gt;
* This is done using the convenience script in &amp;lt;code&amp;gt;turbogap/tools/make_gap_files.py&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;python3 make_gap_files.py {gap_file.xml} {gap_file.gap} {N_local_prop.} \&lt;br /&gt;
              {local_prop1.xml} {local_prop_label1} \&lt;br /&gt;
              {local_prop2.xml} {local_prop_label2}...&lt;br /&gt;
# e.g. let's build a carbon oxygen GAP&lt;br /&gt;
# with core electron binding energy prediction capability.&lt;br /&gt;
python3 make_gap_files.py CO.xml CO.gap 1 \&lt;br /&gt;
        core_electron_be_co.xml core_electron_be&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
* This creates a directory &amp;lt;code&amp;gt;gap_files/&amp;lt;/code&amp;gt; which has&lt;br /&gt;
*# &amp;lt;code&amp;gt;alphas_{descriptor}.dat&amp;lt;/code&amp;gt; which are fitting coefficients for a particular descriptor&lt;br /&gt;
*# &amp;lt;code&amp;gt;qs_{descriptor}.dat&amp;lt;/code&amp;gt; which are the '''sparse set''' descriptors, used for prediction.&lt;br /&gt;
*# &amp;lt;code&amp;gt;alphas_{local_property}.dat&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;qs_{local_property}.dat&amp;lt;/code&amp;gt; for local property prediction.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;running-the-tutorial&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
== Running the Tutorial ==&lt;br /&gt;
&lt;br /&gt;
* Navigate to &amp;lt;code&amp;gt;turbogap/tutorials/xps_optimizaton&amp;lt;/code&amp;gt;&lt;br /&gt;
* Run &amp;lt;code&amp;gt;bash run.sh {calc_type}&amp;lt;/code&amp;gt; where &amp;lt;code&amp;gt;{calc_type}&amp;lt;/code&amp;gt; is either:&lt;br /&gt;
** &amp;lt;code&amp;gt;prediction&amp;lt;/code&amp;gt;&lt;br /&gt;
** &amp;lt;code&amp;gt;standard_gcmc&amp;lt;/code&amp;gt;&lt;br /&gt;
** &amp;lt;code&amp;gt;xps_optimization_gcmc&amp;lt;/code&amp;gt;&lt;br /&gt;
* Note that these simulations have a high chemical potential and (have high &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\gamma&amp;lt;/math&amp;gt; factors), these are just to give a result in a reasonable amount of time. Take care with real simulations.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;core-electron-binding-energy-prediction&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
== Core electron binding energy prediction ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;[mpirun -np N] turbogap predict&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
* We have in our &amp;lt;code&amp;gt;input&amp;lt;/code&amp;gt; file&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre class=&amp;quot;conf&amp;quot;&amp;gt;! Species-specific info&lt;br /&gt;
atoms_file = 'atoms.xyz'&lt;br /&gt;
pot_file = 'gap_files/CO.gap'&lt;br /&gt;
n_species = 2&lt;br /&gt;
species = C O&lt;br /&gt;
masses = 12.01 15.99&lt;br /&gt;
e0 = -.16138053 0.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Output:&lt;br /&gt;
&lt;br /&gt;
; &amp;lt;code&amp;gt;trajectory_out.xyz&amp;lt;/code&amp;gt;&lt;br /&gt;
: which contains atomic positions, local energy and local property arrays for each structure.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt; 512&lt;br /&gt;
Properties=species:S:1:pos:R:3:forces:R:3:local_energy:R:1:core_electron_be:R:1 \&lt;br /&gt;
   Lattice=&amp;quot;...&amp;quot; energy=-4321.582604 energy_soap=-4114.77018429  energy_2b=-124.73820332 energy_3b=0.55261463 \&lt;br /&gt;
   energy_core_pot=0.00000000 energy_vdw=0.00000000 energy_exp=0.00000000 energy_xps=0.00000000 \&lt;br /&gt;
   virial=&amp;quot;...&amp;quot; stress=&amp;quot;...&amp;quot; volume=5372.640346&lt;br /&gt;
   C              4.39625950       7.79414272      11.91703476     \&lt;br /&gt;
                  -0.00176074      -0.00403026       0.00040104    \&lt;br /&gt;
                  -8.32055957 \ # Local energy prediction&lt;br /&gt;
                  283.83841418  # CEBE Prediction&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Withiout specifying Exp. data, Turbogap does not predict the spectra.&lt;br /&gt;
* XPS spectra can simply be calculated from &amp;lt;code&amp;gt;core_electron_be&amp;lt;/code&amp;gt; in &amp;lt;code&amp;gt;trajectory_out.xyz&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;grand-canonical-monte-carlo&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
== (Grand-Canonical) Monte-Carlo ==&lt;br /&gt;
&lt;br /&gt;
* We use &amp;lt;code&amp;gt;mc&amp;lt;/code&amp;gt; mode&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;[mpirun -np N] turbogap mc&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
* ''e.g'' For a &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mu V T&amp;lt;/math&amp;gt; simulation of system in oxygen environment&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre class=&amp;quot;conf&amp;quot;&amp;gt;! Monte-carlo options&lt;br /&gt;
mc_nsteps = 1000                         # Number of Monte-Carlo Steps&lt;br /&gt;
n_mc_types = 3                           # Number of MC move types&lt;br /&gt;
mc_types = 'move' 'insertion' 'removal'  # MC move types (move/insertion/removal/volume/swap/md)&lt;br /&gt;
mc_move_max = 0.5                        # Maximum distance for MC displacement (&amp;amp;quot;move&amp;amp;quot;) type moves&lt;br /&gt;
&lt;br /&gt;
! - GCMC Options&lt;br /&gt;
n_mc_mu = 1              # Number of chemical potentials to add&lt;br /&gt;
mc_mu = 0                # Chemical potential(s) [eV]&lt;br /&gt;
mc_species = 'O'         # GCMC species types&lt;br /&gt;
mc_min_dist = 0.1        # GCMC minimum insertion distance&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Output:&lt;br /&gt;
&lt;br /&gt;
; &amp;lt;code&amp;gt;mc.log&amp;lt;/code&amp;gt;&lt;br /&gt;
: &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;# mc_istep  mc_move  accepted  E_trial              E_current             E_exp_trial          E_exp_current  N_tot_trial  N_mc_species_trial&lt;br /&gt;
       1       move    F       -4321.10376531       -4321.58260476         272.97693282         272.83692252      512  O        0&lt;br /&gt;
       2       move    F       -4321.10017027       -4321.58260476         272.68730901         272.83692252      512  O        0&lt;br /&gt;
       3  insertion    F       -4319.14082561       -4321.58260476         269.49191203         272.83692252      513  O        1&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; &amp;lt;code&amp;gt;mc_all.xyz&amp;lt;/code&amp;gt;&lt;br /&gt;
: xyz file written to every &amp;lt;code&amp;gt;write_xyz = N&amp;lt;/code&amp;gt; steps.&lt;br /&gt;
; &amp;lt;code&amp;gt;mc_current.xyz&amp;lt;/code&amp;gt;&lt;br /&gt;
: xyz file saving current accepted config written to every &amp;lt;code&amp;gt;write_xyz = N&amp;lt;/code&amp;gt; steps.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* If we run &amp;lt;code&amp;gt;bash run.sh standard_gcmc&amp;lt;/code&amp;gt; (may take a few minutes), we can see a prediction of the XPS with oxygen content&lt;br /&gt;
&lt;br /&gt;
[[File:standard_gcmc.png]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;experimental-observable-optimization&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
== Experimental Observable Optimization ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;[mpirun -np N] turbogap mc/md&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
* We can specify experimental observables to predict and optimize them using MC or MD. &amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; E_{\rm spectra} = \frac{1}{2} \gamma \int \,d\varepsilon (g_{\rm pred}(\varepsilon) - g_{\rm exp}(\varepsilon))^2  &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre class=&amp;quot;conf&amp;quot;&amp;gt;! Experimental data options&lt;br /&gt;
n_exp = 1                                  # Number of experimental observables&lt;br /&gt;
exp_labels = 'xps'                         # Experimental observable types (xps/xrd/nd/pdf)&lt;br /&gt;
exp_data_files = 'xps_spectra_interp.dat'  # Experimental data files (Note: the range of resulting XPS prediction will be the same as the experimental range.)&lt;br /&gt;
exp_n_samples = 501                        # Number of interpolations samples over the experimental range.&lt;br /&gt;
exp_energy_scales = 100.0                    # Energy scale (gamma) [eV]&lt;br /&gt;
&lt;br /&gt;
# XPS smearing&lt;br /&gt;
xps_sigma = 0.4&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Output:&lt;br /&gt;
&lt;br /&gt;
; &amp;lt;code&amp;gt;xps_prediction.dat&amp;lt;/code&amp;gt;&lt;br /&gt;
: Data file written every &amp;lt;code&amp;gt;write_xyz = N&amp;lt;/code&amp;gt; steps. Separate predictions separated by blank lines.&lt;br /&gt;
; &amp;lt;code&amp;gt;xps_exp.dat&amp;lt;/code&amp;gt;&lt;br /&gt;
: The experimental data fed into ''TurboGAP''.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* If we run &amp;lt;code&amp;gt;bash run.sh xps_optimization_gcmc&amp;lt;/code&amp;gt; (may take a few minutes), we can see a prediction of the XPS with oxygen content&lt;br /&gt;
&lt;br /&gt;
[[File:xps_optimization_gcmc.png]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;multiple-observables&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
== Multiple Observables ==&lt;br /&gt;
&lt;br /&gt;
* This is not in the tutorial files, but ''TurboGAP'' allows for we can optimization multiple observables.&lt;br /&gt;
** X-ray diffraction&lt;br /&gt;
** Neutron diffraction&lt;br /&gt;
** Pair distribution function&lt;br /&gt;
** XPS&lt;br /&gt;
* Here we show a fictitious example of XPS and XRD optimization.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre class=&amp;quot;conf&amp;quot;&amp;gt;# Partial PDFs needed for XRD calculation&lt;br /&gt;
pair_distribution_n_samples = 301&lt;br /&gt;
r_range_min = 0.1&lt;br /&gt;
r_range_max = 13.5&lt;br /&gt;
pair_distribution_rcut = 14.1&lt;br /&gt;
&lt;br /&gt;
do_xrd = .true.&lt;br /&gt;
&lt;br /&gt;
# Experimental Data Specification&lt;br /&gt;
n_exp = 2                  # Number of Exp. observables&lt;br /&gt;
exp_labels = 'xps' 'xrd'   # Exp. observable type (xps/xrd/nd/pdf)&lt;br /&gt;
exp_data_files = 'xps_spectra_experiment.dat' 'xrd_CO_experiment.dat'&lt;br /&gt;
exp_n_samples = 301 301 # Number of samples for the experimental data&lt;br /&gt;
exp_energy_scales = 10.0 10.0  # The &amp;amp;quot;gamma&amp;amp;quot; term for each observable&lt;br /&gt;
&lt;br /&gt;
# If using monte-carlo, the experimental energies are added directly to the local energy&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;span id=&amp;quot;applications&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
= Applications =&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;experimental-observable-predictionoptimization&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
== Experimental Observable prediction/optimization ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;deconvolution-analysis&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== Deconvolution analysis ===&lt;br /&gt;
&lt;br /&gt;
* Use subgraph isomorphisms of bonding networks to discern motifs present.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:exp_xps_with_background_high.png]]&lt;br /&gt;
&lt;br /&gt;
↑ Experimental XPS deconvolution ([[#citeproc_bib_item_9|Santini et al. 2015]])&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:deconvolution_comparison_fill_-3_new.png]]&lt;br /&gt;
&lt;br /&gt;
↑ Our XPS deconvolution ([[#citeproc_bib_item_9|Santini et al. 2015]])&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:xps_shifts_miguel_first.png]]&lt;br /&gt;
&lt;br /&gt;
[[File:xps_shifts_miguel_last.png]]&lt;br /&gt;
&lt;br /&gt;
We see with oxygen content that sp2 motifs are shifted significantly, even past the sp3 reference. This is why the experimental deconvolution did not give what we expect: sp2 carbon that composes the primary XPS peak. &lt;br /&gt;
&amp;lt;span id=&amp;quot;summary&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Summary =&lt;br /&gt;
&lt;br /&gt;
* Machine-learned potentials can be combined with experimental models to give structures which are consistent with both ''ab-inito'' and experimental data.&lt;br /&gt;
* We can generate oxygenated amorphous carbon structures using a CO GAP with XPS prediction using modified GCMC and a “Molecular Augmented Dynamics” method.&lt;br /&gt;
* We can use ''multiple experimental observables''.&lt;br /&gt;
* '''Finding structures which match experimental data allows us to understand specific experimental results.'''&lt;br /&gt;
* Deconvolve experimental XPS exactly.&lt;br /&gt;
* All of this is implemented in the ''TurboGAP'' code.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;references&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
= References =&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;citeproc_bib_item_1&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;Bartók, Albert P., Risi Kondor, and Gábor Csányi. 2013. “On Representing Chemical Environments.” ''Physical Review B'' 87 (18): 184115. https://doi.org/10.1103/PhysRevB.87.184115.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;citeproc_bib_item_2&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;Bartók, Albert P., Mike C. Payne, Risi Kondor, and Gábor Csányi. 2010. “Gaussian Approximation Potentials: The Accuracy of Quantum Mechanics, without the Electrons.” ''Physical Review Letters'' 104 (13): 136403. https://doi.org/10.1103/PhysRevLett.104.136403.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;citeproc_bib_item_3&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;Caro, Miguel A. 2019. “Optimizing Many-Body Atomic Descriptors for Enhanced Computational Performance of Machine Learning Based Interatomic Potentials.” ''Physical Review B'' 100 (2): 024112. https://doi.org/10.1103/PhysRevB.100.024112.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;citeproc_bib_item_4&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;Deringer, Volker L., Albert P. Bartók, Noam Bernstein, David M. Wilkins, Michele Ceriotti, and Gábor Csányi. 2021. “Gaussian Process Regression for Materials and Molecules.” ''Chemical Reviews'' 121 (16): 10073–141. https://doi.org/10.1021/acs.chemrev.1c00022.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;citeproc_bib_item_5&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;El-Machachi, Zakariya, Damyan Frantzov, A. Nijamudheen, Tigany Zarrouk, Miguel A. Caro, and Volker L. Deringer. 2024. “Accelerated First-Principles Exploration of Structure and Reactivity in Graphene Oxide.” arXiv. https://doi.org/10.48550/arXiv.2405.14814.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;citeproc_bib_item_6&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;Golze, Dorothea, Markus Hirvensalo, Patricia Hernández-León, Anja Aarva, Jarkko Etula, Toma Susi, Patrick Rinke, Tomi Laurila, and Miguel A. Caro. 2022. “Accurate Computational Prediction of Core-Electron Binding Energies in Carbon-Based Materials: A Machine-Learning Model Combining Density-Functional Theory and GW.” ''Chemistry of Materials'' 34 (14): 6240–54. https://doi.org/10.1021/acs.chemmater.1c04279.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;citeproc_bib_item_7&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;Muhli, Heikki, Xi Chen, Albert P. Bartók, Patricia Hernández-León, Gábor Csányi, Tapio Ala-Nissila, and Miguel A. Caro. 2021. “Machine Learning Force Fields Based on Local Parametrization of Dispersion Interactions: Application to the Phase Diagram of \&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathrm\\\C\\\\\_\60\\&amp;lt;/math&amp;gt;.” ''Physical Review B'' 104 (5): 054106. https://doi.org/10.1103/PhysRevB.104.054106.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;citeproc_bib_item_8&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;Opletal, George, Timothy C. Petersen, Amanda S. Barnard, and Salvy P. Russo. 2017. “On Reverse Monte Carlo Constraints and Model Reproduction.” ''Journal of Computational Chemistry'' 38 (17): 1547–51. https://doi.org/10.1002/jcc.24799.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;citeproc_bib_item_9&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;Santini, Claudia A., Abu Sebastian, Chiara Marchiori, Vara Prasad Jonnalagadda, Laurent Dellmann, Wabe W. Koelmans, Marta D. Rossell, Christophe P. Rossel, and Evangelos Eleftheriou. 2015. “Oxygenated Amorphous Carbon for Resistive Memory Applications.” ''Nature Communications'' 6 (1): 8600. https://doi.org/10.1038/ncomms9600.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;citeproc_bib_item_10&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;Wang, Yanzhou, Zheyong Fan, Ping Qian, Tapio Ala-Nissila, and Miguel A. Caro. 2022. “Structure and Pore Size Distribution in Nanoporous Carbon.” ''Chemistry of Materials'' 34 (2): 617–28. https://doi.org/10.1021/acs.chemmater.1c03279.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;citeproc_bib_item_11&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;Zarrouk, Tigany, Rina Ibragimova, Albert P. Bartók, and Miguel A. Caro. 2024. “Experiment-Driven Atomistic Materials Modeling: A Case Study Combining X-Ray Photoelectron Spectroscopy and Machine Learning Potentials to Infer the Structure of Oxygen-Rich Amorphous Carbon.” ''Journal of the American Chemical Society'' 146 (21): 14645–59. https://doi.org/10.1021/jacs.4c01897.&lt;/div&gt;</summary>
		<author><name>Tigany Zarrouk</name></author>
		
	</entry>
	<entry>
		<id>https://turbogap.fi/wiki/index.php?title=XPS-optimized_oxygenated_amorphous_carbon&amp;diff=644</id>
		<title>XPS-optimized oxygenated amorphous carbon</title>
		<link rel="alternate" type="text/html" href="https://turbogap.fi/wiki/index.php?title=XPS-optimized_oxygenated_amorphous_carbon&amp;diff=644"/>
		<updated>2024-06-18T19:38:33Z</updated>

		<summary type="html">&lt;p&gt;Tigany Zarrouk: /* Experimental Observable prediction/optimization */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
&amp;lt;span id=&amp;quot;what-is-turbogap&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
= What is ''TurboGAP'' ? =&lt;br /&gt;
&lt;br /&gt;
* ''TurboGAP'' is a &amp;lt;code&amp;gt;Fortran&amp;lt;/code&amp;gt; atomistic code which uses &amp;lt;u&amp;gt;Gaussian Approximation Potentials&amp;lt;/u&amp;gt; (GAPs).&lt;br /&gt;
* Its specialty are ''SOAP turbo'' descriptors: faster and more accurate than SOAP (Smooth Overlap of Atomic Positions).&lt;br /&gt;
* It's (probably!) the fastest SOAP prediction code, which will be made even faster with ''GPU acceleration'' (ongoing with CSC).&lt;br /&gt;
&lt;br /&gt;
[[File:images/Turbogap_logo.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* Through GAP/SOAP predictions, one can perform simulations with ''ab-initio'' accuracy '''at scale'''&lt;br /&gt;
** Molecular Dynamics&lt;br /&gt;
** Grand-Canonical Monte-Carlo simulations&lt;br /&gt;
** Electronic-stopping and spatially-correlated Langevin Dynamics (in-development).&lt;br /&gt;
** '''Prediction/optimization of experimental observables''' (''e.g.'' X-Ray photoelectron spectra ([[#citeproc_bib_item_6|Golze et al. 2022]]; [[#citeproc_bib_item_11|Zarrouk et al. 2024]]), X-ray/Neutron Diffraction and more to come!).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;motivation-for-structural-inference&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
= Motivation for structural inference =&lt;br /&gt;
&lt;br /&gt;
* We typically want to &amp;lt;u&amp;gt;predict structures&amp;lt;/u&amp;gt;, to make sense of experimental data.&lt;br /&gt;
* We usually pray structures have &amp;lt;u&amp;gt;experimental agreement&amp;lt;/u&amp;gt; (a “bottom-up” approach).&lt;br /&gt;
* What if we can &amp;lt;u&amp;gt;promote agreement&amp;lt;/u&amp;gt; with experimental data?&lt;br /&gt;
* ''Reverse Monte-Carlo'' techniques match experimental data to atomic structure (“top-down” approach).&lt;br /&gt;
** Downsides: “By-hand” constraints&lt;br /&gt;
** Simple experimental observables.&lt;br /&gt;
** Unphysical structures/artifacts ([[#citeproc_bib_item_8|Opletal et al. 2017]])&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Need efficient structure search to find '''agreement''' with '''experimental''' data ''and'' '''ab-inito''' data.&lt;br /&gt;
&lt;br /&gt;
# With &amp;lt;u&amp;gt;CO GAP + Core electron binding energy SOAP&amp;lt;/u&amp;gt; model we will perform '''modified (Grand-canonical) Monte-Carlo''' to produce ''experimentally consistent, low energy structures'' of oxygenated amorphous carbon.&lt;br /&gt;
# I will further show preliminary work on *“Molecular Augmented Dynamics”*: generate forces from experimental deviation, to match experimental spectra via MD.&lt;br /&gt;
&lt;br /&gt;
[[File:deconvolution_comparison_fill_-3_new.png]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;theory-and-methods&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
= Theory and Methods =&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;gaussian-approximation-potentials-gap&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
== Gaussian Approximation Potentials (GAP) ==&lt;br /&gt;
&lt;br /&gt;
([[#citeproc_bib_item_2|Bartók et al. 2010]]; [[#citeproc_bib_item_1|Bartók, Kondor, and Csányi 2013]]; [[#citeproc_bib_item_4|Deringer et al. 2021]])&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;u&amp;gt;Assumption&amp;lt;/u&amp;gt;: Total energy is sum of '''local energies'''. &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;E_{\rm total}(\{\mathbf{r}\}) = \sum_i^{N_{\text{atoms}}} \varepsilon^i(\{r\}, \{\xi^{\text{2b}}_i\}, \{\boldsymbol{\xi}^{\text{3b}}_i\}, \boldsymbol{\xi}^{\text{mb}}_i))&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;\begin{align}&lt;br /&gt;
  \varepsilon^i ( &amp;amp;\{r\}, \{\xi^{\text{2b}}_i\}, \{\boldsymbol{\xi}^{\text{3b}}_i\}, \boldsymbol{\xi}^{\text{mb}}_i) =&lt;br /&gt;
   E^{\text{2b}}(\{\xi^{\text{2b}}_i\}) + E^{\text{3b}}(\{\boldsymbol{\xi}^{\text{3b}}_i\}) \nonumber\\&lt;br /&gt;
  &amp;amp; + E^{\text{mb}}(\boldsymbol{\xi}^{\text{mb}}_i)&lt;br /&gt;
  + \sum_{r &amp;lt; r_{\rm cut}^{\rm core}} E^{\text{core}}(r)  \nonumber&lt;br /&gt;
\end{align}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
; Local energy&lt;br /&gt;
: Sum of '''2b, 3b and many-body''' terms.&lt;br /&gt;
; Descriptor &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\xi / \boldsymbol{\xi}&amp;lt;/math&amp;gt;.&lt;br /&gt;
: ''e.g'' &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\{\xi^{\text{2b}}\} = \{r_{ij}\}&amp;lt;/math&amp;gt;, &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\{\boldsymbol{\xi}^{\text{3b}}\} = \{ [ r_{ij}, r_{ik}, r_{kj} ] \}&amp;lt;/math&amp;gt;&lt;br /&gt;
; Local environment&lt;br /&gt;
: A set of descriptors.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;using-descriptors-to-predict-quantities&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== Using descriptors to predict quantities ===&lt;br /&gt;
&lt;br /&gt;
* ''Kernel/basis functions'' &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;k_{ij}(\boldsymbol{\xi}_i, \boldsymbol{\xi}_j)&amp;lt;/math&amp;gt; measure the ''similarity between descriptors''.&lt;br /&gt;
* ''e.g'' Exponential 2b kernel: &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;k^{2b}_{ij}(\xi_i, \xi_j) \equiv k^{2b}_{ij}(r_{i}, r_{j}) = \exp( - (r_{i} - r_{j})^2/2\sigma^2 )&amp;lt;/math&amp;gt;&lt;br /&gt;
* ''Gaussian Process Regression'' (kernel matrix algebra on training set) → ''fitting coefficients'' &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\{\alpha\}&amp;lt;/math&amp;gt;, ([[#citeproc_bib_item_4|Deringer et al. 2021]])&lt;br /&gt;
* ''e.g.'' 2b model trained with &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;N_s&amp;lt;/math&amp;gt; descriptors &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\{\xi\} \in \{\xi_i, \ldots, \xi_{Ns}\}&amp;lt;/math&amp;gt;, the energy for atom with &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;M&amp;lt;/math&amp;gt; pairwise distances in local environment: &amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;E^{2b} = \sum_i^M \left(E^{2b}_0 + \delta^2\sum_j^{N_s}  \alpha_j k^{2b}_{ij}(\xi_i, \xi_j) \right) &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;soap-many-body-descriptor&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== SOAP (many-body) descriptor ===&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;u&amp;gt;SOAP descriptor&amp;lt;/u&amp;gt;: &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\boldsymbol{\xi}_i(\{\mathbf{r}\}_{ &amp;lt; r_{\rm cut}} )&amp;lt;/math&amp;gt;, represents environment of an atom ([[#citeproc_bib_item_2|Bartók et al. 2010]]).&lt;br /&gt;
* &amp;lt;u&amp;gt;Kernel&amp;lt;/u&amp;gt;: &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;k_{ij} = (\boldsymbol{\xi}_i \cdot \boldsymbol{\xi}_j)^{\zeta}&amp;lt;/math&amp;gt; measures &amp;lt;u&amp;gt;similarity of environments&amp;lt;/u&amp;gt;.&lt;br /&gt;
* &amp;lt;u&amp;gt;Fitting coefficients&amp;lt;/u&amp;gt;: &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\alpha_j&amp;lt;/math&amp;gt; result from Gaussian Process Regression.&lt;br /&gt;
* &amp;lt;u&amp;gt;Prediction&amp;lt;/u&amp;gt;: &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;E^{\rm mb}_i(\boldsymbol{\xi}_i) = E^{\rm mb}_0 + \delta^2\sum_j  \alpha_j k_{ij}&amp;lt;/math&amp;gt;&lt;br /&gt;
* For specifics of SOAP turbo, refer to Miguel's paper ([[#citeproc_bib_item_3|Caro 2019]])&lt;br /&gt;
&lt;br /&gt;
← SOAP expansion.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
← Interpolation of DFT PES ([[#citeproc_bib_item_4|Deringer et al. 2021]])&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;how-do-we-model-xps&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
== How do we model XPS? ==&lt;br /&gt;
&lt;br /&gt;
* XPS (X-ray photoelectron spectroscopy) spectra measure '''core electron binding energies'''.&lt;br /&gt;
* Core electron binding energies ''depend on atomic environment''.&lt;br /&gt;
* SOAP turbo model trained on DFT (&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\Delta\text{KS}&amp;lt;/math&amp;gt;) data with a &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;GW&amp;lt;/math&amp;gt; correction on top ([[#citeproc_bib_item_6|Golze et al. 2022]]).&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\text{CEBE} = ( \Delta KS^0_{\rm extended} + GW_{\rm carved} - \Delta \mathrm{KS}^+_{\rm carved} )&amp;lt;/math&amp;gt;&lt;br /&gt;
* Thermal and instrumental broadening accounted for by a Gaussian with &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\sigma = 0.4\text{ eV}&amp;lt;/math&amp;gt;&lt;br /&gt;
* Can analyse environments which make up spectra.&lt;br /&gt;
&lt;br /&gt;
[[File:miguel_xps_diagram.png]]&lt;br /&gt;
&lt;br /&gt;
↑ Diagram of XPS (x-axis is core electron binding energy) ([[#citeproc_bib_item_6|Golze et al. 2022]])&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;prediction-of-local-properties&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
== Prediction of Local Properties ==&lt;br /&gt;
&lt;br /&gt;
* We can predict an &amp;lt;u&amp;gt;arbitrary number&amp;lt;/u&amp;gt; of ''local properties'' which use SOAP turbo descriptors using ''TurboGAP''.&lt;br /&gt;
* /One can get these for “free”/ if local property models are trained using the same descriptors as atomic energies/forces.&lt;br /&gt;
*; ''Hirshfeld volumes''&lt;br /&gt;
*: gives vdW dispersion via Tkatchenko-Scheffler. &amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; E_{\rm TS} = \sum_i \sum_{j\neq i} C_{6, ij}(v_{i}(\boldsymbol{\xi}_i), v_{j}(\boldsymbol{\xi}_j))\frac{f_{\rm damp}(r_{ij}, \ldots)}{r_{ij}^6} &amp;lt;/math&amp;gt;&lt;br /&gt;
*; ''Core-electron binding energies''&lt;br /&gt;
*: give '''X-ray Photoelectron Spectroscopy''' prediction. &amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; g_{\rm xps}(\varepsilon) = \frac{1}{M} \sum_i \exp\left( -(\varepsilon - \varepsilon_{i}(\boldsymbol{\xi}_i))^2/(2\sigma^2)  \right) &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;how-do-we-marry-experimental-data-and-gap&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
== How do we marry experimental data and GAP? ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* '''Generalized Hamiltonian within Grand-Canonical Monte-Carlo''' scheme.&lt;br /&gt;
* Vary oxygen content with chemical potential, to see motif differences.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;  \textcolor{violet}{ \mathbf{\tilde{g}}_{\rm {pred}}}(\varepsilon)  = \sum_{i} \exp\left(&lt;br /&gt;
-\frac{(\varepsilon - \textcolor{blue}{\varepsilon^{i}_{\rm&lt;br /&gt;
{pred}}(\boldsymbol{\xi}_i)})^2}{2\sigma^2}\right)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; \tilde{E} = E_{\rm GAP} + E_{\rm spectra} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; E_{\rm spectra} =  \frac{1}{2}\gamma \int \,d\varepsilon \left( \textcolor{violet}{ g_{\rm pred}(\varepsilon)} - g_{\rm exp}(\varepsilon)\right)^2&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;p&amp;gt;A simple squared difference, which is a penalty with increases with spectra dissimilarity and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\gamma&amp;lt;/math&amp;gt; is an energy scale.&amp;lt;/p&amp;gt;&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;p&amp;gt;We can do not just XPS but also X-ray/neutron diffraction and pair distribution functions.&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;[[File:xps_gcmc_scheme.png]]&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;/ul&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* We use the standard acceptance criteria for adding/removing/moving a particle&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; \mathrm{acc}(N \rightarrow N+1) = \mathrm{min}\left[1,&lt;br /&gt;
\frac{V}{\lambda^3 (N+1)} \exp\left\{ - \frac{\tilde{E}(N+1) -&lt;br /&gt;
\tilde{E}(N) - \mu}{k_BT} \right\}     \right] &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; \mathrm{acc}(N \rightarrow N-1) = \mathrm{min}\left[1,&lt;br /&gt;
\frac{\lambda^3 N}{V} \exp\left\{ -\frac{\tilde{E}(N-1) -&lt;br /&gt;
\tilde{E}(N) + \mu}{k_BT} \right\}     \right] &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; \mathrm{acc}_{\rm move} = \mathrm{min }\left[ 1, \exp\left\{ -&lt;br /&gt;
  \frac{\tilde{E}(\mathrm{new}) - \tilde{E}(\mathrm{old})}{k_BT} \right\} \right]&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;usage&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
= Usage =&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;installing-turbogap&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
== Installing ''TurboGAP'' ==&lt;br /&gt;
&lt;br /&gt;
We can install the ''TurboGAP'' code, found here https://github.com/mcaroba/turbogap through ''recursively cloning'' the main branch&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;git clone --recursive https://github.com/mcaroba/turbogap.git&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
Then we edit this line in the &amp;lt;code&amp;gt;Makefile&amp;lt;/code&amp;gt; to match our system architecture.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;include makefiles/Makefile.Ubuntu_gfortran_mpi&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Then, we make&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;make&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
and then export the path in &amp;lt;code&amp;gt;.bashrc&amp;lt;/code&amp;gt; file&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;export PATH=&amp;quot;~/turbogap/bin:$PATH&amp;quot;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;span id=&amp;quot;what-you-need-for-a-calculation&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
== What you need for a calculation ==&lt;br /&gt;
&lt;br /&gt;
; &amp;lt;code&amp;gt;gap_files/&amp;lt;/code&amp;gt; directory&lt;br /&gt;
: The directory which contains your &amp;lt;code&amp;gt;*.gap&amp;lt;/code&amp;gt;, with alphas (fitting coefficients) and sparse set descriptor files.&lt;br /&gt;
;* Potentials are available from ''TurboGAP'' wiki https://turbogap.fi/wiki/index.php/Potentials&lt;br /&gt;
;* Conversion script from &amp;lt;code&amp;gt;gap_fit .xml&amp;lt;/code&amp;gt; to &amp;lt;code&amp;gt;.gap&amp;lt;/code&amp;gt; can be used &amp;lt;code&amp;gt;turbogap/tools/make_gap_files.py&amp;lt;/code&amp;gt;&lt;br /&gt;
; &amp;lt;code&amp;gt;input&amp;lt;/code&amp;gt; file&lt;br /&gt;
: The file which tells the code what to do&lt;br /&gt;
; &amp;lt;code&amp;gt;*.xyz&amp;lt;/code&amp;gt;&lt;br /&gt;
: An extended xyz format file which contains positions/lattice/velocity information.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;adding-a-local-property-model-for-cebe-prediction&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== Adding a local property model for CEBE prediction ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;  gap_beg soap_turbo&lt;br /&gt;
  n_species = 2&lt;br /&gt;
  species = C O&lt;br /&gt;
  central_species = 1&lt;br /&gt;
... some params ...&lt;br /&gt;
  zeta = 4&lt;br /&gt;
  delta = 0.1&lt;br /&gt;
  desc_sparse = &amp;quot;gap_files/CO.xml.sparseX.GAP_2022_5_19_180_7_17_31_41410&amp;quot;&lt;br /&gt;
  alphas_sparse = &amp;quot;gap_files/alphas_soap_turbo_1.dat&amp;quot;&lt;br /&gt;
  compress_mode = &amp;quot;trivial&amp;quot;&lt;br /&gt;
  has_local_properties = .true.&lt;br /&gt;
  n_local_properties = 1&lt;br /&gt;
  local_property_qs = 'gap_files/core_electron_be.xml.sparseX.GAP_2024_1_26_120_18_36_33_6091'&lt;br /&gt;
  local_property_alphas = 'gap_files/alphas_core_electron_be_1.dat'&lt;br /&gt;
  local_property_labels = 'core_electron_be'&lt;br /&gt;
  local_property_zetas = 2&lt;br /&gt;
  local_property_deltas = 1.0&lt;br /&gt;
  local_property_v0s = 290.0&lt;br /&gt;
  gap_end&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;span id=&amp;quot;conversion-of-gap_fit-.xml-files-to-.gap-format&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== Conversion of &amp;lt;code&amp;gt;gap_fit&amp;lt;/code&amp;gt; &amp;lt;code&amp;gt;*.xml&amp;lt;/code&amp;gt; files to &amp;lt;code&amp;gt;*.gap&amp;lt;/code&amp;gt; format ===&lt;br /&gt;
&lt;br /&gt;
* Then we convert the &amp;lt;code&amp;gt;*.xml&amp;lt;/code&amp;gt; files which result from &amp;lt;code&amp;gt;gap_fit&amp;lt;/code&amp;gt; into the required format for ''TurboGAP''.&lt;br /&gt;
* This is done using the convenience script in &amp;lt;code&amp;gt;turbogap/tools/make_gap_files.py&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;python3 make_gap_files.py {gap_file.xml} {gap_file.gap} {N_local_prop.} \&lt;br /&gt;
              {local_prop1.xml} {local_prop_label1} \&lt;br /&gt;
              {local_prop2.xml} {local_prop_label2}...&lt;br /&gt;
# e.g. let's build a carbon oxygen GAP&lt;br /&gt;
# with core electron binding energy prediction capability.&lt;br /&gt;
python3 make_gap_files.py CO.xml CO.gap 1 \&lt;br /&gt;
        core_electron_be_co.xml core_electron_be&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
* This creates a directory &amp;lt;code&amp;gt;gap_files/&amp;lt;/code&amp;gt; which has&lt;br /&gt;
*# &amp;lt;code&amp;gt;alphas_{descriptor}.dat&amp;lt;/code&amp;gt; which are fitting coefficients for a particular descriptor&lt;br /&gt;
*# &amp;lt;code&amp;gt;qs_{descriptor}.dat&amp;lt;/code&amp;gt; which are the '''sparse set''' descriptors, used for prediction.&lt;br /&gt;
*# &amp;lt;code&amp;gt;alphas_{local_property}.dat&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;qs_{local_property}.dat&amp;lt;/code&amp;gt; for local property prediction.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;running-the-tutorial&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
== Running the Tutorial ==&lt;br /&gt;
&lt;br /&gt;
* Navigate to &amp;lt;code&amp;gt;turbogap/tutorials/xps_optimizaton&amp;lt;/code&amp;gt;&lt;br /&gt;
* Run &amp;lt;code&amp;gt;bash run.sh {calc_type}&amp;lt;/code&amp;gt; where &amp;lt;code&amp;gt;{calc_type}&amp;lt;/code&amp;gt; is either:&lt;br /&gt;
** &amp;lt;code&amp;gt;prediction&amp;lt;/code&amp;gt;&lt;br /&gt;
** &amp;lt;code&amp;gt;standard_gcmc&amp;lt;/code&amp;gt;&lt;br /&gt;
** &amp;lt;code&amp;gt;xps_optimization_gcmc&amp;lt;/code&amp;gt;&lt;br /&gt;
* Note that these simulations have a high chemical potential and (have high &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\gamma&amp;lt;/math&amp;gt; factors), these are just to give a result in a reasonable amount of time. Take care with real simulations.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;core-electron-binding-energy-prediction&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
== Core electron binding energy prediction ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;[mpirun -np N] turbogap predict&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
* We have in our &amp;lt;code&amp;gt;input&amp;lt;/code&amp;gt; file&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre class=&amp;quot;conf&amp;quot;&amp;gt;! Species-specific info&lt;br /&gt;
atoms_file = 'atoms.xyz'&lt;br /&gt;
pot_file = 'gap_files/CO.gap'&lt;br /&gt;
n_species = 2&lt;br /&gt;
species = C O&lt;br /&gt;
masses = 12.01 15.99&lt;br /&gt;
e0 = -.16138053 0.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Output:&lt;br /&gt;
&lt;br /&gt;
; &amp;lt;code&amp;gt;trajectory_out.xyz&amp;lt;/code&amp;gt;&lt;br /&gt;
: which contains atomic positions, local energy and local property arrays for each structure.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt; 512&lt;br /&gt;
Properties=species:S:1:pos:R:3:forces:R:3:local_energy:R:1:core_electron_be:R:1 \&lt;br /&gt;
   Lattice=&amp;quot;...&amp;quot; energy=-4321.582604 energy_soap=-4114.77018429  energy_2b=-124.73820332 energy_3b=0.55261463 \&lt;br /&gt;
   energy_core_pot=0.00000000 energy_vdw=0.00000000 energy_exp=0.00000000 energy_xps=0.00000000 \&lt;br /&gt;
   virial=&amp;quot;...&amp;quot; stress=&amp;quot;...&amp;quot; volume=5372.640346&lt;br /&gt;
   C              4.39625950       7.79414272      11.91703476     \&lt;br /&gt;
                  -0.00176074      -0.00403026       0.00040104    \&lt;br /&gt;
                  -8.32055957 \ # Local energy prediction&lt;br /&gt;
                  283.83841418  # CEBE Prediction&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Withiout specifying Exp. data, Turbogap does not predict the spectra.&lt;br /&gt;
* XPS spectra can simply be calculated from &amp;lt;code&amp;gt;core_electron_be&amp;lt;/code&amp;gt; in &amp;lt;code&amp;gt;trajectory_out.xyz&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;grand-canonical-monte-carlo&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
== (Grand-Canonical) Monte-Carlo ==&lt;br /&gt;
&lt;br /&gt;
* We use &amp;lt;code&amp;gt;mc&amp;lt;/code&amp;gt; mode&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;[mpirun -np N] turbogap mc&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
* ''e.g'' For a &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mu V T&amp;lt;/math&amp;gt; simulation of system in oxygen environment&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre class=&amp;quot;conf&amp;quot;&amp;gt;! Monte-carlo options&lt;br /&gt;
mc_nsteps = 1000                         # Number of Monte-Carlo Steps&lt;br /&gt;
n_mc_types = 3                           # Number of MC move types&lt;br /&gt;
mc_types = 'move' 'insertion' 'removal'  # MC move types (move/insertion/removal/volume/swap/md)&lt;br /&gt;
mc_move_max = 0.5                        # Maximum distance for MC displacement (&amp;amp;quot;move&amp;amp;quot;) type moves&lt;br /&gt;
&lt;br /&gt;
! - GCMC Options&lt;br /&gt;
n_mc_mu = 1              # Number of chemical potentials to add&lt;br /&gt;
mc_mu = 0                # Chemical potential(s) [eV]&lt;br /&gt;
mc_species = 'O'         # GCMC species types&lt;br /&gt;
mc_min_dist = 0.1        # GCMC minimum insertion distance&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Output:&lt;br /&gt;
&lt;br /&gt;
; &amp;lt;code&amp;gt;mc.log&amp;lt;/code&amp;gt;&lt;br /&gt;
: &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;# mc_istep  mc_move  accepted  E_trial              E_current             E_exp_trial          E_exp_current  N_tot_trial  N_mc_species_trial&lt;br /&gt;
       1       move    F       -4321.10376531       -4321.58260476         272.97693282         272.83692252      512  O        0&lt;br /&gt;
       2       move    F       -4321.10017027       -4321.58260476         272.68730901         272.83692252      512  O        0&lt;br /&gt;
       3  insertion    F       -4319.14082561       -4321.58260476         269.49191203         272.83692252      513  O        1&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; &amp;lt;code&amp;gt;mc_all.xyz&amp;lt;/code&amp;gt;&lt;br /&gt;
: xyz file written to every &amp;lt;code&amp;gt;write_xyz = N&amp;lt;/code&amp;gt; steps.&lt;br /&gt;
; &amp;lt;code&amp;gt;mc_current.xyz&amp;lt;/code&amp;gt;&lt;br /&gt;
: xyz file saving current accepted config written to every &amp;lt;code&amp;gt;write_xyz = N&amp;lt;/code&amp;gt; steps.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* If we run &amp;lt;code&amp;gt;bash run.sh standard_gcmc&amp;lt;/code&amp;gt; (may take a few minutes), we can see a prediction of the XPS with oxygen content&lt;br /&gt;
&lt;br /&gt;
[[File:standard_gcmc.png]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;experimental-observable-optimization&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
== Experimental Observable Optimization ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;[mpirun -np N] turbogap mc/md&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
* We can specify experimental observables to predict and optimize them using MC or MD. &amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; E_{\rm spectra} = \frac{1}{2} \gamma \int \,d\varepsilon (g_{\rm pred}(\varepsilon) - g_{\rm exp}(\varepsilon))^2  &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre class=&amp;quot;conf&amp;quot;&amp;gt;! Experimental data options&lt;br /&gt;
n_exp = 1                                  # Number of experimental observables&lt;br /&gt;
exp_labels = 'xps'                         # Experimental observable types (xps/xrd/nd/pdf)&lt;br /&gt;
exp_data_files = 'xps_spectra_interp.dat'  # Experimental data files (Note: the range of resulting XPS prediction will be the same as the experimental range.)&lt;br /&gt;
exp_n_samples = 501                        # Number of interpolations samples over the experimental range.&lt;br /&gt;
exp_energy_scales = 100.0                    # Energy scale (gamma) [eV]&lt;br /&gt;
&lt;br /&gt;
# XPS smearing&lt;br /&gt;
xps_sigma = 0.4&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Output:&lt;br /&gt;
&lt;br /&gt;
; &amp;lt;code&amp;gt;xps_prediction.dat&amp;lt;/code&amp;gt;&lt;br /&gt;
: Data file written every &amp;lt;code&amp;gt;write_xyz = N&amp;lt;/code&amp;gt; steps. Separate predictions separated by blank lines.&lt;br /&gt;
; &amp;lt;code&amp;gt;xps_exp.dat&amp;lt;/code&amp;gt;&lt;br /&gt;
: The experimental data fed into ''TurboGAP''.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* If we run &amp;lt;code&amp;gt;bash run.sh xps_optimization_gcmc&amp;lt;/code&amp;gt; (may take a few minutes), we can see a prediction of the XPS with oxygen content&lt;br /&gt;
&lt;br /&gt;
[[File:xps_optimization_gcmc.png]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;multiple-observables&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
== Multiple Observables ==&lt;br /&gt;
&lt;br /&gt;
* This is not in the tutorial files, but ''TurboGAP'' allows for we can optimization multiple observables.&lt;br /&gt;
** X-ray diffraction&lt;br /&gt;
** Neutron diffraction&lt;br /&gt;
** Pair distribution function&lt;br /&gt;
** XPS&lt;br /&gt;
* Here we show a fictitious example of XPS and XRD optimization.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre class=&amp;quot;conf&amp;quot;&amp;gt;# Partial PDFs needed for XRD calculation&lt;br /&gt;
pair_distribution_n_samples = 301&lt;br /&gt;
r_range_min = 0.1&lt;br /&gt;
r_range_max = 13.5&lt;br /&gt;
pair_distribution_rcut = 14.1&lt;br /&gt;
&lt;br /&gt;
do_xrd = .true.&lt;br /&gt;
&lt;br /&gt;
# Experimental Data Specification&lt;br /&gt;
n_exp = 2                  # Number of Exp. observables&lt;br /&gt;
exp_labels = 'xps' 'xrd'   # Exp. observable type (xps/xrd/nd/pdf)&lt;br /&gt;
exp_data_files = 'xps_spectra_experiment.dat' 'xrd_CO_experiment.dat'&lt;br /&gt;
exp_n_samples = 301 301 # Number of samples for the experimental data&lt;br /&gt;
exp_energy_scales = 10.0 10.0  # The &amp;amp;quot;gamma&amp;amp;quot; term for each observable&lt;br /&gt;
&lt;br /&gt;
# If using monte-carlo, the experimental energies are added directly to the local energy&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;span id=&amp;quot;applications&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
= Applications =&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;experimental-observable-predictionoptimization&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
== Experimental Observable prediction/optimization ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;deconvolution-analysis&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== Deconvolution analysis ===&lt;br /&gt;
&lt;br /&gt;
* Use subgraph isomorphisms of bonding networks to discern motifs present.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:exp_xps_with_background_high.png]]&lt;br /&gt;
&lt;br /&gt;
↑ Experimental XPS deconvolution ([[#citeproc_bib_item_9|Santini et al. 2015]])&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:deconvolution_comparison_fill_-3_new.png]]&lt;br /&gt;
&lt;br /&gt;
↑ Our XPS deconvolution ([[#citeproc_bib_item_9|Santini et al. 2015]])&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:xps_shifts_miguel_first.png]]&lt;br /&gt;
&lt;br /&gt;
[[File:xps_shifts_miguel_last.png]]&lt;br /&gt;
&lt;br /&gt;
We see with oxygen content that sp2 motifs are shifted significantly, even past the sp3 reference. This is why the experimental deconvolution did not give what we expect: sp2 carbon that composes the primary XPS peak. &lt;br /&gt;
&amp;lt;span id=&amp;quot;summary&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Summary =&lt;br /&gt;
&lt;br /&gt;
* Machine-learned potentials can be combined with experimental models to give structures which are consistent with both ''ab-inito'' and experimental data.&lt;br /&gt;
* We can generate oxygenated amorphous carbon structures using a CO GAP with XPS prediction using modified GCMC and a “Molecular Augmented Dynamics” method.&lt;br /&gt;
* We can use ''multiple experimental observables''.&lt;br /&gt;
* '''Finding structures which match experimental data allows us to understand specific experimental results.'''&lt;br /&gt;
* Deconvolve experimental XPS exactly.&lt;br /&gt;
* All of this is implemented in the ''TurboGAP'' code.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;references&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
= References =&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;citeproc_bib_item_1&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;Bartók, Albert P., Risi Kondor, and Gábor Csányi. 2013. “On Representing Chemical Environments.” ''Physical Review B'' 87 (18): 184115. https://doi.org/10.1103/PhysRevB.87.184115.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;citeproc_bib_item_2&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;Bartók, Albert P., Mike C. Payne, Risi Kondor, and Gábor Csányi. 2010. “Gaussian Approximation Potentials: The Accuracy of Quantum Mechanics, without the Electrons.” ''Physical Review Letters'' 104 (13): 136403. https://doi.org/10.1103/PhysRevLett.104.136403.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;citeproc_bib_item_3&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;Caro, Miguel A. 2019. “Optimizing Many-Body Atomic Descriptors for Enhanced Computational Performance of Machine Learning Based Interatomic Potentials.” ''Physical Review B'' 100 (2): 024112. https://doi.org/10.1103/PhysRevB.100.024112.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;citeproc_bib_item_4&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;Deringer, Volker L., Albert P. Bartók, Noam Bernstein, David M. Wilkins, Michele Ceriotti, and Gábor Csányi. 2021. “Gaussian Process Regression for Materials and Molecules.” ''Chemical Reviews'' 121 (16): 10073–141. https://doi.org/10.1021/acs.chemrev.1c00022.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;citeproc_bib_item_5&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;El-Machachi, Zakariya, Damyan Frantzov, A. Nijamudheen, Tigany Zarrouk, Miguel A. Caro, and Volker L. Deringer. 2024. “Accelerated First-Principles Exploration of Structure and Reactivity in Graphene Oxide.” arXiv. https://doi.org/10.48550/arXiv.2405.14814.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;citeproc_bib_item_6&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;Golze, Dorothea, Markus Hirvensalo, Patricia Hernández-León, Anja Aarva, Jarkko Etula, Toma Susi, Patrick Rinke, Tomi Laurila, and Miguel A. Caro. 2022. “Accurate Computational Prediction of Core-Electron Binding Energies in Carbon-Based Materials: A Machine-Learning Model Combining Density-Functional Theory and GW.” ''Chemistry of Materials'' 34 (14): 6240–54. https://doi.org/10.1021/acs.chemmater.1c04279.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;citeproc_bib_item_7&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;Muhli, Heikki, Xi Chen, Albert P. Bartók, Patricia Hernández-León, Gábor Csányi, Tapio Ala-Nissila, and Miguel A. Caro. 2021. “Machine Learning Force Fields Based on Local Parametrization of Dispersion Interactions: Application to the Phase Diagram of \&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathrm\\\C\\\\\_\60\\&amp;lt;/math&amp;gt;.” ''Physical Review B'' 104 (5): 054106. https://doi.org/10.1103/PhysRevB.104.054106.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;citeproc_bib_item_8&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;Opletal, George, Timothy C. Petersen, Amanda S. Barnard, and Salvy P. Russo. 2017. “On Reverse Monte Carlo Constraints and Model Reproduction.” ''Journal of Computational Chemistry'' 38 (17): 1547–51. https://doi.org/10.1002/jcc.24799.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;citeproc_bib_item_9&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;Santini, Claudia A., Abu Sebastian, Chiara Marchiori, Vara Prasad Jonnalagadda, Laurent Dellmann, Wabe W. Koelmans, Marta D. Rossell, Christophe P. Rossel, and Evangelos Eleftheriou. 2015. “Oxygenated Amorphous Carbon for Resistive Memory Applications.” ''Nature Communications'' 6 (1): 8600. https://doi.org/10.1038/ncomms9600.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;citeproc_bib_item_10&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;Wang, Yanzhou, Zheyong Fan, Ping Qian, Tapio Ala-Nissila, and Miguel A. Caro. 2022. “Structure and Pore Size Distribution in Nanoporous Carbon.” ''Chemistry of Materials'' 34 (2): 617–28. https://doi.org/10.1021/acs.chemmater.1c03279.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;citeproc_bib_item_11&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;Zarrouk, Tigany, Rina Ibragimova, Albert P. Bartók, and Miguel A. Caro. 2024. “Experiment-Driven Atomistic Materials Modeling: A Case Study Combining X-Ray Photoelectron Spectroscopy and Machine Learning Potentials to Infer the Structure of Oxygen-Rich Amorphous Carbon.” ''Journal of the American Chemical Society'' 146 (21): 14645–59. https://doi.org/10.1021/jacs.4c01897.&lt;/div&gt;</summary>
		<author><name>Tigany Zarrouk</name></author>
		
	</entry>
	<entry>
		<id>https://turbogap.fi/wiki/index.php?title=File:Xps_shifts_miguel_last.png&amp;diff=643</id>
		<title>File:Xps shifts miguel last.png</title>
		<link rel="alternate" type="text/html" href="https://turbogap.fi/wiki/index.php?title=File:Xps_shifts_miguel_last.png&amp;diff=643"/>
		<updated>2024-06-18T19:36:07Z</updated>

		<summary type="html">&lt;p&gt;Tigany Zarrouk: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Tigany Zarrouk</name></author>
		
	</entry>
	<entry>
		<id>https://turbogap.fi/wiki/index.php?title=File:Xps_shifts_miguel_first.png&amp;diff=642</id>
		<title>File:Xps shifts miguel first.png</title>
		<link rel="alternate" type="text/html" href="https://turbogap.fi/wiki/index.php?title=File:Xps_shifts_miguel_first.png&amp;diff=642"/>
		<updated>2024-06-18T19:35:52Z</updated>

		<summary type="html">&lt;p&gt;Tigany Zarrouk: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Tigany Zarrouk</name></author>
		
	</entry>
	<entry>
		<id>https://turbogap.fi/wiki/index.php?title=File:Exp_xps_with_background_high.png&amp;diff=641</id>
		<title>File:Exp xps with background high.png</title>
		<link rel="alternate" type="text/html" href="https://turbogap.fi/wiki/index.php?title=File:Exp_xps_with_background_high.png&amp;diff=641"/>
		<updated>2024-06-18T19:35:23Z</updated>

		<summary type="html">&lt;p&gt;Tigany Zarrouk: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Tigany Zarrouk</name></author>
		
	</entry>
	<entry>
		<id>https://turbogap.fi/wiki/index.php?title=File:Xps_gcmc_scheme.png&amp;diff=640</id>
		<title>File:Xps gcmc scheme.png</title>
		<link rel="alternate" type="text/html" href="https://turbogap.fi/wiki/index.php?title=File:Xps_gcmc_scheme.png&amp;diff=640"/>
		<updated>2024-06-18T19:34:58Z</updated>

		<summary type="html">&lt;p&gt;Tigany Zarrouk: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Tigany Zarrouk</name></author>
		
	</entry>
	<entry>
		<id>https://turbogap.fi/wiki/index.php?title=File:Miguel_xps_diagram.png&amp;diff=639</id>
		<title>File:Miguel xps diagram.png</title>
		<link rel="alternate" type="text/html" href="https://turbogap.fi/wiki/index.php?title=File:Miguel_xps_diagram.png&amp;diff=639"/>
		<updated>2024-06-18T19:34:30Z</updated>

		<summary type="html">&lt;p&gt;Tigany Zarrouk: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Tigany Zarrouk</name></author>
		
	</entry>
	<entry>
		<id>https://turbogap.fi/wiki/index.php?title=File:Deconvolution_comparison_fill_-3_new.png&amp;diff=638</id>
		<title>File:Deconvolution comparison fill -3 new.png</title>
		<link rel="alternate" type="text/html" href="https://turbogap.fi/wiki/index.php?title=File:Deconvolution_comparison_fill_-3_new.png&amp;diff=638"/>
		<updated>2024-06-18T19:34:04Z</updated>

		<summary type="html">&lt;p&gt;Tigany Zarrouk: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Tigany Zarrouk</name></author>
		
	</entry>
	<entry>
		<id>https://turbogap.fi/wiki/index.php?title=XPS-optimized_oxygenated_amorphous_carbon&amp;diff=637</id>
		<title>XPS-optimized oxygenated amorphous carbon</title>
		<link rel="alternate" type="text/html" href="https://turbogap.fi/wiki/index.php?title=XPS-optimized_oxygenated_amorphous_carbon&amp;diff=637"/>
		<updated>2024-06-18T19:33:39Z</updated>

		<summary type="html">&lt;p&gt;Tigany Zarrouk: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
&amp;lt;span id=&amp;quot;what-is-turbogap&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
= What is ''TurboGAP'' ? =&lt;br /&gt;
&lt;br /&gt;
* ''TurboGAP'' is a &amp;lt;code&amp;gt;Fortran&amp;lt;/code&amp;gt; atomistic code which uses &amp;lt;u&amp;gt;Gaussian Approximation Potentials&amp;lt;/u&amp;gt; (GAPs).&lt;br /&gt;
* Its specialty are ''SOAP turbo'' descriptors: faster and more accurate than SOAP (Smooth Overlap of Atomic Positions).&lt;br /&gt;
* It's (probably!) the fastest SOAP prediction code, which will be made even faster with ''GPU acceleration'' (ongoing with CSC).&lt;br /&gt;
&lt;br /&gt;
[[File:images/Turbogap_logo.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* Through GAP/SOAP predictions, one can perform simulations with ''ab-initio'' accuracy '''at scale'''&lt;br /&gt;
** Molecular Dynamics&lt;br /&gt;
** Grand-Canonical Monte-Carlo simulations&lt;br /&gt;
** Electronic-stopping and spatially-correlated Langevin Dynamics (in-development).&lt;br /&gt;
** '''Prediction/optimization of experimental observables''' (''e.g.'' X-Ray photoelectron spectra ([[#citeproc_bib_item_6|Golze et al. 2022]]; [[#citeproc_bib_item_11|Zarrouk et al. 2024]]), X-ray/Neutron Diffraction and more to come!).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;motivation-for-structural-inference&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
= Motivation for structural inference =&lt;br /&gt;
&lt;br /&gt;
* We typically want to &amp;lt;u&amp;gt;predict structures&amp;lt;/u&amp;gt;, to make sense of experimental data.&lt;br /&gt;
* We usually pray structures have &amp;lt;u&amp;gt;experimental agreement&amp;lt;/u&amp;gt; (a “bottom-up” approach).&lt;br /&gt;
* What if we can &amp;lt;u&amp;gt;promote agreement&amp;lt;/u&amp;gt; with experimental data?&lt;br /&gt;
* ''Reverse Monte-Carlo'' techniques match experimental data to atomic structure (“top-down” approach).&lt;br /&gt;
** Downsides: “By-hand” constraints&lt;br /&gt;
** Simple experimental observables.&lt;br /&gt;
** Unphysical structures/artifacts ([[#citeproc_bib_item_8|Opletal et al. 2017]])&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Need efficient structure search to find '''agreement''' with '''experimental''' data ''and'' '''ab-inito''' data.&lt;br /&gt;
&lt;br /&gt;
# With &amp;lt;u&amp;gt;CO GAP + Core electron binding energy SOAP&amp;lt;/u&amp;gt; model we will perform '''modified (Grand-canonical) Monte-Carlo''' to produce ''experimentally consistent, low energy structures'' of oxygenated amorphous carbon.&lt;br /&gt;
# I will further show preliminary work on *“Molecular Augmented Dynamics”*: generate forces from experimental deviation, to match experimental spectra via MD.&lt;br /&gt;
&lt;br /&gt;
[[File:deconvolution_comparison_fill_-3_new.png]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;theory-and-methods&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
= Theory and Methods =&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;gaussian-approximation-potentials-gap&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
== Gaussian Approximation Potentials (GAP) ==&lt;br /&gt;
&lt;br /&gt;
([[#citeproc_bib_item_2|Bartók et al. 2010]]; [[#citeproc_bib_item_1|Bartók, Kondor, and Csányi 2013]]; [[#citeproc_bib_item_4|Deringer et al. 2021]])&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;u&amp;gt;Assumption&amp;lt;/u&amp;gt;: Total energy is sum of '''local energies'''. &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;E_{\rm total}(\{\mathbf{r}\}) = \sum_i^{N_{\text{atoms}}} \varepsilon^i(\{r\}, \{\xi^{\text{2b}}_i\}, \{\boldsymbol{\xi}^{\text{3b}}_i\}, \boldsymbol{\xi}^{\text{mb}}_i))&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;\begin{align}&lt;br /&gt;
  \varepsilon^i ( &amp;amp;\{r\}, \{\xi^{\text{2b}}_i\}, \{\boldsymbol{\xi}^{\text{3b}}_i\}, \boldsymbol{\xi}^{\text{mb}}_i) =&lt;br /&gt;
   E^{\text{2b}}(\{\xi^{\text{2b}}_i\}) + E^{\text{3b}}(\{\boldsymbol{\xi}^{\text{3b}}_i\}) \nonumber\\&lt;br /&gt;
  &amp;amp; + E^{\text{mb}}(\boldsymbol{\xi}^{\text{mb}}_i)&lt;br /&gt;
  + \sum_{r &amp;lt; r_{\rm cut}^{\rm core}} E^{\text{core}}(r)  \nonumber&lt;br /&gt;
\end{align}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
; Local energy&lt;br /&gt;
: Sum of '''2b, 3b and many-body''' terms.&lt;br /&gt;
; Descriptor &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\xi / \boldsymbol{\xi}&amp;lt;/math&amp;gt;.&lt;br /&gt;
: ''e.g'' &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\{\xi^{\text{2b}}\} = \{r_{ij}\}&amp;lt;/math&amp;gt;, &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\{\boldsymbol{\xi}^{\text{3b}}\} = \{ [ r_{ij}, r_{ik}, r_{kj} ] \}&amp;lt;/math&amp;gt;&lt;br /&gt;
; Local environment&lt;br /&gt;
: A set of descriptors.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;using-descriptors-to-predict-quantities&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== Using descriptors to predict quantities ===&lt;br /&gt;
&lt;br /&gt;
* ''Kernel/basis functions'' &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;k_{ij}(\boldsymbol{\xi}_i, \boldsymbol{\xi}_j)&amp;lt;/math&amp;gt; measure the ''similarity between descriptors''.&lt;br /&gt;
* ''e.g'' Exponential 2b kernel: &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;k^{2b}_{ij}(\xi_i, \xi_j) \equiv k^{2b}_{ij}(r_{i}, r_{j}) = \exp( - (r_{i} - r_{j})^2/2\sigma^2 )&amp;lt;/math&amp;gt;&lt;br /&gt;
* ''Gaussian Process Regression'' (kernel matrix algebra on training set) → ''fitting coefficients'' &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\{\alpha\}&amp;lt;/math&amp;gt;, ([[#citeproc_bib_item_4|Deringer et al. 2021]])&lt;br /&gt;
* ''e.g.'' 2b model trained with &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;N_s&amp;lt;/math&amp;gt; descriptors &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\{\xi\} \in \{\xi_i, \ldots, \xi_{Ns}\}&amp;lt;/math&amp;gt;, the energy for atom with &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;M&amp;lt;/math&amp;gt; pairwise distances in local environment: &amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;E^{2b} = \sum_i^M \left(E^{2b}_0 + \delta^2\sum_j^{N_s}  \alpha_j k^{2b}_{ij}(\xi_i, \xi_j) \right) &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;soap-many-body-descriptor&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== SOAP (many-body) descriptor ===&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;u&amp;gt;SOAP descriptor&amp;lt;/u&amp;gt;: &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\boldsymbol{\xi}_i(\{\mathbf{r}\}_{ &amp;lt; r_{\rm cut}} )&amp;lt;/math&amp;gt;, represents environment of an atom ([[#citeproc_bib_item_2|Bartók et al. 2010]]).&lt;br /&gt;
* &amp;lt;u&amp;gt;Kernel&amp;lt;/u&amp;gt;: &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;k_{ij} = (\boldsymbol{\xi}_i \cdot \boldsymbol{\xi}_j)^{\zeta}&amp;lt;/math&amp;gt; measures &amp;lt;u&amp;gt;similarity of environments&amp;lt;/u&amp;gt;.&lt;br /&gt;
* &amp;lt;u&amp;gt;Fitting coefficients&amp;lt;/u&amp;gt;: &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\alpha_j&amp;lt;/math&amp;gt; result from Gaussian Process Regression.&lt;br /&gt;
* &amp;lt;u&amp;gt;Prediction&amp;lt;/u&amp;gt;: &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;E^{\rm mb}_i(\boldsymbol{\xi}_i) = E^{\rm mb}_0 + \delta^2\sum_j  \alpha_j k_{ij}&amp;lt;/math&amp;gt;&lt;br /&gt;
* For specifics of SOAP turbo, refer to Miguel's paper ([[#citeproc_bib_item_3|Caro 2019]])&lt;br /&gt;
&lt;br /&gt;
← SOAP expansion.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
← Interpolation of DFT PES ([[#citeproc_bib_item_4|Deringer et al. 2021]])&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;how-do-we-model-xps&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
== How do we model XPS? ==&lt;br /&gt;
&lt;br /&gt;
* XPS (X-ray photoelectron spectroscopy) spectra measure '''core electron binding energies'''.&lt;br /&gt;
* Core electron binding energies ''depend on atomic environment''.&lt;br /&gt;
* SOAP turbo model trained on DFT (&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\Delta\text{KS}&amp;lt;/math&amp;gt;) data with a &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;GW&amp;lt;/math&amp;gt; correction on top ([[#citeproc_bib_item_6|Golze et al. 2022]]).&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\text{CEBE} = ( \Delta KS^0_{\rm extended} + GW_{\rm carved} - \Delta \mathrm{KS}^+_{\rm carved} )&amp;lt;/math&amp;gt;&lt;br /&gt;
* Thermal and instrumental broadening accounted for by a Gaussian with &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\sigma = 0.4\text{ eV}&amp;lt;/math&amp;gt;&lt;br /&gt;
* Can analyse environments which make up spectra.&lt;br /&gt;
&lt;br /&gt;
[[File:miguel_xps_diagram.png]]&lt;br /&gt;
&lt;br /&gt;
↑ Diagram of XPS (x-axis is core electron binding energy) ([[#citeproc_bib_item_6|Golze et al. 2022]])&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;prediction-of-local-properties&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
== Prediction of Local Properties ==&lt;br /&gt;
&lt;br /&gt;
* We can predict an &amp;lt;u&amp;gt;arbitrary number&amp;lt;/u&amp;gt; of ''local properties'' which use SOAP turbo descriptors using ''TurboGAP''.&lt;br /&gt;
* /One can get these for “free”/ if local property models are trained using the same descriptors as atomic energies/forces.&lt;br /&gt;
*; ''Hirshfeld volumes''&lt;br /&gt;
*: gives vdW dispersion via Tkatchenko-Scheffler. &amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; E_{\rm TS} = \sum_i \sum_{j\neq i} C_{6, ij}(v_{i}(\boldsymbol{\xi}_i), v_{j}(\boldsymbol{\xi}_j))\frac{f_{\rm damp}(r_{ij}, \ldots)}{r_{ij}^6} &amp;lt;/math&amp;gt;&lt;br /&gt;
*; ''Core-electron binding energies''&lt;br /&gt;
*: give '''X-ray Photoelectron Spectroscopy''' prediction. &amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; g_{\rm xps}(\varepsilon) = \frac{1}{M} \sum_i \exp\left( -(\varepsilon - \varepsilon_{i}(\boldsymbol{\xi}_i))^2/(2\sigma^2)  \right) &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;how-do-we-marry-experimental-data-and-gap&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
== How do we marry experimental data and GAP? ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* '''Generalized Hamiltonian within Grand-Canonical Monte-Carlo''' scheme.&lt;br /&gt;
* Vary oxygen content with chemical potential, to see motif differences.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;  \textcolor{violet}{ \mathbf{\tilde{g}}_{\rm {pred}}}(\varepsilon)  = \sum_{i} \exp\left(&lt;br /&gt;
-\frac{(\varepsilon - \textcolor{blue}{\varepsilon^{i}_{\rm&lt;br /&gt;
{pred}}(\boldsymbol{\xi}_i)})^2}{2\sigma^2}\right)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; \tilde{E} = E_{\rm GAP} + E_{\rm spectra} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; E_{\rm spectra} =  \frac{1}{2}\gamma \int \,d\varepsilon \left( \textcolor{violet}{ g_{\rm pred}(\varepsilon)} - g_{\rm exp}(\varepsilon)\right)^2&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;p&amp;gt;A simple squared difference, which is a penalty with increases with spectra dissimilarity and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\gamma&amp;lt;/math&amp;gt; is an energy scale.&amp;lt;/p&amp;gt;&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;p&amp;gt;We can do not just XPS but also X-ray/neutron diffraction and pair distribution functions.&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;[[File:xps_gcmc_scheme.png]]&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;/ul&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* We use the standard acceptance criteria for adding/removing/moving a particle&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; \mathrm{acc}(N \rightarrow N+1) = \mathrm{min}\left[1,&lt;br /&gt;
\frac{V}{\lambda^3 (N+1)} \exp\left\{ - \frac{\tilde{E}(N+1) -&lt;br /&gt;
\tilde{E}(N) - \mu}{k_BT} \right\}     \right] &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; \mathrm{acc}(N \rightarrow N-1) = \mathrm{min}\left[1,&lt;br /&gt;
\frac{\lambda^3 N}{V} \exp\left\{ -\frac{\tilde{E}(N-1) -&lt;br /&gt;
\tilde{E}(N) + \mu}{k_BT} \right\}     \right] &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; \mathrm{acc}_{\rm move} = \mathrm{min }\left[ 1, \exp\left\{ -&lt;br /&gt;
  \frac{\tilde{E}(\mathrm{new}) - \tilde{E}(\mathrm{old})}{k_BT} \right\} \right]&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;usage&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
= Usage =&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;installing-turbogap&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
== Installing ''TurboGAP'' ==&lt;br /&gt;
&lt;br /&gt;
We can install the ''TurboGAP'' code, found here https://github.com/mcaroba/turbogap through ''recursively cloning'' the main branch&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;git clone --recursive https://github.com/mcaroba/turbogap.git&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
Then we edit this line in the &amp;lt;code&amp;gt;Makefile&amp;lt;/code&amp;gt; to match our system architecture.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;include makefiles/Makefile.Ubuntu_gfortran_mpi&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Then, we make&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;make&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
and then export the path in &amp;lt;code&amp;gt;.bashrc&amp;lt;/code&amp;gt; file&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;export PATH=&amp;quot;~/turbogap/bin:$PATH&amp;quot;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;span id=&amp;quot;what-you-need-for-a-calculation&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
== What you need for a calculation ==&lt;br /&gt;
&lt;br /&gt;
; &amp;lt;code&amp;gt;gap_files/&amp;lt;/code&amp;gt; directory&lt;br /&gt;
: The directory which contains your &amp;lt;code&amp;gt;*.gap&amp;lt;/code&amp;gt;, with alphas (fitting coefficients) and sparse set descriptor files.&lt;br /&gt;
;* Potentials are available from ''TurboGAP'' wiki https://turbogap.fi/wiki/index.php/Potentials&lt;br /&gt;
;* Conversion script from &amp;lt;code&amp;gt;gap_fit .xml&amp;lt;/code&amp;gt; to &amp;lt;code&amp;gt;.gap&amp;lt;/code&amp;gt; can be used &amp;lt;code&amp;gt;turbogap/tools/make_gap_files.py&amp;lt;/code&amp;gt;&lt;br /&gt;
; &amp;lt;code&amp;gt;input&amp;lt;/code&amp;gt; file&lt;br /&gt;
: The file which tells the code what to do&lt;br /&gt;
; &amp;lt;code&amp;gt;*.xyz&amp;lt;/code&amp;gt;&lt;br /&gt;
: An extended xyz format file which contains positions/lattice/velocity information.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;adding-a-local-property-model-for-cebe-prediction&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== Adding a local property model for CEBE prediction ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;  gap_beg soap_turbo&lt;br /&gt;
  n_species = 2&lt;br /&gt;
  species = C O&lt;br /&gt;
  central_species = 1&lt;br /&gt;
... some params ...&lt;br /&gt;
  zeta = 4&lt;br /&gt;
  delta = 0.1&lt;br /&gt;
  desc_sparse = &amp;quot;gap_files/CO.xml.sparseX.GAP_2022_5_19_180_7_17_31_41410&amp;quot;&lt;br /&gt;
  alphas_sparse = &amp;quot;gap_files/alphas_soap_turbo_1.dat&amp;quot;&lt;br /&gt;
  compress_mode = &amp;quot;trivial&amp;quot;&lt;br /&gt;
  has_local_properties = .true.&lt;br /&gt;
  n_local_properties = 1&lt;br /&gt;
  local_property_qs = 'gap_files/core_electron_be.xml.sparseX.GAP_2024_1_26_120_18_36_33_6091'&lt;br /&gt;
  local_property_alphas = 'gap_files/alphas_core_electron_be_1.dat'&lt;br /&gt;
  local_property_labels = 'core_electron_be'&lt;br /&gt;
  local_property_zetas = 2&lt;br /&gt;
  local_property_deltas = 1.0&lt;br /&gt;
  local_property_v0s = 290.0&lt;br /&gt;
  gap_end&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;span id=&amp;quot;conversion-of-gap_fit-.xml-files-to-.gap-format&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== Conversion of &amp;lt;code&amp;gt;gap_fit&amp;lt;/code&amp;gt; &amp;lt;code&amp;gt;*.xml&amp;lt;/code&amp;gt; files to &amp;lt;code&amp;gt;*.gap&amp;lt;/code&amp;gt; format ===&lt;br /&gt;
&lt;br /&gt;
* Then we convert the &amp;lt;code&amp;gt;*.xml&amp;lt;/code&amp;gt; files which result from &amp;lt;code&amp;gt;gap_fit&amp;lt;/code&amp;gt; into the required format for ''TurboGAP''.&lt;br /&gt;
* This is done using the convenience script in &amp;lt;code&amp;gt;turbogap/tools/make_gap_files.py&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;python3 make_gap_files.py {gap_file.xml} {gap_file.gap} {N_local_prop.} \&lt;br /&gt;
              {local_prop1.xml} {local_prop_label1} \&lt;br /&gt;
              {local_prop2.xml} {local_prop_label2}...&lt;br /&gt;
# e.g. let's build a carbon oxygen GAP&lt;br /&gt;
# with core electron binding energy prediction capability.&lt;br /&gt;
python3 make_gap_files.py CO.xml CO.gap 1 \&lt;br /&gt;
        core_electron_be_co.xml core_electron_be&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
* This creates a directory &amp;lt;code&amp;gt;gap_files/&amp;lt;/code&amp;gt; which has&lt;br /&gt;
*# &amp;lt;code&amp;gt;alphas_{descriptor}.dat&amp;lt;/code&amp;gt; which are fitting coefficients for a particular descriptor&lt;br /&gt;
*# &amp;lt;code&amp;gt;qs_{descriptor}.dat&amp;lt;/code&amp;gt; which are the '''sparse set''' descriptors, used for prediction.&lt;br /&gt;
*# &amp;lt;code&amp;gt;alphas_{local_property}.dat&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;qs_{local_property}.dat&amp;lt;/code&amp;gt; for local property prediction.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;running-the-tutorial&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
== Running the Tutorial ==&lt;br /&gt;
&lt;br /&gt;
* Navigate to &amp;lt;code&amp;gt;turbogap/tutorials/xps_optimizaton&amp;lt;/code&amp;gt;&lt;br /&gt;
* Run &amp;lt;code&amp;gt;bash run.sh {calc_type}&amp;lt;/code&amp;gt; where &amp;lt;code&amp;gt;{calc_type}&amp;lt;/code&amp;gt; is either:&lt;br /&gt;
** &amp;lt;code&amp;gt;prediction&amp;lt;/code&amp;gt;&lt;br /&gt;
** &amp;lt;code&amp;gt;standard_gcmc&amp;lt;/code&amp;gt;&lt;br /&gt;
** &amp;lt;code&amp;gt;xps_optimization_gcmc&amp;lt;/code&amp;gt;&lt;br /&gt;
* Note that these simulations have a high chemical potential and (have high &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\gamma&amp;lt;/math&amp;gt; factors), these are just to give a result in a reasonable amount of time. Take care with real simulations.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;core-electron-binding-energy-prediction&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
== Core electron binding energy prediction ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;[mpirun -np N] turbogap predict&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
* We have in our &amp;lt;code&amp;gt;input&amp;lt;/code&amp;gt; file&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre class=&amp;quot;conf&amp;quot;&amp;gt;! Species-specific info&lt;br /&gt;
atoms_file = 'atoms.xyz'&lt;br /&gt;
pot_file = 'gap_files/CO.gap'&lt;br /&gt;
n_species = 2&lt;br /&gt;
species = C O&lt;br /&gt;
masses = 12.01 15.99&lt;br /&gt;
e0 = -.16138053 0.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Output:&lt;br /&gt;
&lt;br /&gt;
; &amp;lt;code&amp;gt;trajectory_out.xyz&amp;lt;/code&amp;gt;&lt;br /&gt;
: which contains atomic positions, local energy and local property arrays for each structure.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt; 512&lt;br /&gt;
Properties=species:S:1:pos:R:3:forces:R:3:local_energy:R:1:core_electron_be:R:1 \&lt;br /&gt;
   Lattice=&amp;quot;...&amp;quot; energy=-4321.582604 energy_soap=-4114.77018429  energy_2b=-124.73820332 energy_3b=0.55261463 \&lt;br /&gt;
   energy_core_pot=0.00000000 energy_vdw=0.00000000 energy_exp=0.00000000 energy_xps=0.00000000 \&lt;br /&gt;
   virial=&amp;quot;...&amp;quot; stress=&amp;quot;...&amp;quot; volume=5372.640346&lt;br /&gt;
   C              4.39625950       7.79414272      11.91703476     \&lt;br /&gt;
                  -0.00176074      -0.00403026       0.00040104    \&lt;br /&gt;
                  -8.32055957 \ # Local energy prediction&lt;br /&gt;
                  283.83841418  # CEBE Prediction&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Withiout specifying Exp. data, Turbogap does not predict the spectra.&lt;br /&gt;
* XPS spectra can simply be calculated from &amp;lt;code&amp;gt;core_electron_be&amp;lt;/code&amp;gt; in &amp;lt;code&amp;gt;trajectory_out.xyz&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;grand-canonical-monte-carlo&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
== (Grand-Canonical) Monte-Carlo ==&lt;br /&gt;
&lt;br /&gt;
* We use &amp;lt;code&amp;gt;mc&amp;lt;/code&amp;gt; mode&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;[mpirun -np N] turbogap mc&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
* ''e.g'' For a &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mu V T&amp;lt;/math&amp;gt; simulation of system in oxygen environment&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre class=&amp;quot;conf&amp;quot;&amp;gt;! Monte-carlo options&lt;br /&gt;
mc_nsteps = 1000                         # Number of Monte-Carlo Steps&lt;br /&gt;
n_mc_types = 3                           # Number of MC move types&lt;br /&gt;
mc_types = 'move' 'insertion' 'removal'  # MC move types (move/insertion/removal/volume/swap/md)&lt;br /&gt;
mc_move_max = 0.5                        # Maximum distance for MC displacement (&amp;amp;quot;move&amp;amp;quot;) type moves&lt;br /&gt;
&lt;br /&gt;
! - GCMC Options&lt;br /&gt;
n_mc_mu = 1              # Number of chemical potentials to add&lt;br /&gt;
mc_mu = 0                # Chemical potential(s) [eV]&lt;br /&gt;
mc_species = 'O'         # GCMC species types&lt;br /&gt;
mc_min_dist = 0.1        # GCMC minimum insertion distance&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Output:&lt;br /&gt;
&lt;br /&gt;
; &amp;lt;code&amp;gt;mc.log&amp;lt;/code&amp;gt;&lt;br /&gt;
: &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;# mc_istep  mc_move  accepted  E_trial              E_current             E_exp_trial          E_exp_current  N_tot_trial  N_mc_species_trial&lt;br /&gt;
       1       move    F       -4321.10376531       -4321.58260476         272.97693282         272.83692252      512  O        0&lt;br /&gt;
       2       move    F       -4321.10017027       -4321.58260476         272.68730901         272.83692252      512  O        0&lt;br /&gt;
       3  insertion    F       -4319.14082561       -4321.58260476         269.49191203         272.83692252      513  O        1&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; &amp;lt;code&amp;gt;mc_all.xyz&amp;lt;/code&amp;gt;&lt;br /&gt;
: xyz file written to every &amp;lt;code&amp;gt;write_xyz = N&amp;lt;/code&amp;gt; steps.&lt;br /&gt;
; &amp;lt;code&amp;gt;mc_current.xyz&amp;lt;/code&amp;gt;&lt;br /&gt;
: xyz file saving current accepted config written to every &amp;lt;code&amp;gt;write_xyz = N&amp;lt;/code&amp;gt; steps.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* If we run &amp;lt;code&amp;gt;bash run.sh standard_gcmc&amp;lt;/code&amp;gt; (may take a few minutes), we can see a prediction of the XPS with oxygen content&lt;br /&gt;
&lt;br /&gt;
[[File:standard_gcmc.png]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;experimental-observable-optimization&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
== Experimental Observable Optimization ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;[mpirun -np N] turbogap mc/md&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
* We can specify experimental observables to predict and optimize them using MC or MD. &amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; E_{\rm spectra} = \frac{1}{2} \gamma \int \,d\varepsilon (g_{\rm pred}(\varepsilon) - g_{\rm exp}(\varepsilon))^2  &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre class=&amp;quot;conf&amp;quot;&amp;gt;! Experimental data options&lt;br /&gt;
n_exp = 1                                  # Number of experimental observables&lt;br /&gt;
exp_labels = 'xps'                         # Experimental observable types (xps/xrd/nd/pdf)&lt;br /&gt;
exp_data_files = 'xps_spectra_interp.dat'  # Experimental data files (Note: the range of resulting XPS prediction will be the same as the experimental range.)&lt;br /&gt;
exp_n_samples = 501                        # Number of interpolations samples over the experimental range.&lt;br /&gt;
exp_energy_scales = 100.0                    # Energy scale (gamma) [eV]&lt;br /&gt;
&lt;br /&gt;
# XPS smearing&lt;br /&gt;
xps_sigma = 0.4&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Output:&lt;br /&gt;
&lt;br /&gt;
; &amp;lt;code&amp;gt;xps_prediction.dat&amp;lt;/code&amp;gt;&lt;br /&gt;
: Data file written every &amp;lt;code&amp;gt;write_xyz = N&amp;lt;/code&amp;gt; steps. Separate predictions separated by blank lines.&lt;br /&gt;
; &amp;lt;code&amp;gt;xps_exp.dat&amp;lt;/code&amp;gt;&lt;br /&gt;
: The experimental data fed into ''TurboGAP''.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* If we run &amp;lt;code&amp;gt;bash run.sh xps_optimization_gcmc&amp;lt;/code&amp;gt; (may take a few minutes), we can see a prediction of the XPS with oxygen content&lt;br /&gt;
&lt;br /&gt;
[[File:xps_optimization_gcmc.png]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;multiple-observables&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
== Multiple Observables ==&lt;br /&gt;
&lt;br /&gt;
* This is not in the tutorial files, but ''TurboGAP'' allows for we can optimization multiple observables.&lt;br /&gt;
** X-ray diffraction&lt;br /&gt;
** Neutron diffraction&lt;br /&gt;
** Pair distribution function&lt;br /&gt;
** XPS&lt;br /&gt;
* Here we show a fictitious example of XPS and XRD optimization.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre class=&amp;quot;conf&amp;quot;&amp;gt;# Partial PDFs needed for XRD calculation&lt;br /&gt;
pair_distribution_n_samples = 301&lt;br /&gt;
r_range_min = 0.1&lt;br /&gt;
r_range_max = 13.5&lt;br /&gt;
pair_distribution_rcut = 14.1&lt;br /&gt;
&lt;br /&gt;
do_xrd = .true.&lt;br /&gt;
&lt;br /&gt;
# Experimental Data Specification&lt;br /&gt;
n_exp = 2                  # Number of Exp. observables&lt;br /&gt;
exp_labels = 'xps' 'xrd'   # Exp. observable type (xps/xrd/nd/pdf)&lt;br /&gt;
exp_data_files = 'xps_spectra_experiment.dat' 'xrd_CO_experiment.dat'&lt;br /&gt;
exp_n_samples = 301 301 # Number of samples for the experimental data&lt;br /&gt;
exp_energy_scales = 10.0 10.0  # The &amp;amp;quot;gamma&amp;amp;quot; term for each observable&lt;br /&gt;
&lt;br /&gt;
# If using monte-carlo, the experimental energies are added directly to the local energy&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;span id=&amp;quot;applications&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
= Applications =&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;experimental-observable-predictionoptimization&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
== Experimental Observable prediction/optimization ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;deconvolution-analysis&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== Deconvolution analysis ===&lt;br /&gt;
&lt;br /&gt;
* Use subgraph isomorphisms of bonding networks to discern motifs present.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:exp_xps_with_background_high.png]]&lt;br /&gt;
&lt;br /&gt;
↑ Experimental XPS deconvolution ([[#citeproc_bib_item_9|Santini et al. 2015]])&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:deconvolution_comparison_fill_-3_new.png]]&lt;br /&gt;
&lt;br /&gt;
↑ Our XPS deconvolution ([[#citeproc_bib_item_9|Santini et al. 2015]])&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:xps_shifts_miguel_first.png]]&lt;br /&gt;
&lt;br /&gt;
[[File:xps_shifts_miguel_last.png]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;reduced-graphene-oxide---exp.-prediction&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== Reduced graphene oxide - Exp. prediction ===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
([[#citeproc_bib_item_5|El-Machachi et al. 2024]])&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;grand-canonical-monte-carlo---exp.-optimization&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== Grand-Canonical Monte-Carlo - Exp. optimization ===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;molecular-augmented-dynamics-mad---md-with-experimental-forces&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== Molecular Augmented Dynamics ('''MAD''') - MD with ''Experimental Forces'' ===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;summary&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
= Summary =&lt;br /&gt;
&lt;br /&gt;
* Machine-learned potentials can be combined with experimental models to give structures which are consistent with both ''ab-inito'' and experimental data.&lt;br /&gt;
* We can generate oxygenated amorphous carbon structures using a CO GAP with XPS prediction using modified GCMC and a “Molecular Augmented Dynamics” method.&lt;br /&gt;
* We can use ''multiple experimental observables''.&lt;br /&gt;
* '''Finding structures which match experimental data allows us to understand specific experimental results.'''&lt;br /&gt;
* Deconvolve experimental XPS exactly.&lt;br /&gt;
* All of this is implemented in the ''TurboGAP'' code.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;references&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
= References =&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;citeproc_bib_item_1&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;Bartók, Albert P., Risi Kondor, and Gábor Csányi. 2013. “On Representing Chemical Environments.” ''Physical Review B'' 87 (18): 184115. https://doi.org/10.1103/PhysRevB.87.184115.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;citeproc_bib_item_2&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;Bartók, Albert P., Mike C. Payne, Risi Kondor, and Gábor Csányi. 2010. “Gaussian Approximation Potentials: The Accuracy of Quantum Mechanics, without the Electrons.” ''Physical Review Letters'' 104 (13): 136403. https://doi.org/10.1103/PhysRevLett.104.136403.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;citeproc_bib_item_3&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;Caro, Miguel A. 2019. “Optimizing Many-Body Atomic Descriptors for Enhanced Computational Performance of Machine Learning Based Interatomic Potentials.” ''Physical Review B'' 100 (2): 024112. https://doi.org/10.1103/PhysRevB.100.024112.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;citeproc_bib_item_4&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;Deringer, Volker L., Albert P. Bartók, Noam Bernstein, David M. Wilkins, Michele Ceriotti, and Gábor Csányi. 2021. “Gaussian Process Regression for Materials and Molecules.” ''Chemical Reviews'' 121 (16): 10073–141. https://doi.org/10.1021/acs.chemrev.1c00022.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;citeproc_bib_item_5&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;El-Machachi, Zakariya, Damyan Frantzov, A. Nijamudheen, Tigany Zarrouk, Miguel A. Caro, and Volker L. Deringer. 2024. “Accelerated First-Principles Exploration of Structure and Reactivity in Graphene Oxide.” arXiv. https://doi.org/10.48550/arXiv.2405.14814.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;citeproc_bib_item_6&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;Golze, Dorothea, Markus Hirvensalo, Patricia Hernández-León, Anja Aarva, Jarkko Etula, Toma Susi, Patrick Rinke, Tomi Laurila, and Miguel A. Caro. 2022. “Accurate Computational Prediction of Core-Electron Binding Energies in Carbon-Based Materials: A Machine-Learning Model Combining Density-Functional Theory and GW.” ''Chemistry of Materials'' 34 (14): 6240–54. https://doi.org/10.1021/acs.chemmater.1c04279.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;citeproc_bib_item_7&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;Muhli, Heikki, Xi Chen, Albert P. Bartók, Patricia Hernández-León, Gábor Csányi, Tapio Ala-Nissila, and Miguel A. Caro. 2021. “Machine Learning Force Fields Based on Local Parametrization of Dispersion Interactions: Application to the Phase Diagram of \&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathrm\\\C\\\\\_\60\\&amp;lt;/math&amp;gt;.” ''Physical Review B'' 104 (5): 054106. https://doi.org/10.1103/PhysRevB.104.054106.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;citeproc_bib_item_8&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;Opletal, George, Timothy C. Petersen, Amanda S. Barnard, and Salvy P. Russo. 2017. “On Reverse Monte Carlo Constraints and Model Reproduction.” ''Journal of Computational Chemistry'' 38 (17): 1547–51. https://doi.org/10.1002/jcc.24799.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;citeproc_bib_item_9&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;Santini, Claudia A., Abu Sebastian, Chiara Marchiori, Vara Prasad Jonnalagadda, Laurent Dellmann, Wabe W. Koelmans, Marta D. Rossell, Christophe P. Rossel, and Evangelos Eleftheriou. 2015. “Oxygenated Amorphous Carbon for Resistive Memory Applications.” ''Nature Communications'' 6 (1): 8600. https://doi.org/10.1038/ncomms9600.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;citeproc_bib_item_10&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;Wang, Yanzhou, Zheyong Fan, Ping Qian, Tapio Ala-Nissila, and Miguel A. Caro. 2022. “Structure and Pore Size Distribution in Nanoporous Carbon.” ''Chemistry of Materials'' 34 (2): 617–28. https://doi.org/10.1021/acs.chemmater.1c03279.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;citeproc_bib_item_11&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;Zarrouk, Tigany, Rina Ibragimova, Albert P. Bartók, and Miguel A. Caro. 2024. “Experiment-Driven Atomistic Materials Modeling: A Case Study Combining X-Ray Photoelectron Spectroscopy and Machine Learning Potentials to Infer the Structure of Oxygen-Rich Amorphous Carbon.” ''Journal of the American Chemical Society'' 146 (21): 14645–59. https://doi.org/10.1021/jacs.4c01897.&lt;/div&gt;</summary>
		<author><name>Tigany Zarrouk</name></author>
		
	</entry>
	<entry>
		<id>https://turbogap.fi/wiki/index.php?title=XPS-optimized_oxygenated_amorphous_carbon&amp;diff=636</id>
		<title>XPS-optimized oxygenated amorphous carbon</title>
		<link rel="alternate" type="text/html" href="https://turbogap.fi/wiki/index.php?title=XPS-optimized_oxygenated_amorphous_carbon&amp;diff=636"/>
		<updated>2024-06-18T19:32:24Z</updated>

		<summary type="html">&lt;p&gt;Tigany Zarrouk: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
&amp;lt;span id=&amp;quot;table-of-contents&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
= Table of Contents =&lt;br /&gt;
# Introduction&lt;br /&gt;
# Theory/Methods&lt;br /&gt;
# How to use ''TurboGAP''&lt;br /&gt;
## Generalities&lt;br /&gt;
## Predicting core electron binding energies&lt;br /&gt;
## Optimizing an XPS spectrum&lt;br /&gt;
## Optimizing Multiple Observables&lt;br /&gt;
# Applications&lt;br /&gt;
## GCMC optimization of C1s XPS spectrum&lt;br /&gt;
## Molecular Augmented Dynamics optimization&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;what-is-turbogap&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
= What is ''TurboGAP'' ? =&lt;br /&gt;
&lt;br /&gt;
* ''TurboGAP'' is a &amp;lt;code&amp;gt;Fortran&amp;lt;/code&amp;gt; atomistic code which uses &amp;lt;u&amp;gt;Gaussian Approximation Potentials&amp;lt;/u&amp;gt; (GAPs).&lt;br /&gt;
* Its specialty are ''SOAP turbo'' descriptors: faster and more accurate than SOAP (Smooth Overlap of Atomic Positions).&lt;br /&gt;
* It's (probably!) the fastest SOAP prediction code, which will be made even faster with ''GPU acceleration'' (ongoing with CSC).&lt;br /&gt;
&lt;br /&gt;
[[File:images/Turbogap_logo.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* Through GAP/SOAP predictions, one can perform simulations with ''ab-initio'' accuracy '''at scale'''&lt;br /&gt;
** Molecular Dynamics&lt;br /&gt;
** Grand-Canonical Monte-Carlo simulations&lt;br /&gt;
** Electronic-stopping and spatially-correlated Langevin Dynamics (in-development).&lt;br /&gt;
** '''Prediction/optimization of experimental observables''' (''e.g.'' X-Ray photoelectron spectra ([[#citeproc_bib_item_6|Golze et al. 2022]]; [[#citeproc_bib_item_11|Zarrouk et al. 2024]]), X-ray/Neutron Diffraction and more to come!).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;motivation-for-structural-inference&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
= Motivation for structural inference =&lt;br /&gt;
&lt;br /&gt;
* We typically want to &amp;lt;u&amp;gt;predict structures&amp;lt;/u&amp;gt;, to make sense of experimental data.&lt;br /&gt;
* We usually pray structures have &amp;lt;u&amp;gt;experimental agreement&amp;lt;/u&amp;gt; (a “bottom-up” approach).&lt;br /&gt;
* What if we can &amp;lt;u&amp;gt;promote agreement&amp;lt;/u&amp;gt; with experimental data?&lt;br /&gt;
* ''Reverse Monte-Carlo'' techniques match experimental data to atomic structure (“top-down” approach).&lt;br /&gt;
** Downsides: “By-hand” constraints&lt;br /&gt;
** Simple experimental observables.&lt;br /&gt;
** Unphysical structures/artifacts ([[#citeproc_bib_item_8|Opletal et al. 2017]])&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Need efficient structure search to find '''agreement''' with '''experimental''' data ''and'' '''ab-inito''' data.&lt;br /&gt;
&lt;br /&gt;
# With &amp;lt;u&amp;gt;CO GAP + Core electron binding energy SOAP&amp;lt;/u&amp;gt; model we will perform '''modified (Grand-canonical) Monte-Carlo''' to produce ''experimentally consistent, low energy structures'' of oxygenated amorphous carbon.&lt;br /&gt;
# I will further show preliminary work on *“Molecular Augmented Dynamics”*: generate forces from experimental deviation, to match experimental spectra via MD.&lt;br /&gt;
&lt;br /&gt;
[[File:deconvolution_comparison_fill_-3_new.png]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;theory-and-methods&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
= Theory and Methods =&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;gaussian-approximation-potentials-gap&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
== Gaussian Approximation Potentials (GAP) ==&lt;br /&gt;
&lt;br /&gt;
([[#citeproc_bib_item_2|Bartók et al. 2010]]; [[#citeproc_bib_item_1|Bartók, Kondor, and Csányi 2013]]; [[#citeproc_bib_item_4|Deringer et al. 2021]])&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;u&amp;gt;Assumption&amp;lt;/u&amp;gt;: Total energy is sum of '''local energies'''. &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;E_{\rm total}(\{\mathbf{r}\}) = \sum_i^{N_{\text{atoms}}} \varepsilon^i(\{r\}, \{\xi^{\text{2b}}_i\}, \{\boldsymbol{\xi}^{\text{3b}}_i\}, \boldsymbol{\xi}^{\text{mb}}_i))&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;\begin{align}&lt;br /&gt;
  \varepsilon^i ( &amp;amp;\{r\}, \{\xi^{\text{2b}}_i\}, \{\boldsymbol{\xi}^{\text{3b}}_i\}, \boldsymbol{\xi}^{\text{mb}}_i) =&lt;br /&gt;
   E^{\text{2b}}(\{\xi^{\text{2b}}_i\}) + E^{\text{3b}}(\{\boldsymbol{\xi}^{\text{3b}}_i\}) \nonumber\\&lt;br /&gt;
  &amp;amp; + E^{\text{mb}}(\boldsymbol{\xi}^{\text{mb}}_i)&lt;br /&gt;
  + \sum_{r &amp;lt; r_{\rm cut}^{\rm core}} E^{\text{core}}(r)  \nonumber&lt;br /&gt;
\end{align}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
; Local energy&lt;br /&gt;
: Sum of '''2b, 3b and many-body''' terms.&lt;br /&gt;
; Descriptor &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\xi / \boldsymbol{\xi}&amp;lt;/math&amp;gt;.&lt;br /&gt;
: ''e.g'' &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\{\xi^{\text{2b}}\} = \{r_{ij}\}&amp;lt;/math&amp;gt;, &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\{\boldsymbol{\xi}^{\text{3b}}\} = \{ [ r_{ij}, r_{ik}, r_{kj} ] \}&amp;lt;/math&amp;gt;&lt;br /&gt;
; Local environment&lt;br /&gt;
: A set of descriptors.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;using-descriptors-to-predict-quantities&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== Using descriptors to predict quantities ===&lt;br /&gt;
&lt;br /&gt;
* ''Kernel/basis functions'' &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;k_{ij}(\boldsymbol{\xi}_i, \boldsymbol{\xi}_j)&amp;lt;/math&amp;gt; measure the ''similarity between descriptors''.&lt;br /&gt;
* ''e.g'' Exponential 2b kernel: &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;k^{2b}_{ij}(\xi_i, \xi_j) \equiv k^{2b}_{ij}(r_{i}, r_{j}) = \exp( - (r_{i} - r_{j})^2/2\sigma^2 )&amp;lt;/math&amp;gt;&lt;br /&gt;
* ''Gaussian Process Regression'' (kernel matrix algebra on training set) → ''fitting coefficients'' &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\{\alpha\}&amp;lt;/math&amp;gt;, ([[#citeproc_bib_item_4|Deringer et al. 2021]])&lt;br /&gt;
* ''e.g.'' 2b model trained with &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;N_s&amp;lt;/math&amp;gt; descriptors &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\{\xi\} \in \{\xi_i, \ldots, \xi_{Ns}\}&amp;lt;/math&amp;gt;, the energy for atom with &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;M&amp;lt;/math&amp;gt; pairwise distances in local environment: &amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;E^{2b} = \sum_i^M \left(E^{2b}_0 + \delta^2\sum_j^{N_s}  \alpha_j k^{2b}_{ij}(\xi_i, \xi_j) \right) &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;soap-many-body-descriptor&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== SOAP (many-body) descriptor ===&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;u&amp;gt;SOAP descriptor&amp;lt;/u&amp;gt;: &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\boldsymbol{\xi}_i(\{\mathbf{r}\}_{ &amp;lt; r_{\rm cut}} )&amp;lt;/math&amp;gt;, represents environment of an atom ([[#citeproc_bib_item_2|Bartók et al. 2010]]).&lt;br /&gt;
* &amp;lt;u&amp;gt;Kernel&amp;lt;/u&amp;gt;: &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;k_{ij} = (\boldsymbol{\xi}_i \cdot \boldsymbol{\xi}_j)^{\zeta}&amp;lt;/math&amp;gt; measures &amp;lt;u&amp;gt;similarity of environments&amp;lt;/u&amp;gt;.&lt;br /&gt;
* &amp;lt;u&amp;gt;Fitting coefficients&amp;lt;/u&amp;gt;: &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\alpha_j&amp;lt;/math&amp;gt; result from Gaussian Process Regression.&lt;br /&gt;
* &amp;lt;u&amp;gt;Prediction&amp;lt;/u&amp;gt;: &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;E^{\rm mb}_i(\boldsymbol{\xi}_i) = E^{\rm mb}_0 + \delta^2\sum_j  \alpha_j k_{ij}&amp;lt;/math&amp;gt;&lt;br /&gt;
* For specifics of SOAP turbo, refer to Miguel's paper ([[#citeproc_bib_item_3|Caro 2019]])&lt;br /&gt;
&lt;br /&gt;
← SOAP expansion.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
← Interpolation of DFT PES ([[#citeproc_bib_item_4|Deringer et al. 2021]])&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;how-do-we-model-xps&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
== How do we model XPS? ==&lt;br /&gt;
&lt;br /&gt;
* XPS (X-ray photoelectron spectroscopy) spectra measure '''core electron binding energies'''.&lt;br /&gt;
* Core electron binding energies ''depend on atomic environment''.&lt;br /&gt;
* SOAP turbo model trained on DFT (&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\Delta\text{KS}&amp;lt;/math&amp;gt;) data with a &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;GW&amp;lt;/math&amp;gt; correction on top ([[#citeproc_bib_item_6|Golze et al. 2022]]).&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\text{CEBE} = ( \Delta KS^0_{\rm extended} + GW_{\rm carved} - \Delta \mathrm{KS}^+_{\rm carved} )&amp;lt;/math&amp;gt;&lt;br /&gt;
* Thermal and instrumental broadening accounted for by a Gaussian with &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\sigma = 0.4\text{ eV}&amp;lt;/math&amp;gt;&lt;br /&gt;
* Can analyse environments which make up spectra.&lt;br /&gt;
&lt;br /&gt;
[[File:miguel_xps_diagram.png]]&lt;br /&gt;
&lt;br /&gt;
↑ Diagram of XPS (x-axis is core electron binding energy) ([[#citeproc_bib_item_6|Golze et al. 2022]])&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;prediction-of-local-properties&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
== Prediction of Local Properties ==&lt;br /&gt;
&lt;br /&gt;
* We can predict an &amp;lt;u&amp;gt;arbitrary number&amp;lt;/u&amp;gt; of ''local properties'' which use SOAP turbo descriptors using ''TurboGAP''.&lt;br /&gt;
* /One can get these for “free”/ if local property models are trained using the same descriptors as atomic energies/forces.&lt;br /&gt;
*; ''Hirshfeld volumes''&lt;br /&gt;
*: gives vdW dispersion via Tkatchenko-Scheffler. &amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; E_{\rm TS} = \sum_i \sum_{j\neq i} C_{6, ij}(v_{i}(\boldsymbol{\xi}_i), v_{j}(\boldsymbol{\xi}_j))\frac{f_{\rm damp}(r_{ij}, \ldots)}{r_{ij}^6} &amp;lt;/math&amp;gt;&lt;br /&gt;
*; ''Core-electron binding energies''&lt;br /&gt;
*: give '''X-ray Photoelectron Spectroscopy''' prediction. &amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; g_{\rm xps}(\varepsilon) = \frac{1}{M} \sum_i \exp\left( -(\varepsilon - \varepsilon_{i}(\boldsymbol{\xi}_i))^2/(2\sigma^2)  \right) &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;how-do-we-marry-experimental-data-and-gap&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
== How do we marry experimental data and GAP? ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* '''Generalized Hamiltonian within Grand-Canonical Monte-Carlo''' scheme.&lt;br /&gt;
* Vary oxygen content with chemical potential, to see motif differences.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;  \textcolor{violet}{ \mathbf{\tilde{g}}_{\rm {pred}}}(\varepsilon)  = \sum_{i} \exp\left(&lt;br /&gt;
-\frac{(\varepsilon - \textcolor{blue}{\varepsilon^{i}_{\rm&lt;br /&gt;
{pred}}(\boldsymbol{\xi}_i)})^2}{2\sigma^2}\right)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; \tilde{E} = E_{\rm GAP} + E_{\rm spectra} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; E_{\rm spectra} =  \frac{1}{2}\gamma \int \,d\varepsilon \left( \textcolor{violet}{ g_{\rm pred}(\varepsilon)} - g_{\rm exp}(\varepsilon)\right)^2&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;p&amp;gt;A simple squared difference, which is a penalty with increases with spectra dissimilarity and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\gamma&amp;lt;/math&amp;gt; is an energy scale.&amp;lt;/p&amp;gt;&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;p&amp;gt;We can do not just XPS but also X-ray/neutron diffraction and pair distribution functions.&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;[[File:xps_gcmc_scheme.png]]&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;/ul&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* We use the standard acceptance criteria for adding/removing/moving a particle&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; \mathrm{acc}(N \rightarrow N+1) = \mathrm{min}\left[1,&lt;br /&gt;
\frac{V}{\lambda^3 (N+1)} \exp\left\{ - \frac{\tilde{E}(N+1) -&lt;br /&gt;
\tilde{E}(N) - \mu}{k_BT} \right\}     \right] &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; \mathrm{acc}(N \rightarrow N-1) = \mathrm{min}\left[1,&lt;br /&gt;
\frac{\lambda^3 N}{V} \exp\left\{ -\frac{\tilde{E}(N-1) -&lt;br /&gt;
\tilde{E}(N) + \mu}{k_BT} \right\}     \right] &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; \mathrm{acc}_{\rm move} = \mathrm{min }\left[ 1, \exp\left\{ -&lt;br /&gt;
  \frac{\tilde{E}(\mathrm{new}) - \tilde{E}(\mathrm{old})}{k_BT} \right\} \right]&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;usage&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
= Usage =&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;installing-turbogap&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
== Installing ''TurboGAP'' ==&lt;br /&gt;
&lt;br /&gt;
We can install the ''TurboGAP'' code, found here https://github.com/mcaroba/turbogap through ''recursively cloning'' the main branch&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;git clone --recursive https://github.com/mcaroba/turbogap.git&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
Then we edit this line in the &amp;lt;code&amp;gt;Makefile&amp;lt;/code&amp;gt; to match our system architecture.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;include makefiles/Makefile.Ubuntu_gfortran_mpi&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Then, we make&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;make&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
and then export the path in &amp;lt;code&amp;gt;.bashrc&amp;lt;/code&amp;gt; file&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;export PATH=&amp;quot;~/turbogap/bin:$PATH&amp;quot;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;span id=&amp;quot;what-you-need-for-a-calculation&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
== What you need for a calculation ==&lt;br /&gt;
&lt;br /&gt;
; &amp;lt;code&amp;gt;gap_files/&amp;lt;/code&amp;gt; directory&lt;br /&gt;
: The directory which contains your &amp;lt;code&amp;gt;*.gap&amp;lt;/code&amp;gt;, with alphas (fitting coefficients) and sparse set descriptor files.&lt;br /&gt;
;* Potentials are available from ''TurboGAP'' wiki https://turbogap.fi/wiki/index.php/Potentials&lt;br /&gt;
;* Conversion script from &amp;lt;code&amp;gt;gap_fit .xml&amp;lt;/code&amp;gt; to &amp;lt;code&amp;gt;.gap&amp;lt;/code&amp;gt; can be used &amp;lt;code&amp;gt;turbogap/tools/make_gap_files.py&amp;lt;/code&amp;gt;&lt;br /&gt;
; &amp;lt;code&amp;gt;input&amp;lt;/code&amp;gt; file&lt;br /&gt;
: The file which tells the code what to do&lt;br /&gt;
; &amp;lt;code&amp;gt;*.xyz&amp;lt;/code&amp;gt;&lt;br /&gt;
: An extended xyz format file which contains positions/lattice/velocity information.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;adding-a-local-property-model-for-cebe-prediction&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== Adding a local property model for CEBE prediction ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;  gap_beg soap_turbo&lt;br /&gt;
  n_species = 2&lt;br /&gt;
  species = C O&lt;br /&gt;
  central_species = 1&lt;br /&gt;
... some params ...&lt;br /&gt;
  zeta = 4&lt;br /&gt;
  delta = 0.1&lt;br /&gt;
  desc_sparse = &amp;quot;gap_files/CO.xml.sparseX.GAP_2022_5_19_180_7_17_31_41410&amp;quot;&lt;br /&gt;
  alphas_sparse = &amp;quot;gap_files/alphas_soap_turbo_1.dat&amp;quot;&lt;br /&gt;
  compress_mode = &amp;quot;trivial&amp;quot;&lt;br /&gt;
  has_local_properties = .true.&lt;br /&gt;
  n_local_properties = 1&lt;br /&gt;
  local_property_qs = 'gap_files/core_electron_be.xml.sparseX.GAP_2024_1_26_120_18_36_33_6091'&lt;br /&gt;
  local_property_alphas = 'gap_files/alphas_core_electron_be_1.dat'&lt;br /&gt;
  local_property_labels = 'core_electron_be'&lt;br /&gt;
  local_property_zetas = 2&lt;br /&gt;
  local_property_deltas = 1.0&lt;br /&gt;
  local_property_v0s = 290.0&lt;br /&gt;
  gap_end&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;span id=&amp;quot;conversion-of-gap_fit-.xml-files-to-.gap-format&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== Conversion of &amp;lt;code&amp;gt;gap_fit&amp;lt;/code&amp;gt; &amp;lt;code&amp;gt;*.xml&amp;lt;/code&amp;gt; files to &amp;lt;code&amp;gt;*.gap&amp;lt;/code&amp;gt; format ===&lt;br /&gt;
&lt;br /&gt;
* Then we convert the &amp;lt;code&amp;gt;*.xml&amp;lt;/code&amp;gt; files which result from &amp;lt;code&amp;gt;gap_fit&amp;lt;/code&amp;gt; into the required format for ''TurboGAP''.&lt;br /&gt;
* This is done using the convenience script in &amp;lt;code&amp;gt;turbogap/tools/make_gap_files.py&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;python3 make_gap_files.py {gap_file.xml} {gap_file.gap} {N_local_prop.} \&lt;br /&gt;
              {local_prop1.xml} {local_prop_label1} \&lt;br /&gt;
              {local_prop2.xml} {local_prop_label2}...&lt;br /&gt;
# e.g. let's build a carbon oxygen GAP&lt;br /&gt;
# with core electron binding energy prediction capability.&lt;br /&gt;
python3 make_gap_files.py CO.xml CO.gap 1 \&lt;br /&gt;
        core_electron_be_co.xml core_electron_be&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
* This creates a directory &amp;lt;code&amp;gt;gap_files/&amp;lt;/code&amp;gt; which has&lt;br /&gt;
*# &amp;lt;code&amp;gt;alphas_{descriptor}.dat&amp;lt;/code&amp;gt; which are fitting coefficients for a particular descriptor&lt;br /&gt;
*# &amp;lt;code&amp;gt;qs_{descriptor}.dat&amp;lt;/code&amp;gt; which are the '''sparse set''' descriptors, used for prediction.&lt;br /&gt;
*# &amp;lt;code&amp;gt;alphas_{local_property}.dat&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;qs_{local_property}.dat&amp;lt;/code&amp;gt; for local property prediction.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;running-the-tutorial&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
== Running the Tutorial ==&lt;br /&gt;
&lt;br /&gt;
* Navigate to &amp;lt;code&amp;gt;turbogap/tutorials/xps_optimizaton&amp;lt;/code&amp;gt;&lt;br /&gt;
* Run &amp;lt;code&amp;gt;bash run.sh {calc_type}&amp;lt;/code&amp;gt; where &amp;lt;code&amp;gt;{calc_type}&amp;lt;/code&amp;gt; is either:&lt;br /&gt;
** &amp;lt;code&amp;gt;prediction&amp;lt;/code&amp;gt;&lt;br /&gt;
** &amp;lt;code&amp;gt;standard_gcmc&amp;lt;/code&amp;gt;&lt;br /&gt;
** &amp;lt;code&amp;gt;xps_optimization_gcmc&amp;lt;/code&amp;gt;&lt;br /&gt;
* Note that these simulations have a high chemical potential and (have high &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\gamma&amp;lt;/math&amp;gt; factors), these are just to give a result in a reasonable amount of time. Take care with real simulations.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;core-electron-binding-energy-prediction&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
== Core electron binding energy prediction ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;[mpirun -np N] turbogap predict&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
* We have in our &amp;lt;code&amp;gt;input&amp;lt;/code&amp;gt; file&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre class=&amp;quot;conf&amp;quot;&amp;gt;! Species-specific info&lt;br /&gt;
atoms_file = 'atoms.xyz'&lt;br /&gt;
pot_file = 'gap_files/CO.gap'&lt;br /&gt;
n_species = 2&lt;br /&gt;
species = C O&lt;br /&gt;
masses = 12.01 15.99&lt;br /&gt;
e0 = -.16138053 0.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Output:&lt;br /&gt;
&lt;br /&gt;
; &amp;lt;code&amp;gt;trajectory_out.xyz&amp;lt;/code&amp;gt;&lt;br /&gt;
: which contains atomic positions, local energy and local property arrays for each structure.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt; 512&lt;br /&gt;
Properties=species:S:1:pos:R:3:forces:R:3:local_energy:R:1:core_electron_be:R:1 \&lt;br /&gt;
   Lattice=&amp;quot;...&amp;quot; energy=-4321.582604 energy_soap=-4114.77018429  energy_2b=-124.73820332 energy_3b=0.55261463 \&lt;br /&gt;
   energy_core_pot=0.00000000 energy_vdw=0.00000000 energy_exp=0.00000000 energy_xps=0.00000000 \&lt;br /&gt;
   virial=&amp;quot;...&amp;quot; stress=&amp;quot;...&amp;quot; volume=5372.640346&lt;br /&gt;
   C              4.39625950       7.79414272      11.91703476     \&lt;br /&gt;
                  -0.00176074      -0.00403026       0.00040104    \&lt;br /&gt;
                  -8.32055957 \ # Local energy prediction&lt;br /&gt;
                  283.83841418  # CEBE Prediction&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Withiout specifying Exp. data, Turbogap does not predict the spectra.&lt;br /&gt;
* XPS spectra can simply be calculated from &amp;lt;code&amp;gt;core_electron_be&amp;lt;/code&amp;gt; in &amp;lt;code&amp;gt;trajectory_out.xyz&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;grand-canonical-monte-carlo&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
== (Grand-Canonical) Monte-Carlo ==&lt;br /&gt;
&lt;br /&gt;
* We use &amp;lt;code&amp;gt;mc&amp;lt;/code&amp;gt; mode&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;[mpirun -np N] turbogap mc&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
* ''e.g'' For a &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mu V T&amp;lt;/math&amp;gt; simulation of system in oxygen environment&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre class=&amp;quot;conf&amp;quot;&amp;gt;! Monte-carlo options&lt;br /&gt;
mc_nsteps = 1000                         # Number of Monte-Carlo Steps&lt;br /&gt;
n_mc_types = 3                           # Number of MC move types&lt;br /&gt;
mc_types = 'move' 'insertion' 'removal'  # MC move types (move/insertion/removal/volume/swap/md)&lt;br /&gt;
mc_move_max = 0.5                        # Maximum distance for MC displacement (&amp;amp;quot;move&amp;amp;quot;) type moves&lt;br /&gt;
&lt;br /&gt;
! - GCMC Options&lt;br /&gt;
n_mc_mu = 1              # Number of chemical potentials to add&lt;br /&gt;
mc_mu = 0                # Chemical potential(s) [eV]&lt;br /&gt;
mc_species = 'O'         # GCMC species types&lt;br /&gt;
mc_min_dist = 0.1        # GCMC minimum insertion distance&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Output:&lt;br /&gt;
&lt;br /&gt;
; &amp;lt;code&amp;gt;mc.log&amp;lt;/code&amp;gt;&lt;br /&gt;
: &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;# mc_istep  mc_move  accepted  E_trial              E_current             E_exp_trial          E_exp_current  N_tot_trial  N_mc_species_trial&lt;br /&gt;
       1       move    F       -4321.10376531       -4321.58260476         272.97693282         272.83692252      512  O        0&lt;br /&gt;
       2       move    F       -4321.10017027       -4321.58260476         272.68730901         272.83692252      512  O        0&lt;br /&gt;
       3  insertion    F       -4319.14082561       -4321.58260476         269.49191203         272.83692252      513  O        1&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; &amp;lt;code&amp;gt;mc_all.xyz&amp;lt;/code&amp;gt;&lt;br /&gt;
: xyz file written to every &amp;lt;code&amp;gt;write_xyz = N&amp;lt;/code&amp;gt; steps.&lt;br /&gt;
; &amp;lt;code&amp;gt;mc_current.xyz&amp;lt;/code&amp;gt;&lt;br /&gt;
: xyz file saving current accepted config written to every &amp;lt;code&amp;gt;write_xyz = N&amp;lt;/code&amp;gt; steps.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* If we run &amp;lt;code&amp;gt;bash run.sh standard_gcmc&amp;lt;/code&amp;gt; (may take a few minutes), we can see a prediction of the XPS with oxygen content&lt;br /&gt;
&lt;br /&gt;
[[File:standard_gcmc.png]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;experimental-observable-optimization&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
== Experimental Observable Optimization ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;[mpirun -np N] turbogap mc/md&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
* We can specify experimental observables to predict and optimize them using MC or MD. &amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; E_{\rm spectra} = \frac{1}{2} \gamma \int \,d\varepsilon (g_{\rm pred}(\varepsilon) - g_{\rm exp}(\varepsilon))^2  &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre class=&amp;quot;conf&amp;quot;&amp;gt;! Experimental data options&lt;br /&gt;
n_exp = 1                                  # Number of experimental observables&lt;br /&gt;
exp_labels = 'xps'                         # Experimental observable types (xps/xrd/nd/pdf)&lt;br /&gt;
exp_data_files = 'xps_spectra_interp.dat'  # Experimental data files (Note: the range of resulting XPS prediction will be the same as the experimental range.)&lt;br /&gt;
exp_n_samples = 501                        # Number of interpolations samples over the experimental range.&lt;br /&gt;
exp_energy_scales = 100.0                    # Energy scale (gamma) [eV]&lt;br /&gt;
&lt;br /&gt;
# XPS smearing&lt;br /&gt;
xps_sigma = 0.4&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Output:&lt;br /&gt;
&lt;br /&gt;
; &amp;lt;code&amp;gt;xps_prediction.dat&amp;lt;/code&amp;gt;&lt;br /&gt;
: Data file written every &amp;lt;code&amp;gt;write_xyz = N&amp;lt;/code&amp;gt; steps. Separate predictions separated by blank lines.&lt;br /&gt;
; &amp;lt;code&amp;gt;xps_exp.dat&amp;lt;/code&amp;gt;&lt;br /&gt;
: The experimental data fed into ''TurboGAP''.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* If we run &amp;lt;code&amp;gt;bash run.sh xps_optimization_gcmc&amp;lt;/code&amp;gt; (may take a few minutes), we can see a prediction of the XPS with oxygen content&lt;br /&gt;
&lt;br /&gt;
[[File:xps_optimization_gcmc.png]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;multiple-observables&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
== Multiple Observables ==&lt;br /&gt;
&lt;br /&gt;
* This is not in the tutorial files, but ''TurboGAP'' allows for we can optimization multiple observables.&lt;br /&gt;
** X-ray diffraction&lt;br /&gt;
** Neutron diffraction&lt;br /&gt;
** Pair distribution function&lt;br /&gt;
** XPS&lt;br /&gt;
* Here we show a fictitious example of XPS and XRD optimization.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre class=&amp;quot;conf&amp;quot;&amp;gt;# Partial PDFs needed for XRD calculation&lt;br /&gt;
pair_distribution_n_samples = 301&lt;br /&gt;
r_range_min = 0.1&lt;br /&gt;
r_range_max = 13.5&lt;br /&gt;
pair_distribution_rcut = 14.1&lt;br /&gt;
&lt;br /&gt;
do_xrd = .true.&lt;br /&gt;
&lt;br /&gt;
# Experimental Data Specification&lt;br /&gt;
n_exp = 2                  # Number of Exp. observables&lt;br /&gt;
exp_labels = 'xps' 'xrd'   # Exp. observable type (xps/xrd/nd/pdf)&lt;br /&gt;
exp_data_files = 'xps_spectra_experiment.dat' 'xrd_CO_experiment.dat'&lt;br /&gt;
exp_n_samples = 301 301 # Number of samples for the experimental data&lt;br /&gt;
exp_energy_scales = 10.0 10.0  # The &amp;amp;quot;gamma&amp;amp;quot; term for each observable&lt;br /&gt;
&lt;br /&gt;
# If using monte-carlo, the experimental energies are added directly to the local energy&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;span id=&amp;quot;applications&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
= Applications =&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;experimental-observable-predictionoptimization&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
== Experimental Observable prediction/optimization ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;deconvolution-analysis&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== Deconvolution analysis ===&lt;br /&gt;
&lt;br /&gt;
* Use subgraph isomorphisms of bonding networks to discern motifs present.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:exp_xps_with_background_high.png]]&lt;br /&gt;
&lt;br /&gt;
↑ Experimental XPS deconvolution ([[#citeproc_bib_item_9|Santini et al. 2015]])&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:deconvolution_comparison_fill_-3_new.png]]&lt;br /&gt;
&lt;br /&gt;
↑ Our XPS deconvolution ([[#citeproc_bib_item_9|Santini et al. 2015]])&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:xps_shifts_miguel_first.png]]&lt;br /&gt;
&lt;br /&gt;
[[File:xps_shifts_miguel_last.png]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;reduced-graphene-oxide---exp.-prediction&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== Reduced graphene oxide - Exp. prediction ===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
([[#citeproc_bib_item_5|El-Machachi et al. 2024]])&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;grand-canonical-monte-carlo---exp.-optimization&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== Grand-Canonical Monte-Carlo - Exp. optimization ===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;molecular-augmented-dynamics-mad---md-with-experimental-forces&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== Molecular Augmented Dynamics ('''MAD''') - MD with ''Experimental Forces'' ===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;summary&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
= Summary =&lt;br /&gt;
&lt;br /&gt;
* Machine-learned potentials can be combined with experimental models to give structures which are consistent with both ''ab-inito'' and experimental data.&lt;br /&gt;
* We can generate oxygenated amorphous carbon structures using a CO GAP with XPS prediction using modified GCMC and a “Molecular Augmented Dynamics” method.&lt;br /&gt;
* We can use ''multiple experimental observables''.&lt;br /&gt;
* '''Finding structures which match experimental data allows us to understand specific experimental results.'''&lt;br /&gt;
* Deconvolve experimental XPS exactly.&lt;br /&gt;
* All of this is implemented in the ''TurboGAP'' code.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;references&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
= References =&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;citeproc_bib_item_1&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;Bartók, Albert P., Risi Kondor, and Gábor Csányi. 2013. “On Representing Chemical Environments.” ''Physical Review B'' 87 (18): 184115. https://doi.org/10.1103/PhysRevB.87.184115.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;citeproc_bib_item_2&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;Bartók, Albert P., Mike C. Payne, Risi Kondor, and Gábor Csányi. 2010. “Gaussian Approximation Potentials: The Accuracy of Quantum Mechanics, without the Electrons.” ''Physical Review Letters'' 104 (13): 136403. https://doi.org/10.1103/PhysRevLett.104.136403.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;citeproc_bib_item_3&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;Caro, Miguel A. 2019. “Optimizing Many-Body Atomic Descriptors for Enhanced Computational Performance of Machine Learning Based Interatomic Potentials.” ''Physical Review B'' 100 (2): 024112. https://doi.org/10.1103/PhysRevB.100.024112.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;citeproc_bib_item_4&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;Deringer, Volker L., Albert P. Bartók, Noam Bernstein, David M. Wilkins, Michele Ceriotti, and Gábor Csányi. 2021. “Gaussian Process Regression for Materials and Molecules.” ''Chemical Reviews'' 121 (16): 10073–141. https://doi.org/10.1021/acs.chemrev.1c00022.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;citeproc_bib_item_5&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;El-Machachi, Zakariya, Damyan Frantzov, A. Nijamudheen, Tigany Zarrouk, Miguel A. Caro, and Volker L. Deringer. 2024. “Accelerated First-Principles Exploration of Structure and Reactivity in Graphene Oxide.” arXiv. https://doi.org/10.48550/arXiv.2405.14814.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;citeproc_bib_item_6&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;Golze, Dorothea, Markus Hirvensalo, Patricia Hernández-León, Anja Aarva, Jarkko Etula, Toma Susi, Patrick Rinke, Tomi Laurila, and Miguel A. Caro. 2022. “Accurate Computational Prediction of Core-Electron Binding Energies in Carbon-Based Materials: A Machine-Learning Model Combining Density-Functional Theory and GW.” ''Chemistry of Materials'' 34 (14): 6240–54. https://doi.org/10.1021/acs.chemmater.1c04279.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;citeproc_bib_item_7&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;Muhli, Heikki, Xi Chen, Albert P. Bartók, Patricia Hernández-León, Gábor Csányi, Tapio Ala-Nissila, and Miguel A. Caro. 2021. “Machine Learning Force Fields Based on Local Parametrization of Dispersion Interactions: Application to the Phase Diagram of \&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathrm\\\C\\\\\_\60\\&amp;lt;/math&amp;gt;.” ''Physical Review B'' 104 (5): 054106. https://doi.org/10.1103/PhysRevB.104.054106.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;citeproc_bib_item_8&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;Opletal, George, Timothy C. Petersen, Amanda S. Barnard, and Salvy P. Russo. 2017. “On Reverse Monte Carlo Constraints and Model Reproduction.” ''Journal of Computational Chemistry'' 38 (17): 1547–51. https://doi.org/10.1002/jcc.24799.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;citeproc_bib_item_9&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;Santini, Claudia A., Abu Sebastian, Chiara Marchiori, Vara Prasad Jonnalagadda, Laurent Dellmann, Wabe W. Koelmans, Marta D. Rossell, Christophe P. Rossel, and Evangelos Eleftheriou. 2015. “Oxygenated Amorphous Carbon for Resistive Memory Applications.” ''Nature Communications'' 6 (1): 8600. https://doi.org/10.1038/ncomms9600.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;citeproc_bib_item_10&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;Wang, Yanzhou, Zheyong Fan, Ping Qian, Tapio Ala-Nissila, and Miguel A. Caro. 2022. “Structure and Pore Size Distribution in Nanoporous Carbon.” ''Chemistry of Materials'' 34 (2): 617–28. https://doi.org/10.1021/acs.chemmater.1c03279.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;citeproc_bib_item_11&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;Zarrouk, Tigany, Rina Ibragimova, Albert P. Bartók, and Miguel A. Caro. 2024. “Experiment-Driven Atomistic Materials Modeling: A Case Study Combining X-Ray Photoelectron Spectroscopy and Machine Learning Potentials to Infer the Structure of Oxygen-Rich Amorphous Carbon.” ''Journal of the American Chemical Society'' 146 (21): 14645–59. https://doi.org/10.1021/jacs.4c01897.&lt;/div&gt;</summary>
		<author><name>Tigany Zarrouk</name></author>
		
	</entry>
	<entry>
		<id>https://turbogap.fi/wiki/index.php?title=File:Xps_optimization_gcmc.png&amp;diff=635</id>
		<title>File:Xps optimization gcmc.png</title>
		<link rel="alternate" type="text/html" href="https://turbogap.fi/wiki/index.php?title=File:Xps_optimization_gcmc.png&amp;diff=635"/>
		<updated>2024-06-18T19:28:02Z</updated>

		<summary type="html">&lt;p&gt;Tigany Zarrouk: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Tigany Zarrouk</name></author>
		
	</entry>
	<entry>
		<id>https://turbogap.fi/wiki/index.php?title=File:Standard_gcmc.png&amp;diff=634</id>
		<title>File:Standard gcmc.png</title>
		<link rel="alternate" type="text/html" href="https://turbogap.fi/wiki/index.php?title=File:Standard_gcmc.png&amp;diff=634"/>
		<updated>2024-06-18T19:27:07Z</updated>

		<summary type="html">&lt;p&gt;Tigany Zarrouk: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Tigany Zarrouk</name></author>
		
	</entry>
	<entry>
		<id>https://turbogap.fi/wiki/index.php?title=XPS-optimized_oxygenated_amorphous_carbon&amp;diff=633</id>
		<title>XPS-optimized oxygenated amorphous carbon</title>
		<link rel="alternate" type="text/html" href="https://turbogap.fi/wiki/index.php?title=XPS-optimized_oxygenated_amorphous_carbon&amp;diff=633"/>
		<updated>2024-06-18T19:25:55Z</updated>

		<summary type="html">&lt;p&gt;Tigany Zarrouk: Created page with &amp;quot; &amp;lt;span id=&amp;quot;table-of-contents&amp;quot;&amp;gt;&amp;lt;/span&amp;gt; = Table of Contents =  Find this tutorial on https://turbogap.fi/  * (Tutorials → XPS optmization with Augmented GCMC) * ''TurboGAP'' g...&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
&amp;lt;span id=&amp;quot;table-of-contents&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
= Table of Contents =&lt;br /&gt;
&lt;br /&gt;
Find this tutorial on https://turbogap.fi/&lt;br /&gt;
&lt;br /&gt;
* (Tutorials → XPS optmization with Augmented GCMC)&lt;br /&gt;
* ''TurboGAP'' git repo https://github.com/mcaroba/turbogap, with files in &amp;lt;code&amp;gt;turbogap/tutorials/xps_optimization/&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
# Introduction&lt;br /&gt;
# Theory/Methods&lt;br /&gt;
# How to use ''TurboGAP''&lt;br /&gt;
## Generalities&lt;br /&gt;
## Predicting core electron binding energies&lt;br /&gt;
## Optimizing an XPS spectrum&lt;br /&gt;
## Optimizing Multiple Observables&lt;br /&gt;
# Applications&lt;br /&gt;
## GCMC optimization of C1s XPS spectrum&lt;br /&gt;
## Molecular Augmented Dynamics optimization&lt;br /&gt;
## Carbon materials&lt;br /&gt;
## Catalysis&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;what-is-turbogap&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
= What is ''TurboGAP'' ? =&lt;br /&gt;
&lt;br /&gt;
* ''TurboGAP'' is a &amp;lt;code&amp;gt;Fortran&amp;lt;/code&amp;gt; atomistic code which uses &amp;lt;u&amp;gt;Gaussian Approximation Potentials&amp;lt;/u&amp;gt; (GAPs).&lt;br /&gt;
* Its specialty are ''SOAP turbo'' descriptors: faster and more accurate than SOAP (Smooth Overlap of Atomic Positions).&lt;br /&gt;
* It's (probably!) the fastest SOAP prediction code, which will be made even faster with ''GPU acceleration'' (ongoing with CSC).&lt;br /&gt;
&lt;br /&gt;
[[File:images/Turbogap_logo.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* Through GAP/SOAP predictions, one can perform simulations with ''ab-initio'' accuracy '''at scale'''&lt;br /&gt;
** Molecular Dynamics&lt;br /&gt;
** Grand-Canonical Monte-Carlo simulations&lt;br /&gt;
** Electronic-stopping and spatially-correlated Langevin Dynamics (in-development).&lt;br /&gt;
** '''Prediction/optimization of experimental observables''' (''e.g.'' X-Ray photoelectron spectra ([[#citeproc_bib_item_6|Golze et al. 2022]]; [[#citeproc_bib_item_11|Zarrouk et al. 2024]]), X-ray/Neutron Diffraction and more to come!).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;motivation-for-structural-inference&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
= Motivation for structural inference =&lt;br /&gt;
&lt;br /&gt;
* We typically want to &amp;lt;u&amp;gt;predict structures&amp;lt;/u&amp;gt;, to make sense of experimental data.&lt;br /&gt;
* We usually pray structures have &amp;lt;u&amp;gt;experimental agreement&amp;lt;/u&amp;gt; (a “bottom-up” approach).&lt;br /&gt;
* What if we can &amp;lt;u&amp;gt;promote agreement&amp;lt;/u&amp;gt; with experimental data?&lt;br /&gt;
* ''Reverse Monte-Carlo'' techniques match experimental data to atomic structure (“top-down” approach).&lt;br /&gt;
** Downsides: “By-hand” constraints&lt;br /&gt;
** Simple experimental observables.&lt;br /&gt;
** Unphysical structures/artifacts ([[#citeproc_bib_item_8|Opletal et al. 2017]])&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Need efficient structure search to find '''agreement''' with '''experimental''' data ''and'' '''ab-inito''' data.&lt;br /&gt;
&lt;br /&gt;
# With &amp;lt;u&amp;gt;CO GAP + Core electron binding energy SOAP&amp;lt;/u&amp;gt; model we will perform '''modified (Grand-canonical) Monte-Carlo''' to produce ''experimentally consistent, low energy structures'' of oxygenated amorphous carbon.&lt;br /&gt;
# I will further show preliminary work on *“Molecular Augmented Dynamics”*: generate forces from experimental deviation, to match experimental spectra via MD.&lt;br /&gt;
&lt;br /&gt;
[[File:images/deconvolution_comparison_fill_-3_new.png]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;theory-and-methods&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
= Theory and Methods =&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;gaussian-approximation-potentials-gap&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
== Gaussian Approximation Potentials (GAP) ==&lt;br /&gt;
&lt;br /&gt;
([[#citeproc_bib_item_2|Bartók et al. 2010]]; [[#citeproc_bib_item_1|Bartók, Kondor, and Csányi 2013]]; [[#citeproc_bib_item_4|Deringer et al. 2021]])&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;u&amp;gt;Assumption&amp;lt;/u&amp;gt;: Total energy is sum of '''local energies'''. &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;E_{\rm total}(\{\mathbf{r}\}) = \sum_i^{N_{\text{atoms}}} \varepsilon^i(\{r\}, \{\xi^{\text{2b}}_i\}, \{\boldsymbol{\xi}^{\text{3b}}_i\}, \boldsymbol{\xi}^{\text{mb}}_i))&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;\begin{align}&lt;br /&gt;
  \varepsilon^i ( &amp;amp;\{r\}, \{\xi^{\text{2b}}_i\}, \{\boldsymbol{\xi}^{\text{3b}}_i\}, \boldsymbol{\xi}^{\text{mb}}_i) =&lt;br /&gt;
   E^{\text{2b}}(\{\xi^{\text{2b}}_i\}) + E^{\text{3b}}(\{\boldsymbol{\xi}^{\text{3b}}_i\}) \nonumber\\&lt;br /&gt;
  &amp;amp; + E^{\text{mb}}(\boldsymbol{\xi}^{\text{mb}}_i)&lt;br /&gt;
  + \sum_{r &amp;lt; r_{\rm cut}^{\rm core}} E^{\text{core}}(r)  \nonumber&lt;br /&gt;
\end{align}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
; Local energy&lt;br /&gt;
: Sum of '''2b, 3b and many-body''' terms.&lt;br /&gt;
; Descriptor &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\xi / \boldsymbol{\xi}&amp;lt;/math&amp;gt;.&lt;br /&gt;
: ''e.g'' &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\{\xi^{\text{2b}}\} = \{r_{ij}\}&amp;lt;/math&amp;gt;, &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\{\boldsymbol{\xi}^{\text{3b}}\} = \{ [ r_{ij}, r_{ik}, r_{kj} ] \}&amp;lt;/math&amp;gt;&lt;br /&gt;
; Local environment&lt;br /&gt;
: A set of descriptors.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:images/descriptors_deringer.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;using-descriptors-to-predict-quantities&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== Using descriptors to predict quantities ===&lt;br /&gt;
&lt;br /&gt;
* ''Kernel/basis functions'' &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;k_{ij}(\boldsymbol{\xi}_i, \boldsymbol{\xi}_j)&amp;lt;/math&amp;gt; measure the ''similarity between descriptors''.&lt;br /&gt;
* ''e.g'' Exponential 2b kernel: &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;k^{2b}_{ij}(\xi_i, \xi_j) \equiv k^{2b}_{ij}(r_{i}, r_{j}) = \exp( - (r_{i} - r_{j})^2/2\sigma^2 )&amp;lt;/math&amp;gt;&lt;br /&gt;
* ''Gaussian Process Regression'' (kernel matrix algebra on training set) → ''fitting coefficients'' &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\{\alpha\}&amp;lt;/math&amp;gt;, ([[#citeproc_bib_item_4|Deringer et al. 2021]])&lt;br /&gt;
* ''e.g.'' 2b model trained with &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;N_s&amp;lt;/math&amp;gt; descriptors &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\{\xi\} \in \{\xi_i, \ldots, \xi_{Ns}\}&amp;lt;/math&amp;gt;, the energy for atom with &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;M&amp;lt;/math&amp;gt; pairwise distances in local environment: &amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;E^{2b} = \sum_i^M \left(E^{2b}_0 + \delta^2\sum_j^{N_s}  \alpha_j k^{2b}_{ij}(\xi_i, \xi_j) \right) &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;soap-many-body-descriptor&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== SOAP (many-body) descriptor ===&lt;br /&gt;
&lt;br /&gt;
[[File:images/gap_expansion_diagram.png]]&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;u&amp;gt;SOAP descriptor&amp;lt;/u&amp;gt;: &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\boldsymbol{\xi}_i(\{\mathbf{r}\}_{ &amp;lt; r_{\rm cut}} )&amp;lt;/math&amp;gt;, represents environment of an atom ([[#citeproc_bib_item_2|Bartók et al. 2010]]).&lt;br /&gt;
* &amp;lt;u&amp;gt;Kernel&amp;lt;/u&amp;gt;: &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;k_{ij} = (\boldsymbol{\xi}_i \cdot \boldsymbol{\xi}_j)^{\zeta}&amp;lt;/math&amp;gt; measures &amp;lt;u&amp;gt;similarity of environments&amp;lt;/u&amp;gt;.&lt;br /&gt;
* &amp;lt;u&amp;gt;Fitting coefficients&amp;lt;/u&amp;gt;: &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\alpha_j&amp;lt;/math&amp;gt; result from Gaussian Process Regression.&lt;br /&gt;
* &amp;lt;u&amp;gt;Prediction&amp;lt;/u&amp;gt;: &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;E^{\rm mb}_i(\boldsymbol{\xi}_i) = E^{\rm mb}_0 + \delta^2\sum_j  \alpha_j k_{ij}&amp;lt;/math&amp;gt;&lt;br /&gt;
* For specifics of SOAP turbo, refer to Miguel's paper ([[#citeproc_bib_item_3|Caro 2019]])&lt;br /&gt;
&lt;br /&gt;
[[File:images/gpr_regression_deringer.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
← SOAP expansion.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
← Interpolation of DFT PES ([[#citeproc_bib_item_4|Deringer et al. 2021]])&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;how-do-we-model-xps&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
== How do we model XPS? ==&lt;br /&gt;
&lt;br /&gt;
* XPS (X-ray photoelectron spectroscopy) spectra measure '''core electron binding energies'''.&lt;br /&gt;
* Core electron binding energies ''depend on atomic environment''.&lt;br /&gt;
* SOAP turbo model trained on DFT (&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\Delta\text{KS}&amp;lt;/math&amp;gt;) data with a &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;GW&amp;lt;/math&amp;gt; correction on top ([[#citeproc_bib_item_6|Golze et al. 2022]]).&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\text{CEBE} = ( \Delta KS^0_{\rm extended} + GW_{\rm carved} - \Delta \mathrm{KS}^+_{\rm carved} )&amp;lt;/math&amp;gt;&lt;br /&gt;
* Thermal and instrumental broadening accounted for by a Gaussian with &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\sigma = 0.4\text{ eV}&amp;lt;/math&amp;gt;&lt;br /&gt;
* Can analyse environments which make up spectra.&lt;br /&gt;
&lt;br /&gt;
[[File:images/miguel_xps_diagram.png]]&lt;br /&gt;
&lt;br /&gt;
↑ Diagram of XPS (x-axis is core electron binding energy) ([[#citeproc_bib_item_6|Golze et al. 2022]])&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;prediction-of-local-properties&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
== Prediction of Local Properties ==&lt;br /&gt;
&lt;br /&gt;
* We can predict an &amp;lt;u&amp;gt;arbitrary number&amp;lt;/u&amp;gt; of ''local properties'' which use SOAP turbo descriptors using ''TurboGAP''.&lt;br /&gt;
* /One can get these for “free”/ if local property models are trained using the same descriptors as atomic energies/forces.&lt;br /&gt;
*; ''Hirshfeld volumes''&lt;br /&gt;
*: gives vdW dispersion via Tkatchenko-Scheffler. &amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; E_{\rm TS} = \sum_i \sum_{j\neq i} C_{6, ij}(v_{i}(\boldsymbol{\xi}_i), v_{j}(\boldsymbol{\xi}_j))\frac{f_{\rm damp}(r_{ij}, \ldots)}{r_{ij}^6} &amp;lt;/math&amp;gt;&lt;br /&gt;
*; ''Core-electron binding energies''&lt;br /&gt;
*: give '''X-ray Photoelectron Spectroscopy''' prediction. &amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; g_{\rm xps}(\varepsilon) = \frac{1}{M} \sum_i \exp\left( -(\varepsilon - \varepsilon_{i}(\boldsymbol{\xi}_i))^2/(2\sigma^2)  \right) &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;how-do-we-marry-experimental-data-and-gap&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
== How do we marry experimental data and GAP? ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* '''Generalized Hamiltonian within Grand-Canonical Monte-Carlo''' scheme.&lt;br /&gt;
* Vary oxygen content with chemical potential, to see motif differences.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;  \textcolor{violet}{ \mathbf{\tilde{g}}_{\rm {pred}}}(\varepsilon)  = \sum_{i} \exp\left(&lt;br /&gt;
-\frac{(\varepsilon - \textcolor{blue}{\varepsilon^{i}_{\rm&lt;br /&gt;
{pred}}(\boldsymbol{\xi}_i)})^2}{2\sigma^2}\right)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; \tilde{E} = E_{\rm GAP} + E_{\rm spectra} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; E_{\rm spectra} =  \frac{1}{2}\gamma \int \,d\varepsilon \left( \textcolor{violet}{ g_{\rm pred}(\varepsilon)} - g_{\rm exp}(\varepsilon)\right)^2&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;p&amp;gt;A simple squared difference, which is a penalty with increases with spectra dissimilarity and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\gamma&amp;lt;/math&amp;gt; is an energy scale.&amp;lt;/p&amp;gt;&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;p&amp;gt;We can do not just XPS but also X-ray/neutron diffraction and pair distribution functions.&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;[[File:images/xps_gcmc_scheme.png]]&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;/ul&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* We use the standard acceptance criteria for adding/removing/moving a particle&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; \mathrm{acc}(N \rightarrow N+1) = \mathrm{min}\left[1,&lt;br /&gt;
\frac{V}{\lambda^3 (N+1)} \exp\left\{ - \frac{\tilde{E}(N+1) -&lt;br /&gt;
\tilde{E}(N) - \mu}{k_BT} \right\}     \right] &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; \mathrm{acc}(N \rightarrow N-1) = \mathrm{min}\left[1,&lt;br /&gt;
\frac{\lambda^3 N}{V} \exp\left\{ -\frac{\tilde{E}(N-1) -&lt;br /&gt;
\tilde{E}(N) + \mu}{k_BT} \right\}     \right] &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; \mathrm{acc}_{\rm move} = \mathrm{min }\left[ 1, \exp\left\{ -&lt;br /&gt;
  \frac{\tilde{E}(\mathrm{new}) - \tilde{E}(\mathrm{old})}{k_BT} \right\} \right]&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;usage&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
= Usage =&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;installing-turbogap&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
== Installing ''TurboGAP'' ==&lt;br /&gt;
&lt;br /&gt;
We can install the ''TurboGAP'' code, found here https://github.com/mcaroba/turbogap through ''recursively cloning'' the main branch&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;git clone --recursive https://github.com/mcaroba/turbogap.git&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
Then we edit this line in the &amp;lt;code&amp;gt;Makefile&amp;lt;/code&amp;gt; to match our system architecture.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;include makefiles/Makefile.Ubuntu_gfortran_mpi&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Then, we make&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;make&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
and then export the path in &amp;lt;code&amp;gt;.bashrc&amp;lt;/code&amp;gt; file&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;export PATH=&amp;quot;~/turbogap/bin:$PATH&amp;quot;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;span id=&amp;quot;what-you-need-for-a-calculation&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
== What you need for a calculation ==&lt;br /&gt;
&lt;br /&gt;
; &amp;lt;code&amp;gt;gap_files/&amp;lt;/code&amp;gt; directory&lt;br /&gt;
: The directory which contains your &amp;lt;code&amp;gt;*.gap&amp;lt;/code&amp;gt;, with alphas (fitting coefficients) and sparse set descriptor files.&lt;br /&gt;
;* Potentials are available from ''TurboGAP'' wiki https://turbogap.fi/wiki/index.php/Potentials&lt;br /&gt;
;* Conversion script from &amp;lt;code&amp;gt;gap_fit .xml&amp;lt;/code&amp;gt; to &amp;lt;code&amp;gt;.gap&amp;lt;/code&amp;gt; can be used &amp;lt;code&amp;gt;turbogap/tools/make_gap_files.py&amp;lt;/code&amp;gt;&lt;br /&gt;
; &amp;lt;code&amp;gt;input&amp;lt;/code&amp;gt; file&lt;br /&gt;
: The file which tells the code what to do&lt;br /&gt;
; &amp;lt;code&amp;gt;*.xyz&amp;lt;/code&amp;gt;&lt;br /&gt;
: An extended xyz format file which contains positions/lattice/velocity information.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;adding-a-local-property-model-for-cebe-prediction&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== Adding a local property model for CEBE prediction ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;  gap_beg soap_turbo&lt;br /&gt;
  n_species = 2&lt;br /&gt;
  species = C O&lt;br /&gt;
  central_species = 1&lt;br /&gt;
... some params ...&lt;br /&gt;
  zeta = 4&lt;br /&gt;
  delta = 0.1&lt;br /&gt;
  desc_sparse = &amp;quot;gap_files/CO.xml.sparseX.GAP_2022_5_19_180_7_17_31_41410&amp;quot;&lt;br /&gt;
  alphas_sparse = &amp;quot;gap_files/alphas_soap_turbo_1.dat&amp;quot;&lt;br /&gt;
  compress_mode = &amp;quot;trivial&amp;quot;&lt;br /&gt;
  has_local_properties = .true.&lt;br /&gt;
  n_local_properties = 1&lt;br /&gt;
  local_property_qs = 'gap_files/core_electron_be.xml.sparseX.GAP_2024_1_26_120_18_36_33_6091'&lt;br /&gt;
  local_property_alphas = 'gap_files/alphas_core_electron_be_1.dat'&lt;br /&gt;
  local_property_labels = 'core_electron_be'&lt;br /&gt;
  local_property_zetas = 2&lt;br /&gt;
  local_property_deltas = 1.0&lt;br /&gt;
  local_property_v0s = 290.0&lt;br /&gt;
  gap_end&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;span id=&amp;quot;conversion-of-gap_fit-.xml-files-to-.gap-format&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== Conversion of &amp;lt;code&amp;gt;gap_fit&amp;lt;/code&amp;gt; &amp;lt;code&amp;gt;*.xml&amp;lt;/code&amp;gt; files to &amp;lt;code&amp;gt;*.gap&amp;lt;/code&amp;gt; format ===&lt;br /&gt;
&lt;br /&gt;
* Then we convert the &amp;lt;code&amp;gt;*.xml&amp;lt;/code&amp;gt; files which result from &amp;lt;code&amp;gt;gap_fit&amp;lt;/code&amp;gt; into the required format for ''TurboGAP''.&lt;br /&gt;
* This is done using the convenience script in &amp;lt;code&amp;gt;turbogap/tools/make_gap_files.py&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;python3 make_gap_files.py {gap_file.xml} {gap_file.gap} {N_local_prop.} \&lt;br /&gt;
              {local_prop1.xml} {local_prop_label1} \&lt;br /&gt;
              {local_prop2.xml} {local_prop_label2}...&lt;br /&gt;
# e.g. let's build a carbon oxygen GAP&lt;br /&gt;
# with core electron binding energy prediction capability.&lt;br /&gt;
python3 make_gap_files.py CO.xml CO.gap 1 \&lt;br /&gt;
        core_electron_be_co.xml core_electron_be&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
* This creates a directory &amp;lt;code&amp;gt;gap_files/&amp;lt;/code&amp;gt; which has&lt;br /&gt;
*# &amp;lt;code&amp;gt;alphas_{descriptor}.dat&amp;lt;/code&amp;gt; which are fitting coefficients for a particular descriptor&lt;br /&gt;
*# &amp;lt;code&amp;gt;qs_{descriptor}.dat&amp;lt;/code&amp;gt; which are the '''sparse set''' descriptors, used for prediction.&lt;br /&gt;
*# &amp;lt;code&amp;gt;alphas_{local_property}.dat&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;qs_{local_property}.dat&amp;lt;/code&amp;gt; for local property prediction.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;running-the-tutorial&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
== Running the Tutorial ==&lt;br /&gt;
&lt;br /&gt;
* Navigate to &amp;lt;code&amp;gt;turbogap/tutorials/xps_optimizaton&amp;lt;/code&amp;gt;&lt;br /&gt;
* Run &amp;lt;code&amp;gt;bash run.sh {calc_type}&amp;lt;/code&amp;gt; where &amp;lt;code&amp;gt;{calc_type}&amp;lt;/code&amp;gt; is either:&lt;br /&gt;
** &amp;lt;code&amp;gt;prediction&amp;lt;/code&amp;gt;&lt;br /&gt;
** &amp;lt;code&amp;gt;standard_gcmc&amp;lt;/code&amp;gt;&lt;br /&gt;
** &amp;lt;code&amp;gt;xps_optimization_gcmc&amp;lt;/code&amp;gt;&lt;br /&gt;
* Note that these simulations have a high chemical potential and (have high &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\gamma&amp;lt;/math&amp;gt; factors), these are just to give a result in a reasonable amount of time. Take care with real simulations.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;core-electron-binding-energy-prediction&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
== Core electron binding energy prediction ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;[mpirun -np N] turbogap predict&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
* We have in our &amp;lt;code&amp;gt;input&amp;lt;/code&amp;gt; file&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre class=&amp;quot;conf&amp;quot;&amp;gt;! Species-specific info&lt;br /&gt;
atoms_file = 'atoms.xyz'&lt;br /&gt;
pot_file = 'gap_files/CO.gap'&lt;br /&gt;
n_species = 2&lt;br /&gt;
species = C O&lt;br /&gt;
masses = 12.01 15.99&lt;br /&gt;
e0 = -.16138053 0.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Output:&lt;br /&gt;
&lt;br /&gt;
; &amp;lt;code&amp;gt;trajectory_out.xyz&amp;lt;/code&amp;gt;&lt;br /&gt;
: which contains atomic positions, local energy and local property arrays for each structure.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt; 512&lt;br /&gt;
Properties=species:S:1:pos:R:3:forces:R:3:local_energy:R:1:core_electron_be:R:1 \&lt;br /&gt;
   Lattice=&amp;quot;...&amp;quot; energy=-4321.582604 energy_soap=-4114.77018429  energy_2b=-124.73820332 energy_3b=0.55261463 \&lt;br /&gt;
   energy_core_pot=0.00000000 energy_vdw=0.00000000 energy_exp=0.00000000 energy_xps=0.00000000 \&lt;br /&gt;
   virial=&amp;quot;...&amp;quot; stress=&amp;quot;...&amp;quot; volume=5372.640346&lt;br /&gt;
   C              4.39625950       7.79414272      11.91703476     \&lt;br /&gt;
                  -0.00176074      -0.00403026       0.00040104    \&lt;br /&gt;
                  -8.32055957 \ # Local energy prediction&lt;br /&gt;
                  283.83841418  # CEBE Prediction&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Withiout specifying Exp. data, Turbogap does not predict the spectra.&lt;br /&gt;
* XPS spectra can simply be calculated from &amp;lt;code&amp;gt;core_electron_be&amp;lt;/code&amp;gt; in &amp;lt;code&amp;gt;trajectory_out.xyz&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;grand-canonical-monte-carlo&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
== (Grand-Canonical) Monte-Carlo ==&lt;br /&gt;
&lt;br /&gt;
* We use &amp;lt;code&amp;gt;mc&amp;lt;/code&amp;gt; mode&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;[mpirun -np N] turbogap mc&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
* ''e.g'' For a &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mu V T&amp;lt;/math&amp;gt; simulation of system in oxygen environment&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre class=&amp;quot;conf&amp;quot;&amp;gt;! Monte-carlo options&lt;br /&gt;
mc_nsteps = 1000                         # Number of Monte-Carlo Steps&lt;br /&gt;
n_mc_types = 3                           # Number of MC move types&lt;br /&gt;
mc_types = 'move' 'insertion' 'removal'  # MC move types (move/insertion/removal/volume/swap/md)&lt;br /&gt;
mc_move_max = 0.5                        # Maximum distance for MC displacement (&amp;amp;quot;move&amp;amp;quot;) type moves&lt;br /&gt;
&lt;br /&gt;
! - GCMC Options&lt;br /&gt;
n_mc_mu = 1              # Number of chemical potentials to add&lt;br /&gt;
mc_mu = 0                # Chemical potential(s) [eV]&lt;br /&gt;
mc_species = 'O'         # GCMC species types&lt;br /&gt;
mc_min_dist = 0.1        # GCMC minimum insertion distance&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Output:&lt;br /&gt;
&lt;br /&gt;
; &amp;lt;code&amp;gt;mc.log&amp;lt;/code&amp;gt;&lt;br /&gt;
: &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;# mc_istep  mc_move  accepted  E_trial              E_current             E_exp_trial          E_exp_current  N_tot_trial  N_mc_species_trial&lt;br /&gt;
       1       move    F       -4321.10376531       -4321.58260476         272.97693282         272.83692252      512  O        0&lt;br /&gt;
       2       move    F       -4321.10017027       -4321.58260476         272.68730901         272.83692252      512  O        0&lt;br /&gt;
       3  insertion    F       -4319.14082561       -4321.58260476         269.49191203         272.83692252      513  O        1&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; &amp;lt;code&amp;gt;mc_all.xyz&amp;lt;/code&amp;gt;&lt;br /&gt;
: xyz file written to every &amp;lt;code&amp;gt;write_xyz = N&amp;lt;/code&amp;gt; steps.&lt;br /&gt;
; &amp;lt;code&amp;gt;mc_current.xyz&amp;lt;/code&amp;gt;&lt;br /&gt;
: xyz file saving current accepted config written to every &amp;lt;code&amp;gt;write_xyz = N&amp;lt;/code&amp;gt; steps.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* If we run &amp;lt;code&amp;gt;bash run.sh standard_gcmc&amp;lt;/code&amp;gt; (may take a few minutes), we can see a prediction of the XPS with oxygen content&lt;br /&gt;
&lt;br /&gt;
[[File:images/standard_gcmc.png]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;experimental-observable-optimization&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
== Experimental Observable Optimization ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;[mpirun -np N] turbogap mc/md&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
* We can specify experimental observables to predict and optimize them using MC or MD. &amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; E_{\rm spectra} = \frac{1}{2} \gamma \int \,d\varepsilon (g_{\rm pred}(\varepsilon) - g_{\rm exp}(\varepsilon))^2  &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre class=&amp;quot;conf&amp;quot;&amp;gt;! Experimental data options&lt;br /&gt;
n_exp = 1                                  # Number of experimental observables&lt;br /&gt;
exp_labels = 'xps'                         # Experimental observable types (xps/xrd/nd/pdf)&lt;br /&gt;
exp_data_files = 'xps_spectra_interp.dat'  # Experimental data files (Note: the range of resulting XPS prediction will be the same as the experimental range.)&lt;br /&gt;
exp_n_samples = 501                        # Number of interpolations samples over the experimental range.&lt;br /&gt;
exp_energy_scales = 100.0                    # Energy scale (gamma) [eV]&lt;br /&gt;
&lt;br /&gt;
# XPS smearing&lt;br /&gt;
xps_sigma = 0.4&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Output:&lt;br /&gt;
&lt;br /&gt;
; &amp;lt;code&amp;gt;xps_prediction.dat&amp;lt;/code&amp;gt;&lt;br /&gt;
: Data file written every &amp;lt;code&amp;gt;write_xyz = N&amp;lt;/code&amp;gt; steps. Separate predictions separated by blank lines.&lt;br /&gt;
; &amp;lt;code&amp;gt;xps_exp.dat&amp;lt;/code&amp;gt;&lt;br /&gt;
: The experimental data fed into ''TurboGAP''.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* If we run &amp;lt;code&amp;gt;bash run.sh xps_optimization_gcmc&amp;lt;/code&amp;gt; (may take a few minutes), we can see a prediction of the XPS with oxygen content&lt;br /&gt;
&lt;br /&gt;
[[File:images/xps_optimization_gcmc.png]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;multiple-observables&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
== Multiple Observables ==&lt;br /&gt;
&lt;br /&gt;
* This is not in the tutorial files, but ''TurboGAP'' allows for we can optimization multiple observables.&lt;br /&gt;
** X-ray diffraction&lt;br /&gt;
** Neutron diffraction&lt;br /&gt;
** Pair distribution function&lt;br /&gt;
** XPS&lt;br /&gt;
* Here we show a fictitious example of XPS and XRD optimization.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre class=&amp;quot;conf&amp;quot;&amp;gt;# Partial PDFs needed for XRD calculation&lt;br /&gt;
pair_distribution_n_samples = 301&lt;br /&gt;
r_range_min = 0.1&lt;br /&gt;
r_range_max = 13.5&lt;br /&gt;
pair_distribution_rcut = 14.1&lt;br /&gt;
&lt;br /&gt;
do_xrd = .true.&lt;br /&gt;
&lt;br /&gt;
# Experimental Data Specification&lt;br /&gt;
n_exp = 2                  # Number of Exp. observables&lt;br /&gt;
exp_labels = 'xps' 'xrd'   # Exp. observable type (xps/xrd/nd/pdf)&lt;br /&gt;
exp_data_files = 'xps_spectra_experiment.dat' 'xrd_CO_experiment.dat'&lt;br /&gt;
exp_n_samples = 301 301 # Number of samples for the experimental data&lt;br /&gt;
exp_energy_scales = 10.0 10.0  # The &amp;amp;quot;gamma&amp;amp;quot; term for each observable&lt;br /&gt;
&lt;br /&gt;
# If using monte-carlo, the experimental energies are added directly to the local energy&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;span id=&amp;quot;applications&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
= Applications =&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;experimental-observable-predictionoptimization&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
== Experimental Observable prediction/optimization ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;deconvolution-analysis&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== Deconvolution analysis ===&lt;br /&gt;
&lt;br /&gt;
* Use subgraph isomorphisms of bonding networks to discern motifs present.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:images/exp_xps_with_background_high.png]]&lt;br /&gt;
&lt;br /&gt;
↑ Experimental XPS deconvolution ([[#citeproc_bib_item_9|Santini et al. 2015]])&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:images/deconvolution_comparison_fill_-3_new.png]]&lt;br /&gt;
&lt;br /&gt;
↑ Our XPS deconvolution ([[#citeproc_bib_item_9|Santini et al. 2015]])&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:images/xps_shifts_miguel_first.png]]&lt;br /&gt;
&lt;br /&gt;
[[File:images/xps_shifts_miguel_last.png]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;reduced-graphene-oxide---exp.-prediction&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== Reduced graphene oxide - Exp. prediction ===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
([[#citeproc_bib_item_5|El-Machachi et al. 2024]])&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;grand-canonical-monte-carlo---exp.-optimization&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== Grand-Canonical Monte-Carlo - Exp. optimization ===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;molecular-augmented-dynamics-mad---md-with-experimental-forces&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== Molecular Augmented Dynamics ('''MAD''') - MD with ''Experimental Forces'' ===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;summary&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
= Summary =&lt;br /&gt;
&lt;br /&gt;
* Machine-learned potentials can be combined with experimental models to give structures which are consistent with both ''ab-inito'' and experimental data.&lt;br /&gt;
* We can generate oxygenated amorphous carbon structures using a CO GAP with XPS prediction using modified GCMC and a “Molecular Augmented Dynamics” method.&lt;br /&gt;
* We can use ''multiple experimental observables''.&lt;br /&gt;
* '''Finding structures which match experimental data allows us to understand specific experimental results.'''&lt;br /&gt;
* Deconvolve experimental XPS exactly.&lt;br /&gt;
* All of this is implemented in the ''TurboGAP'' code.&lt;br /&gt;
&lt;br /&gt;
[[File:images/Turbogap_logo.png]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;acknowlegements&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
= Acknowlegements =&lt;br /&gt;
&lt;br /&gt;
* Miguel Caro for letting me hijack his code.&lt;br /&gt;
* Albert P. Bartók for helping with local property prediction.&lt;br /&gt;
* The DAS group for stimulating discussion and support.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;references&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
= References =&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;citeproc_bib_item_1&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;Bartók, Albert P., Risi Kondor, and Gábor Csányi. 2013. “On Representing Chemical Environments.” ''Physical Review B'' 87 (18): 184115. https://doi.org/10.1103/PhysRevB.87.184115.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;citeproc_bib_item_2&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;Bartók, Albert P., Mike C. Payne, Risi Kondor, and Gábor Csányi. 2010. “Gaussian Approximation Potentials: The Accuracy of Quantum Mechanics, without the Electrons.” ''Physical Review Letters'' 104 (13): 136403. https://doi.org/10.1103/PhysRevLett.104.136403.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;citeproc_bib_item_3&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;Caro, Miguel A. 2019. “Optimizing Many-Body Atomic Descriptors for Enhanced Computational Performance of Machine Learning Based Interatomic Potentials.” ''Physical Review B'' 100 (2): 024112. https://doi.org/10.1103/PhysRevB.100.024112.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;citeproc_bib_item_4&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;Deringer, Volker L., Albert P. Bartók, Noam Bernstein, David M. Wilkins, Michele Ceriotti, and Gábor Csányi. 2021. “Gaussian Process Regression for Materials and Molecules.” ''Chemical Reviews'' 121 (16): 10073–141. https://doi.org/10.1021/acs.chemrev.1c00022.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;citeproc_bib_item_5&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;El-Machachi, Zakariya, Damyan Frantzov, A. Nijamudheen, Tigany Zarrouk, Miguel A. Caro, and Volker L. Deringer. 2024. “Accelerated First-Principles Exploration of Structure and Reactivity in Graphene Oxide.” arXiv. https://doi.org/10.48550/arXiv.2405.14814.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;citeproc_bib_item_6&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;Golze, Dorothea, Markus Hirvensalo, Patricia Hernández-León, Anja Aarva, Jarkko Etula, Toma Susi, Patrick Rinke, Tomi Laurila, and Miguel A. Caro. 2022. “Accurate Computational Prediction of Core-Electron Binding Energies in Carbon-Based Materials: A Machine-Learning Model Combining Density-Functional Theory and GW.” ''Chemistry of Materials'' 34 (14): 6240–54. https://doi.org/10.1021/acs.chemmater.1c04279.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;citeproc_bib_item_7&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;Muhli, Heikki, Xi Chen, Albert P. Bartók, Patricia Hernández-León, Gábor Csányi, Tapio Ala-Nissila, and Miguel A. Caro. 2021. “Machine Learning Force Fields Based on Local Parametrization of Dispersion Interactions: Application to the Phase Diagram of \&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathrm\\\C\\\\\_\60\\&amp;lt;/math&amp;gt;.” ''Physical Review B'' 104 (5): 054106. https://doi.org/10.1103/PhysRevB.104.054106.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;citeproc_bib_item_8&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;Opletal, George, Timothy C. Petersen, Amanda S. Barnard, and Salvy P. Russo. 2017. “On Reverse Monte Carlo Constraints and Model Reproduction.” ''Journal of Computational Chemistry'' 38 (17): 1547–51. https://doi.org/10.1002/jcc.24799.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;citeproc_bib_item_9&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;Santini, Claudia A., Abu Sebastian, Chiara Marchiori, Vara Prasad Jonnalagadda, Laurent Dellmann, Wabe W. Koelmans, Marta D. Rossell, Christophe P. Rossel, and Evangelos Eleftheriou. 2015. “Oxygenated Amorphous Carbon for Resistive Memory Applications.” ''Nature Communications'' 6 (1): 8600. https://doi.org/10.1038/ncomms9600.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;citeproc_bib_item_10&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;Wang, Yanzhou, Zheyong Fan, Ping Qian, Tapio Ala-Nissila, and Miguel A. Caro. 2022. “Structure and Pore Size Distribution in Nanoporous Carbon.” ''Chemistry of Materials'' 34 (2): 617–28. https://doi.org/10.1021/acs.chemmater.1c03279.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;citeproc_bib_item_11&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;Zarrouk, Tigany, Rina Ibragimova, Albert P. Bartók, and Miguel A. Caro. 2024. “Experiment-Driven Atomistic Materials Modeling: A Case Study Combining X-Ray Photoelectron Spectroscopy and Machine Learning Potentials to Infer the Structure of Oxygen-Rich Amorphous Carbon.” ''Journal of the American Chemical Society'' 146 (21): 14645–59. https://doi.org/10.1021/jacs.4c01897.&lt;/div&gt;</summary>
		<author><name>Tigany Zarrouk</name></author>
		
	</entry>
	<entry>
		<id>https://turbogap.fi/wiki/index.php?title=Tutorials&amp;diff=632</id>
		<title>Tutorials</title>
		<link rel="alternate" type="text/html" href="https://turbogap.fi/wiki/index.php?title=Tutorials&amp;diff=632"/>
		<updated>2024-06-09T17:11:52Z</updated>

		<summary type="html">&lt;p&gt;Tigany Zarrouk: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=== Molecular dynamics ===&lt;br /&gt;
&lt;br /&gt;
# Running a [[simple molecular dynamics]] simulation with '''TurboGAP''': graphitization of carbon&lt;br /&gt;
# [[Graphitization simulation with van der Waals corrections]]&lt;br /&gt;
# [[Generating amorphous silicon from quenching simulations]]&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Geometry optimization ===&lt;br /&gt;
&lt;br /&gt;
# [[Simulating icosahedral gold clusters]]&lt;br /&gt;
&lt;br /&gt;
=== Analysis and visualization ===&lt;br /&gt;
&lt;br /&gt;
# [[Energetic and structural analysis of a database of PtAu nanoclusters]]&lt;br /&gt;
&lt;br /&gt;
=== Grand-Canonical Monte-Carlo ===&lt;br /&gt;
&lt;br /&gt;
# [[Creating oxygenated amorphous carbon]]&lt;br /&gt;
# [[XPS-optimized oxygenated amorphous carbon]]&lt;/div&gt;</summary>
		<author><name>Tigany Zarrouk</name></author>
		
	</entry>
	<entry>
		<id>https://turbogap.fi/wiki/index.php?title=Monte-Carlo&amp;diff=603</id>
		<title>Monte-Carlo</title>
		<link rel="alternate" type="text/html" href="https://turbogap.fi/wiki/index.php?title=Monte-Carlo&amp;diff=603"/>
		<updated>2023-11-14T16:16:51Z</updated>

		<summary type="html">&lt;p&gt;Tigany Zarrouk: /* Monte-Carlo options */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Running Monte-Carlo = &lt;br /&gt;
To perform a (Grand-Canonical) Monte-Carlo simulation we must run '''TurboGAP''' in &amp;lt;code&amp;gt;mc&amp;lt;/code&amp;gt; mode:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;turbogap mc&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
The following files are written to every &amp;lt;code&amp;gt;write_xyz = N&amp;lt;/code&amp;gt; steps&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;code&amp;gt;mc.log&amp;lt;/code&amp;gt;: self-explanatory,&lt;br /&gt;
** format: &amp;lt;code&amp;gt;mc_step  mc_move  accepted  E_trial  E_current  N_sites(trial) N_gcmc_species(trial)&amp;lt;/code&amp;gt;&lt;br /&gt;
* &amp;lt;code&amp;gt;mc_all.xyz&amp;lt;/code&amp;gt;: an appended file which contains all accepted moves&lt;br /&gt;
* &amp;lt;code&amp;gt;mc_trial.xyz&amp;lt;/code&amp;gt;: a single configuration which contains the trial move&lt;br /&gt;
* &amp;lt;code&amp;gt;mc_current.xyz&amp;lt;/code&amp;gt;: a single configuration which contains the current accepted&lt;br /&gt;
&lt;br /&gt;
= Monte-Carlo Move Types = &lt;br /&gt;
We can specify a number of Monte-Carlo trial move types, including doing molecular dynamics (hybrid Monte-Carlo) as trial moves. These include &lt;br /&gt;
* Displacement&lt;br /&gt;
* Swap (to swap atoms in the simulation box)&lt;br /&gt;
* Volume (for NPT)&lt;br /&gt;
* Insertion (for mu VT) &lt;br /&gt;
* Removal  (for mu VT)&lt;br /&gt;
* MD (for hybrid Monte-Carlo)&lt;br /&gt;
&lt;br /&gt;
= Minimal Input File = &lt;br /&gt;
&amp;lt;pre class=&amp;quot;conf&amp;quot;&amp;gt;! Species-specific info&lt;br /&gt;
atoms_file = 'atoms.xyz'&lt;br /&gt;
pot_file = 'gap_files/CO.gap'&lt;br /&gt;
n_species = 2&lt;br /&gt;
species = C O&lt;br /&gt;
masses = 12.01 15.99&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
mc_nsteps = 5000                         ! Number of mc trial steps to be performed&lt;br /&gt;
&lt;br /&gt;
n_mc_types = 3                           ! Number of mc trial types&lt;br /&gt;
mc_types = 'move' 'insertion' 'removal'  ! MC types can be: 'insertion' 'removal' 'md' 'swap' 'move'&lt;br /&gt;
                                         !                  'volume'&lt;br /&gt;
mc_acceptance = 1 1 1                    ! Ratios for choosing the respective trial moves (all equally likely here)&lt;br /&gt;
&lt;br /&gt;
mc_move_max = 0.2                        ! Maximum distance for the move of a particular particle&lt;br /&gt;
&lt;br /&gt;
n_mc_mu = 1&lt;br /&gt;
mc_mu = 0.0                              ! gcmc: Chemical potential [eV], using a large one here&lt;br /&gt;
mc_species = 'O'                         ! gcmc: species to insert / remove&lt;br /&gt;
mc_min_dist = 0.1                        ! gcmc: minimum distance between particles for insertion&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
! Note: The following files are written to every write_xyz steps&lt;br /&gt;
!       mc.log: self-explanatory,&lt;br /&gt;
!          format: mc_step  mc_move  accepted  E_trial  E_current  N_sites(trial)&lt;br /&gt;
!                                                                     N_gcmc_species(trial)&lt;br /&gt;
!       mc_all.xyz:     an appended file which contains all accepted moves&lt;br /&gt;
!       mc_trial.xyz:   a single configuration which contains the trial move&lt;br /&gt;
!       mc_current.xyz: a single configuration which contains the current accepted&lt;br /&gt;
&lt;br /&gt;
write_xyz = 200&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;monte-carlo-options&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
= Monte-Carlo options =&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Keyword&lt;br /&gt;
! Definition&lt;br /&gt;
! Optional&lt;br /&gt;
! Type&lt;br /&gt;
! Default&lt;br /&gt;
! Used when&lt;br /&gt;
! Example&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;mc_nsteps&amp;lt;/code&amp;gt;&lt;br /&gt;
| Number of MC steps&lt;br /&gt;
| N&lt;br /&gt;
| Int&lt;br /&gt;
| 0&lt;br /&gt;
| turbogap mc&lt;br /&gt;
| &amp;lt;code&amp;gt;mc_nsteps = 1000&amp;lt;/code&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;n_mc_types&amp;lt;/code&amp;gt;&lt;br /&gt;
| Number of MC types&lt;br /&gt;
| N&lt;br /&gt;
| Int&lt;br /&gt;
| 0&lt;br /&gt;
| turbogap mc&lt;br /&gt;
| &amp;lt;code&amp;gt;n_mc_types = 2&amp;lt;/code&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;mc_types&amp;lt;/code&amp;gt;&lt;br /&gt;
| Types of MC trials&lt;br /&gt;
| N&lt;br /&gt;
| Str(s)&lt;br /&gt;
| None&lt;br /&gt;
| &amp;lt;code&amp;gt;n_mc_types&amp;lt;/code&amp;gt; &amp;amp;gt; 0&lt;br /&gt;
| &amp;lt;code&amp;gt;mc_types = 'volume' 'move'&amp;lt;/code&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;mc_acceptance&amp;lt;/code&amp;gt;&lt;br /&gt;
| Ratios of MC trial moves&lt;br /&gt;
| N&lt;br /&gt;
| Int(s)&lt;br /&gt;
| None&lt;br /&gt;
| &amp;lt;code&amp;gt;n_mc_types&amp;lt;/code&amp;gt; &amp;amp;gt; 0&lt;br /&gt;
| &amp;lt;code&amp;gt;mc_acceptance = 2 1&amp;lt;/code&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;n_mc_swaps&amp;lt;/code&amp;gt;&lt;br /&gt;
| Number of swaps&lt;br /&gt;
| Y&lt;br /&gt;
| Int&lt;br /&gt;
| 0&lt;br /&gt;
| 'swap' in &amp;lt;code&amp;gt;mc_types&amp;lt;/code&amp;gt;&lt;br /&gt;
| &amp;lt;code&amp;gt;n_mc_swaps = 2&amp;lt;/code&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;mc_swaps&amp;lt;/code&amp;gt;&lt;br /&gt;
| Swap species&lt;br /&gt;
| Y&lt;br /&gt;
| Strs&lt;br /&gt;
| None&lt;br /&gt;
| 'swap' in &amp;lt;code&amp;gt;mc_types&amp;lt;/code&amp;gt;&lt;br /&gt;
| &amp;lt;code&amp;gt;mc_swaps = 'C' 'O' 'N' 'C'&amp;lt;/code&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;mc_move_max&amp;lt;/code&amp;gt;&lt;br /&gt;
| Maximum displacement [A]&lt;br /&gt;
| Y&lt;br /&gt;
| Float&lt;br /&gt;
| 1.0&lt;br /&gt;
| 'move' in &amp;lt;code&amp;gt;mc_types&amp;lt;/code&amp;gt;&lt;br /&gt;
| &amp;lt;code&amp;gt;mc_move_max = 0.5&amp;lt;/code&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;mc_lnvol_max&amp;lt;/code&amp;gt;&lt;br /&gt;
| Log volume max for volume moves.&lt;br /&gt;
| Y&lt;br /&gt;
| Float&lt;br /&gt;
| 0.01&lt;br /&gt;
| 'volume' in &amp;lt;code&amp;gt;mc_types&amp;lt;/code&amp;gt;&lt;br /&gt;
| &amp;lt;code&amp;gt;mc_lnvol_max = 0.02&amp;lt;/code&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;mc_min_dist&amp;lt;/code&amp;gt;&lt;br /&gt;
| Minimum distance for insertion [A]&lt;br /&gt;
| Y&lt;br /&gt;
| Float&lt;br /&gt;
| 0.2&lt;br /&gt;
| 'insertion in &amp;lt;code&amp;gt;mc_types&amp;lt;/code&amp;gt;&lt;br /&gt;
| &amp;lt;code&amp;gt;mc_min_dist = 0.1&amp;lt;/code&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;n_mc_mu&amp;lt;/code&amp;gt;&lt;br /&gt;
| Number of chemical potentials/gcmc species&lt;br /&gt;
| Y&lt;br /&gt;
| Int&lt;br /&gt;
| 1&lt;br /&gt;
| 'insertion'/'removal' in &amp;lt;code&amp;gt;mc_types&amp;lt;/code&amp;gt;&lt;br /&gt;
| &amp;lt;code&amp;gt;n_mc_mu = 2&amp;lt;/code&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;mc_mu&amp;lt;/code&amp;gt;&lt;br /&gt;
| Chemical potential(s) [eV]&lt;br /&gt;
| Y&lt;br /&gt;
| Float&lt;br /&gt;
| 0.0&lt;br /&gt;
| 'insertion'/'removal' in &amp;lt;code&amp;gt;mc_types&amp;lt;/code&amp;gt;&lt;br /&gt;
| &amp;lt;code&amp;gt;mc_mu = -5.16 -2.25&amp;lt;/code&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;mc_species&amp;lt;/code&amp;gt;&lt;br /&gt;
| GCMC species&lt;br /&gt;
| Y&lt;br /&gt;
| Str&lt;br /&gt;
| None&lt;br /&gt;
| 'insertion'/'removal' in &amp;lt;code&amp;gt;mc_types&amp;lt;/code&amp;gt;&lt;br /&gt;
| &amp;lt;code&amp;gt;mc_species = 'O' 'H'&amp;lt;/code&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;mc_relax&amp;lt;/code&amp;gt;&lt;br /&gt;
| Relax MC trials prior to acc. evaluation&lt;br /&gt;
| Y&lt;br /&gt;
| Bool&lt;br /&gt;
| .false.&lt;br /&gt;
| turbogap mc&lt;br /&gt;
| &amp;lt;code&amp;gt;mc_relax = .true.&amp;lt;/code&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;n_mc_relax_after&amp;lt;/code&amp;gt;&lt;br /&gt;
| Number of specific trials to relax&lt;br /&gt;
| Y&lt;br /&gt;
| Int(s)&lt;br /&gt;
| None&lt;br /&gt;
| &amp;lt;code&amp;gt;mc_relax = .true.&amp;lt;/code&amp;gt;&lt;br /&gt;
| &amp;lt;code&amp;gt;n_mc_relax_after = 1&amp;lt;/code&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;mc_relax_after&amp;lt;/code&amp;gt;&lt;br /&gt;
| Relax specific MC trial types&lt;br /&gt;
| Y&lt;br /&gt;
| Str(s)&lt;br /&gt;
| None&lt;br /&gt;
| &amp;lt;code&amp;gt;n_mc_relax_after &amp;amp;gt; 0&amp;lt;/code&amp;gt;&lt;br /&gt;
| &amp;lt;code&amp;gt;mc_relax_after = 'volume'&amp;lt;/code&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;mc_nrelax&amp;lt;/code&amp;gt;&lt;br /&gt;
| Number of relaxation steps after trial&lt;br /&gt;
| Y&lt;br /&gt;
| Int&lt;br /&gt;
| 0&lt;br /&gt;
| &amp;lt;code&amp;gt;mc_relax = .true.&amp;lt;/code&amp;gt;&lt;br /&gt;
| &amp;lt;code&amp;gt;mc_nrelax = 50&amp;lt;/code&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;mc_relax_opt&amp;lt;/code&amp;gt;&lt;br /&gt;
| Optimisation for relaxing after steps&lt;br /&gt;
| Y&lt;br /&gt;
| Str&lt;br /&gt;
| 'gd'&lt;br /&gt;
| &amp;lt;code&amp;gt;mc_relax = .true.&amp;lt;/code&amp;gt;&lt;br /&gt;
| &amp;lt;code&amp;gt;mc_relax_opt = 'gd-box-ortho'&amp;lt;/code&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;mc_hamiltonian&amp;lt;/code&amp;gt;&lt;br /&gt;
| Use NVE for 'md' trials&lt;br /&gt;
| Y&lt;br /&gt;
| Bool&lt;br /&gt;
| .false.&lt;br /&gt;
| 'md' in &amp;lt;code&amp;gt;mc_types&amp;lt;/code&amp;gt;&lt;br /&gt;
| &amp;lt;code&amp;gt;mc_hamiltonian = .true.&amp;lt;/code&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;mc_hybrid_opt&amp;lt;/code&amp;gt;&lt;br /&gt;
| Optimisation for 'md' steps&lt;br /&gt;
| Y&lt;br /&gt;
| Str&lt;br /&gt;
| 'vv'&lt;br /&gt;
| 'md' in &amp;lt;code&amp;gt;mc_types&amp;lt;/code&amp;gt;&lt;br /&gt;
| &amp;lt;code&amp;gt;mc_hybrid_opt = 'vv'&amp;lt;/code&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;mc_write_xyz&amp;lt;/code&amp;gt;&lt;br /&gt;
| Debug: read and write to files every step&lt;br /&gt;
| Y&lt;br /&gt;
| Bool&lt;br /&gt;
| .false.&lt;br /&gt;
| &amp;lt;code&amp;gt;turbogap mc&amp;lt;/code&amp;gt;&lt;br /&gt;
| &amp;lt;code&amp;gt;mc_write_xyz = .true.&amp;lt;/code&amp;gt;&lt;br /&gt;
|}&lt;/div&gt;</summary>
		<author><name>Tigany Zarrouk</name></author>
		
	</entry>
	<entry>
		<id>https://turbogap.fi/wiki/index.php?title=Monte-Carlo&amp;diff=602</id>
		<title>Monte-Carlo</title>
		<link rel="alternate" type="text/html" href="https://turbogap.fi/wiki/index.php?title=Monte-Carlo&amp;diff=602"/>
		<updated>2023-11-14T16:12:41Z</updated>

		<summary type="html">&lt;p&gt;Tigany Zarrouk: /* Minimal Input File */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Running Monte-Carlo = &lt;br /&gt;
To perform a (Grand-Canonical) Monte-Carlo simulation we must run '''TurboGAP''' in &amp;lt;code&amp;gt;mc&amp;lt;/code&amp;gt; mode:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;turbogap mc&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
The following files are written to every &amp;lt;code&amp;gt;write_xyz = N&amp;lt;/code&amp;gt; steps&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;code&amp;gt;mc.log&amp;lt;/code&amp;gt;: self-explanatory,&lt;br /&gt;
** format: &amp;lt;code&amp;gt;mc_step  mc_move  accepted  E_trial  E_current  N_sites(trial) N_gcmc_species(trial)&amp;lt;/code&amp;gt;&lt;br /&gt;
* &amp;lt;code&amp;gt;mc_all.xyz&amp;lt;/code&amp;gt;: an appended file which contains all accepted moves&lt;br /&gt;
* &amp;lt;code&amp;gt;mc_trial.xyz&amp;lt;/code&amp;gt;: a single configuration which contains the trial move&lt;br /&gt;
* &amp;lt;code&amp;gt;mc_current.xyz&amp;lt;/code&amp;gt;: a single configuration which contains the current accepted&lt;br /&gt;
&lt;br /&gt;
= Monte-Carlo Move Types = &lt;br /&gt;
We can specify a number of Monte-Carlo trial move types, including doing molecular dynamics (hybrid Monte-Carlo) as trial moves. These include &lt;br /&gt;
* Displacement&lt;br /&gt;
* Swap (to swap atoms in the simulation box)&lt;br /&gt;
* Volume (for NPT)&lt;br /&gt;
* Insertion (for mu VT) &lt;br /&gt;
* Removal  (for mu VT)&lt;br /&gt;
* MD (for hybrid Monte-Carlo)&lt;br /&gt;
&lt;br /&gt;
= Minimal Input File = &lt;br /&gt;
&amp;lt;pre class=&amp;quot;conf&amp;quot;&amp;gt;! Species-specific info&lt;br /&gt;
atoms_file = 'atoms.xyz'&lt;br /&gt;
pot_file = 'gap_files/CO.gap'&lt;br /&gt;
n_species = 2&lt;br /&gt;
species = C O&lt;br /&gt;
masses = 12.01 15.99&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
mc_nsteps = 5000                         ! Number of mc trial steps to be performed&lt;br /&gt;
&lt;br /&gt;
n_mc_types = 3                           ! Number of mc trial types&lt;br /&gt;
mc_types = 'move' 'insertion' 'removal'  ! MC types can be: 'insertion' 'removal' 'md' 'swap' 'move'&lt;br /&gt;
                                         !                  'volume'&lt;br /&gt;
mc_acceptance = 1 1 1                    ! Ratios for choosing the respective trial moves (all equally likely here)&lt;br /&gt;
&lt;br /&gt;
mc_move_max = 0.2                        ! Maximum distance for the move of a particular particle&lt;br /&gt;
&lt;br /&gt;
n_mc_mu = 1&lt;br /&gt;
mc_mu = 0.0                              ! gcmc: Chemical potential [eV], using a large one here&lt;br /&gt;
mc_species = 'O'                         ! gcmc: species to insert / remove&lt;br /&gt;
mc_min_dist = 0.1                        ! gcmc: minimum distance between particles for insertion&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
! Note: The following files are written to every write_xyz steps&lt;br /&gt;
!       mc.log: self-explanatory,&lt;br /&gt;
!          format: mc_step  mc_move  accepted  E_trial  E_current  N_sites(trial)&lt;br /&gt;
!                                                                     N_gcmc_species(trial)&lt;br /&gt;
!       mc_all.xyz:     an appended file which contains all accepted moves&lt;br /&gt;
!       mc_trial.xyz:   a single configuration which contains the trial move&lt;br /&gt;
!       mc_current.xyz: a single configuration which contains the current accepted&lt;br /&gt;
&lt;br /&gt;
write_xyz = 200&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Monte-Carlo options =&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Keyword&lt;br /&gt;
! Definition&lt;br /&gt;
! Optional&lt;br /&gt;
! Type&lt;br /&gt;
! Default&lt;br /&gt;
! Used when&lt;br /&gt;
! Example&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;mc_nsteps&amp;lt;/code&amp;gt;&lt;br /&gt;
| Number of MC steps&lt;br /&gt;
| N&lt;br /&gt;
| Int&lt;br /&gt;
| 0&lt;br /&gt;
| turbogap mc&lt;br /&gt;
| &amp;lt;code&amp;gt;mc_nsteps = 1000&amp;lt;/code&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;n_mc_types&amp;lt;/code&amp;gt;&lt;br /&gt;
| Number of MC types&lt;br /&gt;
| N&lt;br /&gt;
| Int&lt;br /&gt;
| 0&lt;br /&gt;
| turbogap mc&lt;br /&gt;
| &amp;lt;code&amp;gt;n_mc_types = 2&amp;lt;/code&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;mc_types&amp;lt;/code&amp;gt;&lt;br /&gt;
| Types of MC trials&lt;br /&gt;
| N&lt;br /&gt;
| Str(s)&lt;br /&gt;
| None&lt;br /&gt;
| &amp;lt;code&amp;gt;n_mc_types&amp;lt;/code&amp;gt; &amp;amp;gt; 0&lt;br /&gt;
| &amp;lt;code&amp;gt;mc_types = 'volume' 'move'&amp;lt;/code&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;mc_acceptance&amp;lt;/code&amp;gt;&lt;br /&gt;
| Ratios of MC trial moves&lt;br /&gt;
| N&lt;br /&gt;
| Int(s)&lt;br /&gt;
| None&lt;br /&gt;
| &amp;lt;code&amp;gt;n_mc_types&amp;lt;/code&amp;gt; &amp;amp;gt; 0&lt;br /&gt;
| &amp;lt;code&amp;gt;mc_acceptance = 2 1&amp;lt;/code&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;n_mc_swaps&amp;lt;/code&amp;gt;&lt;br /&gt;
| Number of swaps&lt;br /&gt;
| Y&lt;br /&gt;
| Int&lt;br /&gt;
| 0&lt;br /&gt;
| 'swap' in &amp;lt;code&amp;gt;mc_types&amp;lt;/code&amp;gt;&lt;br /&gt;
| &amp;lt;code&amp;gt;n_mc_swaps = 2&amp;lt;/code&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;mc_swaps&amp;lt;/code&amp;gt;&lt;br /&gt;
| Swap species&lt;br /&gt;
| Y&lt;br /&gt;
| Strs&lt;br /&gt;
| None&lt;br /&gt;
| 'swap' in &amp;lt;code&amp;gt;mc_types&amp;lt;/code&amp;gt;&lt;br /&gt;
| &amp;lt;code&amp;gt;mc_swaps = 'C' 'O' 'N' 'C'&amp;lt;/code&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;mc_move_max&amp;lt;/code&amp;gt;&lt;br /&gt;
| Maximum displacement [A]&lt;br /&gt;
| Y&lt;br /&gt;
| Float&lt;br /&gt;
| 1.0&lt;br /&gt;
| 'move' in &amp;lt;code&amp;gt;mc_types&amp;lt;/code&amp;gt;&lt;br /&gt;
| &amp;lt;code&amp;gt;mc_move_max = 0.5&amp;lt;/code&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;mc_lnvol_max&amp;lt;/code&amp;gt;&lt;br /&gt;
| Log volume max for volume moves.&lt;br /&gt;
| Y&lt;br /&gt;
| Float&lt;br /&gt;
| 0.01&lt;br /&gt;
| 'volume' in &amp;lt;code&amp;gt;mc_types&amp;lt;/code&amp;gt;&lt;br /&gt;
| &amp;lt;code&amp;gt;mc_lnvol_max = 0.02&amp;lt;/code&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;mc_min_dist&amp;lt;/code&amp;gt;&lt;br /&gt;
| Minimum distance for insertion [A]&lt;br /&gt;
| Y&lt;br /&gt;
| Float&lt;br /&gt;
| 0.2&lt;br /&gt;
| 'insertion in &amp;lt;code&amp;gt;mc_types&amp;lt;/code&amp;gt;&lt;br /&gt;
| &amp;lt;code&amp;gt;mc_min_dist = 0.1&amp;lt;/code&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;mc_mu&amp;lt;/code&amp;gt;&lt;br /&gt;
| Chemical potential [eV]&lt;br /&gt;
| Y&lt;br /&gt;
| Float&lt;br /&gt;
| 0.0&lt;br /&gt;
| 'insertion'/'removal' in &amp;lt;code&amp;gt;mc_types&amp;lt;/code&amp;gt;&lt;br /&gt;
| &amp;lt;code&amp;gt;mc_mu = -5.16&amp;lt;/code&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;mc_species&amp;lt;/code&amp;gt;&lt;br /&gt;
| GCMC species&lt;br /&gt;
| Y&lt;br /&gt;
| Str&lt;br /&gt;
| None&lt;br /&gt;
| 'insertion'/'removal' in &amp;lt;code&amp;gt;mc_types&amp;lt;/code&amp;gt;&lt;br /&gt;
| &amp;lt;code&amp;gt;mc_species = 'O'&amp;lt;/code&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;mc_relax&amp;lt;/code&amp;gt;&lt;br /&gt;
| Relax MC trials prior to acc. evaluation&lt;br /&gt;
| Y&lt;br /&gt;
| Bool&lt;br /&gt;
| .false.&lt;br /&gt;
| turbogap mc&lt;br /&gt;
| &amp;lt;code&amp;gt;mc_relax = .true.&amp;lt;/code&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;n_mc_relax_after&amp;lt;/code&amp;gt;&lt;br /&gt;
| Number of specific trials to relax&lt;br /&gt;
| Y&lt;br /&gt;
| Int(s)&lt;br /&gt;
| None&lt;br /&gt;
| &amp;lt;code&amp;gt;mc_relax = .true.&amp;lt;/code&amp;gt;&lt;br /&gt;
| &amp;lt;code&amp;gt;n_mc_relax_after = 1&amp;lt;/code&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;mc_relax_after&amp;lt;/code&amp;gt;&lt;br /&gt;
| Relax specific MC trial types&lt;br /&gt;
| Y&lt;br /&gt;
| Str(s)&lt;br /&gt;
| None&lt;br /&gt;
| &amp;lt;code&amp;gt;n_mc_relax_after &amp;amp;gt; 0&amp;lt;/code&amp;gt;&lt;br /&gt;
| &amp;lt;code&amp;gt;mc_relax_after = 'volume'&amp;lt;/code&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;mc_nrelax&amp;lt;/code&amp;gt;&lt;br /&gt;
| Number of relaxation steps after trial&lt;br /&gt;
| Y&lt;br /&gt;
| Int&lt;br /&gt;
| 0&lt;br /&gt;
| &amp;lt;code&amp;gt;mc_relax = .true.&amp;lt;/code&amp;gt;&lt;br /&gt;
| &amp;lt;code&amp;gt;mc_nrelax = 50&amp;lt;/code&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;mc_relax_opt&amp;lt;/code&amp;gt;&lt;br /&gt;
| Optimisation for relaxing after steps&lt;br /&gt;
| Y&lt;br /&gt;
| Str&lt;br /&gt;
| 'gd'&lt;br /&gt;
| &amp;lt;code&amp;gt;mc_relax = .true.&amp;lt;/code&amp;gt;&lt;br /&gt;
| &amp;lt;code&amp;gt;mc_relax_opt = 'gd-box-ortho'&amp;lt;/code&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;mc_hamiltonian&amp;lt;/code&amp;gt;&lt;br /&gt;
| Use NVE for 'md' trials&lt;br /&gt;
| Y&lt;br /&gt;
| Bool&lt;br /&gt;
| .false.&lt;br /&gt;
| 'md' in &amp;lt;code&amp;gt;mc_types&amp;lt;/code&amp;gt;&lt;br /&gt;
| &amp;lt;code&amp;gt;mc_hamiltonian = .true.&amp;lt;/code&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;mc_hybrid_opt&amp;lt;/code&amp;gt;&lt;br /&gt;
| Optimisation for 'md' steps&lt;br /&gt;
| Y&lt;br /&gt;
| Str&lt;br /&gt;
| 'vv'&lt;br /&gt;
| 'md' in &amp;lt;code&amp;gt;mc_types&amp;lt;/code&amp;gt;&lt;br /&gt;
| &amp;lt;code&amp;gt;mc_hybrid_opt = 'vv'&amp;lt;/code&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;mc_write_xyz&amp;lt;/code&amp;gt;&lt;br /&gt;
| Debug: read and write to files every step&lt;br /&gt;
| Y&lt;br /&gt;
| Bool&lt;br /&gt;
| .false.&lt;br /&gt;
| &amp;lt;code&amp;gt;turbogap mc&amp;lt;/code&amp;gt;&lt;br /&gt;
| &amp;lt;code&amp;gt;mc_write_xyz = .true.&amp;lt;/code&amp;gt;&lt;br /&gt;
|}&lt;/div&gt;</summary>
		<author><name>Tigany Zarrouk</name></author>
		
	</entry>
	<entry>
		<id>https://turbogap.fi/wiki/index.php?title=Creating_oxygenated_amorphous_carbon&amp;diff=577</id>
		<title>Creating oxygenated amorphous carbon</title>
		<link rel="alternate" type="text/html" href="https://turbogap.fi/wiki/index.php?title=Creating_oxygenated_amorphous_carbon&amp;diff=577"/>
		<updated>2023-11-06T14:06:05Z</updated>

		<summary type="html">&lt;p&gt;Tigany Zarrouk: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This tutorial will focus on using molecular dynamics and Grand-Canonical Monte-Carlo (GCMC) simulations to determine equilibrium structures of oxygenated amorphous carbon using '''TurboGAP'''.&lt;br /&gt;
&lt;br /&gt;
This tutorial is found on the '''TurboGAP''' wiki: &amp;lt;u&amp;gt;turbogap.fi&amp;lt;/u&amp;gt; (-&amp;amp;gt; tutorials -&amp;amp;gt; Creating oxygenated amorphous carbon) https://turbogap.fi/wiki/index.php/Creating_oxygenated_amorphous_carbon.&lt;br /&gt;
&lt;br /&gt;
The structure of this tutorial as as follows:&lt;br /&gt;
&lt;br /&gt;
# Create an amorphous carbon structure using molecular dynamics, via a melt-quench procedure.&lt;br /&gt;
# Perform a standard GCMC calculation to populate the structure with oxygen.&lt;br /&gt;
# Perform a hybrid Monte-Carlo/MD simulations, to relax the system.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;introduction&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
= Introduction =&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;what-is-turbogap&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
== What is '''TurboGAP'''? ==&lt;br /&gt;
&lt;br /&gt;
TurboGAP is a code used to simulate Machine-Learned Potentials, specifically, &amp;lt;u&amp;gt;Gaussian Approximation Potentials&amp;lt;/u&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
It has numerous selling points:&lt;br /&gt;
&lt;br /&gt;
# It is ''fast''.&lt;br /&gt;
#* It uses '''soap turbo''' descriptors, which are both faster and more accurate than your typical SOAP expansion (also found in QUIP). See the original paper paper by Miguel Caro for more details: [https://doi.org/10.1103/PhysRevB.100.024112 Optimizing many-body atomic descriptors for enhanced computational performance of machine learning based interatomic potentials]&lt;br /&gt;
#* MPI parallelised, (overlapping domain decomposition currently being developed with help of CSC).&lt;br /&gt;
#* &amp;lt;u&amp;gt;GPU implementation&amp;lt;/u&amp;gt; in progress (with CSC support too).&lt;br /&gt;
# It can perform not just typical molecular statics (with/without box relaxation) and dynamics (&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;NVT&amp;lt;/math&amp;gt; / &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;NPT&amp;lt;/math&amp;gt;), it can perform ''Grand-Canonical Monte-Carlo'' simulations.&lt;br /&gt;
#* Grand-Canonical Monte Carlo (&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mu VT&amp;lt;/math&amp;gt;), with (&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;NVT&amp;lt;/math&amp;gt;) / (&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;NPT&amp;lt;/math&amp;gt;) move types available.&lt;br /&gt;
#* Adaptive time-scale MD (by Uttiyoarnab Saha).&lt;br /&gt;
# Prediction of an arbitrary number of local properties.&lt;br /&gt;
#* &amp;lt;u&amp;gt;ML Van der Waals&amp;lt;/u&amp;gt; (by prediction of local hirshfeld volumes) using Tkatchenko-Scheffler [https://doi.org/10.1103/PhysRevB.104.054106 Machine learning force fields based on local parametrization of dispersion interactions]&lt;br /&gt;
#* Heikki Muhli has developed ''Many-Body Dispersion'' capability, with multiple optimisations.&lt;br /&gt;
#* Max Veit is developing ''electrostatics''.&lt;br /&gt;
# &amp;lt;u&amp;gt;Sneak Peek!&amp;lt;/u&amp;gt;: we have added the capability to predict/simulate numerous types of experimental data (ML XPS/XRD) and can allow them to influence simulation. (Talk to Tigany Zarrouk/look out for the papers when they come out on arXiv)!&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;installing-turbogap&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
== Installing TurboGAP ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;for-the-mlip-workshop&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== For the MLIP workshop ===&lt;br /&gt;
&lt;br /&gt;
If you have a CSC account and can ssh into Mahti/Puhti there is no need to install anything. TurboGAP is installed in the path (on Mahti / Puhti)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;/projappl/project_2008666/turbogap&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
The tutorial is in&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;cd /projappl/project_2008666/turbogap/tutorials/creating_a-COx&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
Copy the directory &amp;lt;code&amp;gt;creating_a-COx&amp;lt;/code&amp;gt; to wherever you want to do the simulations and then check the project in &amp;lt;code&amp;gt;creating_a-COx/sample_submit_script.sh&amp;lt;/code&amp;gt;, change it from &lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;#SBATCH --account=project_&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
to&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;#SBATCH --account=project_2008666&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
This tutorial depends on &amp;lt;code&amp;gt;ase&amp;lt;/code&amp;gt;, so install it as so (after loading the python module)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;module load python-data/3.9-22.04&lt;br /&gt;
pip install ase --user&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
Each of the simulations should take ~5-8 minutes.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;installation&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== Installation ===&lt;br /&gt;
&lt;br /&gt;
To install TurboGAP please run&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;git clone --recursive http://github.com/mcaroba/turbogap.git /your/turbogap/source/directory&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
Where /your/turbogap/source/directory is the directory where you're putting the TurboGAP source code. To build the TurboGAP binary and library, you need to select the options that best match your architecture, by editing this line in the Makefile with one of the names of the corresponding makefiles in turbogap/makefiles:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;include makefiles/Makefile.Ubuntu_gfortran_mpi&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
Then just run &amp;lt;code&amp;gt;make&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;make&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
Copy the directory &amp;lt;code&amp;gt;turbogap/tutorials/creating_a-COx&amp;lt;/code&amp;gt; to wherever you want to do the simulations.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;running-this-tutorial-on-a-cluster&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== Running this tutorial on a cluster ===&lt;br /&gt;
&lt;br /&gt;
* Copy the directory &amp;lt;code&amp;gt;turbogap/tutorials/creating_a-COx&amp;lt;/code&amp;gt; to where you want to run.&lt;br /&gt;
* Change &amp;lt;code&amp;gt;sample_submit_script.sh&amp;lt;/code&amp;gt; to reflect the type of job scheduler you use (here, it's slurm), the modules you've loaded for &amp;lt;code&amp;gt;turbogap&amp;lt;/code&amp;gt; and python, and change the &amp;lt;code&amp;gt;PATH&amp;lt;/code&amp;gt; environment variable to where you've installed &amp;lt;code&amp;gt;turbogap/bin&amp;lt;/code&amp;gt;.&lt;br /&gt;
* Make sure the project account is correct!&lt;br /&gt;
* Load the python module you will use, and make sure &amp;lt;code&amp;gt;ase&amp;lt;/code&amp;gt; is installed by running &amp;lt;code&amp;gt;pip install ase {--user}&amp;lt;/code&amp;gt;.&lt;br /&gt;
* Change the &amp;lt;code&amp;gt;srun turbogap&amp;lt;/code&amp;gt; commands in the &amp;lt;code&amp;gt;script_*.sh&amp;lt;/code&amp;gt; files to the standard for your cluster (e.g. &amp;lt;code&amp;gt;mpirun -np $N turbogap&amp;lt;/code&amp;gt;).&lt;br /&gt;
* In each of the directories enumerated with &amp;amp;quot;1.,2., etc&amp;amp;quot;, run the scripts in order after the preceding job has finished. They are enumerated with &amp;amp;quot;1.,2., etc&amp;amp;quot; with bash, e.g. &amp;lt;code&amp;gt;bash 1.run_randomise.sh&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;running-this-tutorial-locally&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== Running this tutorial locally ===&lt;br /&gt;
&lt;br /&gt;
* Copy the directory &amp;lt;code&amp;gt;turbogap/tutorials/creating_a-COx&amp;lt;/code&amp;gt; to where you want to run.&lt;br /&gt;
* Make sure the python package &amp;lt;code&amp;gt;ase&amp;lt;/code&amp;gt; is installed by running &amp;lt;code&amp;gt;pip install ase {--user}&amp;lt;/code&amp;gt;.&lt;br /&gt;
* Edit the convenience script &amp;lt;code&amp;gt;change_to_local.sh&amp;lt;/code&amp;gt; and run with bash.&lt;br /&gt;
* Change the path environment variable in &amp;lt;code&amp;gt;sample_submit_script.sh&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;note-how-to-make-a-potential-work-in-turbogap&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
== Note: how to make a potential work in '''TurboGAP''' ==&lt;br /&gt;
&lt;br /&gt;
You must convert potentials which are trained from [https://github.com/libatoms/QUIP libAtoms] (the xml files) to &amp;lt;code&amp;gt;*.gap&amp;lt;/code&amp;gt; files. It can be run by&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;python3 /path/turbogap/tools/quip_to_xml/make_gap_files.py  your_potential.xml your_potential.gap {your_hirshfeld.xml}&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;span id=&amp;quot;tutorial&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
= Tutorial =&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;create-amorphous-carbon&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
== Create Amorphous Carbon ==&lt;br /&gt;
&lt;br /&gt;
Here, we perform molecular dynamics simulations to form amorphous carbon from diamond. To do this, we use a simple melt-quench procedure, which is modified from the paper of Wang ''et al.'' to create amorphous carbon [https://doi.org/10.1021/acs.chemmater.1c03279 Structure and Pore Size Distribution in Nanoporous Carbon].&lt;br /&gt;
&lt;br /&gt;
This is also similar to what is done in other tutorials [https://turbogap.fi/wiki/index.php/Graphitization_simulation_with_van_der_Waals_corrections Graphitization simulation with van der Waals corrections] [https://turbogap.fi/wiki/index.php/Generating_amorphous_silicon_from_quenching_simulations Generating amorphous silicon from quenching simulations].&lt;br /&gt;
&lt;br /&gt;
The procedure we will follow is:&lt;br /&gt;
&lt;br /&gt;
# We heat up the diamond to 9000K, thereby randomizing the structure.&lt;br /&gt;
# We quench to 1000K (actual temp used is 3500K in the real paper).&lt;br /&gt;
# We anneal (partially graphitize) the structure at 1000K, to allow the carbon bonds a chance to reform.&lt;br /&gt;
# Relax the structure, allowing both atomic positions and cell vectors to relax.&lt;br /&gt;
&lt;br /&gt;
To run these calculations, do&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;cd 1.make_amorphous_carbon&lt;br /&gt;
bash 1.run_randomise.sh&lt;br /&gt;
# Wait for it to finish&lt;br /&gt;
&lt;br /&gt;
bash 2.run_quench.sh&lt;br /&gt;
# Wait for it to finish&lt;br /&gt;
&lt;br /&gt;
bash 3.run_anneal.sh&lt;br /&gt;
# Wait for it to finish&lt;br /&gt;
&lt;br /&gt;
bash 4.run_relax.sh&lt;br /&gt;
# Wait for it to finish&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;span id=&amp;quot;randomise&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== 1. Randomise ===&lt;br /&gt;
&lt;br /&gt;
First, we create a diamond structure using ASE, changing the volume to achieve a given density.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;sim_name=&amp;quot;md_diamond_randomise&amp;quot;&lt;br /&gt;
&lt;br /&gt;
input_atoms=&amp;quot;atoms.xyz&amp;quot;&lt;br /&gt;
output_atoms=&amp;quot;atoms_randomise.xyz&amp;quot;&lt;br /&gt;
&lt;br /&gt;
ln -sf ../gap_files ./&lt;br /&gt;
&lt;br /&gt;
# 1. Create diamond structure (1000 atoms in atoms.xyz file)&lt;br /&gt;
echo &amp;quot;&amp;gt; Running: python create_diamond.py&amp;quot;&lt;br /&gt;
python3 create_diamond.py&lt;br /&gt;
&lt;br /&gt;
cp diamond.xyz $input_atoms&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;u&amp;gt;Note:&amp;lt;/u&amp;gt; In &amp;lt;code&amp;gt;create_diamond.py&amp;lt;/code&amp;gt; we make 1000 atoms. You can change this to a smaller number, if you want things to run faster.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;python&amp;quot;&amp;gt;atoms *= (3,3,3)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
Then we create the input file for '''TurboGAP''' in &amp;lt;code&amp;gt;input&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre class=&amp;quot;conf&amp;quot;&amp;gt;! Species-specific info&lt;br /&gt;
atoms_file = '${input_atoms}'  ! Input file&lt;br /&gt;
pot_file = 'gap_files/CO.gap'  ! path to gap_files&lt;br /&gt;
n_species = 2                  ! &amp;amp;gt; Actually the number of species in atoms.xyz is 1 (C),&lt;br /&gt;
                               !   but we will add oxygen in future simulations&lt;br /&gt;
species = C O&lt;br /&gt;
masses = 12.01 15.99&lt;br /&gt;
&lt;br /&gt;
! MD options&lt;br /&gt;
md_nsteps = 5000               ! Number of MD steps (5ps randomise - actual time in paper is 20ps)&lt;br /&gt;
md_step = 1                    ! MD timestep [fs]&lt;br /&gt;
thermostat = bussi             ! Either bussi / berendsen&lt;br /&gt;
&lt;br /&gt;
t_beg = 9000                   ! Initial temperature [K]&lt;br /&gt;
t_end = 9000                   ! Final temperature   [K]&lt;br /&gt;
tau_t = 100.                   ! Time constant [fs]&lt;br /&gt;
&lt;br /&gt;
! Output&lt;br /&gt;
write_thermo = 1               ! Write thermodynamic information every step&lt;br /&gt;
                               !       (Step, Time, Temp, Kin_E, Pot_E, Pres)&lt;br /&gt;
&lt;br /&gt;
write_xyz = 200                ! Write extended xyz trajectory (trajectory_out.xyz) every 200 steps&lt;br /&gt;
&lt;br /&gt;
                               ! &amp;amp;gt; Predicted local properties are in the xyz, such as the local energy&lt;br /&gt;
                               !   and if specified, hirshfeld volumes, core electron binding energies etc&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
We run MD/relaxation simulations using the &amp;lt;code&amp;gt;md&amp;lt;/code&amp;gt; option&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;srun turbogap md&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
This simulation outputs a few files:&lt;br /&gt;
&lt;br /&gt;
# &amp;lt;code&amp;gt;trajectory_out.xyz&amp;lt;/code&amp;gt; is the extended xyz of the trajectory, written every write&amp;lt;sub&amp;gt;xyz&amp;lt;/sub&amp;gt; steps.&lt;br /&gt;
# &amp;lt;code&amp;gt;thermo.log&amp;lt;/code&amp;gt; logs the MD simulation&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;quench&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== 2. Quench ===&lt;br /&gt;
&lt;br /&gt;
Here, we cool the system.&lt;br /&gt;
&lt;br /&gt;
The only things necessary to change in the input file (if you rebel against using the provided scripts) is the temperature and the number of MD steps.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre class=&amp;quot;conf&amp;quot;&amp;gt;! MD options&lt;br /&gt;
md_nsteps = 5500               ! 5.5ps quench&lt;br /&gt;
md_step = 1.&lt;br /&gt;
thermostat = bussi&lt;br /&gt;
t_beg = 9000                   ! Quenching from 9000K&lt;br /&gt;
t_end = 1000                   !             to 1000K&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;span id=&amp;quot;anneal&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== 3. Anneal ===&lt;br /&gt;
&lt;br /&gt;
We can anneal the structure to graphitize. The method demonstrated here is different from that of the paper (we are hardly graphitising at 1000K and 10ps), but its here to illustrate the use of a barostat.&lt;br /&gt;
&lt;br /&gt;
The necessary changes to the input file are&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre class=&amp;quot;conf&amp;quot;&amp;gt;! MD options                                                                                                                        &lt;br /&gt;
md_nsteps = 10000                 ! Graphitization (actual time in the paper is 200ps)&lt;br /&gt;
md_step = 1.&lt;br /&gt;
barostat = berendsen              ! Using barostat&lt;br /&gt;
t_beg = 1000                                                                                                                        &lt;br /&gt;
t_end = 1000&lt;br /&gt;
p_beg = 1.0                       ! Initial pressure [bar]&lt;br /&gt;
p_end = 1.0                       ! Final pressure   [bar]&lt;br /&gt;
tau_t = 100.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;span id=&amp;quot;relax&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== 4. Relax ===&lt;br /&gt;
&lt;br /&gt;
Now we relax the structure. We can choose multiple options for this, but here we opt for relaxing the box and the positions.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre class=&amp;quot;conf&amp;quot;&amp;gt;! MD options&lt;br /&gt;
optimize = gd                 ! optimize option allows us to specify the type of relaxation&lt;br /&gt;
                              ! &amp;amp;gt; Can use &amp;amp;quot;gd&amp;amp;quot; (gradient descent)&lt;br /&gt;
                              !           &amp;amp;quot;gd-box-ortho&amp;amp;quot; (gradient descent relaxing diagonal cell vector components)&lt;br /&gt;
                              !           &amp;amp;quot;gd-box&amp;amp;quot; (gradient-decent relaxing all cell vector components)&lt;br /&gt;
&lt;br /&gt;
! e_tol = 1.d-6               ! Default energy/force tolerances used&lt;br /&gt;
! f_tol = 0.010&lt;br /&gt;
md_nsteps = 2000&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
We can now look at the simulation results by running&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;cat traj_* &amp;gt; all_traj.xyz&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
and using your atom viewer of choice.&lt;br /&gt;
&lt;br /&gt;
At the end, you should have a structure which is similar to this. &lt;br /&gt;
&lt;br /&gt;
[[File:amorphous_carbon.png]]&lt;br /&gt;
&lt;br /&gt;
You can look at the local energies predicted by the GAP (here I use &amp;lt;code&amp;gt;ovito&amp;lt;/code&amp;gt;).&lt;br /&gt;
&lt;br /&gt;
* Open structure in &amp;lt;code&amp;gt;ovito&amp;lt;/code&amp;gt;&lt;br /&gt;
* Use modifier &amp;amp;quot;Create Bonds&amp;amp;quot;&lt;br /&gt;
* Use modifier &amp;amp;quot;Color Coding&amp;amp;quot;&lt;br /&gt;
** Change &amp;amp;quot;Input Property&amp;amp;quot; to &amp;amp;quot;Potential Energy&amp;amp;quot; (it might also be called &amp;amp;quot;local energy&amp;amp;quot;).&lt;br /&gt;
&lt;br /&gt;
[[File:amorphous_carbon_local_energy.png]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;perform-standard-grand-canonical-monte-carlo-gcmc&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
== Perform Standard Grand-Canonical Monte-Carlo (GCMC) ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;theory-of-gcmc&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== Theory of GCMC ===&lt;br /&gt;
&lt;br /&gt;
In a GCMC simulation, a system of interest is at fixed volume, allowed to thermalize by contact with a heat bath, and it can exchange particles with an infinite reservoir, forming a constant (&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mu,V,T&amp;lt;/math&amp;gt;) ensemble.&lt;br /&gt;
&lt;br /&gt;
We perform GCMC using a Markov Chain: starting from an initial pure a-C&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;_x&amp;lt;/math&amp;gt; structure, we generate trial configurations by either randomly displacing a particular atom, or inserting/removing oxygen into/from a random position respectively. These trial configurations are either accepted or rejected using the standard acceptance criteria (see Frenkel 2002) for particle displacement/insertion/removal&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;    \mathrm{acc}( \mathrm{move})  = \mathrm{min}\biggl[1, \exp\left\{ -\beta ( E(\mathrm{trial}) - E(\mathrm{current}) ) \right\}     \biggr] &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; \mathrm{acc}(N \rightarrow N+1)  = \mathrm{min}\biggl[ 1,  \frac{V}{\lambda^3 (N+1)} \exp\left\{ - \beta ( E(N+1) - E(N) - \mu ) \right\}     \biggr] &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; \mathrm{acc}(N \rightarrow N-1)  = \mathrm{min}\biggl[1, \frac{\lambda^3 N}{V} \exp\left\{ -\beta ( E(N-1) - E(N) + \mu ) \right\}     \biggr] &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\lambda&amp;lt;/math&amp;gt; is the thermal de-Broglie wavelength which is given by &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\lambda = \sqrt{\frac{2\pi \hslash^2}{mk_BT}}&amp;lt;/math&amp;gt;. We then repeat the procedure with the last accepted configuration until the the maximum number of iterations has been reached.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;gcmc-in-turbogap&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== GCMC in '''TurboGAP''' ===&lt;br /&gt;
&lt;br /&gt;
Now we perform Grand-Canonical Monte-Carlo to obtain an oxygenated amorphous carbon structure. This is a &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mu VT&amp;lt;/math&amp;gt; ensemble, hence we must specify the chemical potential, &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mu&amp;lt;/math&amp;gt;, and the species which we want to insert: here, just oxygen.&lt;br /&gt;
&lt;br /&gt;
The format is similar to above, but there are more options:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre class=&amp;quot;conf&amp;quot;&amp;gt;mc_nsteps = 10000                         ! Number of mc trial steps to be performed&lt;br /&gt;
&lt;br /&gt;
n_mc_types = 3                           ! Number of mc trial types&lt;br /&gt;
mc_types = 'move' 'insertion' 'removal'  ! MC types can be: 'insertion' 'removal' 'md' 'swap' 'move'&lt;br /&gt;
                                         !                  'volume'&lt;br /&gt;
mc_acceptance = 1 1 1                    ! Ratios for choosing the respective trial moves (all equally likely here)&lt;br /&gt;
&lt;br /&gt;
mc_move_max = 0.2                        ! Maximum distance for the move of a particular particle&lt;br /&gt;
&lt;br /&gt;
mc_mu = 0.0                              ! gcmc: Chemical potential [eV], using a large one here&lt;br /&gt;
mc_species = 'O'                         ! gcmc: species to insert / remove&lt;br /&gt;
mc_min_dist = 0.1                        ! gcmc: minimum distance between particles for insertion&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
To see all the options for Monte-Carlo, visit [https://turbogap.fi/wiki/index.php/Monte-Carlo Monte-Carlo].&lt;br /&gt;
&lt;br /&gt;
To run it, we run '''TurboGAP''' in &amp;lt;code&amp;gt;mc&amp;lt;/code&amp;gt; mode:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;srun turbogap mc&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
To run these calculations, do&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;cd ../2.standard_gcmc&lt;br /&gt;
bash 1.run_gcmc.sh&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
The following files are written to every write&amp;lt;sub&amp;gt;xyz&amp;lt;/sub&amp;gt; steps&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;code&amp;gt;mc.log&amp;lt;/code&amp;gt;: self-explanatory,&lt;br /&gt;
** format: &amp;lt;code&amp;gt;mc_step  mc_move  accepted  E_trial  E_current  N_sites(trial) N_gcmc_species(trial)&amp;lt;/code&amp;gt;&lt;br /&gt;
* &amp;lt;code&amp;gt;mc_all.xyz&amp;lt;/code&amp;gt;: an appended file which contains all accepted moves&lt;br /&gt;
* &amp;lt;code&amp;gt;mc_trial.xyz&amp;lt;/code&amp;gt;: a single configuration which contains the trial move&lt;br /&gt;
* &amp;lt;code&amp;gt;mc_current.xyz&amp;lt;/code&amp;gt;: a single configuration which contains the current accepted&lt;br /&gt;
&lt;br /&gt;
You should find a structure which looks like this (the last configuration in &amp;lt;code&amp;gt;mc_all.xyz&amp;lt;/code&amp;gt;).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;figure&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:oxygenated_amorphous_carbon_gcmc.png]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
Here, we use a chemical potential of &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mu = 0.0&amp;lt;/math&amp;gt; eV. You can experiment with different chemical potentials. Using &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mu =&lt;br /&gt;
-5.16&amp;lt;/math&amp;gt; eV is related to half the binding energy of O&amp;lt;sub&amp;gt;2&amp;lt;/sub&amp;gt; at 300K and 1atm. Try it for yourself (in your own time)!&lt;br /&gt;
&lt;br /&gt;
For this short simulation and this size of box, we will not reach convergence of the oxygen content (MC simulation steps are on the order of 10&amp;lt;sup&amp;gt;5&amp;lt;/sup&amp;gt; - 10&amp;lt;sup&amp;gt;6&amp;lt;/sup&amp;gt; steps). We can run&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;module load python-data/3.9&lt;br /&gt;
python analyse_O_content.py&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
to see the oxygen content.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;figure&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:simple_O_content_monitor.png]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
Here, we can see the local energy for the GCMC configuration.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;figure&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:oxygenated_amorphous_carbon_gcmc_local_energy.png]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;span id=&amp;quot;hamiltonian-monte-carlo&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
== Hamiltonian Monte-Carlo ==&lt;br /&gt;
&lt;br /&gt;
Observing the local energies above, we notice that there are some rather high values. To relax them using MC, we can use Hamiltonian MC, which uses the results of NVE molecular dynamics as trial configurations for MC displacements. This gives very high acceptance rates in comparison to other move types due to the energy being approximately conserved from the symplectic (velocity verlet) integrator (hence your acceptance criterion will be approximately 1).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre class=&amp;quot;conf&amp;quot;&amp;gt;md_nsteps = 20                           ! specifying the number of steps for velocity verlet&lt;br /&gt;
md_step = 0.1                            ! 0.1fs timestep&lt;br /&gt;
&lt;br /&gt;
mc_nsteps = 50                           ! Number of mc trial steps to be performed&lt;br /&gt;
n_mc_types = 1&lt;br /&gt;
mc_types = 'md'&lt;br /&gt;
mc_acceptance = 1                        ! Relative rate of choosing the respective trial moves&lt;br /&gt;
mc_hamiltonian = .true.                  ! For Hamiltonian Monte-Carlo&lt;br /&gt;
                                         !   (NVE ensemble used to increase trial acceptance) for md&lt;br /&gt;
                                         !   move type&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;cd ../3.hamiltonian_mc&lt;br /&gt;
bash 1.run_hamiltonian_mc.sh&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;span id=&amp;quot;npt-using-volume-moves&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
== &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;NPT&amp;lt;/math&amp;gt; using volume moves ==&lt;br /&gt;
&lt;br /&gt;
We can do constant pressure Monte-Carlo by doing volume moves. In fact, we can mix volume moves and MD &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;NPT&amp;lt;/math&amp;gt; moves to create trial configurations, if we so desire.&lt;br /&gt;
&lt;br /&gt;
Looking at the &amp;lt;code&amp;gt;input&amp;lt;/code&amp;gt; file, we see that we've specified a volume type MC move in which the acceptance criterion is given by &amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; \mathrm{acc}(V \rightarrow V')  = \mathrm{min}\biggl[1,  \exp\left\{ -\beta ( E(V') - E(V) + P(V-V') - (N+1)\ln (V/V')/\beta ) \right\}     \biggr] &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre class=&amp;quot;conf&amp;quot;&amp;gt;mc_nsteps = 200&lt;br /&gt;
&lt;br /&gt;
n_mc_types = 3&lt;br /&gt;
mc_types = 'move' 'volume' 'md'                  ! We now specify an MD move type for doing NPT&lt;br /&gt;
&lt;br /&gt;
mc_acceptance = 1 1 1&lt;br /&gt;
mc_move_max = 0.2&lt;br /&gt;
&lt;br /&gt;
mc_lnvol_max = 0.01                              ! Maximum lnvol to modify the volume&lt;br /&gt;
&lt;br /&gt;
! Specify MD configuration&lt;br /&gt;
t_beg = 300&lt;br /&gt;
t_end = 300&lt;br /&gt;
p_beg = 1.0&lt;br /&gt;
p_end = 1.0&lt;br /&gt;
&lt;br /&gt;
md_nsteps = 30&lt;br /&gt;
md_step = 0.1                                    ! Reducing the timestep&lt;br /&gt;
barostat = berendsen&lt;br /&gt;
tau_t = 100.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
To run it we do&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;cd ../4.volume_mc&lt;br /&gt;
bash 1.run_volume.sh&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
This gives an expansion of the volume.&lt;/div&gt;</summary>
		<author><name>Tigany Zarrouk</name></author>
		
	</entry>
	<entry>
		<id>https://turbogap.fi/wiki/index.php?title=Creating_oxygenated_amorphous_carbon&amp;diff=547</id>
		<title>Creating oxygenated amorphous carbon</title>
		<link rel="alternate" type="text/html" href="https://turbogap.fi/wiki/index.php?title=Creating_oxygenated_amorphous_carbon&amp;diff=547"/>
		<updated>2023-11-06T10:15:55Z</updated>

		<summary type="html">&lt;p&gt;Tigany Zarrouk: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This tutorial will focus on using molecular dynamics and Grand-Canonical Monte-Carlo (GCMC) simulations to determine equilibrium structures of oxygenated amorphous carbon using '''TurboGAP'''.&lt;br /&gt;
&lt;br /&gt;
This tutorial is found on the '''TurboGAP''' wiki: &amp;lt;u&amp;gt;turbogap.fi&amp;lt;/u&amp;gt; (-&amp;amp;gt; tutorials -&amp;amp;gt; Creating oxygenated amorphous carbon) https://turbogap.fi/wiki/index.php/Creating_oxygenated_amorphous_carbon.&lt;br /&gt;
&lt;br /&gt;
The structure of this tutorial as as follows:&lt;br /&gt;
&lt;br /&gt;
# Create an amorphous carbon structure using molecular dynamics, via a melt-quench procedure.&lt;br /&gt;
# Perform a standard GCMC calculation to populate the structure with oxygen.&lt;br /&gt;
# Perform a hybrid Monte-Carlo/MD simulations, to relax the system.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;introduction&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
= Introduction =&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;what-is-turbogap&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
== What is '''TurboGAP'''? ==&lt;br /&gt;
&lt;br /&gt;
TurboGAP is a code used to simulate Machine-Learned Potentials, specifically, &amp;lt;u&amp;gt;Gaussian Approximation Potentials&amp;lt;/u&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
It has numerous selling points:&lt;br /&gt;
&lt;br /&gt;
# It is ''fast''.&lt;br /&gt;
#* It uses '''soap turbo''' descriptors, which are both faster and more accurate than your typical SOAP expansion (also found in QUIP). See the original paper paper by Miguel Caro for more details: [https://doi.org/10.1103/PhysRevB.100.024112 Optimizing many-body atomic descriptors for enhanced computational performance of machine learning based interatomic potentials]&lt;br /&gt;
#* MPI parallelised, (overlapping domain decomposition currently being developed with help of CSC).&lt;br /&gt;
#* &amp;lt;u&amp;gt;GPU implementation&amp;lt;/u&amp;gt; in progress (with CSC support too).&lt;br /&gt;
# It can perform not just typical molecular statics (with/without box relaxation) and dynamics (&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;NVT&amp;lt;/math&amp;gt; / &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;NPT&amp;lt;/math&amp;gt;), it can perform ''Grand-Canonical Monte-Carlo'' simulations.&lt;br /&gt;
#* Grand-Canonical Monte Carlo (&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mu VT&amp;lt;/math&amp;gt;), with (&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;NVT&amp;lt;/math&amp;gt;) / (&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;NPT&amp;lt;/math&amp;gt;) move types available.&lt;br /&gt;
#* Adaptive time-scale MD (by Uttiyoarnab Saha).&lt;br /&gt;
# Prediction of an arbitrary number of local properties.&lt;br /&gt;
#* &amp;lt;u&amp;gt;ML Van der Waals&amp;lt;/u&amp;gt; (by prediction of local hirshfeld volumes) using Tkatchenko-Scheffler [https://doi.org/10.1103/PhysRevB.104.054106 Machine learning force fields based on local parametrization of dispersion interactions]&lt;br /&gt;
#* Heikki Muhli has developed ''Many-Body Dispersion'' capability, with multiple optimisations.&lt;br /&gt;
#* Max Veit is developing ''electrostatics''.&lt;br /&gt;
# &amp;lt;u&amp;gt;Sneak Peek!&amp;lt;/u&amp;gt;: we have added the capability to predict/simulate numerous types of experimental data (ML XPS/XRD) and can allow them to influence simulation. (Talk to Tigany Zarrouk/look out for the papers when they come out on arXiv)!&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;installing-turbogap&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
== Installing TurboGAP ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;for-the-mlip-workshop&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== For the MLIP workshop ===&lt;br /&gt;
&lt;br /&gt;
If you have a CSC account and can ssh into Mahti/Puhti there is no need to install anything. TurboGAP is installed in the path (on Mahti / Puhti)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;/projappl/project_2008666/turbogap&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
The tutorial is in&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;cd /projappl/project_2008666/turbogap/tutorials/creating_a-COx&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
Copy the directory &amp;lt;code&amp;gt;creating_a-COx&amp;lt;/code&amp;gt; to wherever you want to do the simulations and then check the project in &amp;lt;code&amp;gt;creating_a-COx/sample_submit_script.sh&amp;lt;/code&amp;gt;, change it from &lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;#SBATCH --account=project_&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
to&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;#SBATCH --account=project_2008666&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
This tutorial depends on &amp;lt;code&amp;gt;ase&amp;lt;/code&amp;gt;, so install it as so (after loading the python module)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;module load python-data/3.9-22.04&lt;br /&gt;
pip install ase --user&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
Each of the simulations should take ~5-8 minutes.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;installation&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== Installation ===&lt;br /&gt;
&lt;br /&gt;
To install TurboGAP please run&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;git clone --recursive http://github.com/mcaroba/turbogap.git /your/turbogap/source/directory&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
Where /your/turbogap/source/directory is the directory where you're putting the TurboGAP source code. To build the TurboGAP binary and library, you need to select the options that best match your architecture, by editing this line in the Makefile with one of the names of the corresponding makefiles in turbogap/makefiles:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;include makefiles/Makefile.Ubuntu_gfortran_mpi&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
Then just run &amp;lt;code&amp;gt;make&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;make&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
Copy the directory &amp;lt;code&amp;gt;turbogap/tutorials/creating_a-COx&amp;lt;/code&amp;gt; to wherever you want to do the simulations.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;running-this-tutorial-on-a-cluster&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== Running this tutorial on a cluster ===&lt;br /&gt;
&lt;br /&gt;
* Copy the directory &amp;lt;code&amp;gt;turbogap/tutorials/creating_a-COx&amp;lt;/code&amp;gt; to where you want to run.&lt;br /&gt;
* Change &amp;lt;code&amp;gt;sample_submit_script.sh&amp;lt;/code&amp;gt; to reflect the type of job scheduler you use (here, it's slurm), the modules you've loaded for &amp;lt;code&amp;gt;turbogap&amp;lt;/code&amp;gt; and python, and change the &amp;lt;code&amp;gt;PATH&amp;lt;/code&amp;gt; environment variable to where you've installed &amp;lt;code&amp;gt;turbogap/bin&amp;lt;/code&amp;gt;.&lt;br /&gt;
* Make sure the project account is correct!&lt;br /&gt;
* Load the python module you will use, and make sure &amp;lt;code&amp;gt;ase&amp;lt;/code&amp;gt; is installed by running &amp;lt;code&amp;gt;pip install ase {--user}&amp;lt;/code&amp;gt;.&lt;br /&gt;
* Change the &amp;lt;code&amp;gt;srun turbogap&amp;lt;/code&amp;gt; commands in the &amp;lt;code&amp;gt;script_*.sh&amp;lt;/code&amp;gt; files to the standard for your cluster (e.g. &amp;lt;code&amp;gt;mpirun -np $N turbogap&amp;lt;/code&amp;gt;).&lt;br /&gt;
* In each of the directories enumerated with &amp;amp;quot;1.,2., etc&amp;amp;quot;, run the scripts in order after the preceding job has finished. They are enumerated with &amp;amp;quot;1.,2., etc&amp;amp;quot; with bash, e.g. &amp;lt;code&amp;gt;bash 1.run_randomise.sh&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;running-this-tutorial-locally&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== Running this tutorial locally ===&lt;br /&gt;
&lt;br /&gt;
* Copy the directory &amp;lt;code&amp;gt;turbogap/tutorials/creating_a-COx&amp;lt;/code&amp;gt; to where you want to run.&lt;br /&gt;
* Make sure the python package &amp;lt;code&amp;gt;ase&amp;lt;/code&amp;gt; is installed by running &amp;lt;code&amp;gt;pip install ase {--user}&amp;lt;/code&amp;gt;.&lt;br /&gt;
* Use the edit the convenience script &amp;lt;code&amp;gt;change_to_local.sh&amp;lt;/code&amp;gt; and run.&lt;br /&gt;
* Change the path environment variable in &amp;lt;code&amp;gt;sample_submit_script.sh&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;note-how-to-make-a-potential-work-in-turbogap&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
== Note: how to make a potential work in '''TurboGAP''' ==&lt;br /&gt;
&lt;br /&gt;
You must convert potentials which are trained from [https://github.com/libatoms/QUIP libAtoms] (the xml files) to &amp;lt;code&amp;gt;*.gap&amp;lt;/code&amp;gt; files. It can be run by&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;python3 /path/turbogap/tools/quip_to_xml/make_gap_files.py  your_potential.xml your_potential.gap {your_hirshfeld.xml}&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;span id=&amp;quot;tutorial&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
= Tutorial =&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;create-amorphous-carbon&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
== Create Amorphous Carbon ==&lt;br /&gt;
&lt;br /&gt;
Here, we perform molecular dynamics simulations to form amorphous carbon from diamond. To do this, we use a simple melt-quench procedure, which is modified from the paper of Wang ''et al.'' to create amorphous carbon [https://doi.org/10.1021/acs.chemmater.1c03279 Structure and Pore Size Distribution in Nanoporous Carbon].&lt;br /&gt;
&lt;br /&gt;
This is also similar to what is done in other tutorials [https://turbogap.fi/wiki/index.php/Graphitization_simulation_with_van_der_Waals_corrections Graphitization simulation with van der Waals corrections] [https://turbogap.fi/wiki/index.php/Generating_amorphous_silicon_from_quenching_simulations Generating amorphous silicon from quenching simulations].&lt;br /&gt;
&lt;br /&gt;
The procedure we will follow is:&lt;br /&gt;
&lt;br /&gt;
# We heat up the diamond to 9000K, thereby randomizing the structure.&lt;br /&gt;
# We quench to 1000K (actual temp used is 3500K in the real paper).&lt;br /&gt;
# We anneal (partially graphitize) the structure at 1000K, to allow the carbon bonds a chance to reform.&lt;br /&gt;
# Relax the structure, allowing both atomic positions and cell vectors to relax.&lt;br /&gt;
&lt;br /&gt;
To run these calculations, do&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;cd 1.make_amorphous_carbon&lt;br /&gt;
bash 1.run_randomise.sh&lt;br /&gt;
# Wait for it to finish&lt;br /&gt;
&lt;br /&gt;
bash 2.run_quench.sh&lt;br /&gt;
# Wait for it to finish&lt;br /&gt;
&lt;br /&gt;
bash 3.run_anneal.sh&lt;br /&gt;
# Wait for it to finish&lt;br /&gt;
&lt;br /&gt;
bash 4.run_relax.sh&lt;br /&gt;
# Wait for it to finish&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;span id=&amp;quot;randomise&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== 1. Randomise ===&lt;br /&gt;
&lt;br /&gt;
First, we create a diamond structure using ASE, changing the volume to achieve a given density.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;sim_name=&amp;quot;md_diamond_randomise&amp;quot;&lt;br /&gt;
&lt;br /&gt;
input_atoms=&amp;quot;atoms.xyz&amp;quot;&lt;br /&gt;
output_atoms=&amp;quot;atoms_randomise.xyz&amp;quot;&lt;br /&gt;
&lt;br /&gt;
ln -sf ../gap_files ./&lt;br /&gt;
&lt;br /&gt;
# 1. Create diamond structure (1000 atoms in atoms.xyz file)&lt;br /&gt;
echo &amp;quot;&amp;gt; Running: python create_diamond.py&amp;quot;&lt;br /&gt;
python3 create_diamond.py&lt;br /&gt;
&lt;br /&gt;
cp diamond.xyz $input_atoms&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;u&amp;gt;Note:&amp;lt;/u&amp;gt; In &amp;lt;code&amp;gt;create_diamond.py&amp;lt;/code&amp;gt; we make 1000 atoms. You can change this to a smaller number, if you want things to run faster.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;python&amp;quot;&amp;gt;atoms *= (3,3,3)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
Then we create the input file for '''TurboGAP''' in &amp;lt;code&amp;gt;input&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre class=&amp;quot;conf&amp;quot;&amp;gt;! Species-specific info&lt;br /&gt;
atoms_file = '${input_atoms}'  ! Input file&lt;br /&gt;
pot_file = 'gap_files/CO.gap'  ! path to gap_files&lt;br /&gt;
n_species = 2                  ! &amp;amp;gt; Actually the number of species in atoms.xyz is 1 (C),&lt;br /&gt;
                               !   but we will add oxygen in future simulations&lt;br /&gt;
species = C O&lt;br /&gt;
masses = 12.01 15.99&lt;br /&gt;
&lt;br /&gt;
! MD options&lt;br /&gt;
md_nsteps = 5000               ! Number of MD steps (5ps randomise - actual time in paper is 20ps)&lt;br /&gt;
md_step = 1                    ! MD timestep [fs]&lt;br /&gt;
thermostat = bussi             ! Either bussi / berendsen&lt;br /&gt;
&lt;br /&gt;
t_beg = 9000                   ! Initial temperature [K]&lt;br /&gt;
t_end = 9000                   ! Final temperature   [K]&lt;br /&gt;
tau_t = 100.                   ! Time constant [fs]&lt;br /&gt;
&lt;br /&gt;
! Output&lt;br /&gt;
write_thermo = 1               ! Write thermodynamic information every step&lt;br /&gt;
                               !       (Step, Time, Temp, Kin_E, Pot_E, Pres)&lt;br /&gt;
&lt;br /&gt;
write_xyz = 200                ! Write extended xyz trajectory (trajectory_out.xyz) every 200 steps&lt;br /&gt;
&lt;br /&gt;
                               ! &amp;amp;gt; Predicted local properties are in the xyz, such as the local energy&lt;br /&gt;
                               !   and if specified, hirshfeld volumes, core electron binding energies etc&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
We run MD/relaxation simulations using the &amp;lt;code&amp;gt;md&amp;lt;/code&amp;gt; option&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;srun turbogap md&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
This simulation outputs a few files:&lt;br /&gt;
&lt;br /&gt;
# &amp;lt;code&amp;gt;trajectory_out.xyz&amp;lt;/code&amp;gt; is the extended xyz of the trajectory, written every write&amp;lt;sub&amp;gt;xyz&amp;lt;/sub&amp;gt; steps.&lt;br /&gt;
# &amp;lt;code&amp;gt;thermo.log&amp;lt;/code&amp;gt; logs the MD simulation&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;quench&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== 2. Quench ===&lt;br /&gt;
&lt;br /&gt;
Here, we cool the system.&lt;br /&gt;
&lt;br /&gt;
The only things necessary to change in the input file (if you rebel against using the provided scripts) is the temperature and the number of MD steps.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre class=&amp;quot;conf&amp;quot;&amp;gt;! MD options&lt;br /&gt;
md_nsteps = 5500               ! 5.5ps quench&lt;br /&gt;
md_step = 1.&lt;br /&gt;
thermostat = bussi&lt;br /&gt;
t_beg = 9000                   ! Quenching from 9000K&lt;br /&gt;
t_end = 1000                   !             to 1000K&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;span id=&amp;quot;anneal&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== 3. Anneal ===&lt;br /&gt;
&lt;br /&gt;
We can anneal the structure to graphitize. The method demonstrated here is different from that of the paper (we are hardly graphitising at 1000K and 10ps), but its here to illustrate the use of a barostat.&lt;br /&gt;
&lt;br /&gt;
The necessary changes to the input file are&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre class=&amp;quot;conf&amp;quot;&amp;gt;! MD options                                                                                                                        &lt;br /&gt;
md_nsteps = 10000                 ! Graphitization (actual time in the paper is 200ps)&lt;br /&gt;
md_step = 1.&lt;br /&gt;
barostat = berendsen              ! Using barostat&lt;br /&gt;
t_beg = 1000                                                                                                                        &lt;br /&gt;
t_end = 1000&lt;br /&gt;
p_beg = 1.0                       ! Initial pressure [bar]&lt;br /&gt;
p_end = 1.0                       ! Final pressure   [bar]&lt;br /&gt;
tau_t = 100.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;span id=&amp;quot;relax&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== 4. Relax ===&lt;br /&gt;
&lt;br /&gt;
Now we relax the structure. We can choose multiple options for this, but here we opt for relaxing the box and the positions.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre class=&amp;quot;conf&amp;quot;&amp;gt;! MD options&lt;br /&gt;
optimize = gd                 ! optimize option allows us to specify the type of relaxation&lt;br /&gt;
                              ! &amp;amp;gt; Can use &amp;amp;quot;gd&amp;amp;quot; (gradient descent)&lt;br /&gt;
                              !           &amp;amp;quot;gd-box-ortho&amp;amp;quot; (gradient descent relaxing diagonal cell vector components)&lt;br /&gt;
                              !           &amp;amp;quot;gd-box&amp;amp;quot; (gradient-decent relaxing all cell vector components)&lt;br /&gt;
&lt;br /&gt;
! e_tol = 1.d-6               ! Default energy/force tolerances used&lt;br /&gt;
! f_tol = 0.010&lt;br /&gt;
md_nsteps = 2000&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
We can now look at the simulation results by running&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;cat traj_* &amp;gt; all_traj.xyz&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
and using your atom viewer of choice.&lt;br /&gt;
&lt;br /&gt;
At the end, you should have a structure which is similar to this. &lt;br /&gt;
&lt;br /&gt;
[[File:amorphous_carbon.png]]&lt;br /&gt;
&lt;br /&gt;
You can look at the local energies predicted by the GAP (here I use &amp;lt;code&amp;gt;ovito&amp;lt;/code&amp;gt;).&lt;br /&gt;
&lt;br /&gt;
* Open structure in &amp;lt;code&amp;gt;ovito&amp;lt;/code&amp;gt;&lt;br /&gt;
* Use modifier &amp;amp;quot;Create Bonds&amp;amp;quot;&lt;br /&gt;
* Use modifier &amp;amp;quot;Color Coding&amp;amp;quot;&lt;br /&gt;
** Change &amp;amp;quot;Input Property&amp;amp;quot; to &amp;amp;quot;Potential Energy&amp;amp;quot; (it might also be called &amp;amp;quot;local energy&amp;amp;quot;).&lt;br /&gt;
&lt;br /&gt;
[[File:amorphous_carbon_local_energy.png]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;perform-standard-grand-canonical-monte-carlo-gcmc&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
== Perform Standard Grand-Canonical Monte-Carlo (GCMC) ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;theory-of-gcmc&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== Theory of GCMC ===&lt;br /&gt;
&lt;br /&gt;
In a GCMC simulation, a system of interest is at fixed volume, allowed to thermalize by contact with a heat bath, and it can exchange particles with an infinite reservoir, forming a constant (&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mu,V,T&amp;lt;/math&amp;gt;) ensemble.&lt;br /&gt;
&lt;br /&gt;
We perform GCMC using a Markov Chain: starting from an initial pure a-C&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;_x&amp;lt;/math&amp;gt; structure, we generate trial configurations by either randomly displacing a particular atom, or inserting/removing oxygen into/from a random position respectively. These trial configurations are either accepted or rejected using the standard acceptance criteria (see Frenkel 2002) for particle displacement/insertion/removal&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;    \mathrm{acc}( \mathrm{move})  = \mathrm{min}\biggl[1, \exp\left\{ -\beta ( E(\mathrm{trial}) - E(\mathrm{current}) ) \right\}     \biggr] &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; \mathrm{acc}(N \rightarrow N+1)  = \mathrm{min}\biggl[ 1,  \frac{V}{\lambda^3 (N+1)} \exp\left\{ - \beta ( E(N+1) - E(N) - \mu ) \right\}     \biggr] &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; \mathrm{acc}(N \rightarrow N-1)  = \mathrm{min}\biggl[1, \frac{\lambda^3 N}{V} \exp\left\{ -\beta ( E(N-1) - E(N) + \mu ) \right\}     \biggr] &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\lambda&amp;lt;/math&amp;gt; is the thermal de-Broglie wavelength which is given by &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\lambda = \sqrt{\frac{2\pi \hslash^2}{mk_BT}}&amp;lt;/math&amp;gt;. We then repeat the procedure with the last accepted configuration until the the maximum number of iterations has been reached.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;gcmc-in-turbogap&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== GCMC in '''TurboGAP''' ===&lt;br /&gt;
&lt;br /&gt;
Now we perform Grand-Canonical Monte-Carlo to obtain an oxygenated amorphous carbon structure. This is a &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mu VT&amp;lt;/math&amp;gt; ensemble, hence we must specify the chemical potential, &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mu&amp;lt;/math&amp;gt;, and the species which we want to insert: here, just oxygen.&lt;br /&gt;
&lt;br /&gt;
The format is similar to above, but there are more options:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre class=&amp;quot;conf&amp;quot;&amp;gt;mc_nsteps = 10000                         ! Number of mc trial steps to be performed&lt;br /&gt;
&lt;br /&gt;
n_mc_types = 3                           ! Number of mc trial types&lt;br /&gt;
mc_types = 'move' 'insertion' 'removal'  ! MC types can be: 'insertion' 'removal' 'md' 'swap' 'move'&lt;br /&gt;
                                         !                  'volume'&lt;br /&gt;
mc_acceptance = 1 1 1                    ! Ratios for choosing the respective trial moves (all equally likely here)&lt;br /&gt;
&lt;br /&gt;
mc_move_max = 0.2                        ! Maximum distance for the move of a particular particle&lt;br /&gt;
&lt;br /&gt;
mc_mu = 0.0                              ! gcmc: Chemical potential [eV], using a large one here&lt;br /&gt;
mc_species = 'O'                         ! gcmc: species to insert / remove&lt;br /&gt;
mc_min_dist = 0.1                        ! gcmc: minimum distance between particles for insertion&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
To see all the options for Monte-Carlo, visit [https://turbogap.fi/wiki/index.php/Monte-Carlo Monte-Carlo].&lt;br /&gt;
&lt;br /&gt;
To run it, we run '''TurboGAP''' in &amp;lt;code&amp;gt;mc&amp;lt;/code&amp;gt; mode:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;srun turbogap mc&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
To run these calculations, do&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;cd ../2.standard_gcmc&lt;br /&gt;
bash 1.run_gcmc.sh&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
The following files are written to every write&amp;lt;sub&amp;gt;xyz&amp;lt;/sub&amp;gt; steps&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;code&amp;gt;mc.log&amp;lt;/code&amp;gt;: self-explanatory,&lt;br /&gt;
** format: &amp;lt;code&amp;gt;mc_step  mc_move  accepted  E_trial  E_current  N_sites(trial) N_gcmc_species(trial)&amp;lt;/code&amp;gt;&lt;br /&gt;
* &amp;lt;code&amp;gt;mc_all.xyz&amp;lt;/code&amp;gt;: an appended file which contains all accepted moves&lt;br /&gt;
* &amp;lt;code&amp;gt;mc_trial.xyz&amp;lt;/code&amp;gt;: a single configuration which contains the trial move&lt;br /&gt;
* &amp;lt;code&amp;gt;mc_current.xyz&amp;lt;/code&amp;gt;: a single configuration which contains the current accepted&lt;br /&gt;
&lt;br /&gt;
You should find a structure which looks like this (the last configuration in &amp;lt;code&amp;gt;mc_all.xyz&amp;lt;/code&amp;gt;).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;figure&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:oxygenated_amorphous_carbon_gcmc.png]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
Here, we use a chemical potential of &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mu = 0.0&amp;lt;/math&amp;gt; eV. You can experiment with different chemical potentials. Using &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mu =&lt;br /&gt;
-5.16&amp;lt;/math&amp;gt; eV is related to half the binding energy of O&amp;lt;sub&amp;gt;2&amp;lt;/sub&amp;gt; at 300K and 1atm. Try it for yourself (in your own time)!&lt;br /&gt;
&lt;br /&gt;
For this short simulation and this size of box, we will not reach convergence of the oxygen content (MC simulation steps are on the order of 10&amp;lt;sup&amp;gt;5&amp;lt;/sup&amp;gt; - 10&amp;lt;sup&amp;gt;6&amp;lt;/sup&amp;gt; steps). We can run&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;module load python-data/3.9&lt;br /&gt;
python analyse_O_content.py&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
to see the oxygen content.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;figure&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:simple_O_content_monitor.png]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
Here, we can see the local energy for the GCMC configuration.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;figure&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:oxygenated_amorphous_carbon_gcmc_local_energy.png]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;span id=&amp;quot;hamiltonian-monte-carlo&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
== Hamiltonian Monte-Carlo ==&lt;br /&gt;
&lt;br /&gt;
Observing the local energies above, we notice that there are some rather high values. To relax them using MC, we can use Hamiltonian MC, which uses the results of NVE molecular dynamics as trial configurations for MC displacements. This gives very high acceptance rates in comparison to other move types due to the energy being approximately conserved from the symplectic (velocity verlet) integrator (hence your acceptance criterion will be approximately 1).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre class=&amp;quot;conf&amp;quot;&amp;gt;md_nsteps = 20                           ! specifying the number of steps for velocity verlet&lt;br /&gt;
md_step = 0.1                            ! 0.1fs timestep&lt;br /&gt;
&lt;br /&gt;
mc_nsteps = 50                           ! Number of mc trial steps to be performed&lt;br /&gt;
n_mc_types = 1&lt;br /&gt;
mc_types = 'md'&lt;br /&gt;
mc_acceptance = 1                        ! Relative rate of choosing the respective trial moves&lt;br /&gt;
mc_hamiltonian = .true.                  ! For Hamiltonian Monte-Carlo&lt;br /&gt;
                                         !   (NVE ensemble used to increase trial acceptance) for md&lt;br /&gt;
                                         !   move type&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;cd ../3.hamiltonian_mc&lt;br /&gt;
bash 1.run_hamiltonian_mc.sh&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;span id=&amp;quot;npt-using-volume-moves&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
== &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;NPT&amp;lt;/math&amp;gt; using volume moves ==&lt;br /&gt;
&lt;br /&gt;
We can do constant pressure Monte-Carlo by doing volume moves. In fact, we can mix volume moves and MD &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;NPT&amp;lt;/math&amp;gt; moves to create trial configurations, if we so desire.&lt;br /&gt;
&lt;br /&gt;
Looking at the &amp;lt;code&amp;gt;input&amp;lt;/code&amp;gt; file, we see that we've specified a volume type MC move in which the acceptance criterion is given by &amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; \mathrm{acc}(V \rightarrow V')  = \mathrm{min}\biggl[1,  \exp\left\{ -\beta ( E(V') - E(V) + P(V-V') - (N+1)\ln (V/V')/\beta ) \right\}     \biggr] &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre class=&amp;quot;conf&amp;quot;&amp;gt;mc_nsteps = 200&lt;br /&gt;
&lt;br /&gt;
n_mc_types = 3&lt;br /&gt;
mc_types = 'move' 'volume' 'md'                  ! We now specify an MD move type for doing NPT&lt;br /&gt;
&lt;br /&gt;
mc_acceptance = 1 1 1&lt;br /&gt;
mc_move_max = 0.2&lt;br /&gt;
&lt;br /&gt;
mc_lnvol_max = 0.01                              ! Maximum lnvol to modify the volume&lt;br /&gt;
&lt;br /&gt;
! Specify MD configuration&lt;br /&gt;
t_beg = 300&lt;br /&gt;
t_end = 300&lt;br /&gt;
p_beg = 1.0&lt;br /&gt;
p_end = 1.0&lt;br /&gt;
&lt;br /&gt;
md_nsteps = 30&lt;br /&gt;
md_step = 0.1                                    ! Reducing the timestep&lt;br /&gt;
barostat = berendsen&lt;br /&gt;
tau_t = 100.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
To run it we do&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;cd ../4.volume_mc&lt;br /&gt;
bash 1.run_volume.sh&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
This gives an expansion of the volume.&lt;/div&gt;</summary>
		<author><name>Tigany Zarrouk</name></author>
		
	</entry>
</feed>