Topology-related classes and utility functions¶
This class manages the connections and links between the particles of a system. |
|
-
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 bymake_topology_from_file()
) the topology can be applied to any system (seeapply()
). 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 callingdisable_checks()
prior toapply()
.Instances of this class can be either built with the
make_empty_topology()
ormake_topology_from_file()
static methods or by directly using a constructor that takes as its only parameter theSystem
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_bond
(self: baggianalysis.core.Topology, p: int, q: int) → None¶ Adds a bond between a pair of particles.
-
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
-
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.
-
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¶