多体問題の計算科学
講義スライドなど:https://github.com/compsci-alliance/many-body-problems
FAQ
Q. How can I run sample python codes?
Q. How can I install python package.
Q. How can I use filename.ipynb?
Q. I fail to import matplotlib at ECCS.
Q. I need more instructions to use ALPS.
Q. How can I run sample python codes?
A.
The sample codes are written in python2.7, but I think it can run in python3. At least, you can run them on ECCS terminals with Mac environment. If you want to prepare python environment on your computer. It might be useful to use anaconda. In the case of Mac, you can use package managers such as Homebrew and MacPorts. In addition, you may need to install a few python packages to run the sample codes.
The default python environment in ECCS terminal is python3. In order to use python2.7 for the sample codes, first move to the directory where the codes exist and type
pyenv local anaconda-4.0.0
This means, you change python environment for the current directory to "anaconda-4.0.0", which is python2.7. Note that this change remains after you close the terminal. If you want to back to python3 in the directory, type
pyenv local anaconda3-4.4.0
You can check your current (local) python environment by
pyenv local
If the message
pyenv: no local version configured for this directory
appears, it means your environment may be same with the global python environment which can be checked by typing
pyenv global
Note that, on ECCS terminal, you can not change the global python environment.
Instead to use "pyenv local", you may use
pyenv shell anaconda-4.0.0
which sets python2.7 environment only for the present terminal (shell). In this case, your python setting disappears after logout. Note that this setting is for the shell (terminal) . Thus, this setting affects other directories beyond the current directory where the command was performed. If you use several settings simultaneously, "pyenv shell" has a priority to "pyenv local" and "pyenv global". You can check current python environment by
pyenv version
Available versions are shown by typing
pyenv versions
Q. How can I install python packages.
Usually, pip is the easiest way to install python packages. For example, if you want to install numpy, type
pip install numpy
on the command line .
Q. How can I use filename.ipynb?
A.
".ipynb" is a file extension for jupyter notebook. You can use it, at least on ECCS terminals with Mac environment. Basically, after installing jupyter notebook, please type
jupyter notebook
in the directory where the sample codes exist. Then, select filename.ipynb on the list. Note that before you run jupyter notebook, change your python environment to python2.7.
In order to use it on your computer, you need to install jupyter package. (It is automatically installed if you use anaconda.) For the installation and using it, please visit the web site. http://jupyter.org
Q. I fail to import matplotlib at ECCS.
A.
Depending on your environment, sample code for ALPS may fail to import matplotlib. This is because the "Japanese character code" is not set correctly. One easy way to escape the import error is to type
epxport LC_ALL=ja_JP.UTF-8
This command simply set Japanese character code to UTF-8. Note that you may need to type the command every time you open new terminals.
Q. I need more instructions to use ALPS.
A.
It is useful to visit ALPS web page (http://alps.comp-phys.org) and to look at tutorials.
In addition the slide, which is for exercise in another lecture "計算科学概論", might help you (I'm sorry. It is written in Japanese).