Commit db67ed54 authored by Chris Kerr's avatar Chris Kerr

Merge branch 'master' of git.embl.de:ckerr/galumph

parents af542895 e2656907
# GALUMPH #
Calculate ALM (scattering amplitude decomposed into spherical harmonics) using GPU acceleration.
Calculate ALM (scattering amplitude decomposed into spherical harmonics) at Hyperspeed using GPU acceleration.
This is a preliminary implementation using PyOpenCL.
Example code:
```python
import numpy as np
import Bio.PDB
import periodictable
import galumph
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)
atomalm = galumph.AtomAlm(LMAX, s)
## 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
atomalm.add_many_atoms(xyz, ff)
Icalc = atomalm.sum_intensity()
```
\ No newline at end of file
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment