lammpsio.Dihedrals

class lammpsio.Dihedrals(N, num_types=None)

Dihedral connections between particles.

All values of indexes follow the LAMMPS 1-indexed convention, but the arrays themselves are 0-indexed.

Parameters:
  • N (int) – Number of dihedrals.

  • num_types (int) – Number of dihedral types. Default of None means the number of types is determined from the unique typeids.

Example

Create dihedrals:

dihedrals = lammpsio.topology.Dihedrals(N=2, num_types=2)
dihedrals.id = [1, 2]
dihedrals.typeid = [1, 2]
dihedrals.members = [
    [1, 2, 3, 4],
    [2, 3, 4, 5],
]

This creates two dihedrals of two different types for a molecule consisting of eight atoms.

Methods:

has_id()

Check if configuration has connection IDs.

has_members()

Check if configuration has connection members.

has_typeid()

Check if configuration has connection typeids.

reorder(order[, check_order])

Reorder the connections in place.

Attributes:

N

Number of connections.

id

Unique identifiers (IDs).

members

Connection members.

num_types

Number of connection types.

type_label

Labels of connection type IDs.

typeid

Connection type IDs.

property N

Number of connections.

Type:

int

has_id()

Check if configuration has connection IDs.

Returns:

True if connection IDs have been initialized.

Return type:

bool

has_members()

Check if configuration has connection members.

Returns:

True if particle members have been initialized.

Return type:

bool

has_typeid()

Check if configuration has connection typeids.

Returns:

True if connection typeids have been initialized.

Return type:

bool

property id

Unique identifiers (IDs).

The default value on initialization runs from 1 to N.

Type:

(N,) numpy.ndarray of int

property members

Connection members.

The default value on initialization is 1 for all entries. M is the number of members in the connection.

Type:

(N, M) numpy.ndarray of int

property num_types

Number of connection types.

Type:

int

reorder(order, check_order=True)

Reorder the connections in place.

Parameters:
  • order (list) – New order of indexes.

  • check_order (bool) – If True, validate the new order before applying it.

property type_label

Labels of connection type IDs.

Type:

LabelMap

property typeid

Connection type IDs.

The default value on initialization is 1 for all entries.

Type:

(N,) numpy.ndarray of int