AI_ML_DL’s diary

人工知能、機械学習、ディープラーニングの日記

DNNで量子化学計算(November 2020)

DNNで量子化学計算(November 2020)

最近の進展についてまとめる機会があったので、より深く理解することと、実際の解析コードを使えるようになることを目標に、その経過をブログに記す。

 

11月10日(火)

FermiNet:

FermiNet is a neural network for learning the ground state wavefunctions of atoms and molecules using a variational Monte Carlo approach.

基底状態波動関数を学習するためのNNであるという記述が気になる。

troyerらの成果

Despite the simplicity of the restricted Boltzman machines, very accurate results for both ground-state and dynamical properties of prototypical spin models can be readily obtained.

図のタイトルを並べてみると、

Figure 1.  Artificial Neural Network encoding a many-body quantum state of N spins.

Figure 2.  Neural Network representation of the many-body ground states of prototypical spin models in one and two dimensions.

Figure 3.  Finding the many-body ground-state energy with neural-network quantum states.

Figure 4.  Describing the many-body unitary time evolution with neural-network quantum states.  Shown are results for the time evolution induced by a quantum quench in the microscopical parameters of the models we study (the transverse field h, for the TFI model and the coupling constant Jz in the AFH model). 

TFI : transverse-field Ising (model)

AFH : anti-ferromagnetic Heisenberg (model)

 

11月11日(水)

HermannらのPauliNetの成果

PauliNet outperforms comparable state-of-the-art VMC anzats for atoms, diatomic molecules and a strong-correlated hydrogen chain by a margin and is yet computational efficient.

成果は、正確さと効率化(行列の数)だけなのか。効率化によって、より大きな原子、分子について正確な計算結果を得ることができたということなのか。

Figure 1に、PauliNetによる効率化の程度がわかりやすく図示されている。

PfauらのFermiNetの成果

Using no data other than atomic positions and charges, we predict the dissociation curves of the nitrogen molecule and hydrogen chain, two challenging strongly correlated systems, to significantly higher accuracy than the coupled cluster method, widely considered the most accurate scalable method for quantum chemistry at equilibrium geometry.

coupled cluster method:結合クラスター法

 結合クラスター法(けつごうクラスターほう、クラスター展開法CC法:Coupled Cluster)は多体系を記述するために使われる数値手法である。最もよく使われるのは、量子化学計算化学)におけるポスト-ハートリー-フォック第一原理計算がある。CC法は、ハートリーフォック分子軌道法を基本にして、電子相関を考慮する指数関数クラスタ演算子を使って多電子波動関数を構成する。CC法を用いて、小さい分子や中程度の大きさの分子について最も正確な計算を行うことができる[1][2][3]。from ウイキペディア

Table 1.  Ground state energy, ionization potential, and electron affinity for first-row atoms.

Table 2.  Ground-state energy at equilibrium geometry for diatomic and small molecules.

いずれの表も、FermiNetがCCSD(T)に優っていることを示している。イオン化ポテンシャルと電子親和力は、FermiNetの結果しかないのは、CCSD(T)では基底状態のエネルギーしか計算できないということだろうか。

C.  The H4 rectangleの最初に次のように記述されている。

While CCSD(T) is exceptionally accurate for equilibrium geometries, it often fails for molecules with low-lying exited states or stretched, twisted or otherwise out-of-equiliblrium geometries.

昨日学会に送ったA4半ページの紹介記事で、FermiNetやPauliNetは励起状態のエネルギーも正確に計算できると書いたのだが、励起状態あるいは非平衡状態のエネルギーの計算に関しては、論文の斜め読みでそう書いただけだったので、気になっていたのだが、少なくとも、FermiNetに関しては問題ないようだ。図4から図6には、非平衡状態の計算においてもFermiNetはFCIなどの厳密な計算手法や正確な実験データに匹敵する正確さをもつことが示されている。

PauliNetについても、原子間距離に対するエネルギーの変化をHaetree-Fockなどの量子化学計算結果と比較していて、PauliNetのほうが、exactなデータに近いことが示されているので問題なさそうである。

 

11月12日(木)

PauliNetのGitHubを見てみよう。

deepqmc:Deep learning quantum Monte Carlo for electrons in real space

deepqmc.github.io:DeepQMC documentation

