Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Full sparse PYED #3

Open
wants to merge 35 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@

*.pyc
*checkpoint.ipynb
doc/.DS_Store
.DS_Store
dist/.DS_Store
439 changes: 439 additions & 0 deletions .ipynb_checkpoints/Documentation-checkpoint.ipynb

Large diffs are not rendered by default.

422 changes: 422 additions & 0 deletions Anderson.ipynb

Large diffs are not rendered by default.

467 changes: 467 additions & 0 deletions Documentation.ipynb

Large diffs are not rendered by default.

5 changes: 2 additions & 3 deletions LICENSE.txt
Original file line number Diff line number Diff line change
@@ -1,18 +1,17 @@

PYED: Exact diagonalization routines for finite quantum systems

Copyright (C) 2017 by H. U.R. Strand
Copyright (C) 2018 by H. U.R. Strand, Ya.V. Zhumagulov

PYED is free software: you can redistribute it and/or modify it under the
terms of the GNU General Public License as published by the Free Software
Foundation, either version 3 of the License, or (at your option) any later
version.

PYED is distributed in the hope that it will be useful, but WITHOUT ANY
WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with
TRIQS (in the file COPYING.txt in this directory). If not, see
<http://www.gnu.org/licenses/>.

8 changes: 8 additions & 0 deletions MANIFEST
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# file GENERATED by distutils, do NOT edit
setup.py
pyed/CubeTetras.py
pyed/SparseExactDiagonalization.py
pyed/SparseMatrixFockStates.py
pyed/SquareTriangles.py
pyed/TriqsExactDiagonalization.py
pyed/__init__.py
12 changes: 2 additions & 10 deletions Readme.md
Original file line number Diff line number Diff line change
@@ -1,28 +1,20 @@
# **PYED**: Exact diagonalization for finite quantum systems

Copyright (C) 2017, H. U.R. Strand
Copyright (C) 2018, H. U.R. Strand

The python module `pyed` implements exact diagonalization for finite fermionic many-body quantum systems, together with calculations of several response functions in imagianary time.

The many-body system is defined using `pytriqs` second-quantized operators and the response functions are stored in `pytriqs` Green's function containters.

The original purpose of `pyed` is to provide exact solutions to small finite systems, to be used as benchmarks and tests for stochastic many-body solvers.

## Dependencies

`pyed` requires [the `triqs` library](https://github.com/TRIQS/triqs) to be installed from the `unstable` banch or version `1.5` scheduled for release late 2017.

## Installation

To do: Add `setup_utils` install script

There is currently no formal installation scripts packed with `pyed`. To use and develop the module simply ammend your `PYTHON_PATH` with the `./pyed/` folder, e.g., add the follwing

```
export PYTHON_PATH=${HOME}/path/to/pyed:$PYTHON_PATH
pip install git+https://github.com/yaros72/pyed
```

in your `.bashrc`, `.bash_profile`, or `.profile` file.

## Documentation

Expand Down
Binary file added dist/pyed-0.0.0.tar.gz
Binary file not shown.
327 changes: 327 additions & 0 deletions doc/.ipynb_checkpoints/Documentation_CPT_2D-checkpoint.ipynb

Large diffs are not rendered by default.

438 changes: 438 additions & 0 deletions doc/Anderson.ipynb

Large diffs are not rendered by default.

213 changes: 141 additions & 72 deletions doc/Documentation.ipynb

Large diffs are not rendered by default.

Binary file removed doc/figure_densdens_tau.png
Binary file not shown.
Binary file removed doc/figure_g3pp_tau.png
Binary file not shown.
Binary file removed doc/figure_g_iwn.png
Binary file not shown.
Binary file removed doc/figure_g_tau.png
Binary file not shown.
42 changes: 24 additions & 18 deletions pyed/CubeTetras.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@

"""
"""
Helper routines for the equal time imaginary time cube and
its sub tetrahedrons.

Expand All @@ -11,23 +11,29 @@
import itertools
import numpy as np

# ----------------------------------------------------------------------
def Idxs(integer_index_list):
from pytriqs.gf import Idx
return tuple( Idx(i) for i in integer_index_list )

# ----------------------------------------------------------------------
def zero_outer_planes_and_equal_times(g4_tau):

from pytriqs.gf import Idx
beta = g4_tau.mesh.components[0].beta

for idxs, (t1, t2, t3) in enumerate_tau3(g4_tau):
if t1 == t2 or t2 == t3 or t1 == t3 or \
t1 == 0 or t1 == beta or \
t2 == 0 or t2 == beta or \
t3 == 0 or t3 == beta:
g4_tau[list(idxs)][:] = 0.0
g4_tau[Idxs(idxs)] = 0.0

# ----------------------------------------------------------------------
def enumerate_tau3(g4_tau, make_real=True, beta=None):

from pytriqs.gf import MeshImTime, MeshProduct

assert( type(g4_tau.mesh) == MeshProduct )

for mesh in g4_tau.mesh.components:
Expand All @@ -40,13 +46,13 @@ def enumerate_tau3(g4_tau, make_real=True, beta=None):
yield (i1, i2, i3), (t1.real, t2.real, t3.real)
else:
yield (i1, i2, i3), (t1, t2, t3)

# ----------------------------------------------------------------------
class CubeTetrasBase(object):

""" Base class with definition of the equal time tetrahedrons
in three fermionic imaginary times. """

def get_tetra_list(self):

tetra_list = [
Expand All @@ -57,17 +63,17 @@ def get_tetra_list(self):
(lambda x,y,z : x >= z and z >= y, [0, 2, 1], -1),
(lambda x,y,z : z >= x and x >= y, [2, 0, 1], +1),
]

return tetra_list

# ----------------------------------------------------------------------
class CubeTetras(CubeTetrasBase):

""" Helper class for two-particle Green's function.

Looping over all tetrahedrons in the imaginary time cube.
\tau_1, \tau_2, \tau_3 \in [0, \beta) """

# ------------------------------------------------------------------
def __init__(self, tau):

Expand All @@ -79,38 +85,38 @@ def __init__(self, tau):
def __iter__(self):

for tidx in xrange(6):

func, perm, perm_sign = self.tetra_list[tidx]

index = []
for n1, n2, n3 in itertools.product(
range(self.ntau), repeat=3):
if func(n1, n2, n3): index.append((n1, n2, n3))

index = np.array(index).T

i1, i2, i3 = index
t1, t2, t3 = self.tau[i1], self.tau[i2], self.tau[i3]

taus = np.vstack([t1, t2, t3])

yield list(index), taus, perm, perm_sign

# ----------------------------------------------------------------------
class CubeTetrasMesh(CubeTetrasBase):

""" Helper class for Triqs two-particle Green's function
in imaginary time.

Looping over all tetrahedrons in the imaginary time cube.
\tau_1, \tau_2, \tau_3 \in [0, \beta) """

# ------------------------------------------------------------------
def __init__(self, g4_tau):

self.g4_tau = g4_tau
self.tetra_list = self.get_tetra_list()

# ------------------------------------------------------------------
def __iter__(self):

Expand All @@ -120,7 +126,7 @@ def __iter__(self):
tetra_tau = [ [] for n in xrange(6) ]

for idxs, taus in enumerate_tau3(self.g4_tau):

for tidx, tetra in enumerate(self.tetra_list):
func, perm, perm_sign = tetra

Expand All @@ -133,5 +139,5 @@ def __iter__(self):
func, perm, perm_sign = self.tetra_list[tidx]

yield tetra_idx[tidx], tetra_tau[tidx], perm, perm_sign

# ----------------------------------------------------------------------
Loading