Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
U
usadelndsoc
Manage
Activity
Members
Labels
Plan
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
JYU Condensed Matter Theory
usadelndsoc
Commits
0c525c80
Commit
0c525c80
authored
2 years ago
by
patavirt
Browse files
Options
Downloads
Patches
Plain Diff
solver: add some helper features
parent
f4456424
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
usadelndsoc/solver.py
+40
-1
40 additions, 1 deletion
usadelndsoc/solver.py
with
40 additions
and
1 deletion
usadelndsoc/solver.py
+
40
−
1
View file @
0c525c80
...
@@ -36,12 +36,39 @@ except ImportError:
...
@@ -36,12 +36,39 @@ except ImportError:
from
.core
import
Core
,
MASK_NONE
,
MASK_TERMINAL
,
MASK_VACUUM
,
_DeltaArray
from
.core
import
Core
,
MASK_NONE
,
MASK_TERMINAL
,
MASK_VACUUM
,
_DeltaArray
from
.matsubara
import
get_matsubara_sum
from
.matsubara
import
get_matsubara_sum
__all__
=
[
"
Solver
"
,
"
Result
"
,
"
cpr
"
,
"
tr
"
,
"
MASK_NONE
"
,
"
MASK_TERMINAL
"
,
"
MASK_VACUUM
"
]
__all__
=
[
"
Solver
"
,
"
Result
"
,
"
cpr
"
,
"
MASK_NONE
"
,
"
MASK_TERMINAL
"
,
"
MASK_VACUUM
"
,
"
tr
"
,
"
LEFT
"
,
"
UP
"
,
"
RIGHT
"
,
"
DOWN
"
,
"
S_x
"
,
"
S_y
"
,
"
S_z
"
,
"
S_0
"
,
]
_log
=
logging
.
getLogger
(
__name__
)
_log
=
logging
.
getLogger
(
__name__
)
_log_solve
=
logging
.
getLogger
(
__name__
+
"
.solve
"
)
_log_solve
=
logging
.
getLogger
(
__name__
+
"
.solve
"
)
S_x
=
np
.
array
([[
0
,
1
],
[
1
,
0
]])
S_y
=
np
.
array
([[
0
,
-
1j
],
[
1j
,
0
]])
S_z
=
np
.
array
([[
1
,
0
],
[
0
,
-
1
]])
S_0
=
np
.
array
([[
1
,
0
],
[
0
,
1
]])
LEFT
=
0
UP
=
1
RIGHT
=
2
DOWN
=
3
def
_core_property
(
name
):
def
_core_property
(
name
):
def
fget
(
self
):
def
fget
(
self
):
return
getattr
(
self
.
_core
,
name
)
return
getattr
(
self
.
_core
,
name
)
...
@@ -599,6 +626,18 @@ class Result:
...
@@ -599,6 +626,18 @@ class Result:
def
J
(
self
):
def
J
(
self
):
return
self
.
_core
.
grad_A
(
self
.
Phi
).
transpose
(
0
,
1
,
2
,
4
,
3
)
*
(
1
/
16
)
return
self
.
_core
.
grad_A
(
self
.
Phi
).
transpose
(
0
,
1
,
2
,
4
,
3
)
*
(
1
/
16
)
@property
def
J_c
(
self
):
t3
=
np
.
diag
([
1
,
1
,
-
1
,
-
1
])
return
tr
(
self
.
J
@
t3
)
@property
def
J_s
(
self
):
jx
=
tr
(
self
.
J
@
np
.
kron
(
s0
,
sx
))
jy
=
tr
(
self
.
J
@
np
.
kron
(
s0
,
sy
))
jz
=
tr
(
self
.
J
@
np
.
kron
(
s0
,
sz
))
return
np
.
array
([
jx
,
jy
,
jz
]).
transpose
(
1
,
2
,
3
,
0
)
@property
@property
def
S
(
self
):
def
S
(
self
):
return
self
.
_core
.
grad_Omega
(
self
.
Phi
).
transpose
(
0
,
1
,
3
,
2
)
return
self
.
_core
.
grad_Omega
(
self
.
Phi
).
transpose
(
0
,
1
,
3
,
2
)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment