baggianalysis
0.2.0b1.dev9+g42a7eac.d20210823
  • The core module
    • Particle-related classes
    • Topology-related classes and utility functions
    • Configuration parsers
    • Configuration exporters
    • Filters
    • Trajectory classes
    • Observables
    • Neighbour finders
  • The utils module
  • Writing a parser
  • Writing a function to parse custom topologies
baggianalysis
  • »
  • The core module »
  • Particle-related classes
  • View page source

Particle-related classes¶

Particle

A simulation particle.

ParticleSet

A set of particles.

System

A single configuration.

class baggianalysis.core.Particle(*args, **kwargs)¶

Bases: pybind11_builtins.pybind11_object

A simulation particle.

Overloaded function.

  1. __init__(self: baggianalysis.core.Particle, index: int) -> None

Build a new particle by specifying its index.

Parameters

index (int) – The index of the particle. Note that this value cannot be changed later on.

  1. __init__(self: baggianalysis.core.Particle, index: int, type: str) -> None

Build a new particle by specifying its index and type.

Parameters
  • index (int) – The index of the particle. Note that this value cannot be changed later on.

  • type (str) – The type of the particle.

  • type –

  1. __init__(self: baggianalysis.core.Particle, index: int, type: str, position: glm::tvec3<scalar, P>) -> None

Build a new particle by specifying its index, type and position.

Parameters
  • index (int) – The index of the particle. Note that this value cannot be changed later on.

  • type (str) – The type of the particle.

  • position (numpy.ndarray) – The position of the particle

  1. __init__(self: baggianalysis.core.Particle, index: int, type: str, position: glm::tvec3<scalar, P>, velocity: glm::tvec3<scalar, P>) -> None

Build a new particle by specifying its index, type, position and velocity.

Parameters
  • index (int) – The index of the particle. Note that this value cannot be changed later on.

  • type (str) – The type of the particle.

  • position (numpy.ndarray) – The position of the particle.

  • velocity (numpy.ndarray) – The velocity of the particle.

add_bonded_angle(*args, **kwargs)¶

Overloaded function.

  1. add_bonded_angle(self: baggianalysis.core.Particle, type: str, p1: baggianalysis.core.Particle, p2: baggianalysis.core.Particle, p3: baggianalysis.core.Particle) -> None

Add an angle of the given type (defined by three particles) this particle is involved in. Note that the current particle must be one of the three particles given as parameters.

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

  • p1 (Particle) – The first particle participating in the angle.

  • p2 (Particle) – The second particle participating in the angle.

  • p3 (Particle) – The third particle participating in the angle.

  1. add_bonded_angle(self: baggianalysis.core.Particle, p1: baggianalysis.core.Particle, p2: baggianalysis.core.Particle, p3: baggianalysis.core.Particle) -> None

Add an angle of the default type (defined by three particles) this particle is involved in. Note that the current particle must be one of the three particles given as parameters.

Parameters
  • p1 (Particle) – The first particle participating in the angle.

  • p2 (Particle) – The second particle participating in the angle.

  • p3 (Particle) – The third particle participating in the angle.

add_bonded_dihedral(*args, **kwargs)¶

Overloaded function.

  1. add_bonded_dihedral(self: baggianalysis.core.Particle, type: str, p1: baggianalysis.core.Particle, p2: baggianalysis.core.Particle, p3: baggianalysis.core.Particle, p4: baggianalysis.core.Particle) -> None

Add a dihedral of the given type (defined by four particles) this particle is involved in. Note that the current particle must be one of the four particles given as parameters.

Parameters
  • type (str) – The type of the dihedral.

  • p1 (Particle) – The first particle participating in the dihedral.

  • p2 (Particle) – The second particle participating in the dihedral.

  • p3 (Particle) – The third particle participating in the dihedral.

  • p4 (Particle) – The fourth particle participating in the dihedral.

  1. add_bonded_dihedral(self: baggianalysis.core.Particle, p1: baggianalysis.core.Particle, p2: baggianalysis.core.Particle, p3: baggianalysis.core.Particle, p4: baggianalysis.core.Particle) -> None

