write_util

Short description

@author: Moritz F P Becker

pyrid.observables.write_util.data_id(Particles, System)[source]

Extracts (for each particle in the simulation) the particle index and the index of the corresponding parent molecule from an instance of the Particles class.

Parameters
Particlesobject

Instance of the Particles class.

Systemobject

Instance of the System class.

Returns
array_like

Structured array containing, for each particle, fields for the index and the index of the parent molecule.

pyrid.observables.write_util.pos_data(Particles, System)[source]

Extracts (for each particle in the simulation) the particle type name and coordinates from an instance of the Particles class. If a Particle is bound to another particle, the particle’s type name is extended by ‘_True’, otherwise by ‘_False’.

Parameters
Particlesobject

Instance of the Particles class.

Systemobject

Instance of the System class.

Returns
array_like

Structured array containing fields for the name, x-, y-, and z-coordinates of each particle.

pyrid.observables.write_util.read_xyz(file_path_pos, file_path_id=None)[source]

Reads an .xyz file and returns a structured array containing molecule ids, molecule type ids and the corresponding molecule trajectories/coordinates. In addition a set of the different molecule types is returned.

Parameters
file_path_posstring

Directory of the .xyz file

file_path_idint

file index. Default = None

Returns
tuple(array_like, set)

Structured array containing molecule ids, molecule type ids and the corresponding molecule trajectories/coordinates. Set of the different molecule types.

pyrid.observables.write_util.write(j, Simulation, System, Particles)[source]

Writes the trajectories/coordinates of the particles in the simulation to an .xyz file. This .xyz file can then be read by the PyRID Blender-addon.

Parameters
jint

current simulation time step.

Simulationobject

Instance of the Simulation class.

Systemobject

Instance of the System class.

Particlesobject

Instance of the Particles class.

pyrid.observables.write_util.write_init(Simulation, System)[source]

Initializes the write to file process by creating the .xyz, .prop, .pid and .box files. The .xyz file contains teh particle trajectories. The .prop file contains information about system properties such as the simulation box size, particle radii, interaction radii, Boltzmann constant, Temperature, viscosity, integration step size dt, and 3D mesh scale. The .box file contains the size of the simulation box at each time step. The .box file is only of interest in case the Berendsen barostat is used. The .pid file contains for each particle index the corresponding index of the parent molecule.

Parameters
Simulationobject

Instance of the Simulation class.

Systemobject

Instance of the System class.