# APOAI 2026 Molecular Energy and Dipole Moment Prediction

Note: This task will be evaluated in an environment based on the `ioai3.6` image. Participants should select `ioai3.6` as the training image.

## 1. Background

Energy plays a central role in chemistry. Many questions in chemistry—whether a reaction occurs, how it proceeds, and to what extent it occurs—are closely related to the energies of reactants, transition states, intermediates, and products.

Experimentally determining the energy of a substance often requires carefully designed setups and repeated measurements, which require a lot of time and effort. Computational chemistry enables researchers to obtain the approximate energy of a substance without spending time running experiments. All you need to do is to input the coordinates of the substance of interest into a computational chemistry package, provide basic information of the substance, select a proper method, and run the software. ! You will get the energy as well as a lot of other properties, like the electronic structure and the dipole moment of the substance you calculate. This looks great at first sight, but, as hard as life can be, there is a tradeoff between efficiency (how fast the calculation is) and accuracy (how accurate the calculation is). High-accuracy calculations may require hundreds of CPU cores, terabytes of memory, and weeks of computation.

Machine learning provides a possible way to address this tradeoff between efficiency and accuracy. Your task is to build a model that predicts the **energy** and the **dipole moment** of a molecule from its coordinates. You will be given the energy and dipole moments of 200 molecules to train your model with. After that, you will be required to predict the **energy** and **dipole moments** of 600 molecules (split into groups A and B, 300 molecules in each group).

Note that the **energy** and the **magnitude of the dipole moment** involved in this problem do not change under translation or rotation of the molecule.

## 2. Dataset

The dataset contains molecular structures as **coordinates of atoms** and their corresponding properties including **energy** and **dipole moments**. These properties are stored as scalars. The coordinates are randomly selected from the QM9 dataset.<sup>[1][2]</sup>

The **coordinates of atoms** of each molecule are stored in a file named `coordinate.xyz`. This file is formatted like the following:
```
8
Ethane
C        0.005878076      0.001675234     -0.001723984
H        0.946477520     -0.402968363     -0.408149334
H       -0.108243704      1.017373839     -0.412776310
H       -0.810957045     -0.606202425     -0.422265194
C       -0.005996811     -0.002068269      1.540109968
H        0.928172145     -0.408855414      1.959031412
H       -0.829235044     -0.611934154      1.945004981
H       -0.126414019      1.011636222      1.954265507
```
The first line shows the number of atoms in this molecule. The second line shows the name of the molecule, and the rest of the file stores the identity of the atoms in the molecule, followed by 3-dimensional Cartesian coordinates (in Å) of this atom in space.

In the sample file it shows that the molecule has 8 atoms; the name of the molecule is "Ethane". In this molecule, there is a carbon atom ("C") located at (0.005878076, 0.001675234, -0.001723984), a hydrogen atom ("H") located at (0.946477520, -0.402968363, -0.408149334), etc.

All molecules in this task are neutral (carrying no charges), singlet ground state (no unpaired electrons), and contain **no more than 50 atoms**. All atoms are one of hydrogen, ("H"), carbon ("C"), nitrogen ("N"), oxygen ("O"), and fluorine ("F"). No other types of atoms will be involved.

Some properties of these atoms that might be helpful to you:
|Atom type|Nuclear charge|Atomic mass|Atomic Radius|# Valence electrons|Electronegativity|
|---------|--------------|-----------|-------------|-------------------|-----------------|
|H        |1             |1.008      |37.0         |1                  |2.20             |
|C        |6             |12.011     |67.0         |4                  |2.55             |
|N        |7             |14.007     |56.0         |5                  |3.04             |
|O        |8             |15.999     |48.0         |6                  |3.44             |
|F        |9             |18.998     |42.0         |7                  |3.98             |

**(1). Training set**: Provides the xyz coordinate files of 200 molecules. These files are named `coordinate.xyz`, and located in `./train/molecule_N ` [dataset](https://www.bohrium.com/competitions/25382276824?tab=datasets), where N is 1, 2, 3, ..., 200. The energy and dipole moments of these molecules are stored in `./train/training_ref.csv`. `training_ref.csv` is formatted as a table. A sample `training_ref.csv` is as follows:

| molecule # | energy                  | dipole moment |
|------------|-------------------------|---------------|
| 1          | -327.0543483334524240   | 2.649601019   |
| 2          | -455.3016776263125962   | 2.840915458   |
| 3          | -471.2795923777824214   | 2.194809035   |

The first row is the header of the table. The first column stores the number of the molecule (the N in `molecule_N`); the second column stores the energy of the molecule, and the third column stores the dipole moment of the molecule.

**(2). Test set**: Split into groups A and B, each providing the xyz coordinate files of 300 molecules. These files are named `coordinate.xyz`, and located in `./test/A/molecule_N` and `./test/B/molecule_N`, where N is 1, 2, 3, ..., 300. 

The test set is not accessible during the competition.

## 3. Task

#### 3.1 Objective

Build a machine learning model that predicts the energy and dipole moment magnitude of a molecule from its 3D atomic coordinates.

#### 3.2 Parameters

- **Training Set**: 200 molecules with their coordinates (in XYZ format) and corresponding properties (energy and dipole moment) provided in CSV format.
- **Test Set**: Split into groups A and B, each with 300 molecules with coordinates only (properties must be predicted).

#### 3.3 Input Characteristics
- **Input Format**: Atomic coordinates stored in XYZ files (`coordinate.xyz`) with the following structure:
  - First line: Number of atoms (integer)
  - Second line: Molecule identifier/comment
  - Subsequent lines: Atomic symbol followed by 3D Cartesian coordinates (Å)
- **Molecule Constraints**:
  - Neutral charge (no net charge)
  - Singlet ground state (no unpaired electrons)
  - Maximum 50 atoms per molecule
  - Only hydrogen (H), carbon (C), nitrogen (N), oxygen (O), and fluorine (F) atoms

#### 3.4 Implementation Details
- **Data Loading**: Models should read input data from the provided directory structure:
  - Training coordinates: `./train/molecule_N/coordinate.xyz` (N=1-200)
  - Training properties: `./train/training_ref.csv`
  - Test coordinates on the evaluation machine: `./test/A/molecule_N/coordinate.xyz` and `./test/B/molecule_N/coordinate.xyz` (N=1-300)

​	Please refer to [baseline.ipynb](https://www.bohrium.com/notebooks/33993182597) for details.

#### 3.5 Remarks

  * No additional information is provided (such as molecular connectivity, bond information, etc.). The model must infer all required information solely from atomic coordinates.

  * Although no specific framework is required, you should ensure that the code is reproducible and can run with standard scientific computing libraries.

  * **The following feature engineering ideas are provided only as optional references. Contestants are free to design their own representations.**

    ##### A. Invariant Features (for Energy Prediction)

    These features describe the internal structure of a molecule and are independent of its position or rotation in space.

    * **Atomic Properties**: Pre-encode several physical properties for each atom type (H, C, N, O, F):

      * Electronegativity (Pauling scale)
      * Atomic mass
      * Atomic radius
      * Number of valence electrons
      * Partial charge (approximate value)

    * **Geometric Invariants**: Derived from the interatomic distance matrix $D$:
      * **Coulomb Feature**: Sum over neighboring atoms $q_{\text{neighbor}} / d_{ij}$, simulating electrostatic potential.
      * **Density Feature**: Sum over neighboring atoms $1 / d_{ij}$, representing local atomic density.
      * **Minimum Distance**: Distance to the nearest neighboring atom.
      * **Mean Distance**: Average distance to all other atoms.
    
    ##### B. Geometry-aware Features for Dipole Moment Prediction
    
    These features preserve the geometric arrangement of the molecule and are necessary for computing geometry-related properties such as the dipole moment.
    
    * **Centered Coordinates**: Translate the $(x, y, z)$ coordinates relative to the molecular geometric center, i.e. the mean of the coordinates, to remove the effect of translation invariance.
    * **Atomic Properties**: Same as above, consistent with the energy features.
    * **One-Hot Encoding**: Explicitly encode atom identities (H, C, N, O, F).

## 4. Submission

For each test molecule in each test group, you should use its atom coordinates to predict:
  - **Energy**: Scalar value (atomic units)
  - **Dipole Moment**: Scalar value (Debye units)

Predictions on the energy and dipole moments of the molecules in each test group should be saved to the corresponding `submission_X.csv` (X = A or B) file. The format of this file should be as follows:  
  ```
  molecule #,energy,dipole moment
  1,predicted_energy_1,predicted_dipole_1
  2,predicted_energy_2,predicted_dipole_2
  ...
  300,predicted_energy_300,predicted_dipole_300
  ```

  Or, if shown as a table:
| molecule # | energy                  | dipole moment |
|------------|-------------------------|---------------|
| 1          | predicted_energy_1   | predicted_dipole_1 |
| 2          | predicted_energy_2   | predicted_dipole_2 |
| 3          | predicted_energy_3   | predicted_dipole_3 |
|...|...|...|
| 300          | predicted_energy_300   | predicted_dipole_300 |

You need to save the predictions for test group A as `submission_A.csv`, save the predictions for test group B as `submission_B.csv`, and package both files into `submission.zip` for submission.

We have provided you with a sample script [baseline.ipynb](https://www.bohrium.com/notebooks/33993182597).

## 5. Score

The scoring is calculated separately for test group A and test group B. For each group, the scoring is divided into two parts: **energy scoring** and **dipole moment scoring**.

For the energy part: the score is based on the **mean relative error (MRE)** of the predicted energy values: 
$$
MRE_{energy}= \frac{\sum_{i=1}^{300} |\frac{Energy_{predicted, i} - Energy_{real, i}}{Energy_{real, i} + 10^{-6}}|}{300}
$$
$$
Score_{energy} = max[0, 0.50\times (1-MRE_{energy}\times 5)]
$$

For the dipole moment part: the score is based on the **mean absolute error (MAE)** of the predicted dipole moment values: 
$$
MAE_{dipole}= \frac{\sum_{i=1}^{300} |Dipole_{predicted, i} - Dipole_{real, i}|}{300}
$$
$$
Score_{dipole} = max[0, 0.50\times (1-MAE_{dipole}\div 5)]
$$
The total score is the sum of the energy score and the dipole moment score:
$$
Score_{total} = Score_{energy} + Score_{dipole}
$$

## 6. Restrictions

- Pretrained model weights are not allowed, including weights pretrained on ImageNet or any other external dataset;
- External large language model APIs, such as GPT or Claude, may not be used for prediction, feature generation, data labeling, or model ensembling;
- Notebook execution time: single training run $\le$ 20 minutes with CPU.

## 7. Baseline and Reference Scores

The baseline score on Leaderboard B is: 0.7729

The reference score achieved by the scientific committee on Leaderboard B is: 0.8758

## 8. Acknowledgement

We thank Wang Qiuran from Beijing National Day School for providing this topic and data.
