python_molecular_editor

MoleditPy User Manual

1. Introduction

MoleditPy is a molecular editing software developed in Python. Through an intuitive interface, it allows for the drawing and editing of molecular structures in 2D, as well as the generation, display, and simple editing of 3D structures.

Main Features:


2. Installation and Launch

Installation can be done using pip.

Windows/MacOS

pip install moleditpy

Linux

pip install moleditpy-linux

Launch:

You can launch it with the following command.

moleditpy

3. Screen Layout

The MoleditPy main window is primarily composed of the following elements:

  1. Menu Bar: Contains functions for file operations, editing, viewing, analysis, settings, and help.
  2. Main Toolbar: Provides basic tools for selecting atom/bond drawing modes, setting charges/radicals, and changing 3D display styles.
  3. Template Toolbar: Contains buttons for selecting templates such as ring structures.
  4. 2D Edit View: The main canvas for drawing and editing molecular structures. You can add and edit atoms and bonds using mouse operations.
  5. 3D View: Displays the 3D structure of the generated or loaded molecule. You can rotate, zoom, and pan with the mouse. 3D measurement and editing are also performed in this view.
  6. Splitter: The boundary line between the 2D view and the 3D view. You can drag it to resize the display area of each view.
  7. Status Bar: Displays the current operation mode, messages, and the molecular formula/atom count being calculated.

4. Basic Operations (2D Edit View)

In the 2D Edit View, you create and edit molecular structures using the mouse, toolbar, and keyboard shortcuts.

4.1. Selecting a Drawing Mode

Select a drawing mode by clicking a button on the main toolbar or pressing the corresponding keyboard shortcut.

4.2. Atom and Bond Operations

4.3. Using Templates

4.4. Undo/Redo

4.5. Copy/Cut/Paste


5. File Operations

Perform various file operations from the File menu in the menu bar.

5.1. Project Files (.pmeprj (Python Molecular Editor Project File))

5.2. Import

5.3. Export


6. 3D Functions

MoleditPy provides functions to generate, display, measure, and edit 3D structures from the drawn 2D structure.

6.1. 2D to 3D Conversion

  1. Draw a molecular structure in the 2D Edit View.
  2. Click the Convert 2D to 3D button in the bottom left, or select Edit > Convert 2D to 3D (Ctrl+K) from the menu.
  3. The calculation begins, and progress is displayed in the status bar. 3D coordinates are generated using RDKit (ETKDGv2 algorithm), and a simple structure optimization is performed using a force field (MMFF94 or UFF).
  4. Upon success, the generated 3D structure is displayed in the 3D View.

(Settings): You can set the priority of libraries (RDKit, Open Babel) used for conversion from the menu Settings > 3D Conversion. If Open Babel is not installed, related options will be disabled.

6.2. 3D Structure Optimization

(Settings): You can select the force field calculation library and method (RDKit MMFF/UFF) from the menu Edit > 3D Optimization Settings or Settings > 3D Optimization Settings.

6.3. Changing 3D Display Style

You can select the display style from the 3D Style dropdown menu on the right side of the main toolbar.

(Settings): Details for each display style (atom size, bond radius, rendering quality, etc.) can be adjusted from the menu Settings > 3D View Settings....

6.4. 3D View Operations

6.5. 3D Measurement Function (“3D Select” Mode)

  1. Click the 3D Select button on the main toolbar to enable measurement mode.

  2. Click atoms in the 3D view to select them. Selected atoms are displayed with red labels in order (1, 2, 3, 4).

  3. Depending on the number of selected atoms, the following measurements are calculated and displayed in the upper-left corner of the 3D view:

    • 2 atoms selected: Distance between atoms (Å)
    • 3 atoms selected: Distance (1-2) and Angle (1-2-3) (°)
    • 4 atoms selected: Distance (1-2), Angle (1-2-3), and Dihedral Angle (1-2-3-4) (°)
  4. Clicking anywhere other than an atom, or clicking the 3D Select button again to exit the mode will clear the selection and measurements.

6.6. 3D Editing Function (“3D Drag” Mode / Alt Key)

