diff --git a/doc/Projects/2023/Project1/html/Project1-bs.html b/doc/Projects/2023/Project1/html/Project1-bs.html index cabb4958..7b74baef 100644 --- a/doc/Projects/2023/Project1/html/Project1-bs.html +++ b/doc/Projects/2023/Project1/html/Project1-bs.html @@ -8,8 +8,8 @@ - -Project 1, deadline March 31, 2023 + +Project 1, deadline March 22, 2024 @@ -105,7 +105,7 @@ - Project 1, deadline March 31, 2023 + Project 1, deadline March 22, 2024 +
+

 

 

 

+ +
+
+

Project 1, deadline March 22, 2024

+
+ + +
+Computational Physics II FYS4411/FYS9411 +
+ +
+Department of Physics, University of Oslo, Norway +
+
+
+

Jan 10, 2024

+
+
+ + +
+

Introduction

+ +

The spectacular demonstration of Bose-Einstein condensation (BEC) in +gases of alkali atoms $^{87}$Rb, $^{23}$Na, $^7$Li confined in +magnetic traps has led to an explosion of interest in confined Bose +systems. Of interest is the fraction of condensed atoms, the nature of +the condensate, the excitations above the condensate, the atomic +density in the trap as a function of Temperature and the critical +temperature of BEC, \( T_c \). +

+ +

A key feature of the trapped alkali and atomic hydrogen systems is +that they are dilute. The characteristic dimensions of a typical trap +for $^{87}$Rb is \( a_{ho}=\left( + {\hbar}/{m\omega_\perp}\right)^\frac{1}{2}=1-2 \times 10^4 \) \AA\ + . The interaction between $^{87}$Rb atoms can be well represented by + its s-wave scattering length, \( a_{Rb} \). This scattering length lies + in the range \( 85 a_0 < a_{Rb} < 140 a_0 \) where \( a_0 = 0.5292 \) \AA\ is + the Bohr radius. The definite value \( a_{Rb} = 100 a_0 \) is usually + selected and for calculations the definite ratio of atom size to trap + size \( a_{Rb}/a_{ho} = 4.33 \times 10^{-3} \) is usually chosen. A + typical $^{87}$Rb atom density in the trap is \( n \simeq 10^{12}- + 10^{14} \) atoms per cubic cm, giving an inter-atom spacing \( \ell + \simeq 10^4 \) \AA. Thus the effective atom size is small compared to + both the trap size and the inter-atom spacing, the condition for + diluteness (\( na^3_{Rb} \simeq 10^{-6} \) where \( n = N/V \) is the number + density). +

+ +

Many theoretical studies of Bose-Einstein condensates (BEC) in gases +of alkali atoms confined in magnetic or optical traps have been +conducted in the framework of the Gross-Pitaevskii (GP) equation. The +key point for the validity of this description is the dilute condition +of these systems, that is, the average distance between the atoms is +much larger than the range of the inter-atomic interaction. In this +situation the physics is dominated by two-body collisions, well +described in terms of the \( s \)-wave scattering length \( a \). The crucial +parameter defining the condition for diluteness is the gas parameter +\( x(\mathbf{r})= n(\mathbf{r}) a^3 \), where \( n(\mathbf{r}) \) is the local density +of the system. For low values of the average gas parameter \( x_{av}\le 10^{-3} \), the mean field Gross-Pitaevskii equation does an excellent +job. However, +in recent experiments, the local gas parameter may well exceed this +value due to the possibility of tuning the scattering length in the +presence of a so-called Feshbach resonance. +

+ +

Thus, improved many-body methods like Monte Carlo calculations may be +needed. +

+ +

The aim of this project is to use the Variational Monte Carlo +(VMC) method and evaluate the ground state energy of a trapped, hard +sphere Bose gas for different numbers of particles with a specific +trial wave function. +

+ +

This trial wave function is used to study the sensitivity of + condensate and non-condensate properties to the hard sphere radius + and the number of particles. The trap we will use is a spherical (S) + or an elliptical (E) harmonic trap in one, two and finally three + dimensions, with the latter given by +

+ +$$ +\begin{equation} + V_{ext}(\mathbf{r}) = + \Bigg\{ + \begin{array}{ll} + \frac{1}{2}m\omega_{ho}^2r^2 & (S)\\ + \strut + \frac{1}{2}m[\omega_{ho}^2(x^2+y^2) + \omega_z^2z^2] & (E) +\label{trap_eqn} + \end{array} + \end{equation} +$$ + +

where (S) stands for spherical and

+ +$$ +\begin{equation} + H = \sum_i^N \left(\frac{-\hbar^2}{2m}{\bigtriangledown }_{i}^2 +V_{ext}({\mathbf{r}}_i)\right) + + \sum_{i < j}^{N} V_{int}({\mathbf{r}}_i,{\mathbf{r}}_j), +\label{_auto1} +\end{equation} +$$ + +

as the two-body Hamiltonian of the system. Here \( \omega_{ho}^2 \) + defines the trap potential strength. In the case of the elliptical + trap, \( V_{ext}(x,y,z) \), \( \omega_{ho}=\omega_{\perp} \) is the trap + frequency in the perpendicular or \( xy \) plane and \( \omega_z \) the + frequency in the \( z \) direction. The mean square vibrational + amplitude of a single boson at \( T=0K \) in the trap \eqref{trap_eqn} is + \( \langle x^2\rangle=(\hbar/2m\omega_{ho}) \) so that \( a_{ho} \equiv + (\hbar/m\omega_{ho})^{\frac{1}{2}} \) defines the characteristic length + of the trap. The ratio of the frequencies is denoted + \( \lambda=\omega_z/\omega_{\perp} \) leading to a ratio of the trap + lengths \( (a_{\perp}/a_z)=(\omega_z/\omega_{\perp})^{\frac{1}{2}} = + \sqrt{\lambda} \). Note that we use the shorthand notation +

+$$ +\begin{align} + \sum_{i < j}^{N} V_{ij} \equiv \sum_{i = 1}^{N}\sum_{j = i + 1}^{N} V_{ij}, +\label{_auto2} +\end{align} +$$ + +

that is, the notation \( i < j \) under the summation sign signifies a double sum + running over all pairwise interactions once. +

+ +

We will represent the inter-boson interaction by a pairwise, + repulsive potential +

+ +$$ +\begin{equation} + V_{int}(|\mathbf{r}_i-\mathbf{r}_j|) = \Bigg\{ + \begin{array}{ll} + \infty & {|\mathbf{r}_i-\mathbf{r}_j|} \leq {a}\\ + 0 & {|\mathbf{r}_i-\mathbf{r}_j|} > {a} + \end{array} +\label{_auto3} +\end{equation} +$$ + +

where \( a \) is the so-called hard-core diameter of the bosons. + Clearly, \( V_{int}(|\mathbf{r}_i-\mathbf{r}_j|) \) is zero if the bosons are + separated by a distance \( |\mathbf{r}_i-\mathbf{r}_j| \) greater than \( a \) but + infinite if they attempt to come within a distance \( |\mathbf{r}_i-\mathbf{r}_j| \leq a \). +

+ +

Our trial wave function for the ground state with \( N \) atoms is given by

+ +$$ +\begin{equation} + \Psi_T(\mathbf{r})=\Psi_T(\mathbf{r}_1, \mathbf{r}_2, \dots \mathbf{r}_N,\alpha,\beta) + =\left[ + \prod_i g(\alpha,\beta,\mathbf{r}_i) + \right] + \left[ + \prod_{j < k}f(a,|\mathbf{r}_j-\mathbf{r}_k|) + \right], +\label{eq:trialwf} + \end{equation} +$$ + +

where \( \alpha \) and \( \beta \) are variational parameters. The + single-particle wave function is proportional to the harmonic + oscillator function for the ground state, i.e., +

+ +$$ +\begin{equation} + g(\alpha,\beta,\mathbf{r}_i)= \exp{[-\alpha(x_i^2+y_i^2+\beta z_i^2)]}. +\label{_auto4} +\end{equation} +$$ + +

For spherical traps we have \( \beta = 1 \) and for non-interacting + bosons (\( a=0 \)) we have \( \alpha = 1/2a_{ho}^2 \). The correlation wave + function is +

+ +$$ +\begin{equation} + f(a,|\mathbf{r}_i-\mathbf{r}_j|)=\Bigg\{ + \begin{array}{ll} + 0 & {|\mathbf{r}_i-\mathbf{r}_j|} \leq {a}\\ + (1-\frac{a}{|\mathbf{r}_i-\mathbf{r}_j|}) & {|\mathbf{r}_i-\mathbf{r}_j|} > {a}. + \end{array} +\label{_auto5} +\end{equation} +$$ +

Project 1 a): Local energy

+ +

Find the analytic expressions for the local energy

+$$ +\begin{equation} + E_L(\mathbf{r})=\frac{1}{\Psi_T(\mathbf{r})}H\Psi_T(\mathbf{r}), +\label{eq:locale} + \end{equation} +$$ + +

for the above + trial wave function of Eq. (5) and defined by the terms in Eqs. (6) and (7). +

+ +

Find first the local energy the case with only the harmonic oscillator potential, that is we set \( a=0 \) and discard totally the two-body potential.

+ +

Use first that \( \beta =1 \) and find the relevant local energies in one, two and three dimensions for one and +\( N \) particles with the same mass. +

+ +

Compute also the analytic expression for the drift force to be used in importance sampling

+ +$$ +\begin{equation} + F = \frac{2\nabla \Psi_T}{\Psi_T}. +\label{_auto6} +\end{equation} +$$ + +

Find first the equivalent expressions for the just the harmonic oscillator part in one, two and three dimensions +with \( \beta=1 \). +

+ +

Our next step involves the calculation of local energy for the full problem in three dimensions. +The tricky part is to find an analytic expressions for the derivative of the trial wave function +

+ +$$ +\begin{equation*} + \frac{1}{\Psi_T(\mathbf{r})}\sum_i^{N}\nabla_i^2\Psi_T(\mathbf{r}), +\end{equation*} +$$ + +

with the above +trial wave function of Eq. (5). +We rewrite +

+ +$$ +\begin{equation*} +\Psi_T(\mathbf{r})=\Psi_T(\mathbf{r}_1, \mathbf{r}_2, \dots \mathbf{r}_N,\alpha,\beta) +=\left[ + \prod_i g(\alpha,\beta,\mathbf{r}_i) +\right] +\left[ + \prod_{j < k}f(a,|\mathbf{r}_j-\mathbf{r}_k|) +\right], +\end{equation*} +$$ + +

as

+ +$$ +\begin{equation*} +\Psi_T(\mathbf{r})=\left[ + \prod_i g(\alpha,\beta,\mathbf{r}_i) +\right] +\exp{\left(\sum_{j < k}u(r_{jk})\right)} +\end{equation*} +$$ + +

where we have defined \( r_{ij}=|\mathbf{r}_i-\mathbf{r}_j| \) +and +

+ +$$ +\begin{equation*} + f(r_{ij})= \exp{\left(u(r_{ij})\right)}, +\end{equation*} +$$ + +

with \( u(r_{ij})=\ln{f(r_{ij})} \). +We have also +

+ +$$ +\begin{equation*} + g(\alpha,\beta,\mathbf{r}_i) = \exp{\left[-\alpha(x_i^2+y_i^2+\beta + z_i^2)\right]}= \phi(\mathbf{r}_i). +\end{equation*} +$$ + +

Show that the first derivative for particle \( k \) is

+ +$$ +\begin{align*} + \nabla_k\Psi_T(\mathbf{r}) &= \nabla_k\phi(\mathbf{r}_k)\left[\prod_{i\ne k}\phi(\mathbf{r}_i)\right]\exp{\left(\sum_{j < m}u(r_{jm})\right)} + \\ + &\qquad + + \left[\prod_i\phi(\mathbf{r}_i)\right] + \exp{\left(\sum_{j < m}u(r_{jm})\right)}\sum_{l\ne k}\nabla_k u(r_{kl}), +\end{align*} +$$ + +

and find the final expression for our specific trial function. +The expression for the second derivative is (show this) +

+ +$$ +\begin{align*} + \frac{1}{\Psi_T(\mathbf{r})}\nabla_k^2\Psi_T(\mathbf{r}) + &= \frac{\nabla_k^2\phi(\mathbf{r}_k)}{\phi(\mathbf{r}_k)} + + 2\frac{\nabla_k\phi(\mathbf{r}_k)}{\phi(\mathbf{r}_k)} + \left(\sum_{j\ne k}\frac{(\mathbf{r}_k-\mathbf{r}_j)}{r_{kj}}u'(r_{kj})\right) + \\ + &\qquad + + \sum_{i\ne k}\sum_{j \ne k}\frac{(\mathbf{r}_k-\mathbf{r}_i)(\mathbf{r}_k-\mathbf{r}_j)}{r_{ki}r_{kj}}u'(r_{ki})u'(r_{kj}) + \\ + &\qquad + + \sum_{j\ne k}\left( u''(r_{kj})+\frac{2}{r_{kj}}u'(r_{kj})\right). +\end{align*} +$$ + +

Use this expression to find the final second derivative entering the definition of the local energy. +You need to get the analytic expression for this expression using the harmonic oscillator wave functions +and the correlation term defined in the project. +

+ +

Note: In parts 1b, 1c, 1d, 1e and 1f you will develop all +computational ingredients needed by studying only the non-interacting +case. We add the repulsive interaction in the final two parts, 1g and +1h. The reason for doing so is that we can develop all programming +ingredients and compare our results against exact analytical results. +

+

Project 1 b): Developing the code

+ +

Write a Variational Monte Carlo program which uses standard + Metropolis sampling and compute the ground state energy of a + spherical harmonic oscillator (\( \beta = 1 \)) with no interaction and + one dimension. Use natural units and make an analysis of your + calculations using both the analytic expression for the local + energy and a numerical calculation of the kinetic energy using + numerical derivation. Compare the CPU time difference. The only + variational parameter is \( \alpha \). Perform these calculations for + \( N=1 \), \( N=10 \), \( 100 \) and \( 500 \) atoms. Compare your results with the + exact answer. Extend then your results to two and three dimensions + and compare with the analytical results. +

+

Project 1 c): Adding importance sampling

