spirit-extras
Package with some useful scripts, to be used together with the Spirit python API (github.com/spirit-code/spirit/).
Data structure for spin systems
Parse data from a Spirit state pointer
from spirit import state
import spirit_extras.data
with state.State("input.cfg") as p_state:
spin_sytem = spirit_extras.data.spin_system_from_p_state()
# Information about the bravais lattice is automatically parsed from the spirit API
print(spin_system)
# The spins can be set
ib, a, b, c = 1, 5, 3, 4
idx = spin_system.idx(ib, a, b, c) # computes the linear index from a bravais tupel
spin_system.spins[idx] = [0,0,-1]
ib, a, b, c = spin_system.tupel(5) # computes the bravais tupel from a linear index
# A shaped view into the spin system is also available
spin_system.shaped().spins[ib,a,b,c] = [0,0,1]
# Slicing syntax works
spin_system.shaped().spins[ib,:,b,c] = [0,1,0]
mask = np.linalg.norm(spin_system.positions - spin_system.center() < 5, radius=1)
spin_sytem.spins[mask] = [1,0,0]
Create from your own buffers
# Since spirit_extras.Spin_System is needed for many functions in spirit_extras, it can also be created from a spins and positions arrays
spins = [ [1,0,0] for i in range(10) ]
# The default behaviour is to expect an unordered system, meaning some functions will throw an exception
my_spin_system = spirit_extras.data.Spin_System(positions=None, spins=spins) # positions dont _have_ to be specified
try:
my_spin_sytem.shaped() # needs an ordered system
except:
print("Throws :(")
# To create an ordered system pass `unordered=False` and specify `n_cells`
my_spin_system = spirit_extras.data.Spin_System(positions=None, spins=spins, n_cells=[10,1,1], unordered=False)
my_spin_sytem.shaped() # works!
Metadata
Release files for spirit-extras 0.0.35
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| spirit-extras-0.0.35.tar.gz | 46.0 kB | Without provenance | Details for spirit-extras-0.0.35.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| spirit_extras-0.0.35-py3-none-any.whl | Python 3 | none | any | Details for spirit_extras-0.0.35-py3-none-any.whl |
Total release size: 87.4 kB
Release files / spirit-extras-0.0.35.tar.gz
| Download URL | spirit-extras-0.0.35.tar.gz |
|---|---|
| Size | 46.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
c8536125a133a2b8f97b6fc1832fe4d40576b35ca276a46c1757b5a44a24f954
|
|
BLAKE2b-256 checksum How to use checksums |
1dba409a1b0bb7f763d2480a5e12d269bccc623afc4afbc228052bfe310b83ba
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.12.0
|
Release files / spirit_extras-0.0.35-py3-none-any.whl
| Download URL | spirit_extras-0.0.35-py3-none-any.whl |
|---|---|
| Size | 41.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
9c6b34fba900f87d054a77ba97875ca878f5b7fdcd25c8b81590b5d598caf550
|
|
BLAKE2b-256 checksum How to use checksums |
8693ca47a70de09e68a44f4e148693b8616b2759f24aab737118534c743bc226
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.12.0
|
Security for spirit-extras 0.0.35
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.