A python package simulating the quasi-2D pseudospin-1/2 Gross-Pitaevskii equation with NVIDIA GPU acceleration.

Overview
docs/_static/final_logo.png

A python package simulating the quasi-2D pseudospin-1/2 Gross-Pitaevskii equation with NVIDIA GPU acceleration.

Introduction

spinor-gpe is high-level, object-oriented Python package for numerically solving the quasi-2D, psuedospinor (two component) Gross-Piteavskii equation (GPE), for both ground state solutions and real-time dynamics. This project grew out of a desire to make high-performance simulations of the GPE more accessible to the entering researcher.

While this package is primarily built on NumPy, the main computational heavy-lifting is performed using PyTorch, a deep neural network library commonly used in machine learning applications. PyTorch has a NumPy-like interface, but a backend that can run either on a conventional processor or a CUDA-enabled NVIDIA(R) graphics card. Accessing a CUDA device will provide a significant hardware acceleration of the simulations.

This package has been tested on Windows, Mac, and Linux systems.

View the documentation on ReadTheDocs

Installation

Dependencies

Primary packages:

  1. PyTorch >= 1.8.0
  2. cudatoolkit >= 11.1
  3. NumPy

Other packages:

  1. matplotlib (visualizing results)
  2. tqdm (progress messages)
  3. scikit-image (matrix signal processing)
  4. ffmpeg = 4.3.1 (animation generation)

Installing Dependencies

The dependencies for spinor-gpe can be installed directly into the new conda virtual environment spinor using the environment.yml file included with the package:

conda env create --file environment.yml

This installation may take a while.

Note

The version of CUDA used in this package does not support macOS. Users on these computers may still install PyTorch and run the examples on their CPU. To install correctly on macOS, remove the - cudatoolkit=11.1 line from the environment.yml file. After installation, you will need to modify the example code to run on the cpu device instead of the cuda device.

The above dependencies can also be installed manually using conda into a virtual environment:

conda activate <new_virt_env_name>
conda install pytorch torchvision torchaudio cudatoolkit=11.1 -c pytorch -c conda-forge
conda install numpy matplotlib tqdm scikit-image ffmpeg spyder

Note

For more information on installing PyTorch, see its installation instructions page.

To verify that Pytorch was installed correctly, you should be able to import it:

>>> import torch
>>> x = torch.rand(5, 3)
>>> print(x)
tensor([[0.2757, 0.3957, 0.9074],
        [0.6304, 0.1279, 0.7565],
        [0.0946, 0.7667, 0.2934],
        [0.9395, 0.4782, 0.9530],
        [0.2400, 0.0020, 0.9569]])

Also, if you have an NVIDIA GPU, you can test that it is available for GPU computing:

>>> torch.cuda.is_available()
True

CUDA Installation

CUDA is the API that interfaces with the computing resources on NVIDIA graphics cards, and it can be accessed through the PyTorch package. If your computer has an NVIDIA graphics card, start by verifying that it is CUDA-compatible. This page lists out the compute capability of many NVIDIA devices. (Note: yours may still be CUDA-compatible even if it is not listed here.)

Given that your graphics card can run CUDA, the following are the steps to install CUDA on a Windows computer:

  1. Install the NVIDIA CUDA Toolkit. Go to the CUDA download page for the most recent version. Select the operating system options and installer type. Download the installer and install it via the wizard on the screen. This may take a while. For reference, here is the Windows CUDA Toolkit installation guide.

    To test that CUDA is installed, run which nvcc, and, if instlled correctly, will return the installation path. Also run nvcc --version to verify that the version of CUDA matches the PyTorch CUDA toolkit version (>=11.1).

  2. Download the correct drivers for your NVIDIA device. Once the driver is installed, you will have the NVIDIA Control Panel installed on your computer.

Getting Started

  1. Clone the repository.
  2. Navigate to the spinor_gpe/examples/ directory, and start to experiment with the examples there.

Basic Operation

This package has a simple, object-oriented interface for imaginary- and real-time propagations of the pseudospinor-GPE. While there are other operations and features to this package, all simulations will have the following basic structure:

1. Setup: Data path and PSpinor object

>>> import pspinor as spin
>>> DATA_PATH = '<project_name>/Trial_###'
>>> ps = spin.PSpinor(DATA_PATH)

The program will create a new directory DATA_PATH, in which the data and results from this simulation trial will be saved. If DATA_PATH is a relative path, as shown above, then the trial data will be located in the /data/ folder. When working with multiple simulation projects, it can be helpful to specify a <project_name> directory; furthermore, the form Trial_### is convenient, but not strictly required.

2. Run: Begin Propagation

The example below demonstrates imaginary-time propagation. The method PSpinor.imaginary performs the propagation loop and returns a PropResult object. This object contains the results, including the final wavefunctions and populations, and analysis and plotting methods (described below).

>>> DT = 1/50
>>> N_STEPS = 1000
>>> DEVICE = 'cuda'
>>> res = ps.imaginary(DT, N_STEPS, DEVICE, is_sampling=True, n_samples=50)

For real-time propagation, use the method PSpinor.real.

3. Analyze: Plot the results

PropResult provides several methods for viewing and understanding the final results. The code block below demonstrates several of them:

>>> res.plot_spins()  # Plots the spin-dependent densities and phases.
>>> res.plot_total()  # Plots the total densities and phases.
>>> res.plot_pops()   # Plots the spin populations throughout the propagation.
>>> res.make_movie()  # Generates a movie from the sampled wavefunctions.

Note that PSpinor also exposes methods to plot the spin and total densities. These can be used independent of PropResult:

>>> ps.plot_spins()

4. Repeat