+ +

We repeat part b), but now we replace the brute force Metropolis algorithm with +importance sampling based on the Fokker-Planck and the Langevin equations. +Discuss your results and comment on eventual differences between importance sampling and brute force sampling. +Run the calculations for the one, two and three-dimensional systems only and without the repulsive potential. +Study the dependence of the results as a function of the time step \( \delta t \). +Compare the results with those obtained under b) and comment eventual differences. +

+

Project 1 d): Finding the best parameter(s)

+ +

When we performed the calculations in parts 1b) and 1c), we simply +plotted the expectation value of the energy as a function of the +parameter \( \alpha \). For large systems, this means that we end up with +spending equally many Monte Carlo cycles for values of the energy away +from the minimum. We can improve upon this by using various optimization algorithms. +The aim of this part, still using only the non-interacting case, is to add to our code either a steepest descent algorithm or a stochastic gradient optmization algorithm in order to obtain the best +possible parameter \( \alpha \) which minimized the expectation value of the energy. +

+

Project 1 e): A better statistical analysis

+ +

In performing the Monte Carlo analysis we will use the blocking and + bootstrap techniques to make the final statistical analysis of the + numerical data. Present your results with a proper evaluation of the + statistical errors. Repeat the calculations from part d) (or c) and + include a proper error analysis. Limit yourself to the + three-dimensional case only. +

+ +

A useful strategy here is to write your expectation values to file and +then have a Python code which does the final statistical +analysis. Alternatively, you can obviously write addition functions to +be used by your main program and perform the final statistical +analysis within the same code. +

+

Project 1 f): Parallelizing your code

+ +

Before we add the two-body interaction, our final computational ingredient is to parallelize our code. +With this last ingredient we have obtained a code framework which contains the essential elements used in a Variational Monte Carlo approach to a many-body problem. Dealing with a non-interacting case only till now allows us to continuously check our results against exact solutions. +

+ +

You should parallelize your code using MPI or OpenMP.

+

Project 1 g): The repulsive interaction

+ +

We are now ready to include the repulsive two-body interaction.

+ +

We turn to the elliptic trap with a repulsive + interaction. We fix, as in Refs. [1,2] below, + \( a/a_{ho}=0.0043 \). We introduce lengths in units of \( a_{ho} \), + \( r\rightarrow r/a_{ho} \) and energy in units of \( \hbar\omega_{ho} \). + Show then that the original Hamiltonian can be rewritten as +

+ +$$ +\begin{equation*} + H=\sum_{i=1}^N\frac{1}{2}\left(-\nabla^2_i+x_i^2+y_i^2+\gamma^2z_i^2\right)+\sum_{i < j}V_{int}(|\mathbf{r}_i-\mathbf{r}_j|). + \end{equation*} +$$ + +

What is the expression for \( \gamma \)? Choose the initial value for + \( \beta=\gamma = 2.82843 \) and compute + ground state energy using the trial wave function of + Eq. (5) using only \( \alpha \) as variational + parameter. Vary again the parameter + \( \alpha \) in order to find a minimum. + Perform the calculations for + \( N=10,50 \) and \( N=100 \) and compare your results to those from the + ideal case in the previous exercises. Benchmark your results with + those of Refs. [1,2]. +

+

Project 1 h): Onebody densities

+ +

With the optimal parameters for the ground state wave function, +compute again the onebody density with and without the Jastrow factor. +How important are the correlations induced by the Jastrow factor? +

+

Literature

+ +
    +
  1. J. L. DuBois and H. R. Glyde, H. R., Bose-Einstein condensation in trapped bosons: A variational Monte Carlo analysis, Phys. Rev. A 63, 023602 (2001).
  2. +
  3. J. K. Nilsen, J. Mur-Petit, M. Guilleumas, M. Hjorth-Jensen, and A. Polls, Vortices in atomic Bose-Einstein condensates in the large-gas-parameter region, Phys. Rev. A 71, 053610 (2005).
  4. +
+

Introduction to numerical projects

+ +

Here follows a brief recipe and recommendation on how to write a report for each +project. +

+ + +

Format for electronic delivery of report and programs

+ +

The preferred format for the report is a PDF file. You can also use DOC or postscript formats or as an ipython notebook file. As programming language we prefer that you choose between C/C++, Fortran2008 or Python. The following prescription should be followed when preparing the report:

+ + +

Finally, +we encourage you to work two and two together. Optimal working groups consist of +2-3 students. You can then hand in a common report. +

+ + +
+ + + + +
+ © 1999-2024, "Computational Physics II FYS4411/FYS9411":"http://www.uio.no/studier/emner/matnat/fys/FYS4411/index-eng.html". Released under CC Attribution-NonCommercial 4.0 license +
+ + + diff --git a/doc/Projects/2024/Project1/html/Project1.html b/doc/Projects/2024/Project1/html/Project1.html new file mode 100644 index 00000000..0af86d4f --- /dev/null +++ b/doc/Projects/2024/Project1/html/Project1.html @@ -0,0 +1,639 @@ + + + + + + + +Project 1, deadline March 22, 2024 + + + + + + + + + + + + + + +
+

Project 1, deadline March 22, 2024

+
+ + +
+Computational Physics II FYS4411/FYS9411 +
+ +
+Department of Physics, University of Oslo, Norway +
+
+
+

Jan 10, 2024

+
+
+

Introduction

+ +

The spectacular demonstration of Bose-Einstein condensation (BEC) in +gases of alkali atoms $^{87}$Rb, $^{23}$Na, $^7$Li confined in +magnetic traps has led to an explosion of interest in confined Bose +systems. Of interest is the fraction of condensed atoms, the nature of +the condensate, the excitations above the condensate, the atomic +density in the trap as a function of Temperature and the critical +temperature of BEC, \( T_c \). +

+ +

A key feature of the trapped alkali and atomic hydrogen systems is +that they are dilute. The characteristic dimensions of a typical trap +for $^{87}$Rb is \( a_{ho}=\left( + {\hbar}/{m\omega_\perp}\right)^\frac{1}{2}=1-2 \times 10^4 \) \AA\ + . The interaction between $^{87}$Rb atoms can be well represented by + its s-wave scattering length, \( a_{Rb} \). This scattering length lies + in the range \( 85 a_0 < a_{Rb} < 140 a_0 \) where \( a_0 = 0.5292 \) \AA\ is + the Bohr radius. The definite value \( a_{Rb} = 100 a_0 \) is usually + selected and for calculations the definite ratio of atom size to trap + size \( a_{Rb}/a_{ho} = 4.33 \times 10^{-3} \) is usually chosen. A + typical $^{87}$Rb atom density in the trap is \( n \simeq 10^{12}- + 10^{14} \) atoms per cubic cm, giving an inter-atom spacing \( \ell + \simeq 10^4 \) \AA. Thus the effective atom size is small compared to + both the trap size and the inter-atom spacing, the condition for + diluteness (\( na^3_{Rb} \simeq 10^{-6} \) where \( n = N/V \) is the number + density). +

