Solve lattice llg numerically
Project description
概览
magbox是一个求解格点Landau-Lifshitz-Gilbert方程的python库,支持CPU或者GPU加速。
安装
magbox依赖的库为:numpy, torch, tqdm.
python版本要求为3.9及以上 如果需要启用pytorch的GPU支持,需要先手动安装pytorch,详情见pytorch的官网
直接通过pip安装magbox
pip install magbox
基本用法
先导入magbox
import magbox
通过Lattice类创建一个晶格类型,使用Vars类定义相互作用大小。
lt = magbox.Lattice(type="square", size=[N1, N2], periodic=True)
vars = magbox.Vars(K1=1,J=2)
llg3用于初始化求解器,需要告诉求解器磁矩的初始值x,y,z, 晶格属性(由Lattice类定义)以及相互作用参数(由Vars类定义),还可以设置Gilbert damping的数值 alpha, 旋磁比gamma, 模拟的总时间T, 输出的时间步长dt,温度Temp等参数。通过指定device参数可以选择使用CPU还是GPU进行计算,dtype参数可以选择计算的数据类型。
sf = magbox.llg3(x,y,z,lt,vars,device='cpu',dtype='f64',alpha=0.1,gamma=1,T=50,dt=1)
调用求解器的run方法进行模拟,
t, S, stats,err_info = sf.run()
t是输出的时间序列。S是求解得到的磁矩值,第一个维度表示时间,第二维度表示空间,第三个维度表示自旋空间xyz。stats包含了求解器信息,err_info包含了误差信息。
目前支持的相互作用
- 外磁场。
- 单轴各项异性。
- 海森堡交换耦合。
开发计划
- 支持更多的相互作用。
- 支持更多的晶格类型。
- 添加频域求解,直接求解能带。
- 添加批处理支持。
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file magbox-0.5.0.tar.gz.
File metadata
- Download URL: magbox-0.5.0.tar.gz
- Upload date:
- Size: 170.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9cc4c70a9f48cb341777d3fe1ef657a48c3010efc2fe6038a31420269394ddcb
|
|
| MD5 |
9a6a2e35b61943e41de3d94509383ca8
|
|
| BLAKE2b-256 |
c5385e3db6aa3ffed0178f7a3a3fd6dfbd140958e34e0e301d68bf3d0974784f
|
Provenance
The following attestation bundles were made for magbox-0.5.0.tar.gz:
Publisher:
python-publish.yml on TTSky98/magbox
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
magbox-0.5.0.tar.gz -
Subject digest:
9cc4c70a9f48cb341777d3fe1ef657a48c3010efc2fe6038a31420269394ddcb - Sigstore transparency entry: 1006607539
- Sigstore integration time:
-
Permalink:
TTSky98/magbox@e402de664989eaf2bc2376f0df162646ee5607d7 -
Branch / Tag:
refs/tags/v0.5.0 - Owner: https://github.com/TTSky98
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python-publish.yml@e402de664989eaf2bc2376f0df162646ee5607d7 -
Trigger Event:
release
-
Statement type:
File details
Details for the file magbox-0.5.0-py3-none-any.whl.
File metadata
- Download URL: magbox-0.5.0-py3-none-any.whl
- Upload date:
- Size: 34.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
26624341d1dcca9c245c22e57c9bb0a2e3b3b13b14aa1a21fc1d3d8129839dd8
|
|
| MD5 |
717e02411fc0bea230b84b22f03876d5
|
|
| BLAKE2b-256 |
1202b041730eb782ec0d44e2ec62a8539024c324b20709557082377c10284c47
|
Provenance
The following attestation bundles were made for magbox-0.5.0-py3-none-any.whl:
Publisher:
python-publish.yml on TTSky98/magbox
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
magbox-0.5.0-py3-none-any.whl -
Subject digest:
26624341d1dcca9c245c22e57c9bb0a2e3b3b13b14aa1a21fc1d3d8129839dd8 - Sigstore transparency entry: 1006607543
- Sigstore integration time:
-
Permalink:
TTSky98/magbox@e402de664989eaf2bc2376f0df162646ee5607d7 -
Branch / Tag:
refs/tags/v0.5.0 - Owner: https://github.com/TTSky98
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python-publish.yml@e402de664989eaf2bc2376f0df162646ee5607d7 -
Trigger Event:
release
-
Statement type: