Configuration parsers

All parsers inherit from BaseParser and override the _parse_stream and, possibly, the _parse_file methods. After a parser has been initialised it can be used to build a single system through its make_system() method or a whole trajectory by using it to initialise a Trajectory object.

BaseParser

OxDNAParser

Use oxDNA/topology files to build systems.

GroParser

LAMMPSDataFileParser

Parse LAMMPS data files.

LAMMPSDumpParser

Parse LAMMPS dump files.

LJKAParser

PatchyParticlesParser

Build systems out of PatchyParticles configurations.

class baggianalysis.core.BaseParser(self: baggianalysis.core.BaseParser)None

Bases: pybind11_builtins.pybind11_object

_parse_file(self: baggianalysis.core.BaseParser, arg0: str)baggianalysis.core.System
make_system(self: baggianalysis.core.BaseParser, arg0: str)baggianalysis.core.System
set_topology(self: baggianalysis.core.BaseParser, arg0: baggianalysis.core.Topology)None
use_topology(self: baggianalysis.core.BaseParser, arg0: bool)None
class baggianalysis.core.OxDNAParser(*args, **kwargs)

Bases: baggianalysis.core.BaseParser

Use oxDNA/topology files to build systems.

Overloaded function.

  1. __init__(self: baggianalysis.core.OxDNAParser) -> None

Initialise the parser without any topology file.

  1. __init__(self: baggianalysis.core.OxDNAParser, topology_file: str) -> None

Initialise the parser by using the Default topology parser to parse the given topology file.

Parameters

topology_file (str) – The topology file to be used for initialisation.

  1. __init__(self: baggianalysis.core.OxDNAParser, topology_parser: baggianalysis.core.oxDNA_topology.Default) -> None

Initialise the parser by using the given topology parser.

Parameters

topology – An oxDNA topology parser, which should be an instance of an object inheriting from the Default topology parser.

set_orientation_inserter(self: baggianalysis.core.OxDNAParser, inserter: Callable[[baggianalysis.core.Particle, glm::tmat3x3<scalar, P>], None])None

Set the callable that will be used to initialise the orientation vectors of each particle. The following example will correctly initialise two-patch particles out of oxDNA configurations:

P1 = np.array([0., 0.5, 0.])
P2 = np.array([0., -0.5, 0.])
def add_patches(p, orientation_matrix):
    p.add_orientation_vector(orientation_matrix @ P1)
    p.add_orientation_vector(orientation_matrix @ P2)

oxDNA_parser.set_orientation_inserter(add_patches)
Parameters

inserter – A callable that takes a particle and its orientation matrix and adds to the former the orientation vectors due to the latter.

topology_parser(self: baggianalysis.core.OxDNAParser)baggianalysis.core.oxDNA_topology.Default

Return the topology parser associated to this parser.

class baggianalysis.core.oxDNA_topology.Default(self: baggianalysis.core.oxDNA_topology.Default, arg0: str)None

Bases: pybind11_builtins.pybind11_object

N(self: baggianalysis.core.oxDNA_topology.Default)int

Return the number of particles as specified in the topology file.

Returns

The number of particles as specified in the topology file.

Return type

int

N_A(self: baggianalysis.core.oxDNA_topology.Default)int

A default oxDNA topology contains either a single number (the total number of particles, N) or two numbers (N and the number of particles of the first species, NA). This method returns N in the former case and NA in the latter.

Returns

The number of particles of species A as specified in the topology file.

Return type

int

type(self: baggianalysis.core.oxDNA_topology.Default, p_idx: int)str

The type of the particle with the given index.

Parameters

p_idx (int) – The index of the particle whose type one wants to know.

Returns

The type of the given particle.

Return type

str

class baggianalysis.core.oxDNA_topology.TSP(self: baggianalysis.core.oxDNA_topology.TSP, arg0: str)None

Bases: baggianalysis.core.oxDNA_topology.Default

N_arms(self: baggianalysis.core.oxDNA_topology.TSP, arg0: int)int
N_monomers_per_arm(self: baggianalysis.core.oxDNA_topology.TSP, arg0: int)int
N_stars(self: baggianalysis.core.oxDNA_topology.TSP)int
class baggianalysis.core.GroParser(self: baggianalysis.core.GroParser, arg0: float)None

Bases: baggianalysis.core.BaseParser

class baggianalysis.core.LAMMPSDataFileParser(*args, **kwargs)

Bases: baggianalysis.core.BaseParser

Parse LAMMPS data files.

Overloaded function.

  1. __init__(self: baggianalysis.core.LAMMPSDataFileParser, atom_style: str) -> None

  2. __init__(self: baggianalysis.core.LAMMPSDataFileParser, type_index: int, pos_starting_index: int) -> None

  3. __init__(self: baggianalysis.core.LAMMPSDataFileParser, type_index: int, pos_starting_index: int, charge_index: int) -> None

property topology
class baggianalysis.core.LAMMPSDumpParser(*args, **kwargs)

Bases: baggianalysis.core.BaseParser

Parse LAMMPS dump files.

It uses the “ITEM: ATOMS” line to automatically map fields to atom/particle properties (type, index, mass, charge, coordinates, velocities). It can optionally use a LAMMPS data file to also initialise the system topology.

Overloaded function.

  1. __init__(self: baggianalysis.core.LAMMPSDumpParser) -> None

The default constructor takes no arguments

  1. __init__(self: baggianalysis.core.LAMMPSDumpParser, data_file_system: baggianalysis.core.System) -> None

  2. __init__(self: baggianalysis.core.LAMMPSDumpParser, data_file: str, atom_style: str) -> None

class baggianalysis.core.LJKAParser(self: baggianalysis.core.LJKAParser)None

Bases: baggianalysis.core.BaseParser

class baggianalysis.core.PatchyParticlesParser(*args, **kwargs)

Bases: baggianalysis.core.BaseParser

Build systems out of PatchyParticles configurations. These files store the particles’ positios and orientation matrices.

Overloaded function.

  1. __init__(self: baggianalysis.core.PatchyParticlesParser) -> None

Default constructor: the parser will assume that the particles have four patches arranged on a tetrahedron.

  1. __init__(self: baggianalysis.core.PatchyParticlesParser, base_patches: List[glm::tvec3<scalar, P>]) -> None

The object can also be built by providing a list of vectors storing the base patches, that is, those vectors that, when multiplied by the orientation matrix, yield the particles’ patches.

  1. __init__(self: baggianalysis.core.PatchyParticlesParser, patch_filename: str) -> None

Obtain the list of vectors storing the base patches from the given file.