vermouth.processors.locate_charge_dummies module

Provides a processor that generates positions for every charge dummy.

class vermouth.processors.locate_charge_dummies.LocateChargeDummies(attribute_tag='charge_dummy')[source]

Bases: Processor

run_molecule(molecule)[source]
vermouth.processors.locate_charge_dummies.colinear_pair()[source]

Build two points on a line around the origin at a random orientation.

vermouth.processors.locate_charge_dummies.fibonacci_sphere(n_samples)[source]

Place points near-evenly distributed on a sphere.

Use the Fibonacci sphere algorithm to place ‘n_samples’ points at the surface of a sphere of radius 1, centered on the origin.

Parameters:

n_samples (int) – Number of points to place.

Returns:

3D coordinates of the points.

Return type:

numpy.ndarray

vermouth.processors.locate_charge_dummies.find_anchor(molecule, node_key, attribute_tag='charge_dummy')[source]

Find the non-dummy bead to which a charge dummy is anchored.

Each charge dummy has to be attached to exactly one non-dummy atom. This function returns the node key for that non-dummy atom.

Parameters:
  • molecule (networkx.Graph) – The molecule to work on.

  • node_key – The node key of the charge dummy.

  • attribute_tag (str) – The name of the atom attribute used to describe charge dummies.

Returns:

The node key of the anchor in the molecule graph.

Return type:

collections.abc.Hashable

Raises:

ValueError – Raised if there are no anchor, or more than one anchor, found. Raised also if the charge dummy is not a charge dummy.

vermouth.processors.locate_charge_dummies.locate_all_dummies(molecule, attribute_tag='charge_dummy')[source]

Set the position of all charge dummies of a molecule.

The molecule is modified in-place.

The charge dummies are placed at a distance to the anchor defined in nm by their charge dummy attribute, the name of which is given in the ‘attribute_tag’ argument.

Parameters:
  • molecule (vermouth.molecule.Molecule) – The molecule to work on.

  • attribute_tag (str) – Name of the atom attribute that describe charge dummies.

vermouth.processors.locate_charge_dummies.locate_dummy(molecule, anchor_key, dummy_keys, attribute_tag='charge_dummy')[source]

Set the position of a group of charge dummies around a non-dummy anchor.

The molecule is modified in-place.

The charge dummies are placed at a distance to the anchor defined in nm by their charge dummy attribute, the name of which is given in the ‘attribute_tag’ argument.

Parameters:
  • molecule (vermouth.molecule.Molecule) – The molecule to work on.

  • anchor_key – The key of the non-dummy anchor all the charge dummies are connected to.

  • dummy_keys (collections.abc.Iterable) – A collection of atom keys for charge dummies to position.

  • attribute_tag (str) – Name of the atom attribute that describe charge dummies.