Other
Docking@Home
English
molecular-docking
drug-discovery
distributed-computing
autodock
boinc
chemistry
biology
agent
computational-chemistry
bioinformatics
gpu-acceleration
distributed-network
decentralized
Instructions to use OpenPeerAI/DockingAtHOME with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Docking@Home
How to use OpenPeerAI/DockingAtHOME with Docking@Home:
# No code snippets available yet for this library. # To use this model, check the repository files and the library's documentation. # Want to help? PRs adding snippets are welcome at: # https://github.com/huggingface/huggingface.js
- Notebooks
- Google Colab
- Kaggle
| /** | |
| * @file autodock_gpu.cuh | |
| * @brief CUDA/CUDPP-accelerated AutoDock molecular docking engine | |
| * | |
| * This header defines GPU-accelerated molecular docking algorithms using | |
| * CUDA and CUDPP primitives for high-performance parallel docking. | |
| * | |
| * @authors OpenPeer AI, Riemann Computing Inc., Bleunomics, Andrew Magdy Kamal | |
| * @version 1.0.0 | |
| * @date 2025 | |
| */ | |
| namespace docking_at_home { | |
| namespace autodock { | |
| /** | |
| * @struct Atom | |
| * @brief Represents an atom in 3D space | |
| */ | |
| struct Atom { | |
| float x, y, z; // Coordinates | |
| int type; // Atom type | |
| float charge; // Partial charge | |
| float radius; // Van der Waals radius | |
| }; | |
| /** | |
| * @struct Ligand | |
| * @brief Represents a ligand molecule | |
| */ | |
| struct Ligand { | |
| std::vector<Atom> atoms; | |
| int num_rotatable_bonds; | |
| float center_x, center_y, center_z; | |
| std::string name; | |
| }; | |
| /** | |
| * @struct Receptor | |
| * @brief Represents a receptor (protein) molecule | |
| */ | |
| struct Receptor { | |
| std::vector<Atom> atoms; | |
| float grid_min_x, grid_min_y, grid_min_z; | |
| float grid_max_x, grid_max_y, grid_max_z; | |
| float grid_spacing; | |
| std::string name; | |
| }; | |
| /** | |
| * @struct DockingParameters | |
| * @brief Parameters for docking simulation | |
| */ | |
| struct DockingParameters { | |
| int num_runs; // Number of docking runs | |
| int num_evals; // Number of energy evaluations | |
| int population_size; // GA population size | |
| float rmsd_tolerance; // RMSD clustering tolerance | |
| int max_generations; // Maximum GA generations | |
| float mutation_rate; // GA mutation rate | |
| float crossover_rate; // GA crossover rate | |
| bool use_local_search; // Enable local search | |
| int num_threads_per_block; // CUDA threads per block | |
| int num_blocks; // CUDA blocks | |
| }; | |
| /** | |
| * @struct DockingPose | |
| * @brief Represents a docking pose (conformation) | |
| */ | |
| struct DockingPose { | |
| float translation[3]; // Translation vector | |
| float rotation[4]; // Quaternion rotation | |
| std::vector<float> torsions; // Torsion angles | |
| float binding_energy; // Binding energy (kcal/mol) | |
| float intermolecular_energy; | |
| float internal_energy; | |
| float torsional_energy; | |
| float rank; | |
| }; | |
| /** | |
| * @class AutoDockGPU | |
| * @brief GPU-accelerated AutoDock implementation | |
| */ | |
| class AutoDockGPU { | |
| public: | |
| AutoDockGPU(); | |
| ~AutoDockGPU(); | |
| /** | |
| * @brief Initialize GPU resources | |
| * @param device_id CUDA device ID | |
| * @return true if initialization successful | |
| */ | |
| bool initialize(int device_id = 0); | |
| /** | |
| * @brief Load ligand from PDBQT file | |
| * @param filename Path to ligand file | |
| * @param ligand Output ligand structure | |
| * @return true if loading successful | |
| */ | |
| bool load_ligand(const std::string& filename, Ligand& ligand); | |
| /** | |
| * @brief Load receptor from PDBQT file | |
| * @param filename Path to receptor file | |
| * @param receptor Output receptor structure | |
| * @return true if loading successful | |
| */ | |
| bool load_receptor(const std::string& filename, Receptor& receptor); | |
| /** | |
| * @brief Perform molecular docking | |
| * @param ligand Input ligand | |
| * @param receptor Input receptor | |
| * @param params Docking parameters | |
| * @param poses Output vector of docking poses | |
| * @return true if docking successful | |
| */ | |
| bool dock(const Ligand& ligand, | |
| const Receptor& receptor, | |
| const DockingParameters& params, | |
| std::vector<DockingPose>& poses); | |
| /** | |
| * @brief Get GPU device information | |
| * @return Device info string | |
| */ | |
| std::string get_device_info(); | |
| /** | |
| * @brief Get performance metrics | |
| * @return Metrics string | |
| */ | |
| std::string get_performance_metrics(); | |
| /** | |
| * @brief Cleanup GPU resources | |
| */ | |
| void cleanup(); | |
| private: | |
| bool is_initialized_; | |
| int device_id_; | |
| cudaDeviceProp device_prop_; | |
| CUDPPHandle cudpp_handle_; | |
| // Device memory pointers | |
| Atom* d_ligand_atoms_; | |
| Atom* d_receptor_atoms_; | |
| float* d_energy_grid_; | |
| float* d_population_; | |
| float* d_energies_; | |
| // Host memory | |
| size_t ligand_atoms_size_; | |
| size_t receptor_atoms_size_; | |
| // Performance tracking | |
| float total_computation_time_; | |
| int total_evaluations_; | |
| // Private methods | |
| bool allocate_device_memory(const Ligand& ligand, const Receptor& receptor); | |
| bool transfer_to_device(const Ligand& ligand, const Receptor& receptor); | |
| bool compute_energy_grid(const Receptor& receptor); | |
| bool run_genetic_algorithm(const DockingParameters& params, | |
| std::vector<DockingPose>& poses); | |
| bool cluster_results(std::vector<DockingPose>& poses, float rmsd_tolerance); | |
| void free_device_memory(); | |
| }; | |
| // CUDA kernel declarations | |
| /** | |
| * @brief Calculate pairwise energy between atoms (GPU kernel) | |
| */ | |
| __global__ void calculate_energy_kernel( | |
| const Atom* ligand_atoms, | |
| const Atom* receptor_atoms, | |
| int num_ligand_atoms, | |
| int num_receptor_atoms, | |
| float* energies | |
| ); | |
| /** | |
| * @brief Genetic algorithm population evaluation (GPU kernel) | |
| */ | |
| __global__ void evaluate_population_kernel( | |
| const float* population, | |
| const Atom* ligand_atoms, | |
| const Atom* receptor_atoms, | |
| const float* energy_grid, | |
| float* fitness_values, | |
| int population_size, | |
| int num_genes | |
| ); | |
| /** | |
| * @brief Genetic algorithm crossover operator (GPU kernel) | |
| */ | |
| __global__ void crossover_kernel( | |
| float* population, | |
| const float* parent_indices, | |
| float crossover_rate, | |
| int population_size, | |
| int num_genes, | |
| unsigned long long seed | |
| ); | |
| /** | |
| * @brief Genetic algorithm mutation operator (GPU kernel) | |
| */ | |
| __global__ void mutation_kernel( | |
| float* population, | |
| float mutation_rate, | |
| int population_size, | |
| int num_genes, | |
| unsigned long long seed | |
| ); | |
| /** | |
| * @brief Local search optimization (GPU kernel) | |
| */ | |
| __global__ void local_search_kernel( | |
| float* population, | |
| const float* energy_grid, | |
| float* fitness_values, | |
| int population_size, | |
| int num_genes, | |
| int num_iterations | |
| ); | |
| /** | |
| * @brief RMSD calculation for clustering (GPU kernel) | |
| */ | |
| __global__ void rmsd_kernel( | |
| const DockingPose* poses, | |
| float* rmsd_matrix, | |
| int num_poses | |
| ); | |
| /** | |
| * @brief Sort poses by energy using CUDPP | |
| */ | |
| bool sort_poses_by_energy(DockingPose* d_poses, int num_poses, CUDPPHandle cudpp); | |
| /** | |
| * @brief Parallel reduction to find minimum energy using CUDPP | |
| */ | |
| bool find_min_energy(const float* d_energies, int num_energies, | |
| float& min_energy, CUDPPHandle cudpp); | |
| } // namespace autodock | |
| } // namespace docking_at_home | |