+ +

Many theoretical studies of Bose-Einstein condensates (BEC) in gases +of alkali atoms confined in magnetic or optical traps have been +conducted in the framework of the Gross-Pitaevskii (GP) equation. The +key point for the validity of this description is the dilute condition +of these systems, that is, the average distance between the atoms is +much larger than the range of the inter-atomic interaction. In this +situation the physics is dominated by two-body collisions, well +described in terms of the \( s \)-wave scattering length \( a \). The crucial +parameter defining the condition for diluteness is the gas parameter +\( x(\mathbf{r})= n(\mathbf{r}) a^3 \), where \( n(\mathbf{r}) \) is the local density +of the system. For low values of the average gas parameter \( x_{av}\le 10^{-3} \), the mean field Gross-Pitaevskii equation does an excellent +job. However, +in recent experiments, the local gas parameter may well exceed this +value due to the possibility of tuning the scattering length in the +presence of a so-called Feshbach resonance. +

+ +

Thus, improved many-body methods like Monte Carlo calculations may be +needed. +

+ +

The aim of this project is to use the Variational Monte Carlo +(VMC) method and evaluate the ground state energy of a trapped, hard +sphere Bose gas for different numbers of particles with a specific +trial wave function. +

+ +

This trial wave function is used to study the sensitivity of + condensate and non-condensate properties to the hard sphere radius + and the number of particles. The trap we will use is a spherical (S) + or an elliptical (E) harmonic trap in one, two and finally three + dimensions, with the latter given by +

+ +$$ +\begin{equation} + V_{ext}(\mathbf{r}) = + \Bigg\{ + \begin{array}{ll} + \frac{1}{2}m\omega_{ho}^2r^2 & (S)\\ + \strut + \frac{1}{2}m[\omega_{ho}^2(x^2+y^2) + \omega_z^2z^2] & (E) +\label{trap_eqn} + \end{array} + \end{equation} +$$ + +

where (S) stands for spherical and

+ +$$ +\begin{equation} + H = \sum_i^N \left(\frac{-\hbar^2}{2m}{\bigtriangledown }_{i}^2 +V_{ext}({\mathbf{r}}_i)\right) + + \sum_{i < j}^{N} V_{int}({\mathbf{r}}_i,{\mathbf{r}}_j), +\label{_auto1} +\end{equation} +$$ + +

as the two-body Hamiltonian of the system. Here \( \omega_{ho}^2 \) + defines the trap potential strength. In the case of the elliptical + trap, \( V_{ext}(x,y,z) \), \( \omega_{ho}=\omega_{\perp} \) is the trap + frequency in the perpendicular or \( xy \) plane and \( \omega_z \) the + frequency in the \( z \) direction. The mean square vibrational + amplitude of a single boson at \( T=0K \) in the trap \eqref{trap_eqn} is + \( \langle x^2\rangle=(\hbar/2m\omega_{ho}) \) so that \( a_{ho} \equiv + (\hbar/m\omega_{ho})^{\frac{1}{2}} \) defines the characteristic length + of the trap. The ratio of the frequencies is denoted + \( \lambda=\omega_z/\omega_{\perp} \) leading to a ratio of the trap + lengths \( (a_{\perp}/a_z)=(\omega_z/\omega_{\perp})^{\frac{1}{2}} = + \sqrt{\lambda} \). Note that we use the shorthand notation +

+$$ +\begin{align} + \sum_{i < j}^{N} V_{ij} \equiv \sum_{i = 1}^{N}\sum_{j = i + 1}^{N} V_{ij}, +\label{_auto2} +\end{align} +$$ + +

that is, the notation \( i < j \) under the summation sign signifies a double sum + running over all pairwise interactions once. +

+ +

We will represent the inter-boson interaction by a pairwise, + repulsive potential +

+ +$$ +\begin{equation} + V_{int}(|\mathbf{r}_i-\mathbf{r}_j|) = \Bigg\{ + \begin{array}{ll} + \infty & {|\mathbf{r}_i-\mathbf{r}_j|} \leq {a}\\ + 0 & {|\mathbf{r}_i-\mathbf{r}_j|} > {a} + \end{array} +\label{_auto3} +\end{equation} +$$ + +

where \( a \) is the so-called hard-core diameter of the bosons. + Clearly, \( V_{int}(|\mathbf{r}_i-\mathbf{r}_j|) \) is zero if the bosons are + separated by a distance \( |\mathbf{r}_i-\mathbf{r}_j| \) greater than \( a \) but + infinite if they attempt to come within a distance \( |\mathbf{r}_i-\mathbf{r}_j| \leq a \). +

+ +

Our trial wave function for the ground state with \( N \) atoms is given by

+ +$$ +\begin{equation} + \Psi_T(\mathbf{r})=\Psi_T(\mathbf{r}_1, \mathbf{r}_2, \dots \mathbf{r}_N,\alpha,\beta) + =\left[ + \prod_i g(\alpha,\beta,\mathbf{r}_i) + \right] + \left[ + \prod_{j < k}f(a,|\mathbf{r}_j-\mathbf{r}_k|) + \right], +\label{eq:trialwf} + \end{equation} +$$ + +

where \( \alpha \) and \( \beta \) are variational parameters. The + single-particle wave function is proportional to the harmonic + oscillator function for the ground state, i.e., +

+ +$$ +\begin{equation} + g(\alpha,\beta,\mathbf{r}_i)= \exp{[-\alpha(x_i^2+y_i^2+\beta z_i^2)]}. +\label{_auto4} +\end{equation} +$$ + +

For spherical traps we have \( \beta = 1 \) and for non-interacting + bosons (\( a=0 \)) we have \( \alpha = 1/2a_{ho}^2 \). The correlation wave + function is +

+ +$$ +\begin{equation} + f(a,|\mathbf{r}_i-\mathbf{r}_j|)=\Bigg\{ + \begin{array}{ll} + 0 & {|\mathbf{r}_i-\mathbf{r}_j|} \leq {a}\\ + (1-\frac{a}{|\mathbf{r}_i-\mathbf{r}_j|}) & {|\mathbf{r}_i-\mathbf{r}_j|} > {a}. + \end{array} +\label{_auto5} +\end{equation} +$$ +

Project 1 a): Local energy

+ +

Find the analytic expressions for the local energy

+$$ +\begin{equation} + E_L(\mathbf{r})=\frac{1}{\Psi_T(\mathbf{r})}H\Psi_T(\mathbf{r}), +\label{eq:locale} + \end{equation} +$$ + +

for the above + trial wave function of Eq. (5) and defined by the terms in Eqs. (6) and (7). +

+ +

Find first the local energy the case with only the harmonic oscillator potential, that is we set \( a=0 \) and discard totally the two-body potential.

+ +

Use first that \( \beta =1 \) and find the relevant local energies in one, two and three dimensions for one and +\( N \) particles with the same mass. +

+ +

Compute also the analytic expression for the drift force to be used in importance sampling

+ +$$ +\begin{equation} + F = \frac{2\nabla \Psi_T}{\Psi_T}. +\label{_auto6} +\end{equation} +$$ + +

Find first the equivalent expressions for the just the harmonic oscillator part in one, two and three dimensions +with \( \beta=1 \). +

+ +

Our next step involves the calculation of local energy for the full problem in three dimensions. +The tricky part is to find an analytic expressions for the derivative of the trial wave function +

+ +$$ +\begin{equation*} + \frac{1}{\Psi_T(\mathbf{r})}\sum_i^{N}\nabla_i^2\Psi_T(\mathbf{r}), +\end{equation*} +$$ + +

with the above +trial wave function of Eq. (5). +We rewrite +

+ +$$ +\begin{equation*} +\Psi_T(\mathbf{r})=\Psi_T(\mathbf{r}_1, \mathbf{r}_2, \dots \mathbf{r}_N,\alpha,\beta) +=\left[ + \prod_i g(\alpha,\beta,\mathbf{r}_i) +\right] +\left[ + \prod_{j < k}f(a,|\mathbf{r}_j-\mathbf{r}_k|) +\right], +\end{equation*} +$$ + +

as

+ +$$ +\begin{equation*} +\Psi_T(\mathbf{r})=\left[ + \prod_i g(\alpha,\beta,\mathbf{r}_i) +\right] +\exp{\left(\sum_{j < k}u(r_{jk})\right)} +\end{equation*} +$$ + +

where we have defined \( r_{ij}=|\mathbf{r}_i-\mathbf{r}_j| \) +and +

+ +$$ +\begin{equation*} + f(r_{ij})= \exp{\left(u(r_{ij})\right)}, +\end{equation*} +$$ + +

with \( u(r_{ij})=\ln{f(r_{ij})} \). +We have also +

+ +$$ +\begin{equation*} + g(\alpha,\beta,\mathbf{r}_i) = \exp{\left[-\alpha(x_i^2+y_i^2+\beta + z_i^2)\right]}= \phi(\mathbf{r}_i). +\end{equation*} +$$ + +

Show that the first derivative for particle \( k \) is

+ +$$ +\begin{align*} + \nabla_k\Psi_T(\mathbf{r}) &= \nabla_k\phi(\mathbf{r}_k)\left[\prod_{i\ne k}\phi(\mathbf{r}_i)\right]\exp{\left(\sum_{j < m}u(r_{jm})\right)} + \\ + &\qquad + + \left[\prod_i\phi(\mathbf{r}_i)\right] + \exp{\left(\sum_{j < m}u(r_{jm})\right)}\sum_{l\ne k}\nabla_k u(r_{kl}), +\end{align*} +$$ + +

and find the final expression for our specific trial function. +The expression for the second derivative is (show this) +

+ +$$ +\begin{align*} + \frac{1}{\Psi_T(\mathbf{r})}\nabla_k^2\Psi_T(\mathbf{r}) + &= \frac{\nabla_k^2\phi(\mathbf{r}_k)}{\phi(\mathbf{r}_k)} + + 2\frac{\nabla_k\phi(\mathbf{r}_k)}{\phi(\mathbf{r}_k)} + \left(\sum_{j\ne k}\frac{(\mathbf{r}_k-\mathbf{r}_j)}{r_{kj}}u'(r_{kj})\right) + \\ + &\qquad + + \sum_{i\ne k}\sum_{j \ne k}\frac{(\mathbf{r}_k-\mathbf{r}_i)(\mathbf{r}_k-\mathbf{r}_j)}{r_{ki}r_{kj}}u'(r_{ki})u'(r_{kj}) + \\ + &\qquad + + \sum_{j\ne k}\left( u''(r_{kj})+\frac{2}{r_{kj}}u'(r_{kj})\right). +\end{align*} +$$ + +

Use this expression to find the final second derivative entering the definition of the local energy. +You need to get the analytic expression for this expression using the harmonic oscillator wave functions +and the correlation term defined in the project. +

+ +

Note: In parts 1b, 1c, 1d, 1e and 1f you will develop all +computational ingredients needed by studying only the non-interacting +case. We add the repulsive interaction in the final two parts, 1g and +1h. The reason for doing so is that we can develop all programming +ingredients and compare our results against exact analytical results. +

+

Project 1 b): Developing the code

+ +

Write a Variational Monte Carlo program which uses standard + Metropolis sampling and compute the ground state energy of a + spherical harmonic oscillator (\( \beta = 1 \)) with no interaction and + one dimension. Use natural units and make an analysis of your + calculations using both the analytic expression for the local + energy and a numerical calculation of the kinetic energy using + numerical derivation. Compare the CPU time difference. The only + variational parameter is \( \alpha \). Perform these calculations for + \( N=1 \), \( N=10 \), \( 100 \) and \( 500 \) atoms. Compare your results with the + exact answer. Extend then your results to two and three dimensions + and compare with the analytical results. +

+

Project 1 c): Adding importance sampling

