vermouth.processors.merge_chains module

Merge molecules by chain.

class vermouth.processors.merge_chains.MergeChains(chains=None, all_chains=False)[source]

Bases: Processor

name = 'MergeChains'
vermouth.processors.merge_chains.merge_chains(system, chains, all_chains)[source]

Merge molecules with the given chains as a single molecule.

Molecules are merged into the resulting molecule if their chain is in the list of chains to merge. The resulting molecule is not connected.

If a molecule comprises multiple chains, then it is merged only if all the chains it comprises are part of the selection.

The meta variable are not conserved in the process.

The input system is modified in-place.

  • system (vermouth.system.System) – The system to modify.

  • chains (list[str]) – A container of chain identifier.

  • all_chains (bool) – If True, all chains will be merged.