プログラムコードとは別にドキュメンテーション(ユーザーガイドを含む)も用意されていて、勉強しやすそうだ。

 

11月14日(土)

FermiNetのGitHubを見てみよう。

REDME.mdの最後に、This is not an official Google product.と書かれていて不安になるが、アルファ碁を開発し、その後はバイオやフィジックスなどの自然科学の領域でも影響力を増しているDeepMindが運営している89のrepositoriesのうちの1つである。

 

PauliNetの開発者Jan Hermann氏は、量子物理の専門家であり、計算物理の専門家でもある。Hermann氏のGitHubには45のrepositoriesがあり、量子物理計算関連の内容がメインで、pySCFSchNet(K.T. Schütt. P.-J. Kindermans, H. E. Sauceda, S. Chmiela, A. Tkatchenko, K.-R. Müller. SchNet: A continuous-filter convolutional neural network for modeling quantum interactions. Advances in Neural Information Processing Systems 30, pp. 992-1002 (2017))なども含まれている。

 

FermiNetとPauliNetのどちらから始めようか考えているのだが、Hermann氏のサイトは、SCF計算やSchuNetなど量子物理の匂いが強く、DeepMind社のサイトはディープラーニングの匂いが強い。個人と団体の違いもある。入り口で立ち往生しても始まらないし、チェックしたいGitHubサイトは無限にあるので、GitHub散歩、みたいな感じで進めていこうと思う。

 

11月15日(日)

Hermann氏のサイトをながめてみよう。

Software projects

Most of my programming is related to my research in computational materials science. I believe that strong computational science benefits from strong software engineering, and that all scientific academic software should be open source.

I am involved in the following software projects.

Creator

Beta projects

These are experimental packages that, although fully functional, I don’t yet consider finished.

  • KnitJalternative front-end to Jupyter kernels aiming at editor freedom and easy versioning
  • Mona—framework for reproducible and distributed, potentially long-running calculations

Contributor

  • FHI-aims—massively parallel electronic structure code package with DFT at its core

 

<雑談>

ずっと会社に勤めていて、結局、独立することなく終わったのだが、50歳くらいで研究に没頭できる環境が欲しいと思って、理論計算の受託で稼ぎながら、研究できないかと検討したことがある。 理論屋でも物理屋でもないのだが、量子化学化学結合論などに興味があって、様々な分子軌道計算の論文をながめていたことがあったので、Gaussianのようなソフトを購入して、自分で使いながら、使いたい人に使い方や理論を教えたり、計算代行したりということを考えていた。このとき、ネックになったのが、ソフトの購入代金(使用料)と計算環境であった。会社の中で提案できるヒトではなかったので、夢想に終わった。ネットにアクセスできるパソコンがあれば、幸いにも、無料で、Gaussian(詳細は知らない)のような計算ができるようになっているので、夢の大半は実現することができる。ということを、pySCFについて調べながら、ぼんやり振り返っている。

 

DNN+量子化学計算+紹介記事 ⇒ FermiNet & PauliNet

ということになったのだが、現実問題として、FermiNetやPauliNetにアクセスしてすぐに計算を始められるヒトは理論も計算もすでにプロの領域にいる研究者に限られるだろう。φ、ψ、HF、CBS、FN-DMC、QMC、VMC、Jastrow、FCI、fixed-node correlation energy、・・・、専門用語や略語の意味も分からず、DNNが最先端の量子化学計算の分野に応用されているというだけで食いついても、この技術を適用する課題をもっていないことには始まらない、いや、終わらない。

 

PySCFについて調べてみた。

Recent developments in the PySCF program package
Qiming Sun et al., arXiv:2002.12531v2 [physics.chem-ph] 11 Jul 2020

abstract

PYSCF is a Python-based general-purpose electronic structure platform that both supports first-principles simulations of molecules and solids, as well as accelerates the development of new methodology and complex computational workflows.

The present paper explains the design and philosophy behind PYSCF that enables it to meet these twin objectives.

With several case studies, we show how users can easily implement their own methods using PYSCF as a development environment.

We then summarize the capabilities of PYSCF for molecular and solid-state simulations.

Finally, we describe the growing ecosystem of projects that use PYSCF across the domains of quantum chemistry, materials science, machine learning and quantum information science.

machine learningに関係する記述を次に示す。

A. PySCF in the materials genome initiative and machine learning