+ +

We repeat part b), but now we replace the brute force Metropolis algorithm with +importance sampling based on the Fokker-Planck and the Langevin equations. +Discuss your results and comment on eventual differences between importance sampling and brute force sampling. +Run the calculations for the one, two and three-dimensional systems only and without the repulsive potential. +Study the dependence of the results as a function of the time step \( \delta t \). +Compare the results with those obtained under b) and comment eventual differences. +

+

Project 1 d): Finding the best parameter(s)

+ +

When we performed the calculations in parts 1b) and 1c), we simply +plotted the expectation value of the energy as a function of the +parameter \( \alpha \). For large systems, this means that we end up with +spending equally many Monte Carlo cycles for values of the energy away +from the minimum. We can improve upon this by using various optimization algorithms. +The aim of this part, still using only the non-interacting case, is to add to our code either a steepest descent algorithm or a stochastic gradient optmization algorithm in order to obtain the best +possible parameter \( \alpha \) which minimized the expectation value of the energy. +

+

Project 1 e): A better statistical analysis

+ +

In performing the Monte Carlo analysis we will use the blocking and + bootstrap techniques to make the final statistical analysis of the + numerical data. Present your results with a proper evaluation of the + statistical errors. Repeat the calculations from part d) (or c) and + include a proper error analysis. Limit yourself to the + three-dimensional case only. +

+ +

A useful strategy here is to write your expectation values to file and +then have a Python code which does the final statistical +analysis. Alternatively, you can obviously write addition functions to +be used by your main program and perform the final statistical +analysis within the same code. +

+

Project 1 f): Parallelizing your code

+ +

Before we add the two-body interaction, our final computational ingredient is to parallelize our code. +With this last ingredient we have obtained a code framework which contains the essential elements used in a Variational Monte Carlo approach to a many-body problem. Dealing with a non-interacting case only till now allows us to continuously check our results against exact solutions. +

+ +

You should parallelize your code using MPI or OpenMP.

+

Project 1 g): The repulsive interaction

+ +

We are now ready to include the repulsive two-body interaction.

+ +

We turn to the elliptic trap with a repulsive + interaction. We fix, as in Refs. [1,2] below, + \( a/a_{ho}=0.0043 \). We introduce lengths in units of \( a_{ho} \), + \( r\rightarrow r/a_{ho} \) and energy in units of \( \hbar\omega_{ho} \). + Show then that the original Hamiltonian can be rewritten as +

+ +$$ +\begin{equation*} + H=\sum_{i=1}^N\frac{1}{2}\left(-\nabla^2_i+x_i^2+y_i^2+\gamma^2z_i^2\right)+\sum_{i < j}V_{int}(|\mathbf{r}_i-\mathbf{r}_j|). + \end{equation*} +$$ + +

What is the expression for \( \gamma \)? Choose the initial value for + \( \beta=\gamma = 2.82843 \) and compute + ground state energy using the trial wave function of + Eq. (5) using only \( \alpha \) as variational + parameter. Vary again the parameter + \( \alpha \) in order to find a minimum. + Perform the calculations for + \( N=10,50 \) and \( N=100 \) and compare your results to those from the + ideal case in the previous exercises. Benchmark your results with + those of Refs. [1,2]. +

+

Project 1 h): Onebody densities

+ +

With the optimal parameters for the ground state wave function, +compute again the onebody density with and without the Jastrow factor. +How important are the correlations induced by the Jastrow factor? +

+

Literature

+ +
    +
  1. J. L. DuBois and H. R. Glyde, H. R., Bose-Einstein condensation in trapped bosons: A variational Monte Carlo analysis, Phys. Rev. A 63, 023602 (2001).
  2. +
  3. J. K. Nilsen, J. Mur-Petit, M. Guilleumas, M. Hjorth-Jensen, and A. Polls, Vortices in atomic Bose-Einstein condensates in the large-gas-parameter region, Phys. Rev. A 71, 053610 (2005).
  4. +
+

Introduction to numerical projects

+ +

Here follows a brief recipe and recommendation on how to write a report for each +project. +

+ + +

Format for electronic delivery of report and programs

+ +

The preferred format for the report is a PDF file. You can also use DOC or postscript formats or as an ipython notebook file. As programming language we prefer that you choose between C/C++, Fortran2008 or Python. The following prescription should be followed when preparing the report:

+ + +

Finally, +we encourage you to work two and two together. Optimal working groups consist of +2-3 students. You can then hand in a common report. +

