Started from a PyMol plugin.
The PyMOL ChatGPT Plugin seamlessly integrates LLMs into PyMOL, enabling users to interact with PyMOL using natural language instructions. This tool simplifies PyMOL tasks and offers suggestions, explanations, and guidance on a wide range of PyMOL-related topics. ChatMol provides various interaction modes with PyMOL, including the PyMOL command line, miniGUI chatbot, python and web browsers.
We also provide a Streamlit app for ChatMol, which can be used as a task execution agent or Q&A chatbot. It retains your entire conversation history with ChatMol, and you have the flexibility to modify the execution plan suggested by ChatMol. See more details in here.
See this README for more details.
pip install chatmol
This is ChatMol copilot, just like other copilot, it is designed to help your work.
See more details in here
Visit the official website for comprehensive information about its development and use cases.
The Online Chatbot is a Q&A system designed to answer questions related to PyMOL usage.
The ChatMol web-browser interface allows you to submit PyMOL requests and execute them in PyMOL via ChatMol. (Please note that this feature is browser setting-dependent)
conda install -c conda-forge pymol-open-source
, python 3.7 and 3.10 were test to be fine.pip install openai
in the PyMOL command line.chatmol.py
and save it to a convenient location on your computer.run /path/to/chatmol.py
(replace /path/to
with the actual path to the script).Alternatively, you can use the following command to load the plugin directly:
load https://raw.githubusercontent.com/JinyuanSun/ChatMol/main/chatmol.py
For permanent installation, click on Plugin
, navigate to the Plugin Manager
, go to Install New Plugin
, and either choose the local file or fetch from the URL: https://raw.githubusercontent.com/JinyuanSun/ChatMol/main/chatmol.py
Set your OpenAI API key by entering the following command in the PyMOL command line: set_api_key your_api_key_here
(replace your_api_key_here
with your actual API key). The API key will be stored in the same directory as the plugin script for future use.
ChatMol offers two interaction modes in the PyMOL command line: ChatMol and ChatMol-Lite. ChatMol directly utilizes OpenAI’s GPT-3.5 model and requires an API key setup, whereas ChatMol-Lite is built on text-davinci-003 and supplemented with additional PyMol-related resources. Currently, ChatMol-Lite is undergoing rapid development, providing faster performance and eliminating the need for an API key setup for end users.
The ChatGPT Plugin automates PyMOL tasks with ease. In the PyMOL command line, just enter chat
as the trigger word for the ChatMol plugin, followed by your PyMOL task description or questions about specific PyMOL commands. After entering your requests, a set of instructions will appear, and the commands for completing your tasks will be automatically executed by default. For example, use chat Show me how to color a protein by its secondary structures
to view a protein molecule in the PyMOL 3D window, with colors representing its secondary structures.
ChatMol also serves as a Q&A chatbot, answering your queries about executing PyMOL tasks without actually performing the PyMOL.
You can disable the automatic execution by adding a question mark ?
at the end of ChatMol prompt, e.g., chat How do I align two proteins?
. You will receive a helpful response such as:
ChatGPT: To align two proteins in PyMOL, you can use the `align` command. Here's an example:
```
# Load two proteins
fetch 1ake
fetch 1ttt
# Align the two proteins
align 1ake, 1ttt
# Show the aligned proteins
show cartoon
```
In this example, we first load two proteins using the `fetch` command. If you already have the proteins loaded, you can skip this step.
Next, we use the `align` command to align the two proteins. The first argument is the reference protein (the one that will not move), and the second argument is the mobile protein (the one that will be aligned to the reference). In this case, we're aligning 1ake to 1ttt.
Finally, we use the `show` command to display the aligned proteins in cartoon representation.
Note that the `align` command will superimpose the mobile protein onto the reference protein, so that the two proteins have the same orientation and position.
commands from each query will be saved internally. if you want to execute all saved commands, run chat e
or chat execute
. After execution, the stashed commands are cleared.
To start a new chat session, just enter the following in the PyMOL command line: chat new
. This will let ChatMol clear the conversation history.
We found the response of gpt-3.5 is slow and people might don’t have access to OpenAI’s API, we developed chatmol-lite as an alternative. This is installed with the chatmol automatically. You can use it by typing chatlite
in the PyMOL command line:
chatlite "Something you want chatmol to do for you"
chatlite
is different from the chat
:
chatlite
chat
and you don’t need to set up the OpenAI API key. And the response is more short than the chat
.We also provide a miniGUI for ChatMol-Lite, which can be used as a task execution agent or Q&A chatbot. It retains your entire conversation history with ChatMol, and you have the flexibility to modify the execution plan suggested by ChatMol. For example, you can delete certain commands or add additional commands before sending them to PyMOL. You can launch the miniGUI from a terminal.
git clone https://github.com/JinyuanSun/ChatMol.git
cd ChatMol/miniGUI
python miniGUI.py
Here is a screenshot of the miniGUI:
As an open source project, we thank the support from ChemXAI, WeComput and levinthal.
This project is released under the MIT License.