As discussed in section I, one of our objectives when developing PYSCF was to create a tool which could be used by non-specialist researchers in other fields.

With the integration of machine learning techniques into molecular and materials
simulations, we find that PYSCF is being used in many applications in conjunction with machine learning.

For example, the flexibility of the PYSCF DFT module has allowed it to be used to test exchange-correlation functionals generated by machine-learning protocols in several projects, and has been integrated into other machine learning workflows.

PYSCF can be used as a large-scale computational engine for quantum chemistry data generation.

Also, in the context of machine learning of wavefunctions, PYSCF has been used as
the starting point to develop neural network based approaches for SCF initial guesses, for the learning of HF orbitals by the DeepMind team, and for Hamiltonian integrals used by fermionic neural nets in NETKET.

最後のNETKETってなんだろう。

著者19名の論文が出ている。

トップオーサーのCarleo氏は最初に多体問題にNNを適用した2017年の論文の著者。

NetKetを共通基盤にして、さらなる発展を目指すということかな。

NetKet: A machine learning toolkit for many-body quantum systems
Giuseppe Carleo, Kenny Choo et al., SoftwareX 10 (2019) 100311

abstract

We introduce NetKet, a comprehensive open source framework for the study of many-body quantum systems using machine learning techniques.

The framework is built around a general and flexible implementation of neural-network quantum states, which are used as a variational ansatz for quantum wavefunctions.

NetKet provides algorithms for several key tasks in quantum many-body physics and
quantum technology, namely quantum state tomography, supervised learning from wavefunction data, and ground state searches for a wide range of customizable lattice models.

Our aim is to provide a common platform for open research and to stimulate the collaborative development of computational methods at the interface of machine learning and many-body physics.

NetKetのホームページがある。

What is NetKet?

NetKet is an open-source project delivering cutting-edge methods for the study of many-body quantum systems with artificial neural networks and machine learning techniques.

GitHubに公開されているが、NetKetで検索しても出てこないので、使いにくそうだ。ElsevierのSoftwareXというシステムの中に埋もれてしまっているようである。

NetKetのホームページはチュートリアルもあって、コードの説明も詳しく、自習に適しているように思う。

Carleo氏オリジナルのNQS(Neural-network Quantum States)がGitHubに掲載されているが、更新している形跡がない理由がこれでわかったような気がする。

 

<雑談>

頭が使える間に、何かできないかなと思うのだが、何もできていない。小柴先生が亡くなられたが、ニュートリノの検出に成功されてノーベル賞を受賞され、お弟子さんの梶田先生もニュートリノに質量があることを明らかにしてノーベル賞を受賞された。こんな実験は誰にでもできるものではないが、湯川先生の中間子理論なら誰にでも発見のチャンスはあった。最先端の分野の論文を読んでディスカッションを重ね仮説を積み上げ理論を組み立て・・・。

 

11月16日(月)

G. Carleo氏らの総説(著者8名)、Machine learning and the physical science、arXiv:1903.10563v2 [physics.comp-ph] 6 Dec 2019を読んでみた。 

機械学習がこれだけ浸透していたのかと驚かされる内容だ。

と、書いてみたが、斜め読み(英文の斜め読みだから内容までは頭に入っていない)しただけで、これからじっくり解読していこうと思う。

著者と所属(専門領域が想像できる機関名)をいくつか示す。

Giuseppe Carleo
Center for Computational Quantum Physics,

Ignacio Cirac
Max-Planck-Institut fur Quantenoptik,

Kyle Cranmer
Center for Cosmology and Particle Physics,
Center of Data Science,

Maria Schuld
National Institute for Theoretical Physics,

Leslie Vogt-Maranto
Department of Chemistry

Lenka Zdeborová
Institut de physique théorique

 

11月17日(火)

FermiNetとPauliNetのどちらに食らいつこうか考えていて、チュートリアルも含め、コードの解説がしっかり書かれているように感じたHermann先生のPauliNetでほぼ決まりのつもりだった。

ところが、Neural-network quantum states (NQS) の創始者のCarleo先生は、FermiNetとPauliNetの論文を引用したうえで、NQSをさらに発展させた論文を書いておられる。

さらに、共著で機械学習の物理学への展開と相互作用に関する総説を書かれている。

加えて、NetKetと称する多体量子系に適用する機械学習toolkitを開発されている。

