baggianalysis
0.6.1.dev8+g1a43384
  • Installation
    • Requirements
    • Install with pip
    • Manual install
      • cmake options
      • Common compilation issues
    • Test suite
  • The core module
    • Particle-related classes
    • Topology-related classes and utility functions
    • Configuration parsers
    • Configuration exporters
    • Filters
    • Trajectory classes
    • Observables
    • Neighbour finders
    • Utilities
  • The converters module
  • The traj module
  • The utils module
  • Writing a parser
  • Writing a function to parse custom topologies
baggianalysis
  • »
  • The core module »
  • Topology-related classes and utility functions
  • View page source

Topology-related classes and utility functions¶

Topology

This class manages the connections and links between the particles of a system.

TopologyBond

TopologyAngle

TopologyDihedral

parse_microgel_bondfile

parse_polymer_bondfile

parse_LAMMPS_topology

topology_from_LAMMPS_data_file

class baggianalysis.core.Topology(self: baggianalysis.core.Topology, arg0: baggianalysis.core.System) → None¶

Bases: pybind11_builtins.pybind11_object

This class manages the connections and links between the particles of a system.

Here the term topology refers to the way atoms/particles are partitioned into clusters. In its simplest form, a topology is just a list of links between particles. These links can be shared between two, three, four or more particles. While the latter are pretty rare, the others are quite common. Connections between two, three and four particles are here called bonds, angles and dihedrals. Each link has also associated a link type, which is 1 by default.

It is important to remember that all the links in the topology are specified through using particle indexes, which are integer numbers. Once the links have been added (either manually to an empty topology generated by make_empty_topology() or parsed from a file by make_topology_from_file()) the topology can be applied to any system (see apply()). Note that, by default, it is not possible to apply the same topology to systems having different numbers of particles. This behaviour can be overridden by calling disable_checks() prior to apply().

Instances of this class can be either built with the make_empty_topology() or make_topology_from_file() static methods or by directly using a constructor that takes as its only parameter the System instance whence the topology is extracted:

# here we build or parse a system
system = ...
# and then create a topology out of its bonding pattern
new_topology = ba.Topology(system)
add_angle(*args, **kwargs)¶

Overloaded function.

  1. add_angle(self: baggianalysis.core.Topology, p: int, q: int, r: int) -> None

Adds an angle formed by a triplet of particles.

Parameters
  • p (int) – The index of the first particle of the triplet.

  • q (int) – The index of the second (central) particle of the triplet.

  • r (int) – The index of the third (and last) particle of the triplet.

  1. add_angle(self: baggianalysis.core.Topology, angle_type: str, p: int, q: int, r: int) -> None

Adds a typed angle formed by a triplet of particles.

Parameters
  • angle_type (str) – The type of the angle.

  • p (int) – The index of the first particle of the triplet.

  • q (int) – The index of the second (central) particle of the triplet.

  • r (int) – The index of the third (and last) particle of the triplet.

add_bond(*args, **kwargs)¶

Overloaded function.

  1. add_bond(self: baggianalysis.core.Topology, p: int, q: int) -> None

Adds a bond between a pair of particles.

Parameters
  • p (int) – The index of the first particle of the pair.

  • q (int) – The index of the second particle of the pair.

  1. add_bond(self: baggianalysis.core.Topology, bond_type: str, p: int, q: int) -> None

Adds a typed bond between a pair of particles.

Parameters
  • bond_type (str) – The bond type.

  • p (int) – The index of the first particle of the pair.

  • q (int) – The index of the second particle of the pair.

add_chain_bonds(self: baggianalysis.core.Topology, first_idx: int, last_idx: int) → None¶

Add bonds between consecutive pairs of particles in the given index range. Note that both indexes will be included.

Parameters
  • first_idx (int) – The index of the particle at the beginning of the chain.

  • last_idx (int) – The index of the particle at the end of the chain.

