{"id":8720,"library":"torch-dftd","title":"Torch-DFTD","description":"torch-dftd is a Python library providing a PyTorch implementation of the DFT-D2 and DFT-D3 dispersion correction models for quantum chemistry calculations. It leverages PyTorch's automatic differentiation capabilities to efficiently compute energies, forces, and virials. The library is currently at version 0.5.3, released on March 11, 2026. While it has seen recent updates, its GitHub repository indicates that it is \"not actively maintained\".","status":"maintenance","version":"0.5.3","language":"python","source_language":"en","source_url":"https://github.com/pfnet-research/torch-dftd","tags":["pytorch","dftd","quantum chemistry","dispersion correction","ase","computational chemistry","autodiff"],"install":[{"cmd":"pip install torch-dftd","lang":"bash","label":"Install latest version"}],"dependencies":[{"reason":"Core deep learning framework for tensor operations and autodifferentiation.","package":"torch","optional":false},{"reason":"Atomic Simulation Environment, used for creating and manipulating atomic structures (e.g., `ase.build.molecule`, `ase.Atoms`). Required for common use cases.","package":"ase","optional":false},{"reason":"Required for accelerating 3-body terms on specific CUDA versions for GPU computation. Only needed if using 3-body terms and a compatible CUDA setup.","package":"cupy-cuda12x","optional":true}],"imports":[{"wrong":"from torch_dftd import TorchDFTD3Calculator","symbol":"TorchDFTD3Calculator","correct":"from torch_dftd import TorchDFTD3Calculator"}],"quickstart":{"code":"import torch\nimport ase.build\nfrom torch_dftd.torch_dftd3_calculator import TorchDFTD3Calculator\n\n# Create an ASE Atoms object for methanol\natoms = ase.build.molecule(\"CH3OH\")\n\n# Determine device for computation\ndevice = \"cuda:0\" if torch.cuda.is_available() else \"cpu\"\nprint(f\"Using device: {device}\")\n\n# Initialize the DFTD3 calculator with the atoms object and device\n# Common damping functions are 'zero', 'bj', 's6'\ncalc = TorchDFTD3Calculator(atoms=atoms, device=device, damping=\"bj\")\n\n# Attach the calculator to the atoms object\natoms.set_calculator(calc)\n\n# Get potential energy and forces\nenergy = atoms.get_potential_energy()\nforces = atoms.get_forces()\n\nprint(f\"Total DFT-D3 energy: {energy:.4f} eV\")\nprint(f\"Forces (first atom):\n{forces[0]}\")","lang":"python","description":"This quickstart demonstrates how to set up a DFT-D3 calculation for a methanol molecule using `torch-dftd` with `ase`. It initializes an `ase.Atoms` object, creates a `TorchDFTD3Calculator`, attaches it to the atoms, and then computes the potential energy and atomic forces. It dynamically selects between CUDA (GPU) and CPU for computation."},"warnings":[{"fix":"Be aware that long-term support may be minimal. Consider forking the repository if deep customization or active maintenance is critical for your project.","message":"The official GitHub repository for torch-dftd explicitly states that the project is 'not actively maintained'. While releases might still occur, active development, bug fixes for new issues, or compatibility updates for future PyTorch/Python versions may be limited.","severity":"maintenance","affected_versions":"All versions"},{"fix":"Refer to the project's `README.md` or `pyproject.toml` for the exact tested environment. It's recommended to use a Python version compatible with PyTorch < 3.11 for older PyTorch versions on macOS/Windows.","message":"The library is tested against specific Python (3.10) and CUDA (12.2) versions, and specific torch (2.0.1) and ase (3.22.1) versions. Using significantly different versions may lead to unexpected behavior or incompatibilities.","severity":"gotcha","affected_versions":"<=0.5.3"}],"env_vars":null,"search_vec":"'0.5.3':51 '11':55 '2026':56 'activ':71 'ase':79 'autodiff':82 'automat':35 'calcul':30 'capabl':37 'chemistri':29,76,81 'comput':40,80 'correct':25,78 'current':48 'd2':19 'd3':23 'dft':18,22 'dft-d2':17 'dft-d3':21 'dftd':3,6,74 'differenti':36 'dispers':24,77 'effici':39 'energi':41 'forc':42 'github':64 'implement':14 'indic':66 'leverag':32 'librari':10,46 'maintain':72 'march':54 'model':26 'provid':11 'python':9 'pytorch':13,33,73 'quantum':28,75 'recent':61 'releas':52 'repositori':65 'seen':60 'torch':2,5 'torch-dftd':1,4 'updat':62 'version':50 'virial':44","created_at":"2026-04-16T17:03:39.078140+00:00","updated_at":"2026-04-16T17:03:39.078140+00:00","problems":{"verify_error":"Traceback (most recent call last):\n  File \"<string>\", line 1, in <module>\nImportError: cannot import name 'TorchDFTD3Calculator' from 'torch_dftd' (/tmp/tmpe221gbqe/venv/lib/python3.12/site-packages/torch_dftd/__init__.py)"},"ecosystem":"pypi","meta_description":null,"install_score":null,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":"0.5.3","cli_name":"","cli_version":null,"type":"library","homepage":null,"github":null,"docs":null,"changelog":null,"pypi":"https://pypi.org/project/torch-dftd/","npm":null,"openapi_spec":null,"status_page":null,"smithery":null,"categories":["ai-ml"],"base_url":null,"auth_type":null,"provenance":{"verified_status":"import_fail","verified_at":"2026-07-03","last_verified":"2026-07-03","next_check":"2026-07-10","install_tag":null}}