You can directly edit the atomic coordinates of the 3D structure. Turn on the 3D Drag button on the main toolbar, or perform operations while holding down the Alt key.

Other 3D Editing Functions (Menu 3D Edit):

These functions are available from the menu when a 3D structure is displayed. Many open a dedicated dialog where you can select atoms or input parameters.

6.7. Displaying Atom Information

From the menu View > 3D Atom Info Display, you can select the information to be displayed above each atom in the 3D view.

Selecting the same menu item again will turn off the display.


7. Molecular Analysis

Selecting Analysis > Show Analysis... from the menu will open a dialog that calculates and displays the basic properties of the molecule currently displayed in the 3D view (excluding those from XYZ files).

Example of displayed information:

You can copy each value to the clipboard using the Copy button next to it.


8. Settings

You can change various settings related to the 3D display from the menu Settings > 3D View Settings....

Configurable items:

Click the Apply button to immediately apply the settings, and the OK button to apply and close the dialog. You can also revert settings to default with Reset Current Tab / Reset All. Settings are retained for the next launch.


9. Keyboard Shortcuts

Key Function (Select Mode) Function (Draw/Edit Mode)
Space Switch to Select mode / Select All (if nothing selected) Switch to Select mode
C, H, N, O, S, P, F, I, B Switch to corresponding atom draw mode / Change atom under cursor to that element Switch to corresponding atom draw mode
Shift+C Cl draw mode / Change atom under cursor to Cl Cl draw mode
Shift+S Si draw mode / Change atom under cursor to Si Si draw mode
Shift+B Br draw mode / Change atom under cursor to Br Br draw mode
1 Single bond draw mode / Change selected or hovered bond to single bond / Add atom to atom Single bond draw mode
2 Double bond draw mode / Change selected or hovered bond to double bond Double bond draw mode
3 Triple bond draw mode / Change selected or hovered bond to triple bond Triple bond draw mode
W Wedge bond draw mode / Change selected or hovered bond to Wedge (click to reverse) Wedge bond draw mode
D Dash bond draw mode / Change selected or hovered bond to Dash (click to reverse) Dash bond draw mode
Z / E (On hovered double bond) Set Z / E configuration (On hovered double bond) Set Z / E configuration
. (Period) Toggle radical on selected or hovered atom (0->1->2->0) Toggle radical on selected or hovered atom (0->1->2->0)
+ / - Increase/Decrease charge on selected or hovered atom Increase/Decrease charge on selected or hovered atom
Delete / Backspace Delete selected or hovered item Cancel operation (during drawing) / Delete selected or hovered item
Ctrl+Z Undo Undo
Ctrl+Y / Ctrl+Shift+Z Redo Redo
Ctrl+C Copy Selection Copy Selection
Ctrl+X Cut Selection Cut Selection
Ctrl+V Paste Paste
Ctrl+A Select All Select All
Ctrl+N New New
Ctrl+O Open Project… Open Project…
Ctrl+S Save Project Save Project
Ctrl+Shift+S Save Project As… Save Project As…
Ctrl+J Optimize 2D Optimize 2D
Ctrl+K Convert 2D to 3D Convert 2D to 3D
Ctrl+L Optimize 3D Optimize 3D
Ctrl++ Zoom In (2D View) Zoom In (2D View)
Ctrl+- Zoom Out (2D View) Zoom Out (2D View)
Ctrl+0 Reset Zoom (2D View) Reset Zoom (2D View)
Ctrl+9 Fit to View (2D View) Fit to View (2D View)
Ctrl+R Reset 3D View Reset 3D View
Ctrl+1 Panel Layout 50:50 Panel Layout 50:50
Ctrl+2 Panel Layout 70:30 (2D Focus) Panel Layout 70:30 (2D Focus)
Ctrl+3 Panel Layout 30:70 (3D Focus) Panel Layout 30:70 (3D Focus)
Ctrl+H Toggle 2D Panel Visibility Toggle 2D Panel Visibility
Alt+Drag (3D View) Temporarily enter 3D Drag mode (3D View) Temporarily enter 3D Drag mode
Ctrl+Q Quit Quit

10. Version / License

You can check the version information from the Help > About menu.