以上のことを勘案して、NetKetで本格的な学習を始めることにしたいと思う。

 

ということで、早速、NetKetのホームページへ、行く。

まずは、Get Started、をクリック。

下の方に、青地に白抜きで、こんな表示がある。

Remarks

We are not yet supporting Conda installs
Windows Os is not supported

想定されているのは、MacUbuntuである。

Windowsユーザーは、これにて終了!

ということにならないために、

Windowsパソコンで、Ubuntuを使えるようにする、ということになる。

今使っているパソコンに何かあると困るので、他のWindowsパソコンで確認してみようと思う。

昨年、使わなくなったWindows Vistaパソコンに、Ubuntuをインストールしており、すぐにでも使える状態にある。GPUはなく、RAMは4GB、HDは100GBで、とりあえず動くのであるが、勝手がわからないというか、まったく手も足も出ず、放置している。

Windowsの方々は、私のように、ここで止まってしまう可能性が高いので、Ubuntuを使えるようになることを、当面の目標としよう。

 

Ubuntuの立ち上げ:

WindowsUbuntuをパソコンの起動時に切り替えられるようにしている。

Ubuntuを使いたいと思ったのは、Anacondaに後から追加できるpythonパッケージやモジュールに制限があることで、AnacondaはTF2.0に対しても対応が非常に遅かった。無理に入れようとして、Anaconda3を壊してしまったこともある。

Ubuntuのインストールは、簡単なマニュアルを見ればできる。問題は、UbuntuでAnaconda3を使おうとしたときにおきた。WindowsにAnaconda3をインストールするのは容易で、Windows10だと、すぐに使えるようになったので、その感覚でUbuntuにもAnaconda3を簡単にインストールできると思ったのが間違いだった。

Anacondaのドキュメントには、Installing on Linuxという項目があって、インストール手順を説明しているのだが、Ubuntuという単語が見当たらない。

 

ウイキペディアによると、

Ubuntu(ウブントゥ[6][ʊˈbʊnt] ( 音声ファイル); oo-BOON-too[7])はDebian GNU/Linuxを母体としたオペレーティングシステム(OS)である。Linuxディストリビューションの1つであり、フリーソフトウェアとして提供されている。概念はディストリビューションも参照。カノニカルから支援を受けて開発されている。開発目標は「誰にでも使いやすい最新かつ安定したOS」を提供することである。

Linuxリナックス、他の読みは後述)とは、狭義にはUnix系オペレーティングシステムカーネルであるLinuxカーネルを指し、広義にはそれをカーネルとして周辺を整備したシステム全体のことをいう(GNU/Linuxシステムも参照)。

Linuxは、狭義にはLinuxカーネル、広義にはそれをカーネルとして用いたオペレーティングシステムを指す。LinuxUnix系Unix likeUnixライク)オペレーティングシステム (OS) の1つとされる。カタカナでは「リナックス」と表記されることが多い(「Linux」の読み方を参照)。Linuxは、スーパーコンピュータメインフレームサーバパーソナルコンピュータ組み込みシステム(携帯電話やテレビなど)など、幅広い種類のハードウェアで使用されている。

デスクトップやサーバ用のLinuxは、Linuxディストリビューションという形でパッケージ化されて配布されている。有名なLinuxディストリビューションとしては、Debian(とその派生であるUbuntuLinux Mint)、Red Hat Linux(とその派生であるFedoraRed Hat Enterprise LinuxCentOS)、Mandriva Linux/MageiaopenSUSEArch Linuxなどがある。各Linuxディストリビューションは、Linuxカーネルシステムソフトウェアライブラリ等、巨大なコンパイル済のアプリケーション群を含んでいる。

 

<雑談>

Ubuntuはメジャーではなさそうだが、Kerasを開発したF. Cholleさんが、著書Deep Learning with PythonのAppendixAに、Installing Keras and its dependences on Ubuntuという記事を書かれていたことと、12年ほど前にイオン散乱シミュレーションのソフトを使おうとしたときに、教授から渡されたソフトがUbuntu上で動いていて、Ubuntuの入門書を渡されたということがあって、自分の中ではメジャーであった。しかし、今から思えば残念なのだが、ほどなくして、Windows上で動作する高性能のシミュレーションソフトを使うことになって、Ubuntuという奇妙な単語だけが頭に残った。さらに、F. Cholle氏のテキストをバイブルとしてディープラーニングを学ぶときにはAppendixAの記事を読む前にGPUを搭載したWindowsマシンを購入してAnaconda3上でKeras/TensouFlowを使うようになっていたので、後に、Ubuntuを使ってみたいと思ったときには、時すでに遅し、大きな壁が立ちはだかっていたのである。

 