Likely you will want to repeat or chain together different segments of this structure. Demonstrations of this are shown in the Examples gallery.

Teaches a student network from the knowledge obtained via training of a larger teacher network

Distilling-the-knowledge-in-neural-network Teaches a student network from the knowledge obtained via training of a larger teacher network This is an i

Abhishek Sinha 146 Dec 11, 2022
A Comprehensive Study on Learning-Based PE Malware Family Classification Methods

A Comprehensive Study on Learning-Based PE Malware Family Classification Methods Datasets Because of copyright issues, both the MalwareBazaar dataset

8 Oct 21, 2022
nanodet_plus,yolov5_v6.0

OAK_Detection OAK设备上适配nanodet_plus,yolov5_v6.0 Environment pytorch = 1.7.0

炼丹去了 1 Feb 18, 2022
Deep functional residue identification

DeepFRI Deep functional residue identification Citing @article {Gligorijevic2019, author = {Gligorijevic, Vladimir and Renfrew, P. Douglas and Koscio

Flatiron Institute 156 Dec 25, 2022
Open AI's Python library

OpenAI Python Library The OpenAI Python library provides convenient access to the OpenAI API from applications written in the Python language. It incl

Pavan Ananth Sharma 3 Jul 10, 2022
TiP-Adapter: Training-free CLIP-Adapter for Better Vision-Language Modeling

TiP-Adapter: Training-free CLIP-Adapter for Better Vision-Language Modeling This is the official code release for the paper 'TiP-Adapter: Training-fre

peng gao 189 Jan 04, 2023
Pytorch implementation of “Recursive Non-Autoregressive Graph-to-Graph Transformer for Dependency Parsing with Iterative Refinement”

Graph-to-Graph Transformers Self-attention models, such as Transformer, have been hugely successful in a wide range of natural language processing (NL

Idiap Research Institute 40 Aug 14, 2022
Implementation of "StrengthNet: Deep Learning-based Emotion Strength Assessment for Emotional Speech Synthesis"

StrengthNet Implementation of "StrengthNet: Deep Learning-based Emotion Strength Assessment for Emotional Speech Synthesis" https://arxiv.org/abs/2110

RuiLiu 65 Dec 20, 2022
A Deep Reinforcement Learning Framework for Stock Market Trading

DQN-Trading This is a framework based on deep reinforcement learning for stock market trading. This project is the implementation code for the two pap

61 Jan 01, 2023
Code for NAACL 2021 full paper "Efficient Attentions for Long Document Summarization"

LongDocSum Code for NAACL 2021 paper "Efficient Attentions for Long Document Summarization" This repository contains data and models needed to reprodu

56 Jan 02, 2023
A package for music online and offline rhythmic information analysis including music Beat, downbeat, tempo and meter tracking.

BeatNet A package for music online and offline rhythmic information analysis including music Beat, downbeat, tempo and meter tracking. This repository

Mojtaba Heydari 157 Dec 27, 2022
We will see a basic program that is basically a hint to brute force attack to crack passwords. In other words, we will make a program to Crack Any Password Using Python. Show some ❤️ by starring this repository!

Crack Any Password Using Python We will see a basic program that is basically a hint to brute force attack to crack passwords. In other words, we will

Ananya Chatterjee 11 Dec 03, 2022
DALL-Eval: Probing the Reasoning Skills and Social Biases of Text-to-Image Generative Transformers

DALL-Eval: Probing the Reasoning Skills and Social Biases of Text-to-Image Generative Transformers Authors: Jaemin Cho, Abhay Zala, and Mohit Bansal (

Jaemin Cho 98 Dec 15, 2022
Official PyTorch implementation of RobustNet (CVPR 2021 Oral)

RobustNet (CVPR 2021 Oral): Official Project Webpage Codes and pretrained models will be released soon. This repository provides the official PyTorch

Sungha Choi 173 Dec 21, 2022
TransPrompt - Towards an Automatic Transferable Prompting Framework for Few-shot Text Classification

TransPrompt This code is implement for our EMNLP 2021's paper 《TransPrompt:Towards an Automatic Transferable Prompting Framework for Few-shot Text Cla

WangJianing 23 Dec 21, 2022
Neural Koopman Lyapunov Control

Neural-Koopman-Lyapunov-Control Code for our paper: Neural Koopman Lyapunov Control Requirements dReal4: v4.19.02.1 PyTorch: 1.2.0 The learning framew

Vrushabh Zinage 6 Dec 24, 2022
Putting NeRF on a Diet: Semantically Consistent Few-Shot View Synthesis

Putting NeRF on a Diet: Semantically Consistent Few-Shot View Synthesis Website | ICCV paper | arXiv | Twitter This repository contains the official i

Ajay Jain 73 Dec 27, 2022
This is the official PyTorch implementation for "Mesa: A Memory-saving Training Framework for Transformers".

Mesa: A Memory-saving Training Framework for Transformers This is the official PyTorch implementation for Mesa: A Memory-saving Training Framework for

Zhuang AI Group 105 Dec 06, 2022
Codebase for arXiv preprint "NeRF++: Analyzing and Improving Neural Radiance Fields"

NeRF++ Codebase for arXiv preprint "NeRF++: Analyzing and Improving Neural Radiance Fields" Work with 360 capture of large-scale unbounded scenes. Sup

Kai Zhang 722 Dec 28, 2022
Vertical Federated Principal Component Analysis and Its Kernel Extension on Feature-wise Distributed Data based on Pytorch Framework

VFedPCA+VFedAKPCA This is the official source code for the Paper: Vertical Federated Principal Component Analysis and Its Kernel Extension on Feature-

John 9 Sep 18, 2022