Skip to main content

A python package for generating LaTeX and python code for evaluating residual terms

Project description

termfactory

Master_workflow_coverage Testing_workflow_coverage codecov codecov


About

A python package for generating LaTeX and python code for evaluating residual terms. The package is used to generate the einsum equations for the vecc package (link tbd).

At the moment the package provides three primary ansatz:

  • full CC       (H, CC, P)
  • HZ ansatz (H, CC, S, P)
  • e^T HZ      (H, CC, T, eT, P)

Both LaTeX and python code can be generated. Ground state equations are available for all three ansatz. There are no excited state equations available for HZ ansatz.

Install

pip install termfactory

Usage

driver.py is the main argparse interface py driver.py -h

usage: driver.py [-h] [-l /path/filename.txt] [-s] [-t T [T ...]] [-a ANSATZ] [-es EXCITED_STATE] [-rf REMOVE_F_TERMS] [-c] [-lhs] [-p PATH]

Code/Latex Generator

optional arguments:
  -h, --help            show this help message and exit
  -l /path/filename.txt, --log_path /path/filename.txt
                        path to log file (default: default_logging_file.txt)
  -s, --stdlog          provide if you want the log to be piped to stdout (default: False)
  -t T [T ...]          Provided Truncations, example: -t 2 2 2 2 (default: None)
  -a ANSATZ, --ansatz ANSATZ
                        Specify Ansatz (default: None)
  -es EXCITED_STATE, --excited_state EXCITED_STATE
                        Only ground state? (default: True)
  -rf REMOVE_F_TERMS, --remove_f_terms REMOVE_F_TERMS
                        Choose to remove f terms (default: False)
  -c, --code            Generate LaTeX by default; `-c` generates code instead. (default: False)
  -lhs                  Generate LaTeX by default; `-c` generates code instead. (default: False)
  -p PATH, --path PATH  filename of load/save file (default: None)

Examples

Every execution produces three primary files:

  • filename.(py/tex)
  • default_logging_file.txt
  • truncs.json

Generating LaTeX

full CC


RHS

python3 driver.py -t 1 1 1 1

Default filename: ground_state_full_cc_symmetric_equations.tex

LHS

python3 driver.py -t 1 1 1 1 -lhs

Default filename: ground_state_full_cc_special_LHS_terms.tex

HZ ansatz


RHS

python3 driver.py -t 1 1 1 1

Default filename: ground_state_z_t_symmetric_equations.tex

LHS

python3 driver.py -t 1 1 1 1 -lhs

Default filename: ground_state_z_t_special_LHS_terms.tex

e^T HZ


RHS

python3 driver.py -t 1 1 1 1 1

Default filename: ground_state_eT_z_t_symmetric_equations.tex

LHS

python3 driver.py -t 1 1 1 1 1 -lhs

Default filename: ground_state_eT_z_t_special_LHS_terms.tex

Generating Python code

full CC


RHS

python3 driver.py -t 1 1 1 1 -c

Default filename: ground_state_full_cc_equations.py

LHS

python3 driver.py -t 1 1 1 1 1 -c -lhs

Default filename: ground_state_full_cc_special_LHS_equations.py

HZ ansatz


There is no code generator implemented for the HZ ansatz

e^T HZ


RHS

python3 driver.py -t 1 1 1 1 1 -c

Default filename: eT_zhz_eqs_RHS_H(1)_P(1)_T(1)_exp(1)_Z(1).py

LHS

python3 driver.py -t 1 1 1 1 1 -c -lhs

Default filename: eT_zhz_eqs_LHS_H(1)_P(1)_T(1)_exp(1)_Z(1).py

Project details


Download files

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

Source Distribution

termfactory-1.0.tar.gz (3.6 kB view details)

Uploaded Source

Built Distribution

termfactory-1.0-py3-none-any.whl (2.5 kB view details)

Uploaded Python 3

File details

Details for the file termfactory-1.0.tar.gz.

File metadata

  • Download URL: termfactory-1.0.tar.gz
  • Upload date:
  • Size: 3.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.9.13

File hashes

Hashes for termfactory-1.0.tar.gz
Algorithm Hash digest
SHA256 36d2195374932690037c9eb26f580455d1effd35195906389f29a55d4c14d55d
MD5 82e0203b202e25227468cfb7bf60a1a8
BLAKE2b-256 ebc28e2d9cfc445b5966a73323eabd8cf924361f0ee615b303f4bc6e794efcd5

See more details on using hashes here.

File details

Details for the file termfactory-1.0-py3-none-any.whl.

File metadata

  • Download URL: termfactory-1.0-py3-none-any.whl
  • Upload date:
  • Size: 2.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.9.13

File hashes

Hashes for termfactory-1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 a6d98703d38f550f9c9f49583aab63a0e9514e5dc56bf07018f6e5738a3e10af
MD5 74f2c907a3c17a8e8eb15ca31b48bbf7
BLAKE2b-256 7b88d111b9ce1fbfd5f95064926a3c211fc18132c1cd1cc33344b8c08cb9b783

See more details on using hashes here.

Supported by

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