今、そのAppendixAを眺めているのだが、sudo apt-get update, sudo pip3 install tensorflow-gpu, sudo python setup.py installなどの単語が並んでいる。

こういうものだということがわかったのだから、コマンドプロンプトに慣れて、Ubuntuを自分のものにしていこう。ほんとうに必要性を感じた時に使ってみよう。難しいのではなく、不慣れなだけである、ということにして、Ubuntuは、とりあえずこのへんでおいておく。

 

11月18日(水)

NetKetのホームページを丁寧に辿っていけば目的とする量子化学計算に辿りつけそうであることはわかってきた。

NetKetの論文のabstractをもう1度見てみよう。

abstract

We introduce NetKet, a comprehensive open source framework for the study of many-body quantum systems using machine learning techniques.

The framework is built around a general and flexible implementation of neural-network quantum states, which are used as a variational ansatz for quantum wavefunctions.

NetKet provides algorithms for several key tasks in quantum many-body physics and
quantum technology, namely quantum state tomography, supervised learning from wavefunction data, and ground state searches for a wide range of customizable lattice models.

Our aim is to provide a common platform for open research and to stimulate the collaborative development of computational methods at the interface of machine learning and many-body physics.

 

NetKitの論文を最後まで読んでみた感想:

neural-network quantum states (NQS)とrestricted Boltzman machine (RBM)が根底にあり、C++でプログラムを強化しているようである。使いやすさを強調しており、例題をみると、プログラムコードは非常に単純化されていて、確かに、すぐに使えそうな感じである。機械学習量子化学計算の橋渡しをするプログラム開発の拠点を目指しているようである。

PauliNet:Hermann先生のこてこての量子物理、FermiNet:DeepMindチームのディープラーニング等と比べると、NetKitに対しては、量子物理の観点からも、機械学習の観点からも、前2者と比べると、もの足りなさを感じる。

ということで、NetKitは、このあたりで、ひとまずおいておく。

 

さて、つぎ、どうしようか。

 

多体電子系の量子化学計算ができるようになりたいと思って、このテーマでブログを書いているのだが、「DNNで量子化学計算」というタイトルから多くの方が思い浮かべるのは、おそらく、教師あり学習で、分子構造と基底状態のエネルギー(DFT、CCSD(T)等による計算結果)を教師データにして、DNNにその関係性を学ばせることによって、任意の分子構造に対して基底状態のエネルギー値を予測することができる、ということではないだろうか。

ここで紹介している3種類のNNは、波動関数をなんらかの方法でNNに記述し、その波動関数に物理的意味を与える(最適化する)ために、そのNNを、VMC(variational Monte Carlo)等を用いて学習させる。そうすると、学習したNNは、基底状態だけでなく、非平衡状態や励起状態の分子のエネルギーをも計算することができる、というものだと理解している。

この説明は正確ではないかもしれないので、正しい知識を得るために、D. PfauらのFermiNetの論文を熟読したいと思う。

Ⅰ.  Introduction

ここでは、DNNを量子化学計算に用いる、これまでの方法が紹介されている。そのうちの1つの論文(引用文献6)を眺めてみよう。

Physical machine learning outperforms “human learning” in Quantum Chemistry
A. V. Sinitskiy and V. S. Pande, Department of Bioengineering, Stanford University, Stanford CA 94305, arXiv:1908.00971 (2019).

abstract

Two types of approaches to modeling molecular systems have demonstrated high practical efficiency. Density functional theory (DFT), the most widely used quantum chemical method, is a physical approach predicting energies and electron densities of molecules.

Recently, numerous papers on machine learning (ML) of molecular properties have also been published. ML models greatly outperform DFT in terms of computational costs, and may even reach comparable accuracy, but they are missing physicality — a direct link to Quantum Physics — which limits their applicability.