+ + +
+ © 1999-2024, "Computational Physics II FYS4411/FYS9411":"http://www.uio.no/studier/emner/matnat/fys/FYS4411/index-eng.html". Released under CC Attribution-NonCommercial 4.0 license +
+ + + diff --git a/doc/Projects/2024/Project1/ipynb/Project1.ipynb b/doc/Projects/2024/Project1/ipynb/Project1.ipynb new file mode 100644 index 00000000..031c0f78 --- /dev/null +++ b/doc/Projects/2024/Project1/ipynb/Project1.ipynb @@ -0,0 +1,835 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "id": "4fa78211", + "metadata": { + "editable": true + }, + "source": [ + "\n", + "" + ] + }, + { + "cell_type": "markdown", + "id": "5681f3d7", + "metadata": { + "editable": true + }, + "source": [ + "# Project 1, deadline March 22, 2024\n", + "**[Computational Physics II FYS4411/FYS9411](http://www.uio.no/studier/emner/matnat/fys/FYS4411/index-eng.html)**, Department of Physics, University of Oslo, Norway\n", + "\n", + "Date: **Jan 10, 2024**\n", + "\n", + "Copyright 1999-2024, [Computational Physics II FYS4411/FYS9411](http://www.uio.no/studier/emner/matnat/fys/FYS4411/index-eng.html). Released under CC Attribution-NonCommercial 4.0 license" + ] + }, + { + "cell_type": "markdown", + "id": "d1245d73", + "metadata": { + "editable": true + }, + "source": [ + "## Introduction\n", + "\n", + "The spectacular demonstration of Bose-Einstein condensation (BEC) in\n", + "gases of alkali atoms $^{87}$Rb, $^{23}$Na, $^7$Li confined in\n", + "magnetic traps has led to an explosion of interest in confined Bose\n", + "systems. Of interest is the fraction of condensed atoms, the nature of\n", + "the condensate, the excitations above the condensate, the atomic\n", + "density in the trap as a function of Temperature and the critical\n", + "temperature of BEC, $T_c$.\n", + "\n", + "A key feature of the trapped alkali and atomic hydrogen systems is\n", + "that they are dilute. The characteristic dimensions of a typical trap\n", + "for $^{87}$Rb is $a_{ho}=\\left(\n", + " {\\hbar}/{m\\omega_\\perp}\\right)^\\frac{1}{2}=1-2 \\times 10^4$ \\AA\\\n", + " . The interaction between $^{87}$Rb atoms can be well represented by\n", + " its s-wave scattering length, $a_{Rb}$. This scattering length lies\n", + " in the range $85 a_0 < a_{Rb} < 140 a_0$ where $a_0 = 0.5292$ \\AA\\ is\n", + " the Bohr radius. The definite value $a_{Rb} = 100 a_0$ is usually\n", + " selected and for calculations the definite ratio of atom size to trap\n", + " size $a_{Rb}/a_{ho} = 4.33 \\times 10^{-3}$ is usually chosen. A\n", + " typical $^{87}$Rb atom density in the trap is $n \\simeq 10^{12}-\n", + " 10^{14}$ atoms per cubic cm, giving an inter-atom spacing $\\ell\n", + " \\simeq 10^4$ \\AA. Thus the effective atom size is small compared to\n", + " both the trap size and the inter-atom spacing, the condition for\n", + " diluteness ($na^3_{Rb} \\simeq 10^{-6}$ where $n = N/V$ is the number\n", + " density).\n", + "\n", + "Many theoretical studies of Bose-Einstein condensates (BEC) in gases\n", + "of alkali atoms confined in magnetic or optical traps have been\n", + "conducted in the framework of the Gross-Pitaevskii (GP) equation. The\n", + "key point for the validity of this description is the dilute condition\n", + "of these systems, that is, the average distance between the atoms is\n", + "much larger than the range of the inter-atomic interaction. In this\n", + "situation the physics is dominated by two-body collisions, well\n", + "described in terms of the $s$-wave scattering length $a$. The crucial\n", + "parameter defining the condition for diluteness is the gas parameter\n", + "$x(\\mathbf{r})= n(\\mathbf{r}) a^3$, where $n(\\mathbf{r})$ is the local density\n", + "of the system. For low values of the average gas parameter $x_{av}\\le 10^{-3}$, the mean field Gross-Pitaevskii equation does an excellent\n", + "job. However,\n", + "in recent experiments, the local gas parameter may well exceed this\n", + "value due to the possibility of tuning the scattering length in the\n", + "presence of a so-called Feshbach resonance.\n", + "\n", + "Thus, improved many-body methods like Monte Carlo calculations may be\n", + "needed.\n", + "\n", + "The aim of this project is to use the Variational Monte Carlo\n", + "(VMC) method and evaluate the ground state energy of a trapped, hard\n", + "sphere Bose gas for different numbers of particles with a specific\n", + "trial wave function.\n", + "\n", + "This trial wave function is used to study the sensitivity of\n", + " condensate and non-condensate properties to the hard sphere radius\n", + " and the number of particles. The trap we will use is a spherical (S)\n", + " or an elliptical (E) harmonic trap in one, two and finally three\n", + " dimensions, with the latter given by" + ] + }, + { + "cell_type": "markdown", + "id": "720bca38", + "metadata": { + "editable": true + }, + "source": [ + "\n", + "
\n", + "\n", + "$$\n", + "\\begin{equation}\n", + " V_{ext}(\\mathbf{r}) = \n", + " \\Bigg\\{\n", + " \\begin{array}{ll}\n", + "\t \\frac{1}{2}m\\omega_{ho}^2r^2 & (S)\\\\\n", + " \\strut\n", + "\t \\frac{1}{2}m[\\omega_{ho}^2(x^2+y^2) + \\omega_z^2z^2] & (E)\n", + "\\label{trap_eqn} \\tag{1}\n", + " \\end{array}\n", + " \\end{equation}\n", + "$$" + ] + }, + { + "cell_type": "markdown", + "id": "7b52ab59", + "metadata": { + "editable": true + }, + "source": [ + "where (S) stands for spherical and" + ] + }, + { + "cell_type": "markdown", + "id": "c09ea92c", + "metadata": { + "editable": true + }, + "source": [ + "\n", + "
\n", + "\n", + "$$\n", + "\\begin{equation}\n", + " H = \\sum_i^N \\left(\\frac{-\\hbar^2}{2m}{\\bigtriangledown }_{i}^2 +V_{ext}({\\mathbf{r}}_i)\\right) +\n", + "\t \\sum_{i\n", + "
\n", + "\n", + "$$\n", + "\\begin{equation}\n", + " \\sum_{i < j}^{N} V_{ij} \\equiv \\sum_{i = 1}^{N}\\sum_{j = i + 1}^{N} V_{ij},\n", + "\\label{_auto2} \\tag{3}\n", + "\\end{equation}\n", + "$$" + ] + }, + { + "cell_type": "markdown", + "id": "dd04da62", + "metadata": { + "editable": true + }, + "source": [ + "that is, the notation $i < j$ under the summation sign signifies a double sum\n", + " running over all pairwise interactions once.\n", + "\n", + " We will represent the inter-boson interaction by a pairwise,\n", + " repulsive potential" + ] + }, + { + "cell_type": "markdown", + "id": "1a524d9d", + "metadata": { + "editable": true + }, + "source": [ + "\n", + "
\n", + "\n", + "$$\n", + "\\begin{equation}\n", + " V_{int}(|\\mathbf{r}_i-\\mathbf{r}_j|) = \\Bigg\\{\n", + " \\begin{array}{ll}\n", + "\t \\infty & {|\\mathbf{r}_i-\\mathbf{r}_j|} \\leq {a}\\\\\n", + "\t 0 & {|\\mathbf{r}_i-\\mathbf{r}_j|} > {a}\n", + " \\end{array}\n", + "\\label{_auto3} \\tag{4}\n", + "\\end{equation}\n", + "$$" + ] + }, + { + "cell_type": "markdown", + "id": "85085ff6", + "metadata": { + "editable": true + }, + "source": [ + "where $a$ is the so-called hard-core diameter of the bosons.\n", + " Clearly, $V_{int}(|\\mathbf{r}_i-\\mathbf{r}_j|)$ is zero if the bosons are\n", + " separated by a distance $|\\mathbf{r}_i-\\mathbf{r}_j|$ greater than $a$ but\n", + " infinite if they attempt to come within a distance $|\\mathbf{r}_i-\\mathbf{r}_j| \\leq a$.\n", + "\n", + " Our trial wave function for the ground state with $N$ atoms is given by" + ] + }, + { + "cell_type": "markdown", + "id": "169cb7be", + "metadata": { + "editable": true + }, + "source": [ + "\n", + "
\n", + "\n", + "$$\n", + "\\begin{equation}\n", + " \\Psi_T(\\mathbf{r})=\\Psi_T(\\mathbf{r}_1, \\mathbf{r}_2, \\dots \\mathbf{r}_N,\\alpha,\\beta)\n", + " =\\left[\n", + " \\prod_i g(\\alpha,\\beta,\\mathbf{r}_i)\n", + " \\right]\n", + " \\left[\n", + " \\prod_{j\n", + "
\n", + "\n", + "$$\n", + "\\begin{equation}\n", + " g(\\alpha,\\beta,\\mathbf{r}_i)= \\exp{[-\\alpha(x_i^2+y_i^2+\\beta z_i^2)]}.\n", + "\\label{_auto4} \\tag{6}\n", + "\\end{equation}\n", + "$$" + ] + }, + { + "cell_type": "markdown", + "id": "8211b0b3", + "metadata": { + "editable": true + }, + "source": [ + "For spherical traps we have $\\beta = 1$ and for non-interacting\n", + " bosons ($a=0$) we have $\\alpha = 1/2a_{ho}^2$. The correlation wave\n", + " function is" + ] + }, + { + "cell_type": "markdown", + "id": "a4263467", + "metadata": { + "editable": true + }, + "source": [ + "\n", + "
\n", + "\n", + "$$\n", + "\\begin{equation}\n", + " f(a,|\\mathbf{r}_i-\\mathbf{r}_j|)=\\Bigg\\{\n", + " \\begin{array}{ll}\n", + "\t 0 & {|\\mathbf{r}_i-\\mathbf{r}_j|} \\leq {a}\\\\\n", + "\t (1-\\frac{a}{|\\mathbf{r}_i-\\mathbf{r}_j|}) & {|\\mathbf{r}_i-\\mathbf{r}_j|} > {a}.\n", + " \\end{array}\n", + "\\label{_auto5} \\tag{7}\n", + "\\end{equation}\n", + "$$" + ] + }, + { + "cell_type": "markdown", + "id": "9a5227de", + "metadata": { + "editable": true + }, + "source": [ + "### Project 1 a): Local energy\n", + "\n", + "Find the analytic expressions for the local energy" + ] + }, + { + "cell_type": "markdown", + "id": "30675e4c", + "metadata": { + "editable": true + }, + "source": [ + "\n", + "
\n", + "\n", + "$$\n", + "\\begin{equation}\n", + " E_L(\\mathbf{r})=\\frac{1}{\\Psi_T(\\mathbf{r})}H\\Psi_T(\\mathbf{r}),\n", + "\\label{eq:locale} \\tag{8}\n", + " \\end{equation}\n", + "$$" + ] + }, + { + "cell_type": "markdown", + "id": "606a1343", + "metadata": { + "editable": true + }, + "source": [ + "for the above \n", + " trial wave function of Eq. (5) and defined by the terms in Eqs. (6) and (7). \n", + "\n", + "Find first the local energy the case with only the harmonic oscillator potential, that is we set $a=0$ and discard totally the two-body potential.\n", + "\n", + "Use first that $\\beta =1$ and find the relevant local energies in one, two and three dimensions for one and\n", + "$N$ particles with the same mass. \n", + "\n", + " Compute also the analytic expression for the drift force to be used in importance sampling" + ] + }, + { + "cell_type": "markdown", + "id": "f4b5b3fd", + "metadata": { + "editable": true + }, + "source": [ + "\n", + "
\n", + "\n", + "$$\n", + "\\begin{equation}\n", + " F = \\frac{2\\nabla \\Psi_T}{\\Psi_T}.\n", + "\\label{_auto6} \\tag{9}\n", + "\\end{equation}\n", + "$$" + ] + }, + { + "cell_type": "markdown", + "id": "8bb81322", + "metadata": { + "editable": true + }, + "source": [ + "Find first the equivalent expressions for the just the harmonic oscillator part in one, two and three dimensions\n", + "with $\\beta=1$. \n", + "\n", + "Our next step involves the calculation of local energy for the full problem in three dimensions.\n", + "The tricky part is to find an analytic expressions for the derivative of the trial wave function" + ] + }, + { + "cell_type": "markdown", + "id": "f4ca7f71", + "metadata": { + "editable": true + }, + "source": [ + "$$\n", + "\\frac{1}{\\Psi_T(\\mathbf{r})}\\sum_i^{N}\\nabla_i^2\\Psi_T(\\mathbf{r}),\n", + "$$" + ] + }, + { + "cell_type": "markdown", + "id": "9f2affe8", + "metadata": { + "editable": true + }, + "source": [ + "with the above \n", + "trial wave function of Eq. (5).\n", + "We rewrite" + ] + }, + { + "cell_type": "markdown", + "id": "bf6dc1be", + "metadata": { + "editable": true + }, + "source": [ + "$$\n", + "\\Psi_T(\\mathbf{r})=\\Psi_T(\\mathbf{r}_1, \\mathbf{r}_2, \\dots \\mathbf{r}_N,\\alpha,\\beta)\n", + "=\\left[\n", + " \\prod_i g(\\alpha,\\beta,\\mathbf{r}_i)\n", + "\\right]\n", + "\\left[\n", + " \\prod_{j with your normal UiO username and password.\n", + "\n", + " * Upload **only** the report file! For the source code file(s) you have developed please provide us with your link to your github domain. The report file should include all of your discussions and a list of the codes you have developed. The full version of the codes should be in your github repository.\n", + "\n", + " * In your github repository, please include a folder which contains selected results. These can be in the form of output from your code for a selected set of runs and input parameters.\n", + "\n", + " * Still in your github make a folder where you place your codes. \n", + "\n", + " * In this and all later projects, you should include tests (for example unit tests) of your code(s).\n", + "\n", + " * Comments from us on your projects, approval or not, corrections to be made etc can be found under your Devilry domain and are only visible to you and the teachers of the course.\n", + "\n", + "Finally, \n", + "we encourage you to work two and two together. Optimal working groups consist of \n", + "2-3 students. You can then hand in a common report." + ] + } + ], + "metadata": {}, + "nbformat": 4, + "nbformat_minor": 5 +} diff --git a/doc/Projects/2024/Project1/ipynb/ipynb-Project1-src.tar.gz b/doc/Projects/2024/Project1/ipynb/ipynb-Project1-src.tar.gz new file mode 100644 index 00000000..c78b7788 Binary files /dev/null and b/doc/Projects/2024/Project1/ipynb/ipynb-Project1-src.tar.gz differ diff --git a/doc/Projects/2024/Project1/pdf/Project1.p.tex b/doc/Projects/2024/Project1/pdf/Project1.p.tex new file mode 100644 index 00000000..d380498e --- /dev/null +++ b/doc/Projects/2024/Project1/pdf/Project1.p.tex @@ -0,0 +1,538 @@ +%% +%% Automatically generated file from DocOnce source +%% (https://github.com/doconce/doconce/) +%% doconce format latex Project1.do.txt --print_latex_style=trac --latex_admon=paragraph +%% +% #ifdef PTEX2TEX_EXPLANATION +%% +%% The file follows the ptex2tex extended LaTeX format, see +%% ptex2tex: https://code.google.com/p/ptex2tex/ +%% +%% Run +%% ptex2tex myfile +%% or +%% doconce ptex2tex myfile +%% +%% to turn myfile.p.tex into an ordinary LaTeX file myfile.tex. +%% (The ptex2tex program: https://code.google.com/p/ptex2tex) +%% Many preprocess options can be added to ptex2tex or doconce ptex2tex +%% +%% ptex2tex -DMINTED myfile +%% doconce ptex2tex myfile envir=minted +%% +%% ptex2tex will typeset code environments according to a global or local +%% .ptex2tex.cfg configure file. doconce ptex2tex will typeset code +%% according to options on the command line (just type doconce ptex2tex to +%% see examples). If doconce ptex2tex has envir=minted, it enables the +%% minted style without needing -DMINTED. +% #endif + +% #define PREAMBLE + +% #ifdef PREAMBLE +%-------------------- begin preamble ---------------------- + +\documentclass[% +oneside, % oneside: electronic viewing, twoside: printing +final, % draft: marks overfull hboxes, figures with paths +10pt]{article} + +\listfiles % print all files needed to compile this document + +\usepackage{relsize,makeidx,color,setspace,amsmath,amsfonts,amssymb} +\usepackage[table]{xcolor} +\usepackage{bm,ltablex,microtype} + +\usepackage[pdftex]{graphicx} + +\usepackage[T1]{fontenc} +%\usepackage[latin1]{inputenc} +\usepackage{ucs} +\usepackage[utf8x]{inputenc} + +\usepackage{lmodern} % Latin Modern fonts derived from Computer Modern + +% Hyperlinks in PDF: +\definecolor{linkcolor}{rgb}{0,0,0.4} +\usepackage{hyperref} +\hypersetup{ + breaklinks=true, + colorlinks=true, + linkcolor=linkcolor, + urlcolor=linkcolor, + citecolor=black, + filecolor=black, + %filecolor=blue, + pdfmenubar=true, + pdftoolbar=true, + bookmarksdepth=3 % Uncomment (and tweak) for PDF bookmarks with more levels than the TOC + } +%\hyperbaseurl{} % hyperlinks are relative to this root + +\setcounter{tocdepth}{2} % levels in table of contents + +% --- fancyhdr package for fancy headers --- +\usepackage{fancyhdr} +\fancyhf{} % sets both header and footer to nothing +\renewcommand{\headrulewidth}{0pt} +\fancyfoot[LE,RO]{\thepage} +% Ensure copyright on titlepage (article style) and chapter pages (book style) +\fancypagestyle{plain}{ + \fancyhf{} + \fancyfoot[C]{{\footnotesize \copyright\ 1999-2024, "Computational Physics II FYS4411/FYS9411":"http://www.uio.no/studier/emner/matnat/fys/FYS4411/index-eng.html". Released under CC Attribution-NonCommercial 4.0 license}} +% \renewcommand{\footrulewidth}{0mm} + \renewcommand{\headrulewidth}{0mm} +} +% Ensure copyright on titlepages with \thispagestyle{empty} +\fancypagestyle{empty}{ + \fancyhf{} + \fancyfoot[C]{{\footnotesize \copyright\ 1999-2024, "Computational Physics II FYS4411/FYS9411":"http://www.uio.no/studier/emner/matnat/fys/FYS4411/index-eng.html". Released under CC Attribution-NonCommercial 4.0 license}} + \renewcommand{\footrulewidth}{0mm} + \renewcommand{\headrulewidth}{0mm} +} + +\pagestyle{fancy} + + +% prevent orhpans and widows +\clubpenalty = 10000 +\widowpenalty = 10000 + +% --- end of standard preamble for documents --- + + +% insert custom LaTeX commands... + +\raggedbottom +\makeindex +\usepackage[totoc]{idxlayout} % for index in the toc +\usepackage[nottoc]{tocbibind} % for references/bibliography in the toc + +%-------------------- end preamble ---------------------- + +\begin{document} + +% matching end for #ifdef PREAMBLE +% #endif + +\newcommand{\exercisesection}[1]{\subsection*{#1}} + + +% ------------------- main content ---------------------- + + + +% ----------------- title ------------------------- + +\thispagestyle{empty} + +\begin{center} +{\LARGE\bf +\begin{spacing}{1.25} +Project 1, deadline March 22, 2024 +\end{spacing} +} +\end{center} + +% ----------------- author(s) ------------------------- + +\begin{center} +{\bf \href{{http://www.uio.no/studier/emner/matnat/fys/FYS4411/index-eng.html}}{Computational Physics II FYS4411/FYS9411}} +\end{center} + + \begin{center} +% List of all institutions: +\centerline{{\small Department of Physics, University of Oslo, Norway}} +\end{center} + +% ----------------- end author(s) ------------------------- + +% --- begin date --- +\begin{center} +Jan 10, 2024 +\end{center} +% --- end date --- + +\vspace{1cm} + + +\subsection{Introduction} + +The spectacular demonstration of Bose-Einstein condensation (BEC) in +gases of alkali atoms $^{87}$Rb, $^{23}$Na, $^7$Li confined in +magnetic traps has led to an explosion of interest in confined Bose +systems. Of interest is the fraction of condensed atoms, the nature of +the condensate, the excitations above the condensate, the atomic +density in the trap as a function of Temperature and the critical +temperature of BEC, $T_c$. + +A key feature of the trapped alkali and atomic hydrogen systems is +that they are dilute. The characteristic dimensions of a typical trap +for $^{87}$Rb is $a_{ho}=\left( + {\hbar}/{m\omega_\perp}\right)^\frac{1}{2}=1-2 \times 10^4$ \AA\ + . The interaction between $^{87}$Rb atoms can be well represented by + its s-wave scattering length, $a_{Rb}$. This scattering length lies + in the range $85 a_0 < a_{Rb} < 140 a_0$ where $a_0 = 0.5292$ \AA\ is + the Bohr radius. The definite value $a_{Rb} = 100 a_0$ is usually + selected and for calculations the definite ratio of atom size to trap + size $a_{Rb}/a_{ho} = 4.33 \times 10^{-3}$ is usually chosen. A + typical $^{87}$Rb atom density in the trap is $n \simeq 10^{12}- + 10^{14}$ atoms per cubic cm, giving an inter-atom spacing $\ell + \simeq 10^4$ \AA. Thus the effective atom size is small compared to + both the trap size and the inter-atom spacing, the condition for + diluteness ($na^3_{Rb} \simeq 10^{-6}$ where $n = N/V$ is the number + density). + +Many theoretical studies of Bose-Einstein condensates (BEC) in gases +of alkali atoms confined in magnetic or optical traps have been +conducted in the framework of the Gross-Pitaevskii (GP) equation. The +key point for the validity of this description is the dilute condition +of these systems, that is, the average distance between the atoms is +much larger than the range of the inter-atomic interaction. In this +situation the physics is dominated by two-body collisions, well +described in terms of the $s$-wave scattering length $a$. The crucial +parameter defining the condition for diluteness is the gas parameter +$x(\mathbf{r})= n(\mathbf{r}) a^3$, where $n(\mathbf{r})$ is the local density +of the system. For low values of the average gas parameter $x_{av}\le 10^{-3}$, the mean field Gross-Pitaevskii equation does an excellent +job. However, +in recent experiments, the local gas parameter may well exceed this +value due to the possibility of tuning the scattering length in the +presence of a so-called Feshbach resonance. + +Thus, improved many-body methods like Monte Carlo calculations may be +needed. + +The aim of this project is to use the Variational Monte Carlo +(VMC) method and evaluate the ground state energy of a trapped, hard +sphere Bose gas for different numbers of particles with a specific +trial wave function. + +This trial wave function is used to study the sensitivity of + condensate and non-condensate properties to the hard sphere radius + and the number of particles. The trap we will use is a spherical (S) + or an elliptical (E) harmonic trap in one, two and finally three + dimensions, with the latter given by + +\begin{equation} + V_{ext}(\mathbf{r}) = + \Bigg\{ + \begin{array}{ll} + \frac{1}{2}m\omega_{ho}^2r^2 & (S)\\ + \strut + \frac{1}{2}m[\omega_{ho}^2(x^2+y^2) + \omega_z^2z^2] & (E) + \label{trap_eqn} + \end{array} + \end{equation} + where (S) stands for spherical and + +\begin{equation} + H = \sum_i^N \left(\frac{-\hbar^2}{2m}{\bigtriangledown }_{i}^2 +V_{ext}({\mathbf{r}}_i)\right) + + \sum_{i {a} + \end{array} + \end{equation} + where $a$ is the so-called hard-core diameter of the bosons. + Clearly, $V_{int}(|\mathbf{r}_i-\mathbf{r}_j|)$ is zero if the bosons are + separated by a distance $|\mathbf{r}_i-\mathbf{r}_j|$ greater than $a$ but + infinite if they attempt to come within a distance $|\mathbf{r}_i-\mathbf{r}_j| \leq a$. + + Our trial wave function for the ground state with $N$ atoms is given by + +\begin{equation} + \Psi_T(\mathbf{r})=\Psi_T(\mathbf{r}_1, \mathbf{r}_2, \dots \mathbf{r}_N,\alpha,\beta) + =\left[ + \prod_i g(\alpha,\beta,\mathbf{r}_i) + \right] + \left[ + \prod_{j {a}. + \end{array} + \end{equation} + + +\paragraph{Project 1 a): Local energy.} +Find the analytic expressions for the local energy +\begin{equation} + E_L(\mathbf{r})=\frac{1}{\Psi_T(\mathbf{r})}H\Psi_T(\mathbf{r}), + \label{eq:locale} + \end{equation} + for the above + trial wave function of Eq. (5) and defined by the terms in Eqs. (6) and (7). + +Find first the local energy the case with only the harmonic oscillator potential, that is we set $a=0$ and discard totally the two-body potential. + +Use first that $\beta =1$ and find the relevant local energies in one, two and three dimensions for one and +$N$ particles with the same mass. + + Compute also the analytic expression for the drift force to be used in importance sampling + +\begin{equation} + F = \frac{2\nabla \Psi_T}{\Psi_T}. + \end{equation} + +Find first the equivalent expressions for the just the harmonic oscillator part in one, two and three dimensions +with $\beta=1$. + +Our next step involves the calculation of local energy for the full problem in three dimensions. +The tricky part is to find an analytic expressions for the derivative of the trial wave function + +\begin{equation*} + \frac{1}{\Psi_T(\mathbf{r})}\sum_i^{N}\nabla_i^2\Psi_T(\mathbf{r}), +\end{equation*} +with the above +trial wave function of Eq. (5). +We rewrite + +\begin{equation*} +\Psi_T(\mathbf{r})=\Psi_T(\mathbf{r}_1, \mathbf{r}_2, \dots \mathbf{r}_N,\alpha,\beta) +=\left[ + \prod_i g(\alpha,\beta,\mathbf{r}_i) +\right] +\left[ + \prod_{j {a} + \end{array} + \end{equation} + where $a$ is the so-called hard-core diameter of the bosons. + Clearly, $V_{int}(|\mathbf{r}_i-\mathbf{r}_j|)$ is zero if the bosons are + separated by a distance $|\mathbf{r}_i-\mathbf{r}_j|$ greater than $a$ but + infinite if they attempt to come within a distance $|\mathbf{r}_i-\mathbf{r}_j| \leq a$. + + Our trial wave function for the ground state with $N$ atoms is given by + +\begin{equation} + \Psi_T(\mathbf{r})=\Psi_T(\mathbf{r}_1, \mathbf{r}_2, \dots \mathbf{r}_N,\alpha,\beta) + =\left[ + \prod_i g(\alpha,\beta,\mathbf{r}_i) + \right] + \left[ + \prod_{j {a}. + \end{array} + \end{equation} + + +\paragraph{Project 1 a): Local energy.} +Find the analytic expressions for the local energy +\begin{equation} + E_L(\mathbf{r})=\frac{1}{\Psi_T(\mathbf{r})}H\Psi_T(\mathbf{r}), + \label{eq:locale} + \end{equation} + for the above + trial wave function of Eq. (5) and defined by the terms in Eqs. (6) and (7). + +Find first the local energy the case with only the harmonic oscillator potential, that is we set $a=0$ and discard totally the two-body potential. + +Use first that $\beta =1$ and find the relevant local energies in one, two and three dimensions for one and +$N$ particles with the same mass. + + Compute also the analytic expression for the drift force to be used in importance sampling + +\begin{equation} + F = \frac{2\nabla \Psi_T}{\Psi_T}. + \end{equation} + +Find first the equivalent expressions for the just the harmonic oscillator part in one, two and three dimensions +with $\beta=1$. + +Our next step involves the calculation of local energy for the full problem in three dimensions. +The tricky part is to find an analytic expressions for the derivative of the trial wave function + +\begin{equation*} + \frac{1}{\Psi_T(\mathbf{r})}\sum_i^{N}\nabla_i^2\Psi_T(\mathbf{r}), +\end{equation*} +with the above +trial wave function of Eq. (5). +We rewrite + +\begin{equation*} +\Psi_T(\mathbf{r})=\Psi_T(\mathbf{r}_1, \mathbf{r}_2, \dots \mathbf{r}_N,\alpha,\beta) +=\left[ + \prod_i g(\alpha,\beta,\mathbf{r}_i) +\right] +\left[ + \prod_{j {a} + \end{array} + \end{equation} +!et + where $a$ is the so-called hard-core diameter of the bosons. + Clearly, $V_{int}(|\mathbf{r}_i-\mathbf{r}_j|)$ is zero if the bosons are + separated by a distance $|\mathbf{r}_i-\mathbf{r}_j|$ greater than $a$ but + infinite if they attempt to come within a distance $|\mathbf{r}_i-\mathbf{r}_j| \leq a$. + + Our trial wave function for the ground state with $N$ atoms is given by + +!bt +\begin{equation} + \Psi_T(\mathbf{r})=\Psi_T(\mathbf{r}_1, \mathbf{r}_2, \dots \mathbf{r}_N,\alpha,\beta) + =\left[ + \prod_i g(\alpha,\beta,\mathbf{r}_i) + \right] + \left[ + \prod_{j {a}. + \end{array} + \end{equation} +!et + + +=== Project 1 a): Local energy === + +Find the analytic expressions for the local energy +!bt +\begin{equation} + E_L(\mathbf{r})=\frac{1}{\Psi_T(\mathbf{r})}H\Psi_T(\mathbf{r}), + label{eq:locale} + \end{equation} +!et + for the above + trial wave function of Eq. (5) and defined by the terms in Eqs. (6) and (7). + +Find first the local energy the case with only the harmonic oscillator potential, that is we set $a=0$ and discard totally the two-body potential. + +Use first that $\beta =1$ and find the relevant local energies in one, two and three dimensions for one and +$N$ particles with the same mass. + + Compute also the analytic expression for the drift force to be used in importance sampling + +!bt +\begin{equation} + F = \frac{2\nabla \Psi_T}{\Psi_T}. + \end{equation} +!et + + +Find first the equivalent expressions for the just the harmonic oscillator part in one, two and three dimensions +with $\beta=1$. + +Our next step involves the calculation of local energy for the full problem in three dimensions. +The tricky part is to find an analytic expressions for the derivative of the trial wave function + +!bt +\begin{equation*} + \frac{1}{\Psi_T(\mathbf{r})}\sum_i^{N}\nabla_i^2\Psi_T(\mathbf{r}), +\end{equation*} +!et +with the above +trial wave function of Eq. (5). +We rewrite + +!bt +\begin{equation*} +\Psi_T(\mathbf{r})=\Psi_T(\mathbf{r}_1, \mathbf{r}_2, \dots \mathbf{r}_N,\alpha,\beta) +=\left[ + \prod_i g(\alpha,\beta,\mathbf{r}_i) +\right] +\left[ + \prod_{j\n\\usepackage{simplewick}" $name.tex +doconce replace 'section{' 'section*{' $name.tex +pdflatex -shell-escape $name +pdflatex -shell-escape $name +mv -f $name.pdf ${name}.pdf +cp $name.tex ${name}.tex + +# Publish +dest=../../../../Projects/2024 +if [ ! -d $dest/$name ]; then +mkdir $dest/$name +mkdir $dest/$name/pdf +mkdir $dest/$name/html +mkdir $dest/$name/ipynb +fi +cp ${name}*.tex $dest/$name/pdf +cp ${name}*.pdf $dest/$name/pdf +cp -r ${name}*.html ._${name}*.html $dest/$name/html + +# Figures: cannot just copy link, need to physically copy the files +if [ -d fig-${name} ]; then +if [ ! -d $dest/$name/html/fig-$name ]; then +mkdir $dest/$name/html/fig-$name +fi +cp -r fig-${name}/* $dest/$name/html/fig-$name +fi + +cp ${name}.ipynb $dest/$name/ipynb +ipynb_tarfile=ipynb-${name}-src.tar.gz +if [ ! -f ${ipynb_tarfile} ]; then +cat > README.txt < j$ and all $a > b$, +!bt + \begin{align} + 0 = \langle ab \vert \hat{v} \vert ij \rangle + + \left(\epsilon_a+\epsilon_b-\epsilon_i-\epsilon_j\right)t_{ij}^{ab}+\frac{1}{2}\sum_{cd} \langle ab \vert \hat{v} \vert + cd \rangle t_{ij}^{cd}+\frac{1}{2}\sum_{kl} \langle kl \vert \hat{v} + \vert ij \rangle t_{kl}^{ab}+\hat{P}(ij\vert ab)\sum_{kc} \langle kb + \vert \hat{v} \vert cj \rangle t_{ik}^{ac} & \nonumber + \\ +\frac{1}{4}\sum_{klcd} \langle kl \vert \hat{v} \vert cd \rangle + t_{ij}^{cd}t_{kl}^{ab}+\hat{P}(ij)\sum_{klcd} \langle kl \vert + \hat{v} \vert cd \rangle t_{ik}^{ac}t_{jl}^{bd}-\frac{1}{2}\hat{P}(ij)\sum_{klcd} \langle kl \vert \hat{v} \vert + cd \rangle t_{ik}^{dc}t_{lj}^{ab}-\frac{1}{2}\hat{P}(ab)\sum_{klcd} + \langle kl \vert \hat{v} \vert cd \rangle t_{lk}^{ac}t_{ij}^{db},& + \label{eq:ccd} + \end{align} +!et + where we have defined +!bt + \[ + \hat{P}\left(ab\right)= 1-\hat{P}_{ab}, + \] +!et + where $\hat{P}_{ab}$ interchanges two particles occupying the + quantum numbers $a$ and $b$. The operator $\hat{P}(ij\vert ab)$ is + defined as +!bt + \[ + \hat{P}(ij\vert ab) = (1-\hat{P}_{ij})(1-\hat{P}_{ab}). + \] +!et + The single-particle energies $\epsilon_p$ are normally taken to be either plain harmonic oscillator ones or Hartree-Fock single-particle energies. + Recall also that the unknown amplitudes $t_{ij}^{ab}$ represent + anti-symmetrized matrix elements, meaning that they obey the same + symmetry relations as the two-body interaction, that is +!bt + \[ + t_{ij}^{ab}=-t_{ji}^{ab}=-t_{ij}^{ba}=t_{ji}^{ba}. + \] +!et + The two-body matrix elements are also anti-symmetrized, meaning that +!bt + \[ + \langle ab \vert \hat{v} \vert ij \rangle = -\langle ab \vert + \hat{v} \vert ji \rangle= -\langle ba \vert \hat{v} \vert ij + \rangle=\langle ba \vert \hat{v} \vert ji \rangle. + \] +!et + The non-linear equations for the unknown amplitudes $t_{ij}^{ab}$ + are solved iteratively. + +In order to develop a program, chapter 8 of the recent "Lecture Notes in Physics (volume 936)":"http://www.springer.com/us/book/9783319533353" is highly recommended as literature. +All material is available from the "source site":"https://github.com/ManyBodyPhysics/LectureNotesPhysics/blob/master/doc/src/lnp.pdf". Example of CCD codes are available from the "program site":"https://github.com/ManyBodyPhysics/LectureNotesPhysics/tree/master/Programs/Chapter8-programs/cpp/CCD". These can be used to benchmark your own program. + +=== Project 2 a): === + +Here you should feel free to use either a plain harmonic oscillator basis or Hartree-Fock basis. +If you have performed Hartree-Fock calculations and are familiar with these, the Hartree-Fock basis defines the so-called reference energy +!bt +\begin{equation} + E_{\mathrm{ref}} = \sum_{i\le F} \sum_{\alpha\beta} + C^*_{i\alpha}C_{i\beta}\langle \alpha | h | \beta \rangle + + \frac{1}{2}\sum_{ij\le F}\sum_{{\alpha\beta\gamma\delta}} + C^*_{i\alpha}C^*_{j\beta}C_{i\gamma}C_{j\delta}\langle + \alpha\beta|\hat{v}|\gamma\delta\rangle. +\end{equation} +!et +If you plan to use Hartree-Fock based matrix elements, +you will need to transform the matrix elements from the harmonic oscillator basis to the Hartree-Fock basis. +The first step is to program +!bt +\begin{equation} + \langle pq \vert \hat{v} \vert rs\rangle_{AS}= + \sum_{{\alpha\beta\gamma\delta}} + C^*_{p\alpha}C^*_{q\beta}C_{r\gamma}C_{s\delta}\langle + \alpha\beta|\hat{v}|\gamma\delta\rangle_{AS}, +\end{equation} +!et +where the coefficients are those from the last Hartree-Fock iteration and the matrix elements are all anti-symmetrized. +You can extend your Hartree-Fock program to write out these matrix elements after the last Hartree-Fock iteration. +Make sure that your matrix elements are structured according to conserved quantum numbers, avoiding thereby the write out of many zeros. + +To test that your matrix elements are set up correctly, when you read in these matrix elements in the CCD code, make sure that the reference energy from your Hartree-Fock calculations are reproduced. Alternatively, you can just use the standard harmonic oscillator one-body and two-body matrix elements. + + +=== Project 2 b): === + +Set up a code which solves the CCD equation by encoding the equations as they stand, that is follow the mathematical expressions and perform the sums over all single-particle states. Compute the energy of the two-electron systems using +all single-particle states. Compare these with Taut's results for $\omega=1$ a.u. Since you do not include singles you will not get the exact result. If you wish to include singles, you will able to obtain the exact results in a basis with at least ten major oscillator shells. +Perform also calculations with $N=6$, $N=12$ and $N=20$ electrons and compare with reference [2] of Pedersen et al below. + +=== Project 2 c): === + +The next step consists in rewriting the equations in terms of matrix-matrix multiplications and subdividing +the matrix elements and operations in terms of two-particle configuration that conserve total spin projection and projection of the orbital momentum. Rewrite also the equations in terms of so-called intermediates, as detailed +in section 8.7 of "Lietz et al":"https://github.com/ManyBodyPhysics/LectureNotesPhysics/blob/master/doc/src/lnp.pdf". +This section gives a detailed description on how to build a coupled cluster code and is highly recommended. + +Rerun your calculations for $=2$, $N=6$, $N=12$ and $N=20$ electrons using your optimal Hartree-Fock basis. Make sure your results from 2b) stay the same. + +Calculate as well ground state energies for $\omega=0.5$ and $\omega=0.1$. Try to compare with eventual variational +Monte Carlo results from other students, if possible. + +=== Project 2 d): === +The final step is to parallelize your CCD code using either OpenMP or MPI and do a performance analysis. Use the $N=6$ case. Make a performance analysis by timing your serial code +with and without vectorization. Perform several runs and compute an average timing analysis +with and without vectorization. Comment your results. + +Compare thereafter your serial code(s) with the speedup you get by parallelizing your code, running either OpenMP or MPI or both. +Do you get a near $100\%$ speedup with the parallel version? Comment again your results and perform timing benchmarks several times in order +to extract an average performance time. + + +======= Additional material on Hermite polynomials ======= + +The Hermite polynomials are the solutions of the following differential +equation +!bt +\begin{equation} + \frac{d^2H(x)}{dx^2}-2x\frac{dH(x)}{dx}+ + (\lambda-1)H(x)=0. + label{eq:hermite} +\end{equation} +!et +The first few polynomials are + +!bt +\begin{equation*} + H_0(x)=1, +\end{equation*} +!et + +!bt +\begin{equation*} + H_1(x)=2x, +\end{equation*} +!et + +!bt +\begin{equation*} + H_2(x)=4x^2-2, +\end{equation*} +!et + +!bt +\begin{equation*} + H_3(x)=8x^3-12x, +\end{equation*} +!et +and + +!bt +\begin{equation*} + H_4(x)=16x^4-48x^2+12. +\end{equation*} +!et +They fulfil the orthogonality relation + +!bt +\begin{equation*} + \int_{-\infty}^{\infty}e^{-x^2}H_n(x)^2dx=2^nn!\sqrt{\pi}, +\end{equation*} +!et +and the recursion relation + +!bt +\begin{equation*} + H_{n+1}(x)=2xH_{n}(x)-2nH_{n-1}(x). +\end{equation*} +!et + + + + + + +=== Literature === + + o M. Taut, Phys. Rev. A _48_, 3561 - 3566 (1993). + + o M. L. Pedersen, G. Hagen, M. Hjorth-Jensen, S. Kvaal, and F. Pederiva, Phys. Rev. B _84_, 115302 (2011) + + o S. Riemann and M. Manninen, Reviews of Modern Physics _74_, 1283 (2002). + + + + + + +===== Introduction to numerical projects ===== + +Here follows a brief recipe and recommendation on how to write a report for each +project. + + * Give a short description of the nature of the problem and the eventual numerical methods you have used. + + * Describe the algorithm you have used and/or developed. Here you may find it convenient to use pseudocoding. In many cases you can describe the algorithm in the program itself. + + * Include the source code of your program. Comment your program properly. + + * If possible, try to find analytic solutions, or known limits in order to test your program when developing the code. + + * Include your results either in figure form or in a table. Remember to label your results. All tables and figures should have relevant captions and labels on the axes. + + * Try to evaluate the reliabilty and numerical stability/precision of your results. If possible, include a qualitative and/or quantitative discussion of the numerical stability, eventual loss of precision etc. + + * Try to give an interpretation of you results in your answers to the problems. + + * Critique: if possible include your comments and reflections about the exercise, whether you felt you learnt something, ideas for improvements and other thoughts you've made when solving the exercise. We wish to keep this course at the interactive level and your comments can help us improve it. + + * Try to establish a practice where you log your work at the computerlab. You may find such a logbook very handy at later stages in your work, especially when you don't properly remember what a previous test version of your program did. Here you could also record the time spent on solving the exercise, various algorithms you may have tested or other topics which you feel worthy of mentioning. + + + + + +===== Format for electronic delivery of report and programs ===== + +The preferred format for the report is a PDF file. You can also use DOC or postscript formats or as an ipython notebook file. As programming language we prefer that you choose between C/C++, Fortran2008 or Python. The following prescription should be followed when preparing the report: + + * Use Devilry to hand in your projects, log in at URL:"http://devilry.ifi.uio.no" with your normal UiO username and password. + + * Upload _only_ the report file! For the source code file(s) you have developed please provide us with your link to your github domain. The report file should include all of your discussions and a list of the codes you have developed. The full version of the codes should be in your github repository. + + * In your github repository, please include a folder which contains selected results. These can be in the form of output from your code for a selected set of runs and input parameters. + + * Still in your github make a folder where you place your codes. + + * In this and all later projects, you should include tests (for example unit tests) of your code(s). + + * Comments from us on your projects, approval or not, corrections to be made etc can be found under your Devilry domain and are only visible to you and the teachers of the course. + + + +Finally, +we encourage you to work two and two together. Optimal working groups consist of +2-3 students. You can then hand in a common report. + + + + + + + + + diff --git a/doc/src/Projects/2024/Project2/Project2ML.do.txt b/doc/src/Projects/2024/Project2/Project2ML.do.txt new file mode 100644 index 00000000..82c87c8b --- /dev/null +++ b/doc/src/Projects/2024/Project2/Project2ML.do.txt @@ -0,0 +1,331 @@ +TITLE: FYS4411/9411 Project 2, Machine learning for quantum many-body problems. Deadline May 31 +AUTHOR: "Computational Physics II FYS4411/FYS9411":"http://www.uio.no/studier/emner/matnat/fys/FYS4411/index-eng.html" {copyright, 1999-present|CC BY-NC} at Department of Physics, University of Oslo, Norway +DATE: Spring semester 2023 + +===== Introduction ===== + +The idea of representing the wave function with +a restricted Boltzmann machine (RBM) was presented recently by "G. Carleo and M. Troyer, Science _355_, Issue 6325, pp. 602-606 (2017)":"http://science.sciencemag.org/content/355/6325/602". They +named such a wave function/network a \textit{neural network quantum +state} (NQS). In their article they apply it to the quantum mechanical +spin lattice systems of the Ising model and Heisenberg model, with +encouraging results. To further test the applicability of RBM's to +quantum mechanics we will in this project apply it to a system of +two interacting electrons (or bosons) confined to move in a harmonic oscillator trap. +It is possible to extend this system to more bosons or fermions, but we will limit ourselves to two particles only. + +We will study this system with so-called Boltzmann machine first as deep learning method. If time allows, we can replace the Bolztmann machines with neural networks. + + + +===== Theoretical background and description of the physical system ===== + +We consider a system of two electrons (or bosons) confined in a pure two-dimensional +isotropic harmonic oscillator potential, with an idealized total Hamiltonian given by +!bt +\begin{equation} +\label{eq:finalH} +\hat{H}=\sum_{i=1}^{N} \left( -\frac{1}{2} \nabla_i^2 + \frac{1}{2} \omega^2r_i^2 \right)+\sum_{i