Skip to main content

GALUMPH

pipeline status

Calculate ALM (scattering amplitude decomposed into spherical harmonics) at Hyperspeed using GPU acceleration.

This is a preliminary implementation using PyOpenCL.

Example code:

import numpy as np
import Bio.PDB
import periodictable
import pyopencl
import galumph


ctx = pyopencl.create_some_context()

NS = 4096   # Number of S values at which to calculate the scattering
smax = 1.0  # Maximum S value
LMAX = 63   # Maximum harmonic order to use for the calculations

## Initialise the S array and allocate the ALM storage on the GPU
s = np.linspace(0, smax, NS)
kernel = galumph.AtomicScattering(LMAX, s, ctx=ctx)

## Use Bio.PDB to read the structure and periodictable to calculate the atomic form factors
pdb = Bio.PDB.PDBParser().get_structure("6lyz", "6lyz.pdb")
xyz = np.array([aa.get_vector().get_array() for aa in pdb.get_atoms()])
ff = np.array([periodictable.elements.symbol(aa.element).xray.f0(s) for aa in pdb.get_atoms()])

## Run the GPU calculation
alm = kernel.zeros()
kernel.add_many_atoms(alm, xyz, ff)
Icalc = kernel.sum_intensity(alm)

Download files

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

Source Distribution

galumph-0.3.0.tar.gz (37.2 kB view details)

Uploaded Source

Built Distribution

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

galumph-0.3.0-py3-none-any.whl (34.0 kB view details)

Uploaded Python 3

File details

Details for the file galumph-0.3.0.tar.gz.

File metadata

  • Download URL: galumph-0.3.0.tar.gz
  • Upload date:
  • Size: 37.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.21.0 setuptools/46.3.1 requests-toolbelt/0.9.1 tqdm/4.28.1 CPython/3.7.3

File hashes

Hashes for galumph-0.3.0.tar.gz
Algorithm Hash digest
SHA256 7a132b529f378e2ce56e0abbea3b1c923fdd556d22a95c72de1ff73eeb62b715
MD5 f6d7a2c7cc06279caf7f5f13ea0f6563
BLAKE2b-256 417362f45c396b0f9cee79e0e9aeabc07d7df91962db06efc221edfec688dd1d

See more details on using hashes here.

File details

Details for the file galumph-0.3.0-py3-none-any.whl.

File metadata

  • Download URL: galumph-0.3.0-py3-none-any.whl
  • Upload date:
  • Size: 34.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.21.0 setuptools/46.3.1 requests-toolbelt/0.9.1 tqdm/4.28.1 CPython/3.7.3

File hashes

Hashes for galumph-0.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 2fe83340cd14a5ae06e161074a064afbd1b0ca8928c1162dc34b8a65c2dc5e94
MD5 1d1ea29bb90dc8846b1d082761fca828
BLAKE2b-256 ab54ac897f7fecfabae2e069599639721a075e7dc09c494ab76776c2c0cfd3f0

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

0.3.0 This release

2 files

Supported by

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