Here, we propose an approach that combines the strong sides of DFT and ML, namely, physicality and low computational cost. By generalizing the famous Hohenberg-Kohn theorems, we derive general equations for exact electron densities and energies that can naturally guide applications of ML in Quantum Chemistry. Based on these equations, we build a deep neural network that can compute electron densities and energies of a wide range of organic molecules not only much faster, but also closer to exact physical values than current versions of DFT. In particular, we reached a mean absolute error in energies of molecules with up to eight non-hydrogen atoms as low as 0.9 kcal/mol relative to CCSD(T) values, noticeably lower than those of DFT (down to ~3 kcal/mol on the same set of molecules) and ML (down to ~1.5 kcal/mol) methods. A simultaneous improvement in the accuracy of predictions of electron densities and energies suggests that the proposed approach describes the physics of molecules better than DFT functionals developed by “human learning” earlier. Thus, physics-based ML offers exciting opportunities for modeling, with high-theory-level quantum chemical accuracy, of much larger molecular systems than currently possible.

赤色に変えた文章が、これまで最も多く用いられてきた手法である。同じことが本文中ではもう少し詳しく記述されている。

Recently, many authors used machine learning (ML) for much faster computations of E and some other molecular properties (polarizabilities, HOMO-LUMO gaps, etc.).

However, neither currently used descriptors of molecules, nor ML models have a transparent connection to the basic physical concepts derived from the Schrödinger equation.

For example, the vast majority of ML models cannot be extended to compounds with new elements without retraining, making them methodologically inferior even to least accurate DFT functionals, let alone the absolutely transferable Schrödinger equation.

As a result, such approaches might be devoid of physics, and the criticism of ML as “black boxes” and “curve-fitting” seems totally applicable to them.

物理の教授に機械学習ディープラーニングの話をすると、ああ、あれね、ブラックボックス化されていて、何やってるかわからないよね、物理じゃなくて、単なるカーブフィッティングでしょ、などどいわれる。

A. V. Sinitskiyらは、上記abstractの紫色で示したように、ネットワークの中に物理(DFT)を持ち込み、持ち込んだ関数をDNNで最適化することによってDFTよりも高性能なCCSD(T)を超える正確さでEやρを高速に計算することができるとのことである。FermiNetやPauliNetは基底状態だけでなく非平衡状態(例えば結合距離を変化させたとき)や励起状態のエネルギーを計算できる。これに対して、A. V. Sinitskiyらがこの論文で示しているのは基底状態のみであるが、本文の最後に次の記述がある。

We foresee wide-scale applications of the approach proposed here (after certain technical developments) to computer modeling of various large molecular systems, including biomolecular or artificial material systems of much practical interest, and highly accurate and fast modeling of excited states of molecules and chemical reactions involving bond breaking and formation.

Fig.1 に、用いたDNNモデルの模式図が示されている。

f:id:AI_ML_DL:20201118224659p:plain

Pfauらの論文は20ページもあって読むのも理解するのもたいへんなのだが、参考のためにと思って引用しているこのSinitskiyらの論文は、62ページ(本文7ページ)もある。

 

準備が整ってきたようなので、FermiNetにフォーカスしようかと思ったのだが、根底にある量子物理、シュレーディンガー波動方程式波動関数、密度汎関数、多体電子系、スピン、強相関、・・・、これらに対する強い興味と理解がないと、何をやっているのかわからない。

ここで偶然出会ったA. V. Sinitskiy and V. S. Pandeの論文は、分子を扱っていて、他の論文をみると、生体分子とタンパク質 との相互作用を計算機シミュレーションで調べているようだ。さらに、上記論文の1つ前の論文もある。Deep Neural Network Computes Electron Densities and Energies of a Large Set of Organic Molecules Faster than Density Functional Theory (DFT), Anton V. Sinitskiy, Vijay S. Pande

ということだが、A. V. Sinitskiyらの研究は、別にフォローすることにして、ここでは、FermiNetを、とことん理解することにしよう。

 

11月19日(木)

FermiNetの全体像

f:id:AI_ML_DL:20201119190813p:plain

文字が小さくて見えないので拡大してみよう。

f:id:AI_ML_DL:20201119185931p:plain

 

f:id:AI_ML_DL:20201119191234p:plain

f:id:AI_ML_DL:20201119191524p:plain

f:id:AI_ML_DL:20201119191732p:plain

f:id:AI_ML_DL:20201119191915p:plain

f:id:AI_ML_DL:20201119192002p:plain

