Metadata-Version: 2.4 Name: abacusagent Version: 0.2.5 Summary: ABACUS agent tools for connecting LLMs to first-principles calculation workflows License: GNU LESSER GENERAL PUBLIC LICENSE Version 3, 29 June 2007 Copyright (C) 2007 Free Software Foundation, Inc. Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. This version of the GNU Lesser General Public License incorporates the terms and conditions of version 3 of the GNU General Public License, supplemented by the additional permissions listed below. 0. Additional Definitions. As used herein, "this License" refers to version 3 of the GNU Lesser General Public License, and the "GNU GPL" refers to version 3 of the GNU General Public License. "The Library" refers to a covered work governed by this License, other than an Application or a Combined Work as defined below. An "Application" is any work that makes use of an interface provided by the Library, but which is not otherwise based on the Library. Defining a subclass of a class defined by the Library is deemed a mode of using an interface provided by the Library. A "Combined Work" is a work produced by combining or linking an Application with the Library. The particular version of the Library with which the Combined Work was made is also called the "Linked Version". The "Minimal Corresponding Source" for a Combined Work means the Corresponding Source for the Combined Work, excluding any source code for portions of the Combined Work that, considered in isolation, are based on the Application, and not on the Linked Version. The "Corresponding Application Code" for a Combined Work means the object code and/or source code for the Application, including any data and utility programs needed for reproducing the Combined Work from the Application, but excluding the System Libraries of the Combined Work. 1. Exception to Section 3 of the GNU GPL. You may convey a covered work under sections 3 and 4 of this License without being bound by section 3 of the GNU GPL. 2. Conveying Modified Versions. If you modify a copy of the Library, and, in your modifications, a facility refers to a function or data to be supplied by an Application that uses the facility (other than as an argument passed when the facility is invoked), then you may convey a copy of the modified version: a) under this License, provided that you make a good faith effort to ensure that, in the event an Application does not supply the function or data, the facility still operates, and performs whatever part of its purpose remains meaningful, or b) under the GNU GPL, with none of the additional permissions of this License applicable to that copy. 3. Object Code Incorporating Material from Library Header Files. The object code form of an Application may incorporate material from a header file that is part of the Library. You may convey such object code under terms of your choice, provided that, if the incorporated material is not limited to numerical parameters, data structure layouts and accessors, or small macros, inline functions and templates (ten or fewer lines in length), you do both of the following: a) Give prominent notice with each copy of the object code that the Library is used in it and that the Library and its use are covered by this License. b) Accompany the object code with a copy of the GNU GPL and this license document. 4. Combined Works. You may convey a Combined Work under terms of your choice that, taken together, effectively do not restrict modification of the portions of the Library contained in the Combined Work and reverse engineering for debugging such modifications, if you also do each of the following: a) Give prominent notice with each copy of the Combined Work that the Library is used in it and that the Library and its use are covered by this License. b) Accompany the Combined Work with a copy of the GNU GPL and this license document. c) For a Combined Work that displays copyright notices during execution, include the copyright notice for the Library among these notices, as well as a reference directing the user to the copies of the GNU GPL and this license document. d) Do one of the following: 0) Convey the Minimal Corresponding Source under the terms of this License, and the Corresponding Application Code in a form suitable for, and under terms that permit, the user to recombine or relink the Application with a modified version of the Linked Version to produce a modified Combined Work, in the manner specified by section 6 of the GNU GPL for conveying Corresponding Source. 1) Use a suitable shared library mechanism for linking with the Library. A suitable mechanism is one that (a) uses at run time a copy of the Library already present on the user's computer system, and (b) will operate properly with a modified version of the Library that is interface-compatible with the Linked Version. e) Provide Installation Information, but only if you would otherwise be required to provide such information under section 6 of the GNU GPL, and only to the extent that such information is necessary to install and execute a modified version of the Combined Work produced by recombining or relinking the Application with a modified version of the Linked Version. (If you use option 4d0, the Installation Information must accompany the Minimal Corresponding Source and Corresponding Application Code. If you use option 4d1, you must provide the Installation Information in the manner specified by section 6 of the GNU GPL for conveying Corresponding Source.) 5. Combined Libraries. You may place library facilities that are a work based on the Library side by side in a single library together with other library facilities that are not Applications and are not covered by this License, and convey such a combined library under terms of your choice, if you do both of the following: a) Accompany the combined library with a copy of the same work based on the Library, uncombined with any other library facilities, conveyed under the terms of this License. b) Give prominent notice with the combined library that part of it is a work based on the Library, and explaining where to find the accompanying uncombined form of the same work. 6. Revised Versions of the GNU Lesser General Public License. The Free Software Foundation may publish revised and/or new versions of the GNU Lesser General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Library as you received it specifies that a certain numbered version of the GNU Lesser General Public License "or any later version" applies to it, you have the option of following the terms and conditions either of that published version or of any later version published by the Free Software Foundation. If the Library as you received it does not specify a version number of the GNU Lesser General Public License, you may choose any version of the GNU Lesser General Public License ever published by the Free Software Foundation. If the Library as you received it specifies that a proxy can decide whether future versions of the GNU Lesser General Public License shall apply, that proxy's public statement of acceptance of any version is permanent authorization for you to choose that version for the Library. Classifier: Development Status :: 3 - Alpha Classifier: Intended Audience :: Science/Research Classifier: Operating System :: OS Independent Classifier: Programming Language :: Python :: 3 Classifier: Topic :: Scientific/Engineering :: Physics Classifier: Topic :: Scientific/Engineering :: Chemistry Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence Requires-Python: >=3.11 Description-Content-Type: text/markdown License-File: LICENSE Requires-Dist: abacustest>=0.4.51 Requires-Dist: numpy<2.0 Requires-Dist: pymatgen>=2025.5.28 Requires-Dist: bohr-agent-sdk==0.1.121 Requires-Dist: bohrium-sdk==0.13.0 Requires-Dist: dpdata>=0.2.24 Requires-Dist: regex==2024.11.6 Requires-Dist: pyatb==1.1.1 Provides-Extra: dev Requires-Dist: mcp>=1.10.0; extra == "dev" Requires-Dist: science-agent-sdk; extra == "dev" Dynamic: license-file # ABACUS Agent Tools ABACUS-agent-tools is a Python package that provides the Model Context Protocol (MCP) tools to connect large language models (LLMs) to ABACUS computational jobs. It serves as a bridge between AI models and first principles calculations, enabling intelligent interaction with ABACUS workflows. ## Installation To use ABACUS agent tools with Google Agent Development Kit (ADK), follow the recommended installation process: ### Configuring environment using uv.lock There's a `uv.lock` file in the root directory of this project. You can use it to prepare python packages that needed by running tools in ABACUS-agent-tools. For packages that cannot be installed by `pip` or `conda`, please refer to **Other dependencies`=**. ### Install from scratch manually 1. Create and activate a conda enviroment: ```bash conda create -n abacus-agent python=3.11 conda activate abacus-agent ``` 2. Install necessary dependencies: ```bash pip install mcp google-adk litellm bohr-agent-sdk pymatgen abacustest ``` 3. Install ABACUS-agent-tools: ```bash cd .. git clone -b develop https://github.com/pxlxingliang/ABACUS-agent-tools.git cd abacus-agent pip install . ``` If you haven't installed ABACUS, you can install ABACUS to the same environment by conda: ```bash conda install abacus "libblas=*=*mkl" mpich -c conda-forge ``` ### Other dependencies #### Bader Follow the given step to download, compile and install `bader` executable required in Bader charge analysis: ```bash apt install subversion svn co https://theory.cm.utexas.edu/svn/bader cd bader cp makefile.lnx_ifort makefile vi makefile # Choose `ifort` or `gfortran` as compiler make cp bader /usr/local/bin/bader ``` ## Using ABACUS agent tools with Google ADK ### Use ABACUS agent tools and Google ADK on local machine #### Starting ABACUS agent tools Before launching `abacusagent`, you must provide the necessary configurations in the `~/.abacusagent/env.json` file. This file defines how the ABACUS agent tools generate input files and manage ABACUS calculation workflows. Note: When running `abacusagent`, it will automatically check if the file exists. If not, `abacusagent` will create it and set some default values. It is recommended to run `abacusagent` once first before modifying this file. ``` { "_comments": { "ABACUS_WORK_PATH": "The working directory for AbacusAgent, where all temporary files will be stored.", "ABACUS_SUBMIT_TYPE": "The type of submission for ABACUS, can be local or bohrium.", "ABACUSAGENT_TRANSPORT": "The transport protocol for AbacusAgent, can be 'sse' or 'streamable-http'.", "ABACUSAGENT_HOST": "The host address for the AbacusAgent server.", "ABACUSAGENT_PORT": "The port number for the AbacusAgent server.", "ABACUSAGENT_MODEL": "The model to use for AbacusAgent, can be 'fastmcp', 'test', or 'dp'.", "LLM_MODEL": "The model name for the LLM to use. Like: openai/qwen-turbo, deepseek/deepseek-chat", "LLM_API_KEY": "The API key for the LLM service.", "LLM_BASE_URL": "The base URL for the LLM service, if applicable.", "BOHRIUM_USERNAME": "The username for Bohrium.", "BOHRIUM_PASSWORD": "The password for Bohrium.", "BOHRIUM_PROJECT_ID": "The project ID for Bohrium.", "BOHRIUM_ABACUS_IMAGE": "The image for Abacus on Bohrium.", "BOHRIUM_ABACUS_MACHINE": "The machine type for Abacus on Bohrium.", "BOHRIUM_ABACUS_COMMAND": "The command to run Abacus on Bohrium", "ABACUS_COMMAND": "The command to execute Abacus on local machine.", "ABACUS_PP_PATH": "The path to the pseudopotential library for Abacus.", "ABACUS_ORB_PATH": "The path to the orbital library for ABACUS_PP_PATH", "ABACUS_SOC_PP_PATH": "The path to the SOC pseudopotential library for Abacus.", "ABACUS_SOC_ORB_PATH": "The path to the orbital library for ABACUS_SOC_PP_PATH.", "PYATB_COMMAND": "The command to execute PYATB on local machine.", "_comments": "This dictionary contains the default environment variables for AbacusAgent." } } ``` Then you can start `abacusagent`. ```bash >>> abacusagent ✅ Successfully loaded: abacusagent.modules.abacus INFO: Started server process [25487] INFO: Waiting for application startup. INFO: Application startup complete. INFO: Uvicorn running on http://localhost:50001 (Press CTRL+C to quit) ``` #### Preparing Google ADK Agent You can use the following command to create files needed by a new agent: ``` abacusagent --create ``` Then a directory containing all necessary files will be generated: ``` abacus-agent/ ├── __init__.py └── agent.py ``` Then you can edit the `agent.py` file to customize the agent. #### Starting Google ADK ```bash >>> adk web INFO: Started server process [25799] INFO: Waiting for application startup. +-----------------------------------------------------------------------------+ | ADK Web Server started | | | | For local testing, access at http://localhost:8000. | +-----------------------------------------------------------------------------+ INFO: Application startup complete. INFO: Uvicorn running on http://127.0.0.1:8000 (Press CTRL+C to quit) ``` #### Accessing the agent 1. Open your browser and navigate to the provided ADK address. 2. Select the agent directory name you configured. 3. Interact with the LLM, which can now leverage ABACUS agent tools for computational tasks. ### Use ABACUS agent tools and Google ADK on remote server After installing ABACUS agent tools and Google ADK on a remote server, use the exposed ports for configuration. #### Example for Bohrium Nodes ```bash # Start ABACUS agent tools with public host and port abacusagent --host "0.0.0.0" --port 50001 # Start Google ADK with public host and port adk web --host "0.0.0.0" --port 50002 ``` #### Accessing Remotely Visit http://your-node-address.dp.tech:50002 in your browser, where: - `your-node-address.dp.tech` is the remote node URL - `50002` is the configured port for Google ADK ## Supported functions Functions of ABACUS Agent tools are in active development. Currently, the following functions are supported: - Generate cif/POSCAR/ABACUS STRU file of simple crystals and molecules, and generate crystal structure using Wyckoff positions - Rotate crystal to IEEE standard orientation (important for anisotropic properties, e.g. elastic tensor and orbital-resolved DOS) - Prepare ABACUS input files (INPUT, STRU, KPT, pseudopotential and orbital files) from given structure file - Modify INPUT and STRU file in prepared ABACUS directory - SCF, relax, cell-relax and molecule dynamics calculation using ABACUS - Bader charge - Density of states (DOS) and projected density of states (PDOS) (supports nspin=1 and nspin=2) - Band calculation (supports nspin=1 and nspin=2) - Phonon dispersion curve and phonon DOS - Elastic tensor and related Young's modulus, shear modulus, bulk modulus and possion ratio - Electron localization function (ELF) - Vibrational frequency of molecules using finite-difference method - Charge density difference and spin density - Using Birch-Murganhan equation to fit equation of state - Joint density of states (JDOS) - Work function - Vacancy formation energy of non-charged defects Besides, wrapper functions for MatMaster are provided, which accepts a structure file and some key parameters to do ABACUS calculation/ You can use `abacusagent --screen-modules` to hide tool functions in some modules. The `--matmaster` option will only allow the wrapper function to be loaded.