add_dihedral(*args, **kwargs)¶

Overloaded function.

  1. add_dihedral(self: baggianalysis.core.Topology, p: int, q: int, r: int, s: int) -> None

Adds a dihedral formed by four particles.

Parameters
  • p (int) – The index of the first particle.

  • q (int) – The index of the second particle.

  • r (int) – The index of the third particle.

  • s (int) – The index of the fourth particle.

  1. add_dihedral(self: baggianalysis.core.Topology, dihedral_type: str, p: int, q: int, r: int, s: int) -> None

Adds a typed dihedral formed by four particles.

Parameters
  • dihedral_type (str) – The type of the dyhedral.

  • p (int) – The index of the first particle.

  • q (int) – The index of the second particle.

  • r (int) – The index of the third particle.

  • s (int) – The index of the fourth particle.

property angles¶

The list of angles stored in the topology.

Type

List(TopologyAngle)

apply(self: baggianalysis.core.Topology, system: baggianalysis.core.System) → None¶

Applies the current topology to the given system, adding the bonds to the particles and partitioning them into clusters.

Parameters

system (System) – The target system.

property bonds¶

The list of bonds stored in the topology.

Type

List(TopologyBond)

property clusters¶

The list of clusters stored in the topology. Each cluster is a set of particle ids that belong to that cluster.

Type

List(Set(int))

property dihedrals¶

The list of dihedrals stored in the topology.

Type

List(TopologyDihedral)

disable_checks(self: baggianalysis.core.Topology) → None¶

Disables exception throwing whenever errors occur during application to a system.

enable_checks(self: baggianalysis.core.Topology) → None¶

Makes the topology throw exceptions whenever errors occur during application to a system.

static make_empty_topology() → baggianalysis.core.Topology¶

This static method builds an empty topology and returns it.

Returns

A new empty topology.

Return type

Topology

static make_topology_from_file(filename: str, parser: Callable[[str, baggianalysis.core.Topology], None]) → baggianalysis.core.Topology¶

This static method uses a user-passed callable to build a topology out of a file.

Parameters
  • filename (str) – The name of the file to parse.

  • parser (callable) – A callable that takes a str and a Topology. The former is the name of the file containing the topology details to be parsed, while the latter is the empty topology that will be initialised by the callable.

static make_topology_from_system(system: baggianalysis.core.System) → baggianalysis.core.Topology¶

This static method generates a topology out of a system by using the bonded neighbours of each particle to build the list of bonds.

Parameters

system (System) – The input system.

remove_unappliable_links(self: baggianalysis.core.Topology, system: baggianalysis.core.System) → None¶

Remove from the current topology all those links (bonds, angles, dihedrals) that refer to particles that do not exist in the given system. This procedure makes it so the given system will contain the correct set of molecules once apply() is called on it. Note that this operation is irreversible.

Parameters

system (System) – The system whose particles will be used to identify the links to be removed.

class baggianalysis.core.TopologyBond¶

Bases: pybind11_builtins.pybind11_object

property particles¶
property type¶
class baggianalysis.core.TopologyAngle¶

Bases: pybind11_builtins.pybind11_object

property particles¶
property type¶
class baggianalysis.core.TopologyDihedral¶

Bases: pybind11_builtins.pybind11_object

property particles¶
property type¶
baggianalysis.core.parse_microgel_bondfile(arg0: str, arg1: baggianalysis.core.Topology) → None¶
baggianalysis.core.parse_polymer_bondfile(arg0: str, arg1: baggianalysis.core.Topology) → None¶
baggianalysis.core.parse_LAMMPS_topology(arg0: str, arg1: baggianalysis.core.Topology) → None¶
baggianalysis.core.topology_from_LAMMPS_data_file(arg0: str) → baggianalysis.core.Topology¶
Next Previous

© Copyright 2020, Lorenzo Rovigatti

Built with Sphinx using a theme provided by Read the Docs.