From f2203eaefeb3d05ea540ae65b560c0ef0d6fd2bb Mon Sep 17 00:00:00 2001 From: Hao Zhang Date: Thu, 6 Jul 2023 02:59:08 +0800 Subject: [PATCH] [tetku.py] Add square d-wave and s-wave BCS model. --- tetraku/tetraku/models/bcs/__init__.py | 17 +++++ tetraku/tetraku/models/bcs/square/__init__.py | 17 +++++ tetraku/tetraku/models/bcs/square/d_wave.py | 71 +++++++++++++++++++ tetraku/tetraku/models/bcs/square/s_wave.py | 71 +++++++++++++++++++ 4 files changed, 176 insertions(+) create mode 100644 tetraku/tetraku/models/bcs/__init__.py create mode 100644 tetraku/tetraku/models/bcs/square/__init__.py create mode 100644 tetraku/tetraku/models/bcs/square/d_wave.py create mode 100644 tetraku/tetraku/models/bcs/square/s_wave.py diff --git a/tetraku/tetraku/models/bcs/__init__.py b/tetraku/tetraku/models/bcs/__init__.py new file mode 100644 index 000000000..5a17187c7 --- /dev/null +++ b/tetraku/tetraku/models/bcs/__init__.py @@ -0,0 +1,17 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# Copyright (C) 2022-2023 Hao Zhang +# +# This program 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 +# any later version. +# +# This program 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 this program. If not, see . +# diff --git a/tetraku/tetraku/models/bcs/square/__init__.py b/tetraku/tetraku/models/bcs/square/__init__.py new file mode 100644 index 000000000..5a17187c7 --- /dev/null +++ b/tetraku/tetraku/models/bcs/square/__init__.py @@ -0,0 +1,17 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# Copyright (C) 2022-2023 Hao Zhang +# +# This program 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 +# any later version. +# +# This program 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 this program. If not, see . +# diff --git a/tetraku/tetraku/models/bcs/square/d_wave.py b/tetraku/tetraku/models/bcs/square/d_wave.py new file mode 100644 index 000000000..53041e8ee --- /dev/null +++ b/tetraku/tetraku/models/bcs/square/d_wave.py @@ -0,0 +1,71 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# Copyright (C) 2021-2023 Hao Zhang +# +# This program 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 +# any later version. +# +# This program 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 this program. If not, see . +# + +import TAT +import tetragono as tet + + +def abstract_state(L1, L2, t, Delta, mu): + """ + Create BCS d-wave model state. + + Parameters + ---------- + L1, L2 : int + The lattice size. + t, Delta : float + BCS model parameters. + mu : float + chemical potential. + """ + state = tet.AbstractState(TAT.Parity.D.Tensor, L1, L2) + state.physics_edges[...] = [(False, 2), (True, 2)] + + CSCS = tet.common_tensor.Parity_Hubbard.CSCS.to(float) + + N0 = tet.common_tensor.Parity_Hubbard.N0.to(float) + N1 = tet.common_tensor.Parity_Hubbard.N1.to(float) + N = N0 + N1 + + state.hamiltonians["vertical_bond"] = -t * CSCS + Delta * tet.common_tensor.Parity_Hubbard.singlet.to(float) + state.hamiltonians["horizontal_bond"] = -t * CSCS - Delta * tet.common_tensor.Parity_Hubbard.singlet.to(float) + state.hamiltonians["single_site"] = -mu * N + return state + + +def abstract_lattice(L1, L2, D, t, Delta, mu): + """ + Create BCS model lattice. + + Parameters + ---------- + L1, L2 : int + The lattice size. + D : int + The cut dimension. + t, Delta : float + BCS model parameters. + mu : float + chemical potential. + """ + state = tet.AbstractLattice(abstract_state(L1, L2, t, Delta, mu)) + D0 = D // 2 + D1 = D - D0 + state.virtual_bond["R"] = state.virtual_bond["D"] = [(False, D0), (True, D1)] + + return state diff --git a/tetraku/tetraku/models/bcs/square/s_wave.py b/tetraku/tetraku/models/bcs/square/s_wave.py new file mode 100644 index 000000000..915e57ee5 --- /dev/null +++ b/tetraku/tetraku/models/bcs/square/s_wave.py @@ -0,0 +1,71 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# Copyright (C) 2021-2023 Hao Zhang +# +# This program 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 +# any later version. +# +# This program 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 this program. If not, see . +# + +import TAT +import tetragono as tet + + +def abstract_state(L1, L2, t, Delta, mu): + """ + Create BCS d-wave model state. + + Parameters + ---------- + L1, L2 : int + The lattice size. + t, Delta : float + BCS model parameters. + mu : float + chemical potential. + """ + state = tet.AbstractState(TAT.Parity.D.Tensor, L1, L2) + state.physics_edges[...] = [(False, 2), (True, 2)] + + CSCS = tet.common_tensor.Parity_Hubbard.CSCS.to(float) + + N0 = tet.common_tensor.Parity_Hubbard.N0.to(float) + N1 = tet.common_tensor.Parity_Hubbard.N1.to(float) + N = N0 + N1 + + state.hamiltonians["vertical_bond"] = -t * CSCS + Delta * tet.common_tensor.Parity_Hubbard.singlet.to(float) + state.hamiltonians["horizontal_bond"] = -t * CSCS + Delta * tet.common_tensor.Parity_Hubbard.singlet.to(float) + state.hamiltonians["single_site"] = -mu * N + return state + + +def abstract_lattice(L1, L2, D, t, Delta, mu): + """ + Create BCS model lattice. + + Parameters + ---------- + L1, L2 : int + The lattice size. + D : int + The cut dimension. + t, Delta : float + BCS model parameters. + mu : float + chemical potential. + """ + state = tet.AbstractLattice(abstract_state(L1, L2, t, Delta, mu)) + D0 = D // 2 + D1 = D - D0 + state.virtual_bond["R"] = state.virtual_bond["D"] = [(False, D0), (True, D1)] + + return state