Add a dihedral of the default type (defined by four particles) this particle is involved in. Note that the current particle must be one of the four particles given as parameters.

Parameters
  • p1 (Particle) – The first particle participating in the dihedral.

  • p2 (Particle) – The second particle participating in the dihedral.

  • p3 (Particle) – The third particle participating in the dihedral.

  • p4 (Particle) – The fourth particle participating in the dihedral.

add_bonded_neighbour(*args, **kwargs)¶

Overloaded function.

  1. add_bonded_neighbour(self: baggianalysis.core.Particle, type: str, q: baggianalysis.core.Particle) -> None

Add a bond of the given type between the current particle and q.

Parameters
  • type (str) – The type of bond shared by the two particles.

  • q (Particle) – The new bonded neighbour.

  1. add_bonded_neighbour(self: baggianalysis.core.Particle, q: baggianalysis.core.Particle) -> None

Add a bond of the default type between the current particle and q.

Parameters

q (Particle) – The new bonded neighbour.

add_neighbour(*args, **kwargs)¶

Overloaded function.

  1. add_neighbour(self: baggianalysis.core.Particle, type: str, q: baggianalysis.core.Particle) -> None

Add particle q as a bond of the given type to the list of this particle’s neighbours. Contrary to add_bonded_neighbour(), the current particle is not added to the list of q’s neighbours.

Parameters
  • type (str) – The type of bond shared by the two particles.

  • q (Particle) – The new neighbour.

  1. add_neighbour(self: baggianalysis.core.Particle, q: baggianalysis.core.Particle) -> None

Add particle q as a bond of the default type to the list of this particle’s neighbours. Contrary to add_bonded_neighbour(), the current particle is not added to the list of q’s neighbours.

Parameters

q (Particle) – The new neighbour.

add_orientation_vector(self: baggianalysis.core.Particle, v: glm::tvec3<scalar, P>) → None¶

The molecule to which this particle belongs.

Parameters

v (numpy.ndarray) – The new orientation vector.

property bonded_angles¶

A list of ParticleSet s storing the angles (i.e. triplets of particles) this particle is involved in.

Type

Set(ParticleSet)

property bonded_dihedrals¶

A list of ParticleSet s storing the dihedrals (i.e. list of four particles) this particle is involved in.

Type

Set(ParticleSet)

property bonded_neighbours¶

A list of this particle’s bonded neighbours.

Type

Set(Particle)

property charge¶

The particle’s charge.

Type

float

has_bonded_neighbour(self: baggianalysis.core.Particle, q: baggianalysis.core.Particle) → bool¶

Check whether q is a bonded neighbour.

Parameters

q (Particle) – Another particle.

Returns

True if q is a bonded neighbour, False otherwise.

Return type

bool

has_neighbour(self: baggianalysis.core.Particle, q: baggianalysis.core.Particle) → bool¶

Check whether q is a neighbour.

Parameters

q (Particle) – Another particle.

Returns

True if q is a neighbour, False otherwise.

Return type

bool

property index¶

The particle’s index. This is a read-only property because changing the index of the particle should be done with the methods provided by ParticleSet and System only.

type

int

make_copy(self: baggianalysis.core.Particle, index: int) → baggianalysis.core.Particle¶

Return a copy of this particle with the given index. Note that neighbours and bonded neighbours, angles and dihedrals are not copied.

Parameters

index (int) – The index of the new particle.

property mass¶

The particle’s mass.

Type

float

property molecule¶

The molecule to which this particle belongs.

Type

ParticleSet

property neighbours¶

A list of this particle’s neighbours.

Type

Set(Particle)

property orientation_vectors¶

A list of vectors related to the particle’s orientation. Depending on the specific model it may contain the list of interaction centres or the components of the orientation matrix.

type

List(numpy.ndarray)

property position¶

The particle’s position.

Type

numpy.ndarray

property type¶

The particle’s type.

Type

string

property velocity¶

The particle’s velocity.

Type

numpy.ndarray

class baggianalysis.core.ParticleSet(self: baggianalysis.core.ParticleSet) → None¶

Bases: pybind11_builtins.pybind11_object

A set of particles.

N(self: baggianalysis.core.ParticleSet) → int¶
add_particle(self: baggianalysis.core.ParticleSet, arg0: baggianalysis.core.Particle) → None¶
average_velocity(self: baggianalysis.core.ParticleSet) → glm::tvec3<scalar, P>¶
charge(self: baggianalysis.core.ParticleSet) → float¶
charges(self: baggianalysis.core.ParticleSet) → List[float]¶
com(self: baggianalysis.core.ParticleSet) → glm::tvec3<scalar, P>¶
id_exists(self: baggianalysis.core.ParticleSet, arg0: int) → bool¶
indexes(self: baggianalysis.core.ParticleSet) → List[int]¶
mass(self: baggianalysis.core.ParticleSet) → float¶
masses(self: baggianalysis.core.ParticleSet) → List[float]¶
property name¶
particle_by_id(self: baggianalysis.core.ParticleSet, arg0: int) → baggianalysis.core.Particle¶
particles(self: baggianalysis.core.ParticleSet) → List[baggianalysis.core.Particle]¶
positions(self: baggianalysis.core.ParticleSet) → List[glm::tvec3<scalar, P>]¶
remove_particle(self: baggianalysis.core.ParticleSet, arg0: baggianalysis.core.Particle) → None¶
remove_particle_by_id(self: baggianalysis.core.ParticleSet, arg0: int) → None¶
sort_particles_by_id(self: baggianalysis.core.ParticleSet) → None¶
types(self: baggianalysis.core.ParticleSet) → List[str]¶
velocities(self: baggianalysis.core.ParticleSet) → List[glm::tvec3<scalar, P>]¶
class baggianalysis.core.System(self: baggianalysis.core.System) → None¶

Bases: baggianalysis.core.ParticleSet

A single configuration.

The constructor takes no arguments.

available_index(self: baggianalysis.core.System) → int¶

Return a particle index that can be used in the context of this system (that is, that is not used by any of the particles already present in the system).

Returns

A number that can be used as a valid index for a new particle.

Return type

int

property box¶
bring_particles_in_box(self: baggianalysis.core.System, shift_by_half_box: bool = False) → None¶

Bring the particles back into the box.

Parameters

shift_by_half_box (bool) – If False (the default value) particles will have coordinates ranging from 0 to the length of the box side. If True, the coordinates will range between -box/2 and +box/2.

empty_copy(self: baggianalysis.core.System) → baggianalysis.core.System¶

Return a copy of this system (same time and box, no particles).

Returns

A new system with the same time and box of this one.

Return type

System

molecules(self: baggianalysis.core.System) → List[baggianalysis.core.ParticleSet]¶

Return all the molecules contained in the system in the form of a list of ParticleSet.

Returns

The list of molecules contained in the system.

Return type

list(ParticleSet)

normalise_molecules(self: baggianalysis.core.System) → None¶

Use periodic boundary conditions to shift particle positions so that bonded neighbours are always as close as possible to each other and not separated by distances that are multiple of box sides.

reindex_particles(self: baggianalysis.core.System, base_idx: int) → None¶

Sort the particles by index and assign them new indexes so that the first and last ones are base_index and base_index + N() - 1, respectively.

Parameters

base_index (int) – The starting index that should be used.

rescale_lengths(self: baggianalysis.core.System, factor: float) → None¶

Rescale all lengths (positions, velocities, box sides, etc.) by the given factor.

Parameters

factor (float) – The rescaling factor.

property time¶
Next Previous

© Copyright 2020, Lorenzo Rovigatti

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