Skip to main content

bridge from TNSP to TAT

Project description

TNSP-bridge is a tool used to facilitate the conversion of tensor data from the format of the old TNSP to TAT format. It's important to note that different versions of TNSP may have variations in their data structures, but this specific subproject focuses on compatibility with TNSP version 4. And we support the conversion of non-symmetry tensors and boson/fermion (Z(2)) / (U(1)) symmetry tensors of various scalar types.

Install

Please either copy or create a soft link for the directory in the site-packages directory. Alternatively, users can utilize pip to install the TNSP-bridge package by running the command pip install tnsp_bridge.

Documents

The only function is bridge, which accepts a function that extracts the old version tensor data line by line and returns the tensor in the new version. For example, here is the old version of the data:

 T T T T
 readable_data T
           2           8           3           0
           1           4           8
           3           7           8
   1.00000000       2.00000000       3.00000000      -1.00000000      -2.00000000      -3.00000000      -4.00000000       0.00000000
 End_data
 readable_data T
           1           8           3           0
           1           4           8
           3           7           8
           3           2           1           1           2           2           1           1
 End_data
 readable_data T
           1           6           2           0
           1           4
           3           6
           3           4           1          -1          -1           1
 End_data
 A1_1.D  A1_1.R  A1_1.n
 readable_data T
           3           9          12           0
           1       22049           0           0           4   538976288   538976288   538976288           8   538976288   538976288   538976288
           3           0           0           0           7           0           0           0           9           0           0           0
 0.23446911431164341       0.13002435022579403       -3.1842370052190448E-002  0.45356268067516309       -1.4087785231172337E-002  -9.0396315774136524E-002  -2.0732171027595565E-002 -0.35235299284206140       -1.2456779139446277E-002
 End_data
EOF

The code below converts the aforementioned data, stored in the string variable named example_data, to the new version format:

from bridge import bridge

data_line_by_line = example_data.split("\n")
data_line_by_line.reverse()
print(bridge(data_line_by_line.pop, compat=True, parity=False))

{names:[A1_1.n,A1_1.R,A1_1.D],edges:[{arrow:0,segment:{0:1}},{arrow:1,segment:{-1:1,-2:2,-3:2,-4:1}},{arrow:1,segment:{1:3,2:2,3:1}}],blocks:{[0,-1,1]:[0.234469,0.130024,-0.0318424],[0,-2,2]:[0.453563,-0.0140878,-0.0903963,-0.0207322],[0,-3,3]:[-0.352353,-0.0124568]}}

The function bridge has two optional arguments. The first one is parity, used to distinguish the symmetry group of a symmetry tensor. When parity is set to False (default), it should be a fermion or boson (U(1)) symmetry tensor. If set to True, a fermion or boson (Z(1)) symmetry tensor is considered. The second argument is compat, which distinguishes the version in the old TNSP. Within old TNSP, there are two data formats: the older one is processed when compat is set to True, and the newer one if set to False (default).

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

tnsp_bridge-0.3.17-py3-none-any.whl (5.3 kB view details)

Uploaded Python 3

File details

Details for the file tnsp_bridge-0.3.17-py3-none-any.whl.

File metadata

File hashes

Hashes for tnsp_bridge-0.3.17-py3-none-any.whl
Algorithm Hash digest
SHA256 c7c65d213bbf8dfd3f5b5442d39eb365a4243fc721bcf1efcf1a4f9c926904f3
MD5 1f0de7d5eb55dfde270b5ba7a3fbd16a
BLAKE2b-256 27cad1eb2ba0bbfd9cb7cc511457f88e0787f039d4654882bb5aeab930e8b179

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page