baggianalysis
0.0.2a1.dev24+gb8d84ed.d20210208
  • The core module
    • Particle-related classes
    • Topology-related classes and utility functions
    • Configuration parsers
    • Configuration exporters
    • Filters
    • Trajectory classes
    • Observables
    • Neighbour finders
  • 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.

parse_microgel_bondfile

parse_LAMMPS_topology

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. As of now, although all three classes of links are supported and stored in the topology, the only useful concept is the bond, which is used by the code to partition particles into clusters.

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(self: baggianalysis.core.Topology, arg0: int, arg1: int, arg2: int) → None¶
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.

add_dihedral(self: baggianalysis.core.Topology, arg0: int, arg1: int, arg2: int, arg3: int) → None¶
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. Each bond is a two-element list storing the indexes of a pair of bonded particles.

Type

List(List(int))

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.

baggianalysis.core.parse_microgel_bondfile(arg0: str, arg1: baggianalysis.core.Topology) → None¶
baggianalysis.core.parse_LAMMPS_topology(arg0: str, arg1: baggianalysis.core.Topology) → None¶
Next Previous

© Copyright 2020, Lorenzo Rovigatti

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