f:id:AI_ML_DL:20201119192210p:plain

f:id:AI_ML_DL:20201119192304p:plain

f:id:AI_ML_DL:20201119192822p:plain

入力するのは原子核と電子の座標だけで、ネットワークの形状と四則演算、行列演算との組み合わせによって、波動関数が表現されます、ということのようなのだが、確かに、アルゴリズムの最上段と最下段を見るとそうなっている。

ついでに、変数間の関係式も張り付けておこう。

 

f:id:AI_ML_DL:20201119213948p:plain

f:id:AI_ML_DL:20201119214044p:plain

f:id:AI_ML_DL:20201119214118p:plain

f:id:AI_ML_DL:20201119214152p:plain

f:id:AI_ML_DL:20201119214243p:plain

PauliNetのHermann先生は、論文Deep neural network solution of the electronic Schrodinge equationの中で、次のように書いている。

The parallel work of Pfau et al. (2019) follows the same basic idea as ours, but differs in several significant aspects.

Their architecture does not encode any physical knowledge about wave functions besides the essential antisymmetry, which is compensated by a much larger number of optimized parameters.

Perhaps as a result of that, their ansatz achieves somewhat higher accuracy at the cost of being about two orders of magnitude more computationally expensive than ours.

この文章から、FermiNetは、反対称性以外に波動関数に関する物理学的知識を含んでいないと思い込み、自分の紹介記事にもそう書いたのだが、これは正しい認識だろうか。

次にPauliNetの模式図を示す。

Hartree Fock, Jastrow, Backflow, Electronic cusps, Equivariant Interaction Blockが、fixed functionもしくはtrainable functionとして組み込まれている。

Fermi netには、それらのphysical knowledgeを表現することができる変数は用意されているが、physical knowledgeが含まれているとは言えない、という理解でよいのだろうか。

 

f:id:AI_ML_DL:20201119224317p:plain

 

11月20日(金)

B. Wave-function optimization

これが、FermiNetにphysical knowledgeを教え、学ばせる作業、ということかな。

波動関数のエネルギー期待値を最小化する、ということのようだが、Kronecker-factored approximate curvature (KFAC)、Fisher Information Matrix (FIM)など、ついていけなくなる。

大沢 和樹 氏の記事を一部転載させていただく。

Kronecker-factored Approximate Curvature (K-FAC) は(当時)University of Toronto の Ph.D. 学生であった James Martens らによって、2015年のICMLで提案された深層ニューラルネットワークのための最適化手法である。大規模な深層学習において応用が限られていた二次最適化手法のボトルネックである曲率 (Curvature) 計算の効率的な実現手法である。

自然勾配学習法(Natural Gradient Learning)は1998年にShun-ichi Amariによって提案された情報幾何に基づくニューラルネットワークの最適化手法である。自然勾配学習ではFisher情報行列を曲率として用いることで目的関数の地形を正確に捉え、「反復数」において学習の高速な収束を実現する。このため、自然勾配学習法は二次最適化の効率的な実現法としても知られる。

Natural Gradient Works Efficiently in Learning
Shun-ichi Amari
RIKEN Frontier Research Program, Saitama 351-01, Japan

This article introduces the Riemannian structures to the parameter spaces of multilayer perceptrons, blind source separation, and blind source deconvolution by means of information geometry. The natural gradient learningmethod is then introduced and is shown to be statistically efficient. This implies that optimal online learning is as efficient as optimal batch learning when the Fisher information matrix exists. It is also suggested that natural gradient learning might be easier to get out of plateaus than conventional
stochastic gradient learning.

KFACの論文:

Optimizing Neural Networks with Kronecker-factored Approximate Curvature
James Martens∗ and oger Grosse†
Department of Computer Science, University of Toronto

Abstract
We propose an efficient method for approximating natural gradient descent in neural networks which we call Kronecker-factored Approximate Curvature (K-FAC). K-FAC is based on an efficiently invertible approximation of a neural network’s Fisher information matrix which is neither diagonal nor low-rank, and in some cases is completely non-sparse. It is derived by approximating various large blocks of the Fisher (corresponding to entire layers) as being the Kronecker product of two much smaller matrices. While only several times more expensive to compute than the plain stochastic gradient, the updates produced by K-FAC make much more progress optimizing the objective, which results in an algorithm that can be much faster than stochastic gradient descent with momentum in practice. And unlike some previously proposed approximate natural-gradient/Newton methods which use high-quality non-diagonal curvature matrices (such as Hessian-free optimization), K-FAC works very well in highly stochastic optimization regimes. This is because the cost of storing and inverting K-FAC’s approximation to the curvature matrix does not depend on the amount of data used to estimate it, which is a feature typically associated only with diagonal or low-rank approximations to the curvature matrix.

optimizationの奥の深さを少し感じることができたような気がする。Optimizationの方法を理解するだけならもうすこし簡単だと思うのだが、ハミルトニアン波動関数の式を目の前にしてoptimizationのアルゴリズムを理解することは、たいへん難しく感じる。

Ⅲ. RESULTS

ここから先は、他の手法と比較して、FermiNetの方がより正確に計算結果を出すことができるかということを示している。ちょっととばして先に進んでみよう。

 

 

APPENDIX A: EXPERIMENTAL SETUP

1. FermiNet architekuture and training

FermiNetは4層+最終層

各層は、one-electron streamに対して256のhidden units、two-electron streamに対して32のhidden units

最終層はlinear、Laplacianが良く定義されて、全領域で正になるように、4層全てにtanh nonlinialityを用いている。

特に指定がなければ、16の行列を用いている。

表1に示したSethらの通常のVMC (Variational Monte Carlo)の結果は、50のconfiguration state function (CSF)を用いている。

CSFの行列の数は系に依存し、その数は数百から数千である。

対応するFermiNetのパラメータ数は、約700,000であり、正確な数は原子数や分子構造によって異なってくる。

*以上がFermiNetの構造に関する本文より具体的な説明である。これでも、Fig.1の概略図との対応はわかりにくいが、なんとなくわかったような気にもなる。

 

optimizationとしてlocal energyを適用する前に、pySCFを用いて計算したHartree-Fock (HF)軌道に合致するように事前トレーニングを行っている。

この事前トレーニングは、optimizationに対して非常に効果的であるとのこと。

事前学習のlossの式が示されており、Hartree-Fock計算に用いるminimal basisはSTO-3Gであるとのこと。

少しとばす。

 

FermiNetはTensorFlowで書かれている。

20電子系に対しては、8台のV100 GPUを並列作動させている。より大きな系では16 GPUも用いられている。

etheneの計算には、8GPUで2日間を要するとのこと。

30電子のBicyclobutaneは、16GPUで1か月を要するとのこと。

デフォルトのパラメータが表4に示されている。ただし、Bicyclobutaneの場合には、batch sizaは半分にし、事前トレーニングの試行回数は桁で増やしているとのこと。

 

このブログの目的は、多電子系の電子状態の計算をANNを使ったプログラムで実行するところまでの道筋を記録することだった。しかし、ここまで見てきてわかったように、FermiNetは、計算コストが高すぎるように思う。

FermiNetの論文解読はこのへんで中断して、プログラムの中身をのぞいてみようか。

 

早速、GitHubにあるdeepmind/ferminetに行ってみましょう。

github.com

ここへは何回か来ているが、プログラムをちょっと覗いてみただけで、何もしていない。したがって、どうなるかまったくわからない。

FermiNet: Fermionic Neural Networks

An implementation of the algorithm and experiments defined in "Ab-Initio Solution of the Many-Electron Schroedinger Equation with Deep Neural Networks", David Pfau, James S. Spencer, Alex G de G Matthews and W.M.C. Foulkes, Phys. Rev. Research 2, 033429 (2020). FermiNet is a neural network for learning the ground state wavefunctions of atoms and molecules using a variational Monte Carlo approach.

Installation

pip install -e . will install all required dependencies. This is best done inside a virtual environment.

virtualenv -m python3.7 ~/venv/ferminet
source ~/venv/ferminet/bin/activate
pip install -e .

11月21日(土)

ここで壁にぶち当たりました。

GitHubのコードの利用の仕方を学ぶ必要があります。 

 

11月22日(日)

Introduvtion to GitHubを学習中

 

 

f:id:AI_ML_DL:20201110151235p:plain

style=158 iteration=500

 

f:id:AI_ML_DL:20201118002548p:plain

style=158 iteration=50

f:id:AI_ML_DL:20201118002845p:plain

style=158 iteration=5