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. Each link has also associated a link type, which is1
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 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_angle
(*args, **kwargs)¶ Overloaded function.
add_angle(self: baggianalysis.core.Topology, p: int, q: int, r: int) -> None
Adds an angle formed by a triplet of particles.
- Parameters
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.
-
add_bond
(*args, **kwargs)¶ Overloaded function.
add_bond(self: baggianalysis.core.Topology, p: int, q: int) -> None
Adds a bond between a pair of particles.
- Parameters
add_bond(self: baggianalysis.core.Topology, bond_type: str, p: int, q: int) -> None
Adds a typed bond between a pair of particles.
-
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.
-
add_dihedral
(*args, **kwargs)¶ Overloaded function.
add_dihedral(self: baggianalysis.core.Topology, p: int, q: int, r: int, s: int) -> None
Adds a dihedral formed by four particles.
- Parameters
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.
-
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
-
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.
-
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
¶
-
property
-
class
baggianalysis.core.
TopologyAngle
¶ Bases:
pybind11_builtins.pybind11_object
-
property
particles
¶
-
property
type
¶
-
property
-
class
baggianalysis.core.
TopologyDihedral
¶ Bases:
pybind11_builtins.pybind11_object
-
property
particles
¶
-
property
type
¶
-
property
-
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¶