Skip to main content

COMPLAX Python package PyPI License: MIT PyPI Downloads

COMPLAX is an automated Python workflow designed to position solvent molecules (provided as .xyz files) around a user-specified atom of another molecule, also supplied in .xyz format.
It was primarily developed for the microsolvation of small organic molecules, but it can also be applied to other molecular systems, serving as a robust starting point for high-level quantum mechanical modeling (e.g., DFT).

Following an unbiased stochastic solvent placement, the program performs two-stage geometry optimization using the semiempirical xTB methods. [1]

A constrained pre-relaxation prevents unphysical solvent detachment, which is then automatically followed by a full structural equilibration.

Optionally, the user can perform a stochastic sampling to explore the conformational space and request an on-the-fly evaluation of the solvation effect in terms of potential energy differences.

Installation

Install via PyPI

You can install COMPLAX directly from PyPI using pip:

pip install complax

Installation from GitHub:

Manually clone the repository and install it via pip:

git clone [https://github.com/Fedelau/complax.git](https://github.com/Fedelau/complax.git)
cd complax
pip install .

Requirements

  • Python 3.8 or higher
  • External dependencies (automatically installed via pip):
    • numpy
    • ase
    • colorama
    • tqdm
    • tabulate

Tested with Python 3.11.2

External Software

COMPLAX interfaces with the external program xTB, which must be installed and accessible from your system’s PATH. See https://github.com/grimme-lab/xtb for installation instructions. Since this version of COMPLAX utilizes the recent g-xTB semi-empirical electronic structure method, to run a calculation with this level of theory, the modified xTB binaries are required, available at this link https://github.com/grimme-lab/g-xtb. [2]

xTB is developed by the Grimme group and distributed under the Creative Commons Attribution-ShareAlike 4.0 International License (CC BY-SA 4.0).

Quick Start

Example input files are provided in the examples/ folder. (If you installed complax via pip, you can access these files by cloning the repository or downloading them directly from the GitHub examples directory).

This example shows how to position 3 tetrahydrofuran molecules (thf.xyz) around a lithium atom in methyllithium (meli.xyz).

  1. First, identify the indices of the atoms to be used:

    • Lithium atom in meli.xyz: 5
    • Oxygen atom in thf.xyz: 2
  2. Then run the command:

complax meli.xyz thf.xyz -a 5 2 -c 3
  1. What happens next?
    • The program places the molecules avoiding steric clashes.
    • Then, a robust two-stage geometry optimization is performed using xTB for each incremental number of solvent molecules. During the entire process, the solute coordinates and the internal geometries of the solvent molecules (intramolecular distances) are kept completely frozen.
      • Stage 1 (Pre-relaxation): The intermolecular target distance (e.g., Li-O) is harmonically constrained for 50 cycles. This crucial step dissipates initial spatial clashes and prevents the solvent molecules from artificially detaching or flying away.
      • Stage 2 (Full equilibration): The intermolecular distance constraint is released. The rigid solvent molecules are now completely free to translate and reorient around the fixed solute core to find their global thermodynamic minimum.
    • After optimization, the final geometry is saved in the outplax/ directory named complax_struct_{n}solvent_{s}.xtbopt.xyz, where {n} is the number of solvent molecules and {s} is the structure index.

Conformational Sampling and Energy Evaluation Example

To get the most out of COMPLAX, you can combine multiple flags to run a fully automated conformational search and thermodynamic analysis in a single line.

This command generates 40 different starting configurations (--nstruct 40), retains only the top 3 most stable geometries for each solvation state (--keep-best 3), and computes the stabilization energies (--solvfx):

complax meli.xyz thf.xyz -a 5 2 -c 3 --nstruct 40 --keep-best 3 --solvfx

What happens here?

  • COMPLAX explores the coordination space by optimizing 40 random clusters.
  • It automatically ranks them by total energy, discarding the highest-energy structures to save disk space and keeping only the top 3 conformers per state.
  • Finally, it prints a clean summary report on the terminal (and saves it in complax_summary.txt), displaying both the energy ranking and the stepwise solvation effect:
[...]
--- 3 solvent molecule(s) ---
complax_struct_3solvent_7.xtbopt.xyz          -103.573414 Eh
complax_struct_3solvent_23.xtbopt.xyz         -103.573345 Eh
complax_struct_3solvent_39.xtbopt.xyz         -103.573296 Eh
[...]

                     ***************************
                     * Effect of the Solvation *
                     ***************************

+--------------------------------+------------+------------+------------+
|                                |          1 |          2 |          3 |
+================================+============+============+============+
| Sum of reag + solv (Hartree)   | -20.609217 | -37.322501 | -54.035785 |
+--------------------------------+------------+------------+------------+
| Tot Energy (Complex) (Hartree) | -20.631873 | -37.364828 | -54.095412 |
+--------------------------------+------------+------------+------------+
| ΔE (kcal/mol)                  |     -14.22 |     -26.56 |     -37.42 |
+--------------------------------+------------+------------+------------+

Commandline Usage

complax molecule.xyz solvent.xyz [options]

Mandatory arguments:

Argument Description Default
-a (MOL) (SOLV) Atom numbers of molecule and solvent. Format: (MOLECULE ATOM) (SOLVENT ATOM) using 1-based indexing. Required
-c INT Number of solvent copies (solvent.xyz) to be placed around the selected atom of the solute. 1

Optional arguments:

Argument Description Default
-t FLOAT Target distance from the selected molecule atom, in Ångstrom. 2.0
--alpb SOLVENT Analytical linearized Poisson-Boltzman (ALPB) model. Available solvents on xTB are acetone, acetonitrile, aniline, benzaldehyde, benzene, ch2cl2, chcl3, cs2, dioxane, dmf, dmso, ether, ethylacetate, furane, hexandecane, hexane, methanol, nitromethane, octanol, woctanol, phenol, toluene, thf, water. [3] None
--gbsa SOLVENT Generalized Born solvation model (GBSA) is a simplified version of ALPB. Available solvents are acetone, acetonitrile, benzene (only GFN1-xTB), CH2Cl2, CHCl3, CS2, DMF (only GFN2-xTB), DMSO, ether, H2O, methanol, n-hexane (only GFN2-xTB), THF and toluene. [3] None
--gbe SOLVENT Generalized Born model with finite epsilon for solvation. Requires --lev gxtb. None
-p INT Number of parallel processes. During the initial optimization, the program uses the specified number of processes. For subsequent optimizations, it automatically launches as many parallel calculations as the number of solvent molecules selected. 1
--lev LEVEL Level of theory for the optimization. Options include gfn0, gfn1, gfn2, gfnff, gxtb. gfn2
--chrg INT Molecular charge. 0
-u, --uhf INT Number of unpaired electrons. 0
--res INT Number of points in the Fibonacci spherical grid. 10000
--nstruct INT Number of stochastic, non-overlapping starting structures to generate and optimize. Ideal for exploring the conformational space of the solvated complex. 400
--keep-best INT Filters the output to keep only the N lowest-energy optimized structures for each solvent configuration, automatically deleting the less stable ones. None
--solvfx Evaluates the effect of solvation in terms of potential energy differences among systems with an increasing number of solvent molecules. False
--cutoff FLOAT Steric overlap distance threshold in Ångstrom. 1.6
--seed INT Seed for the pseudo-random number generator to ensure reproducibility. Set to -1 for pure stochasticity. 42

Tips and Troubleshooting

  • Stochastic Sampling: For complex solvent environments, use --nstruct 1000 --keep-best 3. COMPLAX will generate 1000 different random orientations of the solvent cluster, optimize all of them, and retain only the 3 most thermodynamically stable configurations, saving you a massive amount of manual sorting. (Note: The number of generated structures is equal to --nstruct multiplied by the number of solvent molecules, -c).

  • Pre-optimized geometries: The ideal workflow uses pre-optimized input geometries from prior DFT calculations. COMPLAX keeps the internal geometry of both solute and solvent rigidly constrained during the entire xTB optimization process. This maintains their original intramolecular distances while exclusively allowing the exploration of the best intermolecular solvent coordination.

  • Visual Check: COMPLAX stochastically positions solvent molecules around the selected atom, avoiding steric overlaps based on the chosen target distance. Due to the unbiased nature of the sampling, especially in highly congested spatial environments, it is always recommended to visually inspect the final optimized geometries to ensure the resulting coordination aligns with your chemical intuition.

  • Important: COMPLAX writes output files in the outplax/ folder. If you want to keep multiple results, move the files out of outplax before running a new calculation or run complax in another folder, otherwise the previous files will be overwritten and lost.

Authors

Federica Lauria, Department of Chemistry, University of Turin, Torino, Italy

Andrea Maranzana, Deparment of Chemistry, University of Turin, Torino, Italy

References

[1] C. Bannwarth, E. Caldeweyher, S. Ehlert, A. Hansen, P. Pracht, J. Seibert, S. Spicher, S. Grimme WIREs Comput. Mol. Sci., 2020, 11, e01493. DOI: 10.1002/wcms.1493

[2] T. Froitzheim, M. Müller, A. Hansen, et al., ChemRxiv. 23 June 2025. DOI: 10.26434/chemrxiv-2025-bjxvt

[3] S. Ehlert, M. Stahn, S. Spicher, S. Grimme, J. Chem. Theory Comput., 2021, 17, 4250-4261 DOI: 10.1021/acs.jctc.1c00471

License

Complax is licensed under the MIT License.

See the LICENSE file for the full text.

Citation

If you use COMPLAX in your research, please cite our paper:

COMPLAX: A Python Tool Package for Automated Microsolvation of Organic Molecules
Federica Lauria and Andrea Maranzana.
Journal of Chemical Information and Modeling, 2026.
DOI: 10.1021/acs.jcim.6c02105

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

complax-1.1.2.tar.gz (86.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

complax-1.1.2-py3-none-any.whl (15.2 kB view details)

Uploaded Python 3

File details

Details for the file complax-1.1.2.tar.gz.

File metadata

  • Download URL: complax-1.1.2.tar.gz
  • Upload date:
  • Size: 86.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.2

File hashes

Hashes for complax-1.1.2.tar.gz
Algorithm Hash digest
SHA256 4adb1684f8ec7c5c13bcd6629ac9015599eddbf850984e08e7df7d6117170138
MD5 e1030a183de35f254c32f190d0a046f9
BLAKE2b-256 9c609fd8bdd1dd7a05ba42502fdc1b4726657f98ac288a3cb1dbd2488d8238a5

See more details on using hashes here.

File details

Details for the file complax-1.1.2-py3-none-any.whl.

File metadata

  • Download URL: complax-1.1.2-py3-none-any.whl
  • Upload date:
  • Size: 15.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.2

File hashes

Hashes for complax-1.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 a84d96c6c3ceabf46625f6568c5805dee985a47d2963175f6731b81034cdf3b8
MD5 08b9476040316256410da0297220aa5b
BLAKE2b-256 65ffc1fc5457c77b2db06517dc74b79eed745d1604c9f84675ef81b6830ef5db

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

1.1.2 This release

2 files

1.1.1

2 files

1.1.0

2 files

1.0.1

2 files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page