Skip to main content

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是求解得到的磁矩值,第一个维度表示时间,第二维度表示空间,第三个维度表示自旋空间xyzstats包含了求解器信息,err_info包含了误差信息。

目前支持的相互作用

  1. 外磁场。
  2. 单轴各项异性。
  3. 海森堡交换耦合。

开发计划

  1. 支持更多的相互作用。
  2. 支持更多的晶格类型。
  3. 添加频域求解,直接求解能带。
  4. 添加批处理支持。

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

magbox-0.4.6.tar.gz (168.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

magbox-0.4.6-py3-none-any.whl (30.4 kB view details)

Uploaded Python 3

File details

Details for the file magbox-0.4.6.tar.gz.

File metadata

  • Download URL: magbox-0.4.6.tar.gz
  • Upload date:
  • Size: 168.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for magbox-0.4.6.tar.gz
Algorithm Hash digest
SHA256 e1d5f18d3028a7c0317c22ce724c7eb4c2cd8945bd8b704c90e767e52b17a528
MD5 07a6b9b6c60818002c2f429aeb3b4e4d
BLAKE2b-256 2148e02176865bf42b81cada6ed000a38b158e760dec7d334d41936064fb32b2

See more details on using hashes here.

Provenance

The following attestation bundles were made for magbox-0.4.6.tar.gz:

Publisher: python-publish.yml on TTSky98/magbox

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file magbox-0.4.6-py3-none-any.whl.

File metadata

  • Download URL: magbox-0.4.6-py3-none-any.whl
  • Upload date:
  • Size: 30.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for magbox-0.4.6-py3-none-any.whl
Algorithm Hash digest
SHA256 3169b432853a78aa5762811d80ce3616d7dee35e676c1f12a2611c4dac0a27aa
MD5 7c738d5de2c67716f70fa180e387d6c3
BLAKE2b-256 8f40d02000a9ee0ec11b2df1d1d0aa6ebb05311ddeb11af7b200d9aa249b8b82

See more details on using hashes here.

Provenance

The following attestation bundles were made for magbox-0.4.6-py3-none-any.whl:

Publisher: python-publish.yml on TTSky98/magbox

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

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