pyiron_contrib.protocol.primitive.one_state module
- class pyiron_contrib.protocol.primitive.one_state.BerendsenBarostat(name=None)[source]
Bases:
PrimitiveVertex
The Berendsen barostat which can be used for pressure control as elaborated in https://doi.org/10.1063/1.448118 NOTE: Always use in conjunction with a thermostat, otherwise time integration will not be performed. The barostat only modifies the cell of the input structure, and scales the positions. Positions and velocities will only be updated by the thermostat. Input attributes:
pressure (float): The pressure in GPa to be simulated (Default is None GPa) temperature (float): The temperature in K (Default is 0. K) box_pressures (numpy.ndarray): The pressure tensor in GPa generated per step by Lammps energy_kin (float): The kinetic energy of the system in eV (Default is None) time_step (float): MD time step in fs. (Default is 1 fs.) pressure_damping_timescale (float): Damping timescale in fs. (Default is None, no barostat is used.) compressibility (float): The compressibility of water in bar-1. More information here:
http://www.sklogwiki.org/SklogWiki/index.php/Berendsen_barostat (Default is 4.57e-5 bar-1)
structure (Atoms): The structure whose cell and positions are to be scaled. positions (numpy.ndarray): The updated positions from VerletPositionUpdate. previous_volume (float): The volume of the cell from the previous step in Ang3 (Default is None) pressure_style (string): ‘isotorpic’ or ‘anisotropic’. (Default is ‘anisotropic’)
- Output attributes:
pressure (float): The isotropic pressure in GPa volume (float): The volume of the cell in Ang3 structure (Atoms): The scaled structure, corresponding to the simulated volume positions (numpy.ndarray): The scaled positions
- class pyiron_contrib.protocol.primitive.one_state.BuildMixingPairs(name=None)[source]
Bases:
PrimitiveVertex
- Builds an array of mixing parameters [lambda, (1-lambda)], and also finds the deltas between consecutive
lambdas.
- Input attributes:
n_lambdas (int): How many mixing pairs to create. (Default is 5.) custom_lambdas (list/numpy.ndarray): The individual lambda values to use for the first member of each pair.
(Default is None.)
- Output attributes:
lambda_pairs (numpy.ndarray): The (n_lambdas, 2)-shaped array of mixing pairs. delta_lambdas (numpy.ndarray): The delta between two consecutive lambdas. The end deltas are
halved.
- class pyiron_contrib.protocol.primitive.one_state.Compute(name=None)[source]
Bases:
PrimitiveVertex
- class pyiron_contrib.protocol.primitive.one_state.ComputeFormationEnergy(**kwargs)[source]
Bases:
PrimitiveVertex
- class pyiron_contrib.protocol.primitive.one_state.Counter(name=None)[source]
Bases:
PrimitiveVertex
Increments by one at each execution. Can be made to increment from a specific value. Input attributes:
add_counts (int): A specific value from which to increment. (Default is 0.)
- Output attributes:
n_counts (int): How many executions have passed. (Default is 0.)
- class pyiron_contrib.protocol.primitive.one_state.CreateJob(name=None)[source]
Bases:
ExternalHamiltonian
- Creates a job of an external interpreter (e.g. Lammps, Vasp, Sphinx…) outside of the ExternalHamiltonian.
This vertex does not run the interpreter, but only creates the job and saves it.
- Input attributes:
- ref_job_full_path (string): The full path to the hdf5 file of the job to use as a reference template.
(Default is None.)
n_images (int): Number of jobs to create. (Default is 5.) structure (Atoms): The structure for initializing the external Hamiltonian. Overwrites the reference
job structure when provided. (Default is None, the reference job needs to have its structure set.)
- Output attributes:
project_path (list/string): The path of the project. job_names (list/string): The name of the job.
- class pyiron_contrib.protocol.primitive.one_state.CutoffDistance(**kwargs)[source]
Bases:
PrimitiveVertex
Compute the cutoff distance for SphereReflection. Input attributes:
structure (Atoms): The reference structure. cutoff_factor (float): The cutoff is obtained by taking the first nearest neighbor distance and multiplying
it by the cutoff factor. A default value of 0.4 is chosen, because taking a cutoff factor of ~0.5 sometimes let certain reflections off the hook, and we do not want that to happen.
- Output attributes:
cutoff_distance (float): The cutoff distance.
- class pyiron_contrib.protocol.primitive.one_state.DeleteAtom(name=None)[source]
Bases:
PrimitiveVertex
Given a structure, deletes one of the atoms. Input attributes:
structure (Atoms): The structure to delete an atom of. atom_id (int): Which atom to delete. (Default is 0, the 0th atom.)
- Output attributes:
structure (Atoms): The new, modified structure. mask (numpy.ndarray): The integer ids shared by both the old and new structure.
- class pyiron_contrib.protocol.primitive.one_state.ExternalHamiltonian(name=None)[source]
Bases:
PrimitiveVertex
- Manages calls to an external interpreter (e.g. Lammps, Vasp, Sphinx…) to produce energies, forces,
and possibly other properties. The collected output can be expanded beyond forces and energies (e.g. to magnetic properties or whatever else the interpreting code produces) by modifying the interesting_keys in the input. The property must have a corresponding interactive getter for this property.
- Input attributes:
- ref_job_full_path (string): The full path to the hdf5 file of the job to use as a reference template.
(Default is None.)
- project_path (string): The path of the project. To be specified ONLY when the jobs are already
initialized outside of this vertex. If project_path is specified, ref_job_full_path must be set to None. (Default is None.)
- job_name (string): The name of the job. This is specified only when the jobs are already
initialized outside of this vertex. (Default is None.)
- structure (Atoms): The structure for initializing the external Hamiltonian. Overwrites the reference
job structure when provided. (Default is None, the reference job needs to have its structure set.)
- positions (numpy.ndarray): New positions to evaluate. Shape must match the shape of the structure.
(Default is None, only necessary if positions are being updated.)
- cell (numpy.ndarray): The cell, if not same as that in the specified structure. (Default is None,
same cell as in the structure.)
- interesting_keys (list[str]): String codes for output properties of the underlying job to collect.
(Default is [‘positions’, ‘forces’, ‘energy_pot’, ‘pressures’, ‘volume’, ‘cell’].)
- Output attributes:
keys (list/numpy.ndarray): The output corresponding to the interesting keys.
- class pyiron_contrib.protocol.primitive.one_state.FEPExponential(**kwargs)[source]
Bases:
PrimitiveVertex
Compute the free energy perturbation exponential difference. Input attributes:
u_diff (float): The energy difference between system B and system A. delta_lambda (float): The delta for the lambdas for the two systems A and B. temperature (float): The instantaneous temperature.
- Output attributes:
exponential_difference (float): The exponential difference.
- pyiron_contrib.protocol.primitive.one_state.GPA_TO_BAR = 10000.0
Primitive vertices which have only one outbound execution edge.
- class pyiron_contrib.protocol.primitive.one_state.GradientDescent(name=None)[source]
Bases:
PrimitiveVertex
Simple gradient descent update for positions in flex_output and structure. Input attributes:
gamma0 (float): Initial step size as a multiple of the force. (Default is 0.1.) fix_com (bool): Whether the center of mass motion should be subtracted off of the position update.
(Default is True)
use_adagrad (bool): Whether to have the step size decay according to adagrad. (Default is False) output_displacements (bool): Whether to return the per-atom displacement vector in the output dictionary.
- Output attributes:
positions (numpy.ndarray): The updated positions. displacements (numpy.ndarray): The displacements, if output_displacements is True.
TODO: Fix adagrad bug when GradientDescent is passed as a Serial vertex
- class pyiron_contrib.protocol.primitive.one_state.HarmonicHamiltonian(name=None)[source]
Bases:
PrimitiveVertex
- Treat the atoms in the structure as harmonic oscillators and calculate the forces on each atom, and the total
potential energy of the structure. If the spring constant is specified, the atoms act as Einstein atoms (independent of each other). If the Hessian / force constant matrix is specified, the atoms act as Debye atoms.
- Input attributes:
positions (numpy.ndarray): Current positions of the atoms. reference_positions (numpy.ndarray): Equilibrium positions of the atoms. spring_constant (float): A single spring / force constant that is used to compute the restoring forces
on each atom. (Default is 1.)
- force_constants (NxNx3x3 matrix): The Hessian matrix, obtained from, for ex. Phonopy. (Default is None, treat
the atoms as independent harmonic oscillators (Einstein atoms).
structure (Atoms): The reference structure. mask (numpy.array): Which of the atoms to consider. The other atoms are ignored. (Default is None, consider
all atoms.)
eq_energy (float): The minimized potential energy of the static (expanded) structure. (Default is None.)
- Output attributes:
energy_pot (float): The harmonic potential energy. forces (numpy.ndarray): The harmonic forces.
- class pyiron_contrib.protocol.primitive.one_state.InitialPositions(name=None)[source]
Bases:
PrimitiveVertex
- Assigns initial positions. If no initial positions are specified, interpolates between the positions of the
initial and the final structures.
- Input attributes:
initial_positions (list/numpy.ndarray): The initial positions (Default is None) structure_initial (Atoms): The initial structure structure_final (Atoms): The final structure n_images (int): Number of structures to interpolate
- Output attributes:
- initial_positions (list/numpy.ndarray): if initial_positions is None, a list of (n_images) positions
interpolated between the positions of the initial and final structures. Else, initial_positions
- class pyiron_contrib.protocol.primitive.one_state.LangevinThermostat(name=None)[source]
Bases:
PrimitiveVertex
Calculates the necessary forces for a Langevin thermostat based on drag and a random kick. Input dictionary:
velocities (numpy.ndarray): The per-atom velocities in angstroms/fs. masses (numpy.ndarray): The per-atom masses in atomic mass units. temperature (float): The target temperature. (Default is 0 K, which just applies a drag force.) damping_timescale (float): Damping timescale. (Default is 100 fs.) time_step (float): MD time step in fs. (Default is 1 fs.) fix_com (bool): Whether to ensure the net force is zero. (Default is True.)
- Output dictionary:
forces (numpy.ndarray): The per-atom forces from the thermostat.
TODO: Make a version that uses uniform random numbers like Lammps does (for speed)
- class pyiron_contrib.protocol.primitive.one_state.Max(name=None)[source]
Bases:
PrimitiveVertex
Numpy’s amax (except no out option). Docstrings directly copied from the `numpy docs`_. The initial field is renamed initial_val to not conflict with the input dictionary. numpy docs: https://docs.scipy.org/doc/numpy/reference/generated/numpy.amax.html Input attributes:
a (array_like): Input data. axis (None/int/tuple of ints): Axis or axes along which to operate. By default, flattened input is used. If
this is a tuple of ints, the maximum is selected over multiple axes, instead of a single axis or all the axes as before.
- keepdims (bool): If this is set to True, the axes which are reduced are left in the result as dimensions with
size one. With this option, the result will broadcast correctly against the input array. If the default value is passed, then keepdims will not be passed through to the amax method of sub-classes of ndarray, however any non-default value will be. If the sub-class’ method does not implement keepdims any exceptions will be raised.
- Output attributes:
- amax (numpy.ndarray/scalar): Maximum of a. If axis is None, the result is a scalar value. If axis is given,
the result is an array of dimension a.ndim - 1.
Note: This misses the new argument initial in the latest version of Numpy.
- class pyiron_contrib.protocol.primitive.one_state.MinimizeReferenceJob(name=None)[source]
Bases:
ExternalHamiltonian
- Minimizes a job using an external interpreter (e.g. Lammps, Vasp, Sphinx…) outside of the ExternalHamiltonian.
This vertex minimizes the job at constant volume or constant pressure.
- Input attributes:
- ref_job_full_path (string): The full path to the hdf5 file of the job to use as a reference template.
(Default is None.)
pressure (float): Pressure of the system. (Default is None.) structure (Atoms): The structure for initializing the external Hamiltonian. Overwrites the reference
job structure when provided. (Default is None, the reference job needs to have its structure set.)
- Output attributes:
energy_pot (float): The evaluated potential energy. forces (numpy.ndarray): The evaluated forces.
- class pyiron_contrib.protocol.primitive.one_state.NEBForces(name=None)[source]
Bases:
PrimitiveVertex
- Given a list of positions, forces, and energies for each image along some transition, calculates the tangent
direction along the transition path for each image and returns new forces which have their original value perpendicular to this tangent, and ‘spring’ forces parallel to the tangent. Endpoints forces are set to zero, so start with relaxed endpoint structures.
Note: All images must use the same cell and contain the same number of atoms. Input attributes:
- positions (list/numpy.ndarray): The positions of the images. Each element should have the same shape, and
the order of the images is relevant!
- energies (list/numpy.ndarray): The potential energies associated with each set of positions. (Not always
needed.)
- forces (list/numpy.ndarray): The forces from the underlying energy landscape on which the NEB is being run.
Must have the same shape as positions. (Not always needed.)
structure (Atoms): The reference structure. spring_constant (float): Spring force between atoms in adjacent images. (Default is 1.0 eV/angstrom^2.) tangent_style (‘plain’/’improved’/’upwinding’): How to calculate the image tangent in 3N-dimensional space.
(Default is ‘upwinding’, which requires energies to be set.)
- use_climbing_image (bool): Whether to replace the force with one that climbs along the tangent direction for
the job with the highest energy. (Default is True, which requires energies and a list of forces to be set.)
- smoothing (float): Strength of the smoothing spring when consecutive images form an angle. (Default is None,
do not apply such a force.)
- Output attributes:
forces (list): The forces after applying nudged elastic band method.
- class pyiron_contrib.protocol.primitive.one_state.Norm(name=None)[source]
Bases:
PrimitiveVertex
Numpy’s linalg norm. Docstrings directly copied from the `numpy docs`_. numpy docs: https://docs.scipy.org/doc/numpy/reference/generated/numpy.linalg.norm.html Input attributes:
x (array_like): Input array. If axis is None, x must be 1-D or 2-D. ord (non-zero int/inf/-inf/’fro’/’nuc’): Order of the norm. inf means numpy’s inf object. (Default is 2). axis (int/2-tuple of ints/None): If axis is an integer, it specifies the axis of x along which to compute the
vector norms. If axis is a 2-tuple, it specifies the axes that hold 2-D matrices, and the matrix norms of these matrices are computed. If axis is None then either a vector norm (when x is 1-D) or a matrix norm (when x is 2-D) is returned. (Default is None.)
- keepdims (bool): If this is set to True, the axes which are normed over are left in the result as dimensions
with size one. With this option the result will broadcast correctly against the original x. (Default is False)
- Output attributes:
n (float/numpy.ndarray): Norm of the matrix or vector(s).
- class pyiron_contrib.protocol.primitive.one_state.Overwrite(**kwargs)[source]
Bases:
PrimitiveVertex
Overwrite particular entries of an array with new values. Input attributes:
target (numpy.ndarray): The target array. mask (numpy.array): The indices of the target that will be replaced. new_values (numpy.ndarray): The targeted indices will be replaced by these values.
- Output attributes:
overwritten (numpy.ndarray): The overwritten array.
- class pyiron_contrib.protocol.primitive.one_state.RandomVelocity(name=None)[source]
Bases:
PrimitiveVertex
- Generates a set of random velocities which (on average) have give the requested temperature.
Hard-coded for 3D systems.
- Input attributes:
temperature (float): The temperature of the velocities (in Kelvin). masses (numpy.ndarray/list): The masses of the atoms. overheat_fraction (float): The fraction by which to overheat the initial velocities. This can be useful for
more quickly equilibrating a system whose initial structure is its fully relaxed positions – in which case equipartition of energy tells us that the kinetic energy should be initialized to double the desired value. (Default is 2.0, assume energy equipartition is a good idea.)
- Output attributes:
velocities (numpy.ndarray): Per-atom velocities. energy_kin (float): Total kinetic energy of all atoms. n_atoms (int): Number of atoms.
- class pyiron_contrib.protocol.primitive.one_state.RemoveJob(name=None)[source]
Bases:
PrimitiveVertex
Remove an existing job/s from a project path. Input attributes:
project_path (string): The path of the project. (Default is None.) job_names (string): The names of the jobs to be removed. (Default is None.)
- class pyiron_contrib.protocol.primitive.one_state.Slice(name=None)[source]
Bases:
PrimitiveVertex
Slices off the masked positions from the input vector. Input attributes:
vector (numpy.ndarray): The input vector. mask (numpy.ndarray): The integer ids shared by both the old and new structure. ensure_interable mask (bool):
- Output attributes:
sliced (numpy.ndarray): The sliced vector.
- class pyiron_contrib.protocol.primitive.one_state.SphereReflection(name=None)[source]
Bases:
PrimitiveVertex
- Checks whether each atom in a structure is within a cutoff radius of its reference position; if not, reverts
the positions and velocities of all atoms to an earlier state and reverses those earlier velocities. Forces from the current and previous time step can be provided optionally.
- Input attributes:
reference_positions (numpy.ndarray): The reference positions to check the distances from. positions (numpy.ndarray): The positions to check. velocities (numpy.ndarray): The velocities corresponding to the positions at this time. previous_positions (numpy.ndarray): The previous positions to revert to. previous_velocities (numpy.ndarray): The previous velocities to revert to and reverse. structure (Atoms): The reference structure. cutoff_distance (float): The cutoff distance from the reference position to trigger reflection. use_reflection (boolean): Turn on or off SphereReflection total_steps (int): The total number of times SphereReflection is called so far.
- Output attributes:
positions (numpy.ndarray): The (possibly reverted) positions. velocities (numpy.ndarray): The (possibly reverted and reversed) velocities. reflected_mask (bool): Whether or not reflection occurred. total_steps (int): The total number of times SphereReflection is called.
- class pyiron_contrib.protocol.primitive.one_state.SphereReflectionPerAtom(name=None)[source]
Bases:
PrimitiveVertex
- Checks whether each atom in a structure is within a cutoff radius of its reference position; if not, reverts
the positions and velocities of the violating atoms to an earlier state and reverses those earlier velocities. The remaining atoms are unaffected.
- Input attributes:
reference_positions (numpy.ndarray): The reference positions to check the distances from. positions (numpy.ndarray): The positions to check. velocities (numpy.ndarray): The velocities corresponding to the positions at this time. previous_positions (numpy.ndarray): The previous positions to revert to. previous_velocities (numpy.ndarray): The previous velocities to revert to and reverse. structure (Atoms): The reference structure. cutoff_distance (float): The cutoff distance from the reference position to trigger reflection. use_reflection (boolean): Turn on or off SphereReflectionPerAtom total_steps (int): The total number of times SphereReflectionPerAtom is called so far.
- Output attributes:
positions (numpy.ndarray): The (possibly reverted) positions. velocities (numpy.ndarray): The (possibly reverted and reversed) velocities. reflected_mask (numpy.ndarray): A boolean mask that is true for each atom who was reflected. total_steps (int): The total number of times SphereReflectionPerAtom is called.
- class pyiron_contrib.protocol.primitive.one_state.TILDPostProcess(**kwargs)[source]
Bases:
PrimitiveVertex
- Post processing for the Harmonic and Vacancy TILD protocols, to remove the necessity to load interactive
jobs after they have been closed, once the protocol has been executed.
- Input attributes:
lambda_pairs (numpy.ndarray): The (n_lambdas, 2)-shaped array of mixing pairs. tild_mean (list): The mean of the computed integration points. tild_std (list): The standard deviation of the computed integration points. fep_exp_mean (list): The mean of the free energy perturbation exponential differences. fep_exp_mean (list): The standard deviation of the free energy perturbation exponential differences. temperature (float): The simulated temperature in K. n_samples (int): Number of samples used to calculate the means.
- Output attributes:
tild_free_energy_mean (float): The mean calculated via thermodynamic integration. tild_free_energy_std (float): The standard deviation calculated via thermodynamic integration. tild_free_energy_se (float): The standard error calculated via thermodynamic integration. fep_free_energy_mean (float): The mean calculated via free energy perturbation. fep_free_energy_std (float): The standard deviation calculated via free energy perturbation. fep_free_energy_se (float): The standard error calculated via free energy perturbation.
- class pyiron_contrib.protocol.primitive.one_state.Transpose(**kwargs)[source]
Bases:
PrimitiveVertex
Transposes the input matrix. Input attributes:
matrix (numpy.ndarray): The input matrix.
- Output attributes:
matrix_transpose (numpy.ndarray): The transposed matrix.
- class pyiron_contrib.protocol.primitive.one_state.VerletParent(name=None)[source]
Bases:
PrimitiveVertex
,ABC
- A parent class for holding code which is shared between both position and velocity updates in two-step
Velocity Verlet.
- Input attributes:
time_step (float): MD time step in fs. (Default is 1 fs.) temperature (float): The target temperature. (Default is None, no thermostat is used.) damping_timescale (float): Damping timescale in fs. (Default is None, no thermostat is used.)
- TODO: VerletVelocityUpdate should always have its velocity input wired to the velocity outupt of
VerletPositionUpdate. This implies to me that we need some structure other than two fully independent nodes. It would also be nice to syncronize, e.g. the thermostat and timestep input which is also the same for both. However, I haven’t figured out how to do that in the confines of the current graph traversal and hdf5 setup.
- static langevin_delta_v(temperature, time_step, masses, damping_timescale, velocities)[source]
Velocity changes due to the Langevin thermostat. :param temperature: The target temperature in K. :type temperature: float :param time_step: The MD time step in fs. :type time_step: float :param masses: Per-atom masses in u with a shape (N_atoms, 1). :type masses: numpy.ndarray :param damping_timescale: The characteristic timescale of the thermostat in fs. :type damping_timescale: float :param velocities: Per-atom velocities in angstrom/fs. :type velocities: numpy.ndarray
- Returns
Per atom accelerations to use for changing velocities.
- Return type
(numpy.ndarray)
- class pyiron_contrib.protocol.primitive.one_state.VerletPositionUpdate(name=None)[source]
Bases:
VerletParent
First half of Velocity Verlet, where positions are updated and velocities are set to their half-step value. Input attributes:
positions (numpy.ndarray): The per-atom positions in angstroms. velocities (numpy.ndarray): The per-atom velocities in angstroms/fs. forces (numpy.ndarray): The per-atom forces in eV/angstroms. masses (numpy.ndarray): The per-atom masses in atomic mass units. time_step (float): MD time step in fs. (Default is 1 fs.) temperature (float): The target temperature. (Default is None, no thermostat is used.) damping_timescale (float): Damping timescale in fs. (Default is None, no thermostat is used.)
- Output attributes:
positions (numpy.ndarray): The new positions on time step in the future. velocities (numpy.ndarray): The new velocities half a time step in the future.
- class pyiron_contrib.protocol.primitive.one_state.VerletVelocityUpdate(name=None)[source]
Bases:
VerletParent
- Second half of Velocity Verlet, where velocities are updated. Forces should be updated between the position
and velocity updates
- Input attributes:
- velocities (numpy.ndarray): The per-atom velocities in angstroms/fs. These should be the half-step
velocities output by VerletPositionUpdate.
- forces (numpy.ndarray): The per-atom forces in eV/angstroms. These should be updated since the last call
of VerletPositionUpdate.
masses (numpy.ndarray): The per-atom masses in atomic mass units. time_step (float): MD time step in fs. (Default is 1 fs.) temperature (float): The target temperature. (Default is None, no thermostat is used.) damping_timescale (float): Damping timescale in fs. (Default is None, no thermostat is used.)
- Output attributes:
velocities (numpy.ndarray): The new velocities half a time step in the future. energy_kin (float): The total kinetic energy of the system in eV. instant_temperature (float): The instantaneous temperature, obtained from the total kinetic energy.
- class pyiron_contrib.protocol.primitive.one_state.VoronoiReflection(name=None)[source]
Bases:
PrimitiveVertex
- Checks whether each atom in a structure is closest to its own reference site; if not, reverts the positions
and velocities to an earlier state and reverses those earlier velocities.
- Input attributes:
reference_positions (numpy.ndarray): The reference positions to check the distances from. positions (numpy.ndarray): The positions to check. velocities (numpy.ndarray): The velocities to check. previous_positions (numpy.ndarray): The previous positions to revert to. previous_velocities (numpy.ndarray): The previous velocities to revert to and reverse. pbc (numpy.ndarray/list): Three booleans declaring which dimensions have periodic boundary conditions for
finding the minimum distance convention.
cell (numpy.ndarray): The 3x3 cell vectors for pbcs.
- Output attributes:
positions (numpy.ndarray): The (possibly reverted) positions. velocities (numpy.ndarray): The (possibly reverted and reversed) velocities. reflected_mask (numpy.ndarray): A boolean mask that is true for each atom who was reflected.
WARNING: Outdated.
- class pyiron_contrib.protocol.primitive.one_state.WeightedSum(name=None)[source]
Bases:
PrimitiveVertex
- Given a list of vectors of with the same shape, calculates a weighted sum of the vectors. By default the
weights are the inverse of the number of elements and the sum is just the mean.
- Input attributes:
- vectors (list/numpy.ndarray): The vectors to sum. (Masked) vectors must all be of the same length. If the
the vectors are already in a numpy array, the 0th index should determine the vector.
- weights (list/numpy.ndarray): A 1D list of coefficients (floats) with the same length as vectors.
(Default is None, which gives the simple mean.)
- masks (list): If not None, a mask must be passed for each vector to extract a sub-vector. The resulting
collection of vectors and sub-vectors must all have the same length. If the mask for a given vector is None, all elements are retained. Otherwise the mask must be integer-like or boolean. (Default is None, do not mask any of the vectors.)
- Output attributes:
weighted_sum (numpy.ndarray): The weighted sum, having the same shape as a (masked) input vector.
- class pyiron_contrib.protocol.primitive.one_state.WelfordOnline(name=None)[source]
Bases:
PrimitiveVertex
Computes the cumulative mean and standard deviation. Note: The standard deviation calculated is for the population (ddof=0). For the sample (ddof=1) it would
to be extended.
- Input attributes:
sample (float/numpy.ndarray): The new sample. (Default is None.) mean (float/numpy.ndarray): The mean so far. (Default is None.) std (float/numpy.ndarray): The standard deviation so far. (Default is None.) n_samples (int): How many samples were used to calculate the existing mean and std.
- Output attributes:
mean (float/numpy.ndarray): The new mean. std (float/numpy.ndarray): The new standard deviation. n_samples (int): The new number of samples.
- class pyiron_contrib.protocol.primitive.one_state.Zeros(**kwargs)[source]
Bases:
PrimitiveVertex
A numpy vector of zeros that is pointer-compatible. Input attributes:
shape (int/tuple): The shape of the array.
- Output attributes:
zeros (numpy.ndarray): An array of numpy.float64 zeros.