Study Notes in Physics & Chemistry

Electromagnetism

FDTD

Configuring meep on a supercomputer

Equipment: JAIST supercomputer

Since I have to do some FDTD/EM simulations, but it's a pain to use a personal PC, I chose to build a MEEP simulation environment on the supercomputer, which will be very time saving. My reference is the official MEEP documentation https://meep.readthedocs.io/en/latest/Installation/

Installation of miniconda

Create a python folder in your own directory, the school supercomputers already have the python3 environment pre-installed, so just follow the official documentation to install it.

wget https://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh -O miniconda.sh
Download the miniconda package, which is python 3 version. Then
bash miniconda.sh -b -p <desired_prefix>
Note that the here is the directory to unpack, you have to set it yourself!, here I put it under python meep. After that
export PATH=<desired_prefix>/bin:$PATH
It'll report an error

export: command not found
Is there something wrong with my SHELL? So check the SHELL info first.
echo $SHELL
return to
/bin/tcsh
So it's tcsh not bash! No wonder the error is reported. In this case, just go back to my account directory and manually add the path information to the .cshrc file.
vim ~/.cshrc
But after many tests, I still can't execute it, probably due to account permissions restrictions (and why is the SHELL in the school's supercomputing tcsh instead of bash, orz), so I have to use the setenv command to execute it manually.
setenv PATH "<desired_prefix>/bin"
setenv PATH <desired_prefix>/bin:$PATH
After that it worked, the downside is that you'll probably have to manually execute the command again the next time you use the conda command. Then create an environment named mp and install meep in it.
conda create -n mp -c chogan -c conda-forge pymeep
Then there was the long installation process. After installing it, this error popped up.
Exception('No compatible shell found!')
It doesn't matter. Go on.
conda activate mp
It was reported wrong! Prompting to use conda init to specify the shell. It seems to be a SHELL selection problem, so I'll have to do it manually, but to make it easier, I'll select tcsh, so I'll type in
conda init tcsh
exec /bin/tcsh -l
Then activate the mp environment.
conda activate mp
No errors were reported and the directory front shows (mp), indicating successful activation! You should be able to use it after that, but for ease of use, it's better to just install a Jupyter, and here I'm also referring to the official documentation at https://jupyter.org/install

Execute in this miniconda's directory.

conda install -c conda-forge jupyterlab
After that it's a long install and wait, sometimes it prompts to upgrade the conda version, which can be ignored. jupyterlab is the next generation of jupyter notebook (replacement), so I don't install jupyter notebook anymore. It's possible to use the pip command to install it, but it's too complicated to configure the PATH, so I'll use the conda command. After the installation, execute.
jupyter lab
It brings up a browser window where you can use jupyter lab.

However, when using it, I can't find the package! But the conda list is packaged! thus

conda search pymeep
return to
Loading channels: done
No match found for: pymeep. search: *pymeep*

PackagesNotFoundError: The following packages are not available from current cha nnels:

  - pymeep

Current channels:

  - https://repo.anaconda.com/pkgs/main/linux-64
  - https://repo.anaconda.com/pkgs/main/noarch
  - https://repo.anaconda.com/pkgs/r/linux-64
  - https://repo.anaconda.com/pkgs/r/noarch

To search for alternate channels that may provide the conda package you're
Looking for, navigate to

    https://anaconda.org

and use the search bar at the top of the page.
The solution is to configure conda and enter
conda config --append channels conda-forge
At this time.
python -c 'import meep'
It will not report an error, indicating that the installation is generally successful and working. However, there may be other problems, such as
AttributeError: module 'meep' has no attribute 'Vector3'
But I installed it on a virtual machine in the same way, and running the same code didn't cause this problem. It's most likely a problem with the supercomputing on the python version. But overall the installation method is correct, and it is possible to run some simple code. As for some bug fixes, I'll update them later.

I'll try to install Linux for Windows on my workstation (DELL PowerEdge T620) by installing Linux for Windows and then use the above method to install, after all, the configuration of this workstation is not low, barely work. After all, the configuration of this workstation is not low, it barely works. Although the problem of IEER1 has not been solved (even if it is not serious) because of unknown reasons.

About the installation and setting method of WSL, I refer to the following: https://zhuanlan.zhihu.com/p/61542198

After starting Ubuntu, first beautify the vim, after all, it is to show the boss to pretend to use .... I'm not going to say anything specific, but the code is as follows.

mkdir .vim
cd .vim
git clone https://github.com/tomasr/molokai.git
cp -rf molokai/colors/ . /colors/ .
vim vimrc
After opening vim, add the following code, then:wq to exit
colorscheme molokai
After that create a meep folder and install miniconda, since the shell here is bash by default, it's sour to just copy it. The commands in order are as follows.
mkdir meep
wget https://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh -O miniconda.sh
bash miniconda.sh -b -p miniconda // Here I extracted it to miniconda folder
export PATH=/root/meep/miniconda/bin:$PATH //set PATH variable
This is followed by the steps to install meep, in exactly the same way as above. The commands in order are as follows.
conda create -n mp -c chogan -c conda-forge pymeep //create a virtual environment named mp to install the pymeep package
conda init bash //configure the shell
exec /bin/bash //configure the shell
conda activate mp // activate environment
Then I installed jupyterlab in that environment.
conda install -c conda-forge jupyterlab
But when opening jupyterlab, you get an error.
 Running as root is not recommended. Use --allow-root to bypass.
Use --allow-root to bypass. ``
The solution.
```java
jupyter notebook --generate-config --allow-root
Then vim generates the configuration file, after which
#c.NotebookApp.allow_root = False // Remove the # and change it to True to fix the root running issue.
In order to use wsl properly without errors, it's best to use this command and copy the address to the browser manually!
jupyter-notebook --no-browser
But after configuration, meep still doesn't work with orz.... Here's a statistic: On Supercomputers, PC's, and VM's, the above method is successful and can run simple code. On a workstation wsl, it doesn't work... I give up... But !!!! After I recreated a virtual environment, all the commands worked again!!!! Everything is normal again !!!! It's so confusing!!! But at least it worked!!!

Quantum Chemistry

DFT