libmolgrid Python documentation
- Home
- About
- Docs Home
- Tutorials
- libmolgrid Python documentation
- Python Docs
- molgrid.torch_bindings module
- molgrid module classes
- The
AtomTyper
class - The
CartesianGrid
class - The
CoordinateSet
class - The
ElementIndexTyper
class - The
Example
class - The
ExampleProvider
class - The
ExampleProviderSettings
class - The
ExampleVec
class - The
FileAtomMapper
class - The
FileMappedElementTyper
class - The
FileMappedGninaTyper
class - The
GninaIndexTyper
class - The
GninaVectorTyper
class - The
GridMaker
class - The
NullIndexTyper
class - The
PythonCallbackIndexTyper
class - The
PythonCallbackVectorTyper
class - The
Quaternion
class - The
SubsetAtomMapper
class - The
SubsettedElementTyper
class - The
Transform
class
- The
- Module contents
- Indices and tables
Python Docs
molgrid.torch_bindings module
- class molgrid.torch_bindings.BatchedCoords2GridFunction(*args, **kwargs)
Bases:
torch.autograd.function.Function
Layer for converting from coordinate and type tensors to a molecular grid using batched input
- static backward(ctx, grid_gradient)
Return Nx3 coordinate gradient and NxT type gradient
- static forward(ctx, gmaker, center, coords, types, radii)
coords are BxNx3, types are BxNxT, radii are BxN
- class molgrid.torch_bindings.Coords2Grid(gmaker, center=(0, 0, 0))
Bases:
torch.nn.modules.module.Module
Convert coordinates/types/radii to a grid using the provided GridMaker and grid center
- extra_repr()
Set the extra representation of the module
To print customized extra information, you should re-implement this method in your own modules. Both single-line and multi-line strings are acceptable.
- forward(coords, types, radii)
Defines the computation performed at every call.
Should be overridden by all subclasses.
Note
Although the recipe for forward pass needs to be defined within this function, one should call the
Module
instance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.
- training: bool
- class molgrid.torch_bindings.Coords2GridFunction(*args, **kwargs)
Bases:
torch.autograd.function.Function
Layer for converting from coordinate and type tensors to a molecular grid
- static backward(ctx, grid_gradient)
Return Nx3 coordinate gradient and NxT type gradient
- static forward(ctx, gmaker, center, coords, types, radii)
coords are Nx3, types are NxT, radii are N
- class molgrid.torch_bindings.Grid2CoordsGradientFunction(*args, **kwargs)
Bases:
torch.autograd.function.Function
Backwards pass of grid generation so can create graph of gradient calculation
- static backward(ctx, grad_coords, grad_types)
Return second order grid gradient
- static forward(ctx, gmaker, center, coords, types, radii, grid_gradient)
Return Nx3 coordinate gradient and NxT type gradient
- class molgrid.torch_bindings.MolDataset(*args, **kwargs)
Bases:
torch.utils.data.dataset.Dataset
A pytorch mappable dataset for molgrid training files.
Initialize mappable MolGridDataset. :param input(s): File name(s) of training example files :param typers: A tuple of AtomTypers to use :type typers: tuple :param cache_structs: retain coordinates in memory for faster training :param add_hydrogens: protonate molecules read using openbabel :param duplicate_first: clone the first coordinate set to be paired with each of the remaining (receptor-ligand pairs) :param make_vector_types: convert index types into one-hot encoded vector types :param data_root: prefix for data files :param recmolcache: precalculated molcache2 file for receptor (first molecule); if doesn’t exist, will look in data _root :param ligmolcache: precalculated molcache2 file for ligand; if doesn’t exist, will look in data_root
- static collateMolDataset(batch)
collate_fn for use in torch.utils.data.Dataloader when using the MolDataset. Returns lengths, centers, coords, types, radii, labels all padded to fit maximum size of batch
- molgrid.torch_bindings.make_grid_tensor(gridmaker, center, c)
Create appropriately sized pytorch tensor of grid densities. set_gpu_enabled can be used to control if result is located on the cpu or gpu
- molgrid.torch_bindings.tensor_as_grid(t)
Return a Grid view of tensor t
molgrid module classes
The AtomTyper
class
- class molgrid.AtomTyper
Bases:
Boost.Python.instance
Base class for all atom typers
Raises an exception This class cannot be instantiated from Python
The CartesianGrid
class
- class molgrid.CartesianGrid((object)arg1, (MGrid3f)arg2, (float3)arg3, (float)arg4) None :
Bases:
Boost.Python.instance
Wrapper around grid of type G that imposes Cartesian coordinates. Includes center and resolution and supports (eventually) interpolation.
/
- C++ signature :
void __init__(_object*,libmolgrid::ManagedGrid<float, 3ul>,float3,float)
- center((CartesianGrid)arg1) float3 :
- C++ signature :
float3 center(libmolgrid::CartesianGrid<libmolgrid::ManagedGrid<float, 3ul> > {lvalue})
- grid((CartesianGrid)arg1) MGrid3f :
- C++ signature :
libmolgrid::ManagedGrid<float, 3ul> grid(libmolgrid::CartesianGrid<libmolgrid::ManagedGrid<float, 3ul> > {lvalue})
- resolution((CartesianGrid)arg1) float :
- C++ signature :
float resolution(libmolgrid::CartesianGrid<libmolgrid::ManagedGrid<float, 3ul> > {lvalue})
The CoordinateSet
class
- class molgrid.CoordinateSet((object)arg1) None :
Bases:
Boost.Python.instance
A collection of typed atomic coordinates
Types may be specified either as an index or a dense vector. Typically, only one type formated will be initialized although a vector one-hot encoding of an index type can be created.
/
- C++ signature :
void __init__(_object*)
__init__( (object)arg1, (object)arg2 [, (AtomTyper)arg3]) -> None :
- C++ signature :
void __init__(_object*,OpenBabel::OBMol* [,libmolgrid::AtomTyper])
__init__( (object)arg1, (Grid2f)arg2, (Grid1f)arg3, (Grid1f)arg4, (int)arg5) -> None :
- C++ signature :
void __init__(_object*,libmolgrid::Grid<float, 2ul, false>,libmolgrid::Grid<float, 1ul, false>,libmolgrid::Grid<float, 1ul, false>,unsigned int)
__init__( (object)arg1, (Grid2fCUDA)arg2, (Grid1fCUDA)arg3, (Grid1fCUDA)arg4, (int)arg5) -> None :
- C++ signature :
void __init__(_object*,libmolgrid::Grid<float, 2ul, true>,libmolgrid::Grid<float, 1ul, true>,libmolgrid::Grid<float, 1ul, true>,unsigned int)
__init__( (object)arg1, (Grid2f)arg2, (Grid2f)arg3, (Grid1f)arg4) -> None :
- C++ signature :
void __init__(_object*,libmolgrid::Grid<float, 2ul, false>,libmolgrid::Grid<float, 2ul, false>,libmolgrid::Grid<float, 1ul, false>)
__init__( (object)arg1, (Grid2fCUDA)arg2, (Grid2fCUDA)arg3, (Grid1fCUDA)arg4) -> None :
- C++ signature :
void __init__(_object*,libmolgrid::Grid<float, 2ul, true>,libmolgrid::Grid<float, 2ul, true>,libmolgrid::Grid<float, 1ul, true>)
__init__( (object)arg1, (CoordinateSet)rec, (CoordinateSet)lig [, (bool)unique_index_types=True]) -> None :
- C++ signature :
void __init__(_object*,libmolgrid::CoordinateSet,libmolgrid::CoordinateSet [,bool=True])
- center((CoordinateSet)arg1) float3 :
- C++ signature :
float3 center(libmolgrid::CoordinateSet {lvalue})
- clone((CoordinateSet)arg1) CoordinateSet :
- C++ signature :
libmolgrid::CoordinateSet clone(libmolgrid::CoordinateSet {lvalue})
- property coords
coordinates
- copyTo((CoordinateSet)arg1, (Grid2f)arg2, (Grid1f)arg3, (Grid1f)arg4) int :
copy into coord/type/radii grids
- C++ signature :
unsigned long copyTo(libmolgrid::CoordinateSet,libmolgrid::Grid<float, 2ul, false>,libmolgrid::Grid<float, 1ul, false>,libmolgrid::Grid<float, 1ul, false>)
- copyTo( (CoordinateSet)arg1, (Grid2fCUDA)arg2, (Grid1fCUDA)arg3, (Grid1fCUDA)arg4) -> int :
copy into coord/type/radii grids
- C++ signature :
unsigned long copyTo(libmolgrid::CoordinateSet,libmolgrid::Grid<float, 2ul, true>,libmolgrid::Grid<float, 1ul, true>,libmolgrid::Grid<float, 1ul, true>)
- copyTo( (CoordinateSet)arg1, (Grid2f)arg2, (Grid2f)arg3, (Grid1f)arg4) -> int :
copy into coord/type/radii grids
- C++ signature :
unsigned long copyTo(libmolgrid::CoordinateSet,libmolgrid::Grid<float, 2ul, false>,libmolgrid::Grid<float, 2ul, false>,libmolgrid::Grid<float, 1ul, false>)
- copyTo( (CoordinateSet)arg1, (Grid2fCUDA)arg2, (Grid2fCUDA)arg3, (Grid1fCUDA)arg4) -> int :
copy into coord/type/radii grids
- C++ signature :
unsigned long copyTo(libmolgrid::CoordinateSet,libmolgrid::Grid<float, 2ul, true>,libmolgrid::Grid<float, 2ul, true>,libmolgrid::Grid<float, 1ul, true>)
- has_indexed_types((CoordinateSet)arg1) bool :
- C++ signature :
bool has_indexed_types(libmolgrid::CoordinateSet {lvalue})
- has_vector_types((CoordinateSet)arg1) bool :
- C++ signature :
bool has_vector_types(libmolgrid::CoordinateSet {lvalue})
- make_vector_types((CoordinateSet)arg1[, (bool)include_dummy_type=False[, (list)type_radii=[]]]) None :
convert index types to vector types in-place @param include_dummy_type - if true will create an additional type at end (has zero radii if type radii are provided is true) @param type_radii - if provided, convert radii array to be type indexed,
/
- C++ signature :
void make_vector_types(libmolgrid::CoordinateSet {lvalue} [,bool=False [,boost::python::list=[]]])
make_vector_types( (CoordinateSet)arg1 [, (bool)include_dummy_type=False [, (FloatVec)type_radii=<molgrid.molgrid.FloatVec object at 0x7ff808209350>]]) -> None :
convert index types to vector types in-place @param include_dummy_type - if true will create an additional type at end (has zero radii if type radii are provided is true) @param type_radii - if provided, convert radii array to be type indexed,
/
- C++ signature :
void make_vector_types(libmolgrid::CoordinateSet {lvalue} [,bool=False [,std::vector<float, std::allocator<float> >=<molgrid.molgrid.FloatVec object at 0x7ff808209350>]])
- property max_type
largest type index
- num_types((CoordinateSet)arg1) int :
- C++ signature :
unsigned int num_types(libmolgrid::CoordinateSet {lvalue})
- property radii
atomic radii
- size((CoordinateSet)arg1) int :
- C++ signature :
unsigned int size(libmolgrid::CoordinateSet {lvalue})
- property src
file source of coordinates
- sum_types((CoordinateSet)arg1, (Grid1f)arg2) None :
sum types across atoms
- C++ signature :
void sum_types(libmolgrid::CoordinateSet,libmolgrid::Grid<float, 1ul, false>)
- sum_types( (CoordinateSet)arg1, (Grid1fCUDA)arg2) -> None :
sum types across atoms
- C++ signature :
void sum_types(libmolgrid::CoordinateSet,libmolgrid::Grid<float, 1ul, true>)
- tocpu((CoordinateSet)arg1, (bool)arg2) None :
set memory affinity to CPU
- C++ signature :
void tocpu(libmolgrid::CoordinateSet {lvalue},bool)
- togpu((CoordinateSet)arg1, (bool)arg2) None :
set memory affinity to GPU
- C++ signature :
void togpu(libmolgrid::CoordinateSet {lvalue},bool)
- property type_index
indexed types
- property type_vector
vector types
The ElementIndexTyper
class
- class molgrid.ElementIndexTyper((object)arg1) None :
Bases:
molgrid.molgrid.AtomTyper
Calculate element types
There are quite a few elements, so should probably run this through an organic chem atom mapper that reduces to number of types. The type id is the atomic number. Any element with atomic number greater than or equal to the specified max is assigned type zero.
- C++ signature :
void __init__(_object*)
__init__( (object)arg1, (int)arg2) -> None :
- C++ signature :
void __init__(_object*,int)
- get_atom_type_index((ElementIndexTyper)arg1, (object)arg2) object :
- C++ signature :
std::pair<int, float> get_atom_type_index(libmolgrid::ElementIndexTyper {lvalue},OpenBabel::OBAtom*)
- get_type_names((ElementIndexTyper)arg1) StringVec :
- C++ signature :
std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > get_type_names(libmolgrid::ElementIndexTyper {lvalue})
- get_type_radii((ElementIndexTyper)arg1) FloatVec :
- C++ signature :
std::vector<float, std::allocator<float> > get_type_radii(libmolgrid::ElementIndexTyper {lvalue})
- num_types((ElementIndexTyper)arg1) int :
- C++ signature :
unsigned int num_types(libmolgrid::ElementIndexTyper {lvalue})
The Example
class
- class molgrid.Example((object)arg1) None :
Bases:
Boost.Python.instance
A single example represented by its typed coordinates and label(s)
/
- C++ signature :
void __init__(_object*)
- property coord_sets
- property group
- has_index_types((Example)arg1[, (int)start=0]) bool :
uses index typing
- C++ signature :
bool has_index_types(libmolgrid::Example {lvalue} [,unsigned int=0])
- has_vector_types((Example)arg1[, (int)start=0]) bool :
uses vector typing
- C++ signature :
bool has_vector_types(libmolgrid::Example {lvalue} [,unsigned int=0])
- property labels
- merge_coordinates((Example)arg1[, (int)start=0[, (bool)unique_index_types=True]]) CoordinateSet :
Combine all coordinate sets into one and return it. All coordinate sets must have the same kind of typing. The result is a copy of the input coordinates.
- param start
ignore coordinates sets prior to this index (default zero)
- param unique_indexed_types
if true, different coordinate sets will have unique, non-overlapping types
/
- C++ signature :
libmolgrid::CoordinateSet merge_coordinates(libmolgrid::Example {lvalue} [,unsigned int=0 [,bool=True]])
merge_coordinates( (Example)arg1, (Grid2f)coord, (Grid1f)type_index, (Grid1f)radius [, (int)start=0 [, (bool)unique_index_types=True]]) -> None :
Combine all coordinate sets into one. All coordinate sets must have index typing
- param coords
combined coordinates
- param type_index
combined types
- param radii
combined radii
- param start
ignore coordinates sets prior to this index (default zero)
- param unique_indexed_types
if true, different coordinate sets will have unique, non-overlapping types
/
- C++ signature :
void merge_coordinates(libmolgrid::Example {lvalue},libmolgrid::Grid<float, 2ul, false> {lvalue},libmolgrid::Grid<float, 1ul, false> {lvalue},libmolgrid::Grid<float, 1ul, false> {lvalue} [,unsigned int=0 [,bool=True]])
merge_coordinates( (Example)arg1, (Grid2f)coord, (Grid2f)type_vector, (Grid1f)radius [, (int)start=0 [, (bool)unique_index_types=True]]) -> None :
Combine all coordinate sets into one. All coordinate sets must have vector typing
- param coords
combined coordinates
- param type_index
combined types
- param radii
combined radii
- param start
ignore coordinates sets prior to this index (default zero)
- param unique_indexed_types
if true, different coordinate sets will have unique, non-overlapping types
/
- C++ signature :
void merge_coordinates(libmolgrid::Example {lvalue},libmolgrid::Grid<float, 2ul, false> {lvalue},libmolgrid::Grid<float, 2ul, false> {lvalue},libmolgrid::Grid<float, 1ul, false> {lvalue} [,unsigned int=0 [,bool=True]])
- num_coordinates((Example)arg1) int :
- C++ signature :
unsigned long num_coordinates(libmolgrid::Example {lvalue})
- num_types((Example)arg1[, (bool)unique_index_type=True]) int :
- C++ signature :
unsigned long num_types(libmolgrid::Example {lvalue} [,bool=True])
- property seqcont
- sum_types((Example)arg1, (Grid1fCUDA)sum[, (bool)unique_types=True]) None :
sum types across atoms in coordinate sets
- C++ signature :
void sum_types(libmolgrid::Example,libmolgrid::Grid<float, 1ul, true> [,bool=True])
- sum_types( (Example)arg1, (Grid1f)sum [, (bool)unique_types=True]) -> None :
sum types across atoms in coordinate sets
- C++ signature :
void sum_types(libmolgrid::Example,libmolgrid::Grid<float, 1ul, false> [,bool=True])
- tocpu((Example)arg1) None :
set memory affinity to CPU
- C++ signature :
void tocpu(libmolgrid::Example {lvalue})
- togpu((Example)arg1) None :
set memory affinity to GPU
- C++ signature :
void togpu(libmolgrid::Example {lvalue})
The ExampleProvider
class
- class molgrid.ExampleProvider((object)arg1) None :
Bases:
Boost.Python.instance
Given a file of examples, provide Example classes one at a time This contains an ExampleRefProvider, which can be configured using a single settings object if so desired, and an example extractor. Note that cache_structs is true by default which will load the entirety of the dataset into memory.
An example files contains a single example on each line where an example consists of some number of numerical labels (num_labels, will be auto-detected if not specified) followed by file paths to molecular data, all space separated.
/
- C++ signature :
void __init__(_object*)
- object __init__(tuple args, dict kwds) :
Construct an ExampleProvider using an ExampleSettings object and the desired AtomTypers for each molecule. Alternatively, specify individual settings using keyword arguments, where the keys correspond to properties of the ExampleProviderSettings class (please see that class for complete documentation of available settings).
- C++ signature :
object __init__(tuple args, dict kwds)
- get_large_epoch_num((ExampleProvider)arg1) int :
Return large epoch number, where an epoch means every example has been seen at LEAST once.
- C++ signature :
unsigned long get_large_epoch_num(libmolgrid::ExampleProvider {lvalue})
- get_small_epoch_num((ExampleProvider)arg1) int :
Return small epoch number, where an epoch means every example has been seen at MOST once.
- C++ signature :
unsigned long get_small_epoch_num(libmolgrid::ExampleProvider {lvalue})
- get_type_names((ExampleProvider)arg1) StringVec :
- C++ signature :
std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > get_type_names(libmolgrid::ExampleProvider {lvalue})
- large_epoch_size((ExampleProvider)arg1) int :
Return size of large epoch
- C++ signature :
unsigned long large_epoch_size(libmolgrid::ExampleProvider {lvalue})
- next((ExampleProvider)arg1) Example :
- C++ signature :
libmolgrid::Example next(libmolgrid::ExampleProvider {lvalue})
- next_batch((ExampleProvider)arg1[, (int)batch_size=0]) ExampleVec :
- C++ signature :
std::vector<libmolgrid::Example, std::allocator<libmolgrid::Example> > next_batch(libmolgrid::ExampleProvider {lvalue} [,unsigned int=0])
- num_labels((ExampleProvider)arg1) int :
- C++ signature :
unsigned long num_labels(libmolgrid::ExampleProvider {lvalue})
- num_types((ExampleProvider)arg1) int :
- C++ signature :
unsigned long num_types(libmolgrid::ExampleProvider {lvalue})
- populate((ExampleProvider)arg1, (str)file_name[, (int)num_labels=-1]) None :
- C++ signature :
void populate(libmolgrid::ExampleProvider {lvalue},std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > [,int=-1])
populate( (ExampleProvider)arg1, (list)file_names [, (int)num_labels=-1]) -> None :
- C++ signature :
void populate(libmolgrid::ExampleProvider {lvalue},boost::python::list [,int=-1])
- reset((ExampleProvider)arg1) None :
Reset iterator to beginning
- C++ signature :
void reset(libmolgrid::ExampleProvider {lvalue})
- settings((ExampleProvider)arg1) ExampleProviderSettings :
- C++ signature :
libmolgrid::ExampleProviderSettings settings(libmolgrid::ExampleProvider {lvalue})
- size((ExampleProvider)arg1) int :
- C++ signature :
unsigned long size(libmolgrid::ExampleProvider {lvalue})
- small_epoch_size((ExampleProvider)arg1) int :
Return size of small epoch
- C++ signature :
unsigned long small_epoch_size(libmolgrid::ExampleProvider {lvalue})
The ExampleProviderSettings
class
- class molgrid.ExampleProviderSettings((object)arg1) None :
Bases:
Boost.Python.instance
- C++ signature :
void __init__(_object*)
- property add_hydrogens
protonate read in molecule using openbabel
- property balanced
provide equal number of positive and negative examples as determined by label
- property cache_structs
retain coordinates in memory for faster training
- property data_root
prefix for data files
- property default_batch_size
default batch size
- property duplicate_first
clone the first coordinate set to be paired with each of the remaining (receptor-ligand pairs)
- property group_batch_size
slice time series (groups) by batches of this size
- property iteration_scheme
Continuous, LargeEpoch, SmallEpoch
- Type
how to iterate over examples; note that the last batch may get padded with example from the next epoch. Options are
- property labelpos
position of binary label
- property ligmolcache
precalculated molcache2 file for ligand; if doesn’t exist, will look in data_root
- property make_vector_types
convert index types into one-hot encoded vector types
- property max_group_size
maximum group size, all groups are padded out to this size; example file must contain group number in first column
- property num_copies
number of times to repeatedly produce an example
- property recmolcache
precalculated molcache2 file for receptor (first molecule); if doesn’t exist, will look in data _root
- property shuffle
randomize order of examples
- property stratify_abs
stratify based on absolute value, for cases where negative has special meaning (e.g., hinge loss indicator)
- property stratify_max
maximum range for value stratification
- property stratify_min
minimum range for value stratification
- property stratify_pos
position of label for numerical stratification
- property stratify_receptor
sample uniformly across receptors (first molecule)
- property stratify_step
step size for value stratification, together with min and max determines number of bins
The ExampleVec
class
- class molgrid.ExampleVec((object)arg1) None :
Bases:
Boost.Python.instance
- C++ signature :
void __init__(_object*)
__init__( (object)arg1, (list)arg2) -> object :
- C++ signature :
void* __init__(boost::python::api::object,boost::python::list)
- append((ExampleVec)arg1, (object)arg2) None :
- C++ signature :
void append(std::vector<libmolgrid::Example, std::allocator<libmolgrid::Example> > {lvalue},boost::python::api::object)
- extend((ExampleVec)arg1, (object)arg2) None :
- C++ signature :
void extend(std::vector<libmolgrid::Example, std::allocator<libmolgrid::Example> > {lvalue},boost::python::api::object)
- extract_label((ExampleVec)arg1, (int)arg2, (Grid1f)arg3) None :
Extract a specific label from a vector of examples, as returned by ExampleProvider.next_batch.
- param examples
vector of examples
- param labelpos
position of label
- param out
1D grid (N)
/
- C++ signature :
void extract_label(std::vector<libmolgrid::Example, std::allocator<libmolgrid::Example> >,int,libmolgrid::Grid<float, 1ul, false>)
extract_label( (ExampleVec)arg1, (int)arg2, (Grid1fCUDA)arg3) -> None :
Extract a specific label from a vector of examples, as returned by ExampleProvider.next_batch.
- param examples
vector of examples
- param labelpos
position of label
- param out
1D grid (N)
/
- C++ signature :
void extract_label(std::vector<libmolgrid::Example, std::allocator<libmolgrid::Example> >,int,libmolgrid::Grid<float, 1ul, true>)
- extract_labels((ExampleVec)arg1, (Grid2f)arg2) None :
Extract labels from a vector of examples, as returned by ExampleProvider.next_batch.
- param examples
vector of examples
- param grid
2D grid (NxL)
/
- C++ signature :
void extract_labels(std::vector<libmolgrid::Example, std::allocator<libmolgrid::Example> >,libmolgrid::Grid<float, 2ul, false>)
extract_labels( (ExampleVec)arg1, (Grid2fCUDA)arg2) -> None :
Extract labels from a vector of examples, as returned by ExampleProvider.next_batch.
- param examples
vector of examples
- param grid
2D grid (NxL)
/
- C++ signature :
void extract_labels(std::vector<libmolgrid::Example, std::allocator<libmolgrid::Example> >,libmolgrid::Grid<float, 2ul, true>)
- sum_types((ExampleVec)arg1, (Grid2fCUDA)sum[, (bool)unique_types=True]) None :
- C++ signature :
void sum_types(std::vector<libmolgrid::Example, std::allocator<libmolgrid::Example> >,libmolgrid::Grid<float, 2ul, true> [,bool=True])
sum_types( (ExampleVec)arg1, (Grid2f)sum [, (bool)unique_types=True]) -> None :
- C++ signature :
void sum_types(std::vector<libmolgrid::Example, std::allocator<libmolgrid::Example> >,libmolgrid::Grid<float, 2ul, false> [,bool=True])
The FileAtomMapper
class
- class molgrid.FileAtomMapper((object)arg1, (str)arg2, (StringVec)arg3) None :
Bases:
Boost.Python.instance
Atom mappers ************ Map atom types based on provided file.
Each line for the provided file specifies a single type. Types are specified using type names. This class must be provided the type names properly indexed (should match get_type_names).
/
- C++ signature :
void __init__(_object*,std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >,std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > >)
- get_new_type((FileAtomMapper)arg1, (int)arg2) int :
- C++ signature :
int get_new_type(libmolgrid::FileAtomMapper {lvalue},unsigned int)
- get_type_names((FileAtomMapper)arg1) StringVec :
- C++ signature :
std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > get_type_names(libmolgrid::FileAtomMapper {lvalue})
- num_types((FileAtomMapper)arg1) int :
- C++ signature :
unsigned int num_types(libmolgrid::FileAtomMapper {lvalue})
The FileMappedElementTyper
class
- class molgrid.FileMappedElementTyper((object)arg1, (str)fname[, (int)maxe=84]) None :
Bases:
molgrid.molgrid.AtomTyper
- C++ signature :
void __init__(_object*,std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > [,unsigned int=84])
- get_atom_type_index((FileMappedElementTyper)arg1, (object)arg2) object :
- C++ signature :
std::pair<int, float> get_atom_type_index(libmolgrid::FileMappedElementTyper {lvalue},OpenBabel::OBAtom*)
- get_type_names((FileMappedElementTyper)arg1) StringVec :
- C++ signature :
std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > get_type_names(libmolgrid::FileMappedElementTyper {lvalue})
- get_type_radii((FileMappedElementTyper)arg1) FloatVec :
- C++ signature :
std::vector<float, std::allocator<float> > get_type_radii(libmolgrid::FileMappedElementTyper {lvalue})
- num_types((FileMappedElementTyper)arg1) int :
- C++ signature :
unsigned int num_types(libmolgrid::FileMappedElementTyper {lvalue})
The FileMappedGninaTyper
class
- class molgrid.FileMappedGninaTyper((object)arg1, (str)fname[, (bool)use_covalent_radius=False]) None :
Bases:
molgrid.molgrid.AtomTyper
- C++ signature :
void __init__(_object*,std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > [,bool=False])
- get_atom_type_index((FileMappedGninaTyper)arg1, (object)arg2) object :
- C++ signature :
std::pair<int, float> get_atom_type_index(libmolgrid::FileMappedGninaTyper {lvalue},OpenBabel::OBAtom*)
- get_type_names((FileMappedGninaTyper)arg1) StringVec :
- C++ signature :
std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > get_type_names(libmolgrid::FileMappedGninaTyper {lvalue})
- get_type_radii((FileMappedGninaTyper)arg1) FloatVec :
- C++ signature :
std::vector<float, std::allocator<float> > get_type_radii(libmolgrid::FileMappedGninaTyper {lvalue})
- num_types((FileMappedGninaTyper)arg1) int :
- C++ signature :
unsigned int num_types(libmolgrid::FileMappedGninaTyper {lvalue})
The GninaIndexTyper
class
- class molgrid.GninaIndexTyper((object)arg1) None :
Bases:
molgrid.molgrid.AtomTyper
Atom typers ************ Calculate gnina types
These are variants of AutoDock4 types.
- C++ signature :
void __init__(_object*)
__init__( (object)arg1, (bool)arg2) -> None :
- C++ signature :
void __init__(_object*,bool)
- get_atom_type_index((GninaIndexTyper)arg1, (object)arg2) object :
- C++ signature :
std::pair<int, float> get_atom_type_index(libmolgrid::GninaIndexTyper {lvalue},OpenBabel::OBAtom*)
- get_type_names((GninaIndexTyper)arg1) StringVec :
- C++ signature :
std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > get_type_names(libmolgrid::GninaIndexTyper {lvalue})
- get_type_radii((GninaIndexTyper)arg1) FloatVec :
- C++ signature :
std::vector<float, std::allocator<float> > get_type_radii(libmolgrid::GninaIndexTyper {lvalue})
- num_types((GninaIndexTyper)arg1) int :
- C++ signature :
unsigned int num_types(libmolgrid::GninaIndexTyper {lvalue})
The GridMaker
class
- class molgrid.GridMaker((object)arg1[, (float)resolution=0.5[, (float)dimension=23.5[, (bool)binary=False[, (bool)radius_type_indexed=False[, (float)radius_scale=1.0[, (float)gaussian_radius_multiple=1.0]]]]]]) None :
Bases:
Boost.Python.instance
GridMaker Populates a grid with atom density values that correspond to atoms in a CoordinateSet and accumulates atomic gradients from the grid gradients. It stores state about universal grid settings. In functions that map from atomic coordinates to grids and vice versa (e.g. forward and backward), it must be passed the grid_center (which may have changed due to transformations performed directly on the atom coordinates externally to this class)
/
- C++ signature :
void __init__(_object* [,float=0.5 [,float=23.5 [,bool=False [,bool=False [,float=1.0 [,float=1.0]]]]]])
- backward((GridMaker)arg1, (float3)arg2, (CoordinateSet)arg3, (Grid4f)arg4, (Grid2f)arg5, (Grid2f)arg6) None :
Generate atom and type gradients from grid gradients. (CPU) Must provide atom coordinates that defined the original grid in forward Vector types are required.
- param center
of grid
- param coordinate
set
- param a
4D grid of gradients
- param atomic_gradients
vector quantities for each atom
- param type_gradients
only set if input has type vectors
/
- C++ signature :
void backward(libmolgrid::GridMaker {lvalue},float3,libmolgrid::CoordinateSet,libmolgrid::Grid<float, 4ul, false>,libmolgrid::Grid<float, 2ul, false>,libmolgrid::Grid<float, 2ul, false>)
backward( (GridMaker)arg1, (float3)arg2, (CoordinateSet)arg3, (Grid4f)arg4, (Grid2f)arg5) -> None :
Generate atom gradients from grid gradients. (CPU) Must provide atom coordinates that defined the original grid in forward Index types are required
- param center
of grid
- param coordinate
set
- param a
4D grid of gradients
- param atomic_gradients
vector quantities for each atom
/
- C++ signature :
void backward(libmolgrid::GridMaker {lvalue},float3,libmolgrid::CoordinateSet,libmolgrid::Grid<float, 4ul, false>,libmolgrid::Grid<float, 2ul, false>)
backward( (GridMaker)arg1, (float3)arg2, (CoordinateSet)arg3, (Grid4fCUDA)arg4, (Grid2fCUDA)arg5, (Grid2fCUDA)arg6) -> None :
Generate atom and type gradients from grid gradients. (GPU) Must provide atom coordinates that defined the original grid in forward Vector types are required.
- param center
of grid
- param coordinate
set
- param a
4D grid of gradients
- param atomic_gradients
vector quantities for each atom
- param type_gradients
only set if input has type vectors
/
- C++ signature :
void backward(libmolgrid::GridMaker {lvalue},float3,libmolgrid::CoordinateSet,libmolgrid::Grid<float, 4ul, true>,libmolgrid::Grid<float, 2ul, true>,libmolgrid::Grid<float, 2ul, true>)
backward( (GridMaker)arg1, (float3)arg2, (CoordinateSet)arg3, (Grid4fCUDA)arg4, (Grid2fCUDA)arg5) -> None :
Generate atom gradients from grid gradients. (GPU) Must provide atom coordinates that defined the original grid in forward Index types are required.
- param center
of grid
- param coordinate
set
- param diff
a 4D grid of gradients
- param atomic_gradients
vector quantities for each atom
/
- C++ signature :
void backward(libmolgrid::GridMaker {lvalue},float3,libmolgrid::CoordinateSet,libmolgrid::Grid<float, 4ul, true>,libmolgrid::Grid<float, 2ul, true>)
backward( (GridMaker)arg1, (float3)arg2, (Grid2f)arg3, (Grid1f)arg4, (Grid1f)arg5, (Grid4f)arg6, (Grid2f)arg7) -> None :
Generate atom gradients from grid gradients. (CPU) Must provide atom coordinates, types, and radii that defined the original grid in forward
- param center
of grid
- param coordinates
(Nx3)
- param type
indices (N integers stored as floats)
- param radii
- param a
4D grid of gradients
- param atomic_gradients
vector quantities for each atom
/
- C++ signature :
void backward(libmolgrid::GridMaker {lvalue},float3,libmolgrid::Grid<float, 2ul, false>,libmolgrid::Grid<float, 1ul, false>,libmolgrid::Grid<float, 1ul, false>,libmolgrid::Grid<float, 4ul, false>,libmolgrid::Grid<float, 2ul, false>)
backward( (GridMaker)arg1, (float3)arg2, (Grid2fCUDA)arg3, (Grid1fCUDA)arg4, (Grid1fCUDA)arg5, (Grid4fCUDA)arg6, (Grid2fCUDA)arg7) -> None :
Generate atom gradients from grid gradients. (GPU) Must provide atom coordinates, types, and radii that defined the original grid in forward
- param center
of grid
- param coordinates
(Nx3)
- param type
indices (N integers stored as floats)
- param radii
- param a
4D grid of gradients
- param atomic_gradients
vector quantities for each atom
/
- C++ signature :
void backward(libmolgrid::GridMaker {lvalue},float3,libmolgrid::Grid<float, 2ul, true>,libmolgrid::Grid<float, 1ul, true>,libmolgrid::Grid<float, 1ul, true>,libmolgrid::Grid<float, 4ul, true>,libmolgrid::Grid<float, 2ul, true>)
backward( (GridMaker)arg1, (float3)arg2, (Grid2f)arg3, (Grid2f)arg4, (Grid1f)arg5, (Grid4f)arg6, (Grid2f)arg7, (Grid2f)arg8) -> None :
Generate atom and type gradients from grid gradients. (CPU) Must provide atom coordinates, types, and radii that defined the original grid in forward
- param center
of grid
- param coordinates
(Nx3)
- param type
vectors (NxT)
- param radii
- param a
4D grid of gradients
- param atomic_gradients
vector quantities for each atom
- param type_gradients
vector quantities for each atom
/
- C++ signature :
void backward(libmolgrid::GridMaker {lvalue},float3,libmolgrid::Grid<float, 2ul, false>,libmolgrid::Grid<float, 2ul, false>,libmolgrid::Grid<float, 1ul, false>,libmolgrid::Grid<float, 4ul, false>,libmolgrid::Grid<float, 2ul, false>,libmolgrid::Grid<float, 2ul, false>)
backward( (GridMaker)arg1, (float3)arg2, (Grid2fCUDA)arg3, (Grid2fCUDA)arg4, (Grid1fCUDA)arg5, (Grid4fCUDA)arg6, (Grid2fCUDA)arg7, (Grid2fCUDA)arg8) -> None :
Generate atom gradients from grid gradients. (GPU) Must provide atom coordinates, types, and radii that defined the original grid in forward
- param center
of grid
- param coordinates
(Nx3)
- param type
vectors (NxT)
- param radii
- param a
4D grid of gradients
- param atomic_gradients
vector quantities for each atom
- param type_gradients
vector quantities for each atom
/
- C++ signature :
void backward(libmolgrid::GridMaker {lvalue},float3,libmolgrid::Grid<float, 2ul, true>,libmolgrid::Grid<float, 2ul, true>,libmolgrid::Grid<float, 1ul, true>,libmolgrid::Grid<float, 4ul, true>,libmolgrid::Grid<float, 2ul, true>,libmolgrid::Grid<float, 2ul, true>)
- backward_gradients((GridMaker)arg1, (float3)arg2, (Grid2f)arg3, (Grid2f)arg4, (Grid1f)arg5, (Grid4f)arg6, (Grid2f)arg7, (Grid2f)arg8, (Grid4f)arg9, (Grid2f)arg10, (Grid2f)arg11) None :
Generate gradients of atom/type gradients. (CPU) Must provide atom coordinates, types, and radii that defined the original grid in forward and grid gradients from backward.
- param center
of grid
- param coordinates
(Nx3)
- param type
vectors (NxT)
- param radii
- param a
4D grid of gradients
- param atomic_gradients
vector quantities for each atom
- param type_gradients
vector quantities for each atom
- param diffdiff
a 4D grid of gradients of gradients
- param atom_diffdiff
vector quantities for each atom
- param type_diffdiff
vector quantities for each atom*
/
- C++ signature :
void backward_gradients(libmolgrid::GridMaker {lvalue},float3,libmolgrid::Grid<float, 2ul, false>,libmolgrid::Grid<float, 2ul, false>,libmolgrid::Grid<float, 1ul, false>,libmolgrid::Grid<float, 4ul, false>,libmolgrid::Grid<float, 2ul, false>,libmolgrid::Grid<float, 2ul, false>,libmolgrid::Grid<float, 4ul, false>,libmolgrid::Grid<float, 2ul, false>,libmolgrid::Grid<float, 2ul, false>)
backward_gradients( (GridMaker)arg1, (float3)arg2, (Grid2fCUDA)arg3, (Grid2fCUDA)arg4, (Grid1fCUDA)arg5, (Grid4fCUDA)arg6, (Grid2fCUDA)arg7, (Grid2fCUDA)arg8, (Grid4fCUDA)arg9, (Grid2fCUDA)arg10, (Grid2fCUDA)arg11) -> None :
Generate gradients of atom/type gradients. (GPU) Must provide atom coordinates, types, and radii that defined the original grid in forward and grid gradients from backward.
- param center
of grid
- param coordinates
(Nx3)
- param type
vectors (NxT)
- param radii
- param a
4D grid of gradients
- param atomic_gradients
vector quantities for each atom
- param type_gradients
vector quantities for each atom
- param diffdiff
a 4D grid of gradients of gradients
- param atom_diffdiff
vector quantities for each atom
- param type_diffdiff
vector quantities for each atom*
/
- C++ signature :
void backward_gradients(libmolgrid::GridMaker {lvalue},float3,libmolgrid::Grid<float, 2ul, true>,libmolgrid::Grid<float, 2ul, true>,libmolgrid::Grid<float, 1ul, true>,libmolgrid::Grid<float, 4ul, true>,libmolgrid::Grid<float, 2ul, true>,libmolgrid::Grid<float, 2ul, true>,libmolgrid::Grid<float, 4ul, true>,libmolgrid::Grid<float, 2ul, true>,libmolgrid::Grid<float, 2ul, true>)
backward_gradients( (GridMaker)arg1, (float3)arg2, (CoordinateSet)arg3, (Grid4f)arg4, (Grid2f)arg5, (Grid2f)arg6, (Grid4f)arg7, (Grid2f)arg8, (Grid2f)arg9) -> None :
Generate gradients of atom/type gradients. (CPU) Must provide CoordinateSet that defined the original grid in forward and grid gradients from backward.
- param in
coordinate set
- param a
4D grid of gradients
- param atomic_gradients
vector quantities for each atom
- param type_gradients
vector quantities for each atom
- param diffdiff
a 4D grid of gradients of gradients
- param atom_diffdiff
vector quantities for each atom
- param type_diffdiff
vector quantities for each atom*
/
- C++ signature :
void backward_gradients(libmolgrid::GridMaker {lvalue},float3,libmolgrid::CoordinateSet,libmolgrid::Grid<float, 4ul, false>,libmolgrid::Grid<float, 2ul, false>,libmolgrid::Grid<float, 2ul, false>,libmolgrid::Grid<float, 4ul, false>,libmolgrid::Grid<float, 2ul, false>,libmolgrid::Grid<float, 2ul, false>)
backward_gradients( (GridMaker)arg1, (float3)arg2, (CoordinateSet)arg3, (Grid4fCUDA)arg4, (Grid2fCUDA)arg5, (Grid2fCUDA)arg6, (Grid4fCUDA)arg7, (Grid2fCUDA)arg8, (Grid2fCUDA)arg9) -> None :
Generate gradients of atom/type gradients. (GPU) Must provide CoordinateSet that defined the original grid in forward and grid gradients from backward.
- param in
coordinate set
- param a
4D grid of gradients
- param atomic_gradients
vector quantities for each atom
- param type_gradients
vector quantities for each atom
- param diffdiff
a 4D grid of gradients of gradients
- param atom_diffdiff
vector quantities for each atom
- param type_diffdiff
vector quantities for each atom
/
- C++ signature :
void backward_gradients(libmolgrid::GridMaker {lvalue},float3,libmolgrid::CoordinateSet,libmolgrid::Grid<float, 4ul, true>,libmolgrid::Grid<float, 2ul, true>,libmolgrid::Grid<float, 2ul, true>,libmolgrid::Grid<float, 4ul, true>,libmolgrid::Grid<float, 2ul, true>,libmolgrid::Grid<float, 2ul, true>)
- forward((GridMaker)arg1, (Example)example, (Grid4f)grid[, (float)random_translation=0.0[, (bool)random_rotation=False]]) None :
Generate CPU grid tensor from an example. Coordinates may be optionally translated/rotated. Do not use this function if it is desirable to retain the transformation used (e.g., when backpropagating). The center of the last coordinate set before transformation will be used as the grid center.
- param in
example
- param out
a 4D grid
- param random_translation
maximum amount to randomly translate each coordinate (+/-)
- param random_rotation
whether or not to randomly rotate
- C++ signature :
void forward(libmolgrid::GridMaker {lvalue},libmolgrid::Example,libmolgrid::Grid<float, 4ul, false> [,float=0.0 [,bool=False]])
forward( (GridMaker)arg1, (Example)example, (Grid4fCUDA)grid [, (float)random_translation=0.0 [, (bool)random_rotation=False]]) -> None :
Generate GPU grid tensor from an example. Coordinates may be optionally translated/rotated. Do not use this function if it is desirable to retain the transformation used (e.g., when backpropagating). The center of the last coordinate set before transformation will be used as the grid center.
- param in
example
- param out
a 4D grid
- param random_translation
maximum amount to randomly translate each coordinate (+/-)
- param random_rotation
whether or not to randomly rotate
- C++ signature :
void forward(libmolgrid::GridMaker {lvalue},libmolgrid::Example,libmolgrid::Grid<float, 4ul, true> [,float=0.0 [,bool=False]])
forward( (GridMaker)arg1, (ExampleVec)examplevec, (Grid5f)grid [, (float)random_translation=0.0 [, (bool)random_rotation=False]]) -> None :
Generate grid tensor from a vector of examples, as provided by ExampleProvider.next_batch. Coordinates may be optionally translated/rotated. Do not use this function if it is desirable to retain the transformation used (e.g., when backpropagating). The center of the last coordinate set before transformation will be used as the grid center.
- param example
- param a
4D grid
- param maximum
amount to randomly translate each coordinate (+/-)
- param whether
or not to randomly rotate
/
- C++ signature :
void forward(libmolgrid::GridMaker {lvalue},std::vector<libmolgrid::Example, std::allocator<libmolgrid::Example> >,libmolgrid::Grid<float, 5ul, false> [,float=0.0 [,bool=False]])
forward( (GridMaker)arg1, (ExampleVec)examples, (Grid5fCUDA)grid [, (float)random_translation=0.0 [, (bool)random_rotation=False]]) -> None :
Generate grid tensor from a vector of examples, as provided by ExampleProvider.next_batch. Coordinates may be optionally translated/rotated. Do not use this function if it is desirable to retain the transformation used (e.g., when backpropagating). The center of the last coordinate set before transformation will be used as the grid center.
- param example
- param a
4D grid
- param maximum
amount to randomly translate each coordinate (+/-)
- param whether
or not to randomly rotate
/
- C++ signature :
void forward(libmolgrid::GridMaker {lvalue},std::vector<libmolgrid::Example, std::allocator<libmolgrid::Example> >,libmolgrid::Grid<float, 5ul, true> [,float=0.0 [,bool=False]])
forward( (GridMaker)arg1, (float3)arg2, (CoordinateSet)arg3, (Grid4f)arg4) -> None :
Generate grid tensor from atomic data. Grid (CPU) must be properly sized.
- param center
of grid
- param coordinate
set
- param a
4D grid
/
- C++ signature :
void forward(libmolgrid::GridMaker {lvalue},float3,libmolgrid::CoordinateSet,libmolgrid::Grid<float, 4ul, false>)
forward( (GridMaker)arg1, (float3)arg2, (CoordinateSet)arg3, (Grid4fCUDA)arg4) -> None :
Generate grid tensor from atomic data. Grid (GPU) must be properly sized.
- param center
of grid
- param coordinate
set
- param a
4D grid
/
- C++ signature :
void forward(libmolgrid::GridMaker {lvalue},float3,libmolgrid::CoordinateSet,libmolgrid::Grid<float, 4ul, true>)
forward( (GridMaker)arg1, (Example)arg2, (Transform)arg3, (Grid4f)arg4) -> None :
Generate grid tensor from an example while applying a transformation. The center specified in the transform will be used as the grid center.
- param example
- param transformation
to apply
- param a
4D grid
/
- C++ signature :
void forward(libmolgrid::GridMaker {lvalue},libmolgrid::Example,libmolgrid::Transform,libmolgrid::Grid<float, 4ul, false>)
forward( (GridMaker)arg1, (Example)arg2, (Transform)arg3, (Grid4fCUDA)arg4) -> None :
Generate grid tensor from an example while applying a transformation. The center specified in the transform will be used as the grid center.
- param example
- param transformation
to apply
- param a
4D grid
/
- C++ signature :
void forward(libmolgrid::GridMaker {lvalue},libmolgrid::Example,libmolgrid::Transform,libmolgrid::Grid<float, 4ul, true>)
forward( (GridMaker)arg1, (float3)arg2, (Grid2f)arg3, (Grid1f)arg4, (Grid1f)arg5, (Grid4f)arg6) -> None :
Generate grid tensor from CPU atomic data. Grid must be properly sized.
- param center
of grid
- param coordinates
(Nx3)
- param indices
(N integers stored as floats)
- param radii
- param a
4D grid
/
- C++ signature :
void forward(libmolgrid::GridMaker {lvalue},float3,libmolgrid::Grid<float, 2ul, false>,libmolgrid::Grid<float, 1ul, false>,libmolgrid::Grid<float, 1ul, false>,libmolgrid::Grid<float, 4ul, false> {lvalue})
forward( (GridMaker)arg1, (float3)arg2, (Grid2fCUDA)arg3, (Grid1fCUDA)arg4, (Grid1fCUDA)arg5, (Grid4fCUDA)arg6) -> None :
Generate grid tensor from GPU atomic data. Grid must be properly sized.
- param center
of grid
- param coordinates
(Nx3)
- param indices
(N integers stored as floats)
- param radii
- param a
4D grid
/
- C++ signature :
void forward(libmolgrid::GridMaker {lvalue},float3,libmolgrid::Grid<float, 2ul, true>,libmolgrid::Grid<float, 1ul, true>,libmolgrid::Grid<float, 1ul, true>,libmolgrid::Grid<float, 4ul, true> {lvalue})
forward( (GridMaker)arg1, (float3)arg2, (Grid2f)arg3, (Grid2f)arg4, (Grid1f)arg5, (Grid4f)arg6) -> None :
Generate grid tensor from CPU atomic data. Grid must be properly sized.
- param center
of grid
- param coordinates
(Nx3)
- param vectors
(NxT)
- param radii
or (T)
- param a
4D grid
/
- C++ signature :
void forward(libmolgrid::GridMaker {lvalue},float3,libmolgrid::Grid<float, 2ul, false>,libmolgrid::Grid<float, 2ul, false>,libmolgrid::Grid<float, 1ul, false>,libmolgrid::Grid<float, 4ul, false>)
forward( (GridMaker)arg1, (float3)arg2, (Grid2fCUDA)arg3, (Grid2fCUDA)arg4, (Grid1fCUDA)arg5, (Grid4fCUDA)arg6) -> None :
Generate grid tensor from GPU atomic data. Grid must be properly sized.
- param center
of grid
- param coordinates
(Nx3)
- param vector
indices (NxT)
- param radii
or (T) depending on if radii_type_indexed is set
- param a
4D grid
/
- C++ signature :
void forward(libmolgrid::GridMaker {lvalue},float3,libmolgrid::Grid<float, 2ul, true>,libmolgrid::Grid<float, 2ul, true>,libmolgrid::Grid<float, 1ul, true>,libmolgrid::Grid<float, 4ul, true>)
forward( (GridMaker)arg1, (Grid2f)arg2, (Grid3f)arg3, (Grid2f)arg4, (Grid2f)arg5, (Grid5f)arg6) -> None :
Generate grid tensors from batched atomic data. Grid must be properly sized.
- param centers
of grid (Bx3)
- param coordinates
(BxNx3)
- param type
vectors (BxNxT) or type indices (BxN)
- param radii
(BxN) or (BxT)
- param a
5D grid
/
- C++ signature :
void forward(libmolgrid::GridMaker {lvalue},libmolgrid::Grid<float, 2ul, false>,libmolgrid::Grid<float, 3ul, false>,libmolgrid::Grid<float, 2ul, false>,libmolgrid::Grid<float, 2ul, false>,libmolgrid::Grid<float, 5ul, false>)
forward( (GridMaker)arg1, (Grid2fCUDA)arg2, (Grid3fCUDA)arg3, (Grid2fCUDA)arg4, (Grid2fCUDA)arg5, (Grid5fCUDA)arg6) -> None :
Generate grid tensors from batched atomic data. Grid must be properly sized.
- param centers
of grid (Bx3)
- param coordinates
(BxNx3)
- param type
vectors (BxNxT) or type indices (BxN)
- param radii
(BxN) or (BxT)
- param a
5D grid
/
- C++ signature :
void forward(libmolgrid::GridMaker {lvalue},libmolgrid::Grid<float, 2ul, true>,libmolgrid::Grid<float, 3ul, true>,libmolgrid::Grid<float, 2ul, true>,libmolgrid::Grid<float, 2ul, true>,libmolgrid::Grid<float, 5ul, true>)
forward( (GridMaker)arg1, (Grid2f)arg2, (Grid3f)arg3, (Grid3f)arg4, (Grid2f)arg5, (Grid5f)arg6) -> None :
Generate grid tensors from batched atomic data. Grid must be properly sized.
- param centers
of grid (Bx3)
- param coordinates
(BxNx3)
- param type
vectors (BxNxT) or type indices (BxN)
- param radii
(BxN) or (BxT)
- param a
5D grid
/
- C++ signature :
void forward(libmolgrid::GridMaker {lvalue},libmolgrid::Grid<float, 2ul, false>,libmolgrid::Grid<float, 3ul, false>,libmolgrid::Grid<float, 3ul, false>,libmolgrid::Grid<float, 2ul, false>,libmolgrid::Grid<float, 5ul, false>)
forward( (GridMaker)arg1, (Grid2fCUDA)arg2, (Grid3fCUDA)arg3, (Grid3fCUDA)arg4, (Grid2fCUDA)arg5, (Grid5fCUDA)arg6) -> None :
Generate grid tensors from batched atomic data. Grid must be properly sized.
- param centers
of grid (Bx3)
- param coordinates
(BxNx3)
- param type
vectors (BxNxT) or type indices (BxN)
- param radii
(BxN) or (BxT)
- param a
5D grid
/
- C++ signature :
void forward(libmolgrid::GridMaker {lvalue},libmolgrid::Grid<float, 2ul, true>,libmolgrid::Grid<float, 3ul, true>,libmolgrid::Grid<float, 3ul, true>,libmolgrid::Grid<float, 2ul, true>,libmolgrid::Grid<float, 5ul, true>)
- get_binary((GridMaker)arg1) bool :
- C++ signature :
bool get_binary(libmolgrid::GridMaker {lvalue})
- get_dimension((GridMaker)arg1) float :
- C++ signature :
float get_dimension(libmolgrid::GridMaker {lvalue})
- get_radii_type_indexed((GridMaker)arg1) bool :
- C++ signature :
bool get_radii_type_indexed(libmolgrid::GridMaker {lvalue})
- get_resolution((GridMaker)arg1) float :
- C++ signature :
float get_resolution(libmolgrid::GridMaker {lvalue})
- grid_dimensions((GridMaker)arg1, (int)arg2) tuple :
- C++ signature :
boost::python::tuple grid_dimensions(libmolgrid::GridMaker {lvalue},int)
- make_ndarray(center, c)
Create appropriately sized numpy array of grid densities.
- make_tensor(center, c)
Create appropriately sized pytorch tensor of grid densities. set_gpu_enabled can be used to control if result is located on the cpu or gpu
- set_binary((GridMaker)arg1, (bool)arg2) None :
- C++ signature :
void set_binary(libmolgrid::GridMaker {lvalue},bool)
- set_dimension((GridMaker)arg1, (float)arg2) None :
- C++ signature :
void set_dimension(libmolgrid::GridMaker {lvalue},float)
- set_radii_type_indexed((GridMaker)arg1, (bool)arg2) None :
- C++ signature :
void set_radii_type_indexed(libmolgrid::GridMaker {lvalue},bool)
- set_resolution((GridMaker)arg1, (float)arg2) None :
- C++ signature :
void set_resolution(libmolgrid::GridMaker {lvalue},float)
- spatial_grid_dimensions((GridMaker)arg1) tuple :
- C++ signature :
boost::python::tuple spatial_grid_dimensions(libmolgrid::GridMaker {lvalue})
- tonumpy()
Return a numpy array copy of grid g
The NullIndexTyper
class
- class molgrid.NullIndexTyper((object)arg1) None :
Bases:
molgrid.molgrid.AtomTyper
Always return an invalid type
- C++ signature :
void __init__(_object*)
- get_atom_type_index((NullIndexTyper)arg1, (object)arg2) object :
- C++ signature :
std::pair<int, float> get_atom_type_index(libmolgrid::NullIndexTyper {lvalue},OpenBabel::OBAtom*)
- get_type_names((NullIndexTyper)arg1) StringVec :
- C++ signature :
std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > get_type_names(libmolgrid::NullIndexTyper {lvalue})
- get_type_radii((NullIndexTyper)arg1) FloatVec :
- C++ signature :
std::vector<float, std::allocator<float> > get_type_radii(libmolgrid::NullIndexTyper {lvalue})
- num_types((NullIndexTyper)arg1) int :
- C++ signature :
unsigned int num_types(libmolgrid::NullIndexTyper {lvalue})
The PythonCallbackIndexTyper
class
- class molgrid.PythonCallbackIndexTyper((object)arg1, (object)func, (int)num_types[, (list)names=[]]) None :
Bases:
molgrid.molgrid.AtomTyper
- C++ signature :
void __init__(_object*,boost::python::api::object,unsigned int [,boost::python::list=[]])
- get_atom_type_index((PythonCallbackIndexTyper)arg1, (object)arg2) object :
- C++ signature :
std::pair<int, float> get_atom_type_index(PythonCallbackIndexTyper {lvalue},boost::python::api::object)
- get_type_names((PythonCallbackIndexTyper)arg1) StringVec :
- C++ signature :
std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > get_type_names(PythonCallbackIndexTyper {lvalue})
- num_types((PythonCallbackIndexTyper)arg1) int :
- C++ signature :
unsigned int num_types(PythonCallbackIndexTyper {lvalue})
The PythonCallbackVectorTyper
class
- class molgrid.PythonCallbackVectorTyper((object)arg1, (object)func, (int)num_types[, (list)names=[]]) None :
Bases:
molgrid.molgrid.AtomTyper
- C++ signature :
void __init__(_object*,boost::python::api::object,unsigned int [,boost::python::list=[]])
- get_atom_type_vector((PythonCallbackVectorTyper)arg1, (object)arg2) tuple :
- C++ signature :
boost::python::tuple get_atom_type_vector(PythonCallbackVectorTyper {lvalue},boost::python::api::object)
- get_type_names((PythonCallbackVectorTyper)arg1) StringVec :
- C++ signature :
std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > get_type_names(PythonCallbackVectorTyper {lvalue})
- num_types((PythonCallbackVectorTyper)arg1) int :
- C++ signature :
unsigned int num_types(PythonCallbackVectorTyper {lvalue})
The Quaternion
class
- class molgrid.Quaternion((object)arg1) None :
Bases:
Boost.Python.instance
A CUDA friendly quaternion class. Single precision only for maximum CUDA performance.
/
- C++ signature :
void __init__(_object*)
__init__( (object)arg1, (float)arg2, (float)arg3, (float)arg4, (float)arg5) -> None :
- C++ signature :
void __init__(_object*,float,float,float,float)
- R_component_1((Quaternion)arg1) float :
- C++ signature :
float R_component_1(libmolgrid::Quaternion {lvalue})
- R_component_2((Quaternion)arg1) float :
- C++ signature :
float R_component_2(libmolgrid::Quaternion {lvalue})
- R_component_3((Quaternion)arg1) float :
- C++ signature :
float R_component_3(libmolgrid::Quaternion {lvalue})
- R_component_4((Quaternion)arg1) float :
- C++ signature :
float R_component_4(libmolgrid::Quaternion {lvalue})
- conj((Quaternion)arg1) Quaternion :
- C++ signature :
libmolgrid::Quaternion conj(libmolgrid::Quaternion {lvalue})
- inverse((Quaternion)arg1) Quaternion :
- C++ signature :
libmolgrid::Quaternion inverse(libmolgrid::Quaternion {lvalue})
- norm((Quaternion)arg1) float :
- C++ signature :
float norm(libmolgrid::Quaternion {lvalue})
- real((Quaternion)arg1) float :
- C++ signature :
float real(libmolgrid::Quaternion {lvalue})
- rotate((Quaternion)arg1, (float)x, (float)y, (float)z) float3 :
- C++ signature :
float3 rotate(libmolgrid::Quaternion {lvalue},float,float,float)
- transform((Quaternion)arg1, (float)arg2, (float)arg3, (float)arg4, (float3)arg5, (float3)arg6) float3 :
- C++ signature :
float3 transform(libmolgrid::Quaternion {lvalue},float,float,float,float3,float3)
The SubsetAtomMapper
class
- class molgrid.SubsetAtomMapper((object)arg1, (object)arg2, (bool)arg3) None :
Bases:
Boost.Python.instance
Map atom types onto a provided subset.
/
- C++ signature :
void __init__(_object*,std::vector<int, std::allocator<int> >,bool)
__init__( (object)arg1, (object)arg2, (bool)arg3) -> None :
- C++ signature :
void __init__(_object*,std::vector<std::vector<int, std::allocator<int> >, std::allocator<std::vector<int, std::allocator<int> > > >,bool)
__init__( (object)arg1, (object)arg2, (bool)arg3, (StringVec)arg4) -> None :
- C++ signature :
void __init__(_object*,std::vector<int, std::allocator<int> > {lvalue},bool,std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > >)
__init__( (object)arg1, (object)arg2, (bool)arg3, (StringVec)arg4) -> None :
- C++ signature :
void __init__(_object*,std::vector<std::vector<int, std::allocator<int> >, std::allocator<std::vector<int, std::allocator<int> > > > {lvalue},bool,std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > >)
__init__( (object)arg1, (list)map [, (bool)catchall=True [, (StringVec)old_names=<molgrid.molgrid.StringVec object at 0x7ff808209200>]]) -> object :
- C++ signature :
void* __init__(boost::python::api::object,boost::python::list [,bool=True [,std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > >=<molgrid.molgrid.StringVec object at 0x7ff808209200>]])
- get_new_type((SubsetAtomMapper)arg1, (int)arg2) int :
- C++ signature :
int get_new_type(libmolgrid::SubsetAtomMapper {lvalue},unsigned int)
- get_type_names((SubsetAtomMapper)arg1) StringVec :
- C++ signature :
std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > get_type_names(libmolgrid::SubsetAtomMapper {lvalue})
- num_types((SubsetAtomMapper)arg1) int :
- C++ signature :
unsigned int num_types(libmolgrid::SubsetAtomMapper {lvalue})
The SubsettedElementTyper
class
- class molgrid.SubsettedElementTyper((object)arg1, (list)map[, (bool)catchall=True[, (int)maxe=84]]) object :
Bases:
molgrid.molgrid.AtomTyper
- C++ signature :
void* __init__(boost::python::api::object,boost::python::list [,bool=True [,unsigned int=84]])
- get_atom_type_index((SubsettedElementTyper)arg1, (object)arg2) object :
- C++ signature :
std::pair<int, float> get_atom_type_index(libmolgrid::SubsettedElementTyper {lvalue},OpenBabel::OBAtom*)
- get_type_names((SubsettedElementTyper)arg1) StringVec :
- C++ signature :
std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > get_type_names(libmolgrid::SubsettedElementTyper {lvalue})
- get_type_radii((SubsettedElementTyper)arg1) FloatVec :
- C++ signature :
std::vector<float, std::allocator<float> > get_type_radii(libmolgrid::SubsettedElementTyper {lvalue})
- num_types((SubsettedElementTyper)arg1) int :
- C++ signature :
unsigned int num_types(libmolgrid::SubsettedElementTyper {lvalue})
The Transform
class
- class molgrid.Transform((object)arg1) None :
Bases:
Boost.Python.instance
Stateful transformation of Cartesian coordinates.
Stores a center of rotation, quaternion, and translation. Can apply transformation forward or backward, with or without translations.
/
- C++ signature :
void __init__(_object*)
__init__( (object)arg1, (Quaternion)arg2) -> None :
- C++ signature :
void __init__(_object*,libmolgrid::Quaternion)
__init__( (object)arg1, (Quaternion)arg2, (float3)arg3) -> None :
- C++ signature :
void __init__(_object*,libmolgrid::Quaternion,float3)
__init__( (object)arg1, (Quaternion)arg2, (float3)arg3, (float3)arg4) -> None :
- C++ signature :
void __init__(_object*,libmolgrid::Quaternion,float3,float3)
__init__( (object)arg1, (float3)center [, (float)random_translate=0.0 [, (bool)random_rotation=False]]) -> None :
- C++ signature :
void __init__(_object*,float3 [,float=0.0 [,bool=False]])
- backward((Transform)arg1, (Grid2f)in, (Grid2f)out[, (bool)dotranslate=True]) None :
Apply inverse of 3D transformation on CPU.
- param in
Nx3 input grid
- param out
Nx3 output grid (will be overwritten)
- param dotranslate
if false only the inverse rotation is applied
/
- C++ signature :
void backward(libmolgrid::Transform {lvalue},libmolgrid::Grid<float, 2ul, false>,libmolgrid::Grid<float, 2ul, false> [,bool=True])
backward( (Transform)arg1, (Grid2fCUDA)in, (Grid2fCUDA)out [, (bool)dotranslate=True]) -> None :
Apply inverse of 3D transformation on GPU.
- param in
Nx3 input grid
- param out
Nx3 output grid (will be overwritten)
- param dotranslate
if false only the inverse rotation is applied
/
- C++ signature :
void backward(libmolgrid::Transform {lvalue},libmolgrid::Grid<float, 2ul, true>,libmolgrid::Grid<float, 2ul, true> [,bool=True])
- forward((Transform)arg1, (Grid2f)in, (Grid2f)out[, (bool)dotranslate=True]) None :
Apply 3D transformation on CPU. It is safe to transform a grid in-place.
- param in
Nx3 input grid
- param out
Nx3 output grid (will be overwritten)
- param dotranslate
if false only a rotation around the origin is applied. (This is for vector quantities such as gradients and normals).
/
- C++ signature :
void forward(libmolgrid::Transform {lvalue},libmolgrid::Grid<float, 2ul, false>,libmolgrid::Grid<float, 2ul, false> [,bool=True])
forward( (Transform)arg1, (Grid2fCUDA)in, (Grid2fCUDA)out [, (bool)dotranslate=True]) -> None :
Apply 3D transformation on GPU. It is safe to transform a grid in-place.
- param in
Nx3 input grid
- param out
Nx3 output grid (will be overwritten)
- param dotranslate
if false only a rotation around the origin is applied. (This is for vector quantities such as gradients and normals).
/
- C++ signature :
void forward(libmolgrid::Transform {lvalue},libmolgrid::Grid<float, 2ul, true>,libmolgrid::Grid<float, 2ul, true> [,bool=True])
forward( (Transform)arg1, (CoordinateSet)in, (CoordinateSet)out [, (bool)dotranslate=True]) -> None :
Apply 3D transformation to CoordinateSet. It is safe to transform in-place
- param input
coords
- param output
coords with same dimensions
- param dotranslate
if false only a rotation around the origin is applied. (This is for vector quantities such as gradients and normals).
/
- C++ signature :
void forward(libmolgrid::Transform {lvalue},libmolgrid::CoordinateSet,libmolgrid::CoordinateSet {lvalue} [,bool=True])
forward( (Transform)arg1, (Example)in, (Example)out [, (bool)dotranslate=True]) -> None :
Apply 3D transformation to Example. It is safe to transform in-place
- param input
example
- param output
example with same dimensions
- param dotranslate
if false only a rotation around the origin is applied. (This is for vector quantities such as gradients and normals).
/
- C++ signature :
void forward(libmolgrid::Transform {lvalue},libmolgrid::Example,libmolgrid::Example {lvalue} [,bool=True])
- get_quaternion((Transform)arg1) Quaternion :
- C++ signature :
libmolgrid::Quaternion get_quaternion(libmolgrid::Transform {lvalue})
- get_rotation_center((Transform)arg1) float3 :
- C++ signature :
float3 get_rotation_center(libmolgrid::Transform {lvalue})
- get_translation((Transform)arg1) float3 :
- C++ signature :
float3 get_translation(libmolgrid::Transform {lvalue})
- set_quaternion((Transform)arg1, (Quaternion)arg2) None :
- C++ signature :
void set_quaternion(libmolgrid::Transform {lvalue},libmolgrid::Quaternion)
- set_rotation_center((Transform)arg1, (float3)arg2) None :
- C++ signature :
void set_rotation_center(libmolgrid::Transform {lvalue},float3)
- set_translation((Transform)arg1, (float3)arg2) None :
- C++ signature :
void set_translation(libmolgrid::Transform {lvalue},float3)
Module contents
- molgrid.get_gpu_device() int :
Get current GPU device.
- C++ signature :
int get_gpu_device()
- molgrid.get_gpu_enabled() bool :
Get if generated grids are on GPU by default.
- C++ signature :
bool get_gpu_enabled()
- molgrid.read_dx((str)arg1) CartesianGrid :
Read in dx formatted grid and return initialized grid
- C++ signature :
libmolgrid::CartesianGrid<libmolgrid::ManagedGrid<float, 3ul> > read_dx(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >)
- molgrid.read_dx_grids((str)arg1, (StringVec)arg2, (Grid4f)arg3) None :
Read multiple grids using type names as a suffix. Grids must be correctly sized
- Parameters
prefix – filename will have form [prefix]_[typename].dx
names – must have same size as first dimension of grid
grid – input grids
/
- C++ signature :
void read_dx_grids(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >,std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > >,libmolgrid::Grid<float, 4ul, false>)
- molgrid.set_gpu_device((int)arg1) None :
Set current GPU device.
- C++ signature :
void set_gpu_device(int)
- molgrid.set_gpu_enabled((bool)arg1) None :
Set if generated grids should be on GPU by default.
- C++ signature :
void set_gpu_enabled(bool)
- molgrid.set_random_seed((int)arg1) None :
- C++ signature :
void set_random_seed(long)
- molgrid.tonumpy(g)
Return a numpy array copy of grid g
- molgrid.write_dx((str)file_name, (Grid3f)grid, (float3)center, (float)resolution[, (float)scale=1.0]) None :
output grid as dx formatted file Values are multiplied by scale, which may be necessary to adjust for limited precision in the text-based format
/
- C++ signature :
void write_dx(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >,libmolgrid::Grid<float, 3ul, false>,float3,float [,float=1.0])
- molgrid.write_dx_grids((str)prefix, (StringVec)type_names, (Grid4f)grid, (float3)center, (float)resolution[, (float)scale=1.0]) None :
Output multiple grids using type names as a suffix.
- Parameters
prefix – filename will have form [prefix]_[typename].dx
names – must have same size as first dimension of grid
grid – input grids
center –
resolution –
scale – multiply each value by this factor
/
- C++ signature :
void write_dx_grids(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >,std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > >,libmolgrid::Grid<float, 4ul, false>,float3,float [,float=1.0])
- molgrid.write_map((str)file_name, (Grid3f)grid, (float3)center, (float)resolution[, (float)scale=1.0]) None :
- C++ signature :
void write_map(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >,libmolgrid::Grid<float, 3ul, false>,float3,float [,float=1.0])