gnina / libmolgrid

Comprehensive library for fast, GPU accelerated molecular gridding for deep learning workflows
https://gnina.github.io/libmolgrid/
Apache License 2.0
137 stars 45 forks source link

General Question about AtomTyping #116

Closed GregorySchwing closed 11 months ago

GregorySchwing commented 11 months ago

I am working through the "grid a single molecule" tutorial, with a different molecule from a smile string.

https://github.com/GregorySchwing/libmolgrid/blob/development/tutorials/gridmolecule_smiles.ipynb

The molecule is

image

being gridded into multiple different channels.

Figure 2(1)

I am confused as to what each channel in the tensor represents.

gmaker = molgrid.GridMaker() dims = gmaker.grid_dimensions(molgrid.defaultGninaLigandTyper.num_types()) gridtensor = torch.zeros(dims,dtype=torch.float32)

forward( (GridMaker)arg1, (float3)arg2, (CoordinateSet)arg3, (Grid4fCUDA)arg4) -> None :

Generate grid tensor from atomic data. Grid (GPU) must be properly sized.

gmaker.forward(c.center(),c,gridtensor) print(gridtensor.shape) torch.Size([14, 48, 48, 48])

I think the axis, of length 14, is the different atom types. Is that correct?

However, the molecule only consists of C, H, O, which is 3 different atom types?

Any insight into what's going on would be appreciated.

dkoes commented 11 months ago

Yes, the first axis are the atom types. Which channel is which atom type is predetermined. Think of an image - if there was no red in it would you expect it to only have two channels instead of RGB? Also, the default atom types have four different types of carbon and two types of oxygen, so you might have as many as 6 channels with non zero values.

GregorySchwing commented 11 months ago

That makes sense. I appreciate your response.