Skip to main content

Combine 2 molecules in 3D by sample.

Project description

CombineMols3D

Combine 2 molecules in 3D by sample.

overview

Overview of the combination process.

How it works?

In short, it could be summarized into 2 steps:

  1. Translation:
    • The new bond length is determined by the summation of the covalent radii of the two atoms.
    • Set one atom as the central of a sphere, sample positions on this sphere and calculate the repulsion between the new addon to the whole molecule. (The repulsion is measured by the summation of the inverse distance.)
    • Choose the minimum repulsion position and translate the whole addon molecule as a rigid body.
  2. Rotation:
    • Set the bonded site as center and the nearest neighbor as rotation axes. Rotate the addon molecule as a rigid body
    • Sample rotation angles to minimize the repulsion between the addon molecule to the main molecule. (Again, the repulsion is measured by the summation of the inverse distance.)
    • Choose the minimum repulsion image and this is the final combination state.

Install

pip install combinemols3d

Usage

  1. Prepare your to-be-bonded molecules as ase.Atoms object. (Read ase documentation for format manipulation.)
  2. Determine which sites to be bonded together. (dummy sites)
  3. Combine them by eliminate the dummy sites.
from ase.visualize import view
from ase.build.molecule import molecule
from combinemols3d.CombineMols3D import combine_2_mols_with_dummy, combine_2_mols

main_mol = molecule('C7NH5')
sub_mol = molecule('BDA')

view(main_mol)
view(sub_mol)

final_mol = combine_2_mols_with_dummy(molecule_1=main_mol.copy(), molecule_2=sub_mol.copy(),
                                      dummy_atom_index_1=11, dummy_atom_index_2=6)
view(final_mol)

If you don't want to eliminate the dummy sites, use the combine_2_mols instead:

final_mol = combine_2_mols(molecule_1=main_mol, molecule_2=sub_mol,
                                      tgt_atom_1_index=11, tgt_atom_2_index=6)
view(final_mol)

Other parameters are same for the two functions:

  • Conformation related:

    • skin: to get a proper bond length for the new bond. Here we adopt the covalent radii method. A skin parameter is added to finetune the bond length, though it is 0 by default.

      $R(\mathrm{AB})=r(\mathrm{A})+r(\mathrm{B})+skin$

    • cutoff_mult: there are several places to detect neighbors for a specific atom. By default, it is natural cutoff as follow equation:

      $DetectRange(\mathrm{AB})=r(\mathrm{A})+r(\mathrm{B})+0.3$

      We can enlarge our search scope to multiply the natural cutoff as follow equation:

      $DetectRange(\mathrm{AB})=cutoff mult*(r(\mathrm{A})+r(\mathrm{B})+0.3)$

  • Performance related:

    • sample_times: how many times to sample addon positions in translation and angles in rotation.
    • rotation_times: In the rotation stage, we will rotate the whole addon molecule as a rigid body. The orientations of the addon site to its neighbors are taken as fixed rotation axes. How many neighbors to be considered could be performance critical.

Note

Contact me: 1660810667@qq.com

Project details


Download files

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

Source Distribution

combinemols3d-1.1.0.tar.gz (505.9 kB view details)

Uploaded Source

Built Distribution

combinemols3d-1.1.0-py3-none-any.whl (6.3 kB view details)

Uploaded Python 3

File details

Details for the file combinemols3d-1.1.0.tar.gz.

File metadata

  • Download URL: combinemols3d-1.1.0.tar.gz
  • Upload date:
  • Size: 505.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.9.19

File hashes

Hashes for combinemols3d-1.1.0.tar.gz
Algorithm Hash digest
SHA256 247cb149b41bae1b154ffcbeadfb7d5c101a1748eb90e7bd34973815bf44ef2d
MD5 3c8a979231ea4eb5a924b16e46b71279
BLAKE2b-256 0e1073d6f6e111878e996de08d6b1f54f17b98aa7c0ddfd9422db9edc7eb2143

See more details on using hashes here.

File details

Details for the file combinemols3d-1.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for combinemols3d-1.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 7eb584bd1d61525baf6ed2cce77d1682130cb5f71e8dd306ee0b84eb42a6c435
MD5 ee4240bab41cbc87a5b854aabf6b6a92
BLAKE2b-256 aba9667727c1575c10761075f3170e30b82b722e4c8d532fb47b02dd949bf09e

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page