ensembler.system package¶
Submodules¶
ensembler.system.basic_system module¶
- Module: System
This module shall be used to implement subclasses of system. It wraps all information needed and generated by a simulation.
-
class
ensembler.system.basic_system.
system
(potential: potential = <ensembler.potentials.OneD.harmonicOscillatorPotential object>, sampler: samplers = <ensembler.samplers.stochastic.metropolisMonteCarloIntegrator object>, conditions: Iterable[condition] = None, temperature: numbers.Number = 298.0, start_position: Iterable[numbers.Number] = None, mass: numbers.Number = 1, verbose: bool = True)[source]¶ Bases:
ensembler.util.basic_class._baseClass
The system class is managing the simulation approaches and all system data as well as the simulation results.
-
__init__
(potential: potential = <ensembler.potentials.OneD.harmonicOscillatorPotential object>, sampler: samplers = <ensembler.samplers.stochastic.metropolisMonteCarloIntegrator object>, conditions: Iterable[condition] = None, temperature: numbers.Number = 298.0, start_position: Iterable[numbers.Number] = None, mass: numbers.Number = 1, verbose: bool = True) → NoReturn[source]¶ The system class is wrapping all components needed for a simulation. It can be used as the control unit for executing a simulation (simulate) and also to manage the generated data or input data.
- Parameters
potential (_potentialCls) – gives the potential function to be explored/sampled
sampler (_samplerCls) – gives the method of choice to sample/explore the potential function
conditions (Iterable[_conditionCls], optional) – apply the given conditions to the systems in a preset (tau) step iteration
temperature (float, optional) – temperature of the system
start_position (float, optional) – starting position of the system during the simulation
mass (float, optional) – mass of the single particle
verbose (bool, optional) – I can tell you a long iterative story…
-
_gen_rand_vel
() → numbers.Number[source]¶ - _gen_rand_vel
get a random velocity according to the temperature and mass.
- Returns
a randomly selected velocity
- Return type
Number, Iterable[Number]
-
_init_position
(initial_position: Union[numbers.Number, Iterable[numbers.Number]] = None) → NoReturn[source]¶ - _init_position
this function initializes the current position of the system.
- Parameters
initial_position (Union[Number, Iterable[Number]], optional) – if None, a random position is selected else the given position is used.
-
_update_current_vars_from_current_state
()[source]¶ - _update_current_vars_from_current_state
update the _current Vars from the currentState
- Returns
- Return type
NoReturn
-
_update_energies
() → NoReturn[source]¶ - _updateEne
update all total energy terms.
- Returns
- Return type
NoReturn
-
_update_state_from_traj
() → NoReturn[source]¶ - _update_state_from_traj
replaces the current state and the currentstate vars by the last trajectory state.
- Returns
- Return type
NoReturn
-
_update_temperature
() → NoReturn[source]¶ this looks like a thermostat like thing! not implemented!@ TODO calc temperature from velocity
- Returns
- Return type
NoReturn
-
append_state
(new_position: Union[Iterable[numbers.Number], numbers.Number], new_velocity: Union[Iterable[numbers.Number], numbers.Number], new_forces: Union[Iterable[numbers.Number], numbers.Number]) → NoReturn[source]¶ - append_state
appends a new state, based on the given arguments and updates the system to them.
- Parameters
new_position (Union[Iterable[Number], Number]) – a new position
new_velocity (Union[Iterable[Number], Number]) – a new velocity
new_forces (Union[Iterable[Number], Number]) – a new Force
-
apply_conditions
() → NoReturn[source]¶ - applyConditions
this function applies the coupled conditions to the current state of system.
- Returns
- Return type
NoReturn
-
calculate_total_kinetic_energy
() → Union[Iterable[numbers.Number], numbers.Number][source]¶ - totKin
returns the total kinetic energy of the system.
- Returns
total kinetic energy.
- Return type
Union[Iterable[Number], Number, np.nan]
-
calculate_total_potential_energy
() → Union[Iterable[numbers.Number], numbers.Number][source]¶ - totPot
return the total potential energy
- Returns
summed up total potential energies
- Return type
Union[Iterable[Number], Number]
-
clear_trajectory
()[source]¶ deletes all entries of trajectory and adds current state as first timestep to the trajectory :return: None
-
property
conditions
¶ conditions list contains the system conditions. These conditions are applied during the sampling of the potential energy function to add additional constraints.
- Returns
the list of conditions coupled to the system.
- Return type
List[_conditionCls]
-
property
current_state
¶
-
initialise
(withdraw_Traj: bool = True, init_position: bool = True, init_velocity: bool = True, set_initial_position: Union[numbers.Number, Iterable[numbers.Number]] = None) → NoReturn[source]¶ - initialise
initialises the system, i.e. can set an initial position, initial velocities and initialize the forces.
- Parameters
withdraw_Traj (bool, optional) – reset the simulation trajectory?
init_position (bool, optional) – reinitialize the start_position - currentPosition
init_velocity (bool, optional) – reinitialize the start_velocity - currentVelocity
set_initial_position (Union[Number, Iterable[Number]], optional) – set the start_position to the given one.
- Returns
- Return type
NoReturn
-
property
mass
¶
-
nDimensions
: int¶
-
nParticles
: int¶
-
nStates
: int¶ Attributes
-
name
: str = 'system'¶
-
property
position
¶
-
property
potential
¶ The potential energy function class can be explored in a simulation
- Returns
systems potential energy class
- Return type
_potentialCls
-
propagate
()[source]¶ - propagate
Do a single exploration step. Not stored in the trajectory and no energies returned or updated.
- Returns
returns the new current position, the new current velocities and the new current forces
- Return type
(Union[Iterable[Number], Number], Union[Iterable[Number], Number], Union[Iterable[Number], Number])
-
random_position
() → Union[numbers.Number, Iterable[numbers.Number]][source]¶ - randomPos
returns a randomly selected position for the system.
- Returns
a random position
- Return type
Union[Number, Iterable[Number]]
-
revert_step
() → NoReturn[source]¶ - revertStep
removes the last step which was performed from the trajectory and sets back the system to the one before.
- Returns
- Return type
NoReturn
-
property
sampler
¶ The sampler method is used by the system to explore the potential energy function.
- Returns
the sampler method that can be used to explore the potential energy function.
- Return type
_samplerCls
-
set_current_state
(current_position: Union[numbers.Number, Iterable[numbers.Number]], current_velocities: Union[numbers.Number, Iterable[numbers.Number]] = 0, current_force: Union[numbers.Number, Iterable[numbers.Number]] = 0, current_temperature: numbers.Number = 298)[source]¶ set the current State of the system.
- Parameters
current_position (Union[Number, Iterable[Number]]) – new current system position
current_velocities (Union[Number, Iterable[Number]], optional) – new current system velocity. (default: 0)
current_force (Union[Number, Iterable[Number]], optional) – new current system force. (default: 0)
current_temperature (Union[Number, Iterable[Number]], optional) – new current system temperature. (default: 298)
-
set_temperature
(temperature: numbers.Number)[source]¶ - set Temperature
set the systems current temperature.
- Parameters
temperature
-
simulate
(steps: int, withdraw_traj: bool = False, save_every_state: int = 1, init_system: bool = False, verbosity: bool = True, _progress_bar_prefix: str = 'Simulation: ') → __main__.State[source]¶ this function executes the simulation, by exploring the potential energy function with the sampling method for the given n steps.
- Parameters
steps (int) – number of integration steps
init_system (bool, optional) – initialize the system. (default: False)
withdraw_traj (bool, optional) – reset the current simulation trajectory. (default: False)
save_every_state (int, optional) – save every n step. (and leave out the rest) (default: 1 - each step)
verbosity (bool, optional) – change the verbosity of the simulation. (default: True)
_progress_bar_prefix (str, optional) – prefix of tqdm progress bar. (default: “Simulation”)
- Returns
returns the last current state
- Return type
state
-
state
¶ alias of
__main__.State
-
property
temperature
¶ The set temperature of the system
- Returns
set temperature
- Return type
Number
-
property
total_kinetic_energy
¶ the total kinetic energy of the current system
- Returns
total kinetic energy of the current system
- Return type
Number
-
property
total_potential_energy
¶ the total potential energy of the current system
- Returns
total potential energy of the current system
- Return type
Number
-
property
total_system_energy
¶ the total energy of the current system
- Returns
total energy of the current system
- Return type
Number
-
property
trajectory
¶
-
update_current_state
() → NoReturn[source]¶ - updateCurrentState
update current state from the _current vars.
- Returns
- Return type
NoReturn
-
update_system_properties
() → NoReturn[source]¶ - updateSystemProperties
updates the energies and temperature of the system
- Returns
- Return type
NoReturn
-
property
velocity
¶ - velocity
The current velocity of the system
- Returns
- Return type
Union[Number, Iterable[Number]]
-
ensembler.system.eds_system module¶
- Module: System
This module shall be used to implement subclasses of system. It wraps all information needed and generated by a simulation.
-
class
ensembler.system.eds_system.
edsSystem
(potential: ensembler.potentials.OneD.envelopedPotential = <ensembler.potentials.OneD.envelopedPotential object>, sampler: samplers = <ensembler.samplers.stochastic.metropolisMonteCarloIntegrator object>, conditions: Iterable[condition] = [], temperature: float = 298.0, start_position: Union[numbers.Number, Iterable[numbers.Number]] = None, eds_s: float = 1, eds_Eoff: Iterable[numbers.Number] = [0, 0])[source]¶ Bases:
ensembler.system.basic_system.system
The EDS-System is collecting and providing information essential to EDS. The Trajectory contains s and Eoff values for each step. Functions like set_s (or simply access s) or set_eoff (or simply access Eoff) give direct acces to the EDS potential.
-
__init__
(potential: ensembler.potentials.OneD.envelopedPotential = <ensembler.potentials.OneD.envelopedPotential object>, sampler: samplers = <ensembler.samplers.stochastic.metropolisMonteCarloIntegrator object>, conditions: Iterable[condition] = [], temperature: float = 298.0, start_position: Union[numbers.Number, Iterable[numbers.Number]] = None, eds_s: float = 1, eds_Eoff: Iterable[numbers.Number] = [0, 0])[source]¶ - __init__
construct a eds-System that can be used to manage a simulation.
- Parameters
potential (pot.envelopedPotential, optional) – potential function class to be explored by sampling
sampler (sampler, optional) – sampling method, that allows exploring the potential function
conditions (Iterable[condition], optional) – conditions that shall be applied to the system.
temperature (float, optional) – The temperature of the system (default: 298K)
start_position – starting position for the simulation and setup of the system.
eds_s (float, optional) – is the S-value of the EDS-Potential
eds_Eoff (Iterable[Number], optional) – giving the energy offsets for the
-
append_state
(new_position: Union[numbers.Number, Iterable[numbers.Number]], new_velocity: Union[numbers.Number, Iterable[numbers.Number]], new_forces: Union[numbers.Number, Iterable[numbers.Number]], new_s: Union[numbers.Number, Iterable[numbers.Number]], new_eoff: Iterable[numbers.Number])[source]¶ - append_state
Append a new state to the trajectory.
- Parameters
new_position (Union[Number, Iterable[Number]]) – new position for the system
new_velocity (Union[Number, Iterable[Number]]) – new velocity for the system
new_forces (Union[Number, Iterable[Number]]) – new forces for the system
new_s (Union[Number, Iterable[Number]]) – new s-value for the system
new_eoff (Iterable[Number]) – new eoffs for the system
-
property
eoff
¶ Eoff Energy Offsets for the EDS-potential
-
name
: str = 'eds system'¶
-
property
s
¶ smoothing parameter for the EDS-potential
-
set_current_state
(current_position: Union[numbers.Number, Iterable[numbers.Number]], current_velocities: Union[numbers.Number, Iterable[numbers.Number]] = 0, current_force: Union[numbers.Number, Iterable[numbers.Number]] = 0, current_temperature: Union[numbers.Number, Iterable[numbers.Number]] = 298, current_s: Union[numbers.Number, Iterable[numbers.Number]] = 1.0, current_eoff: Iterable[numbers.Number] = None)[source]¶ - set_current_state
set s the current state to the given variables.
- Parameters
current_position (Union[Number, Iterable[Number]]) – The new Position
current_velocities (Union[Number, Iterable[Number]],) – The new Velocities
current_force (Union[Number, Iterable[Number]],) – The new Forces of the system
current_temperature (Union[Number, Iterable[Number]],) – The new S_value
current_s (Union[Number, Iterable[Number]],) – the new s values.
current_eoff (Iterable[Number],) – the new eoff values.
-
set_eoff
(eoff: Iterable[numbers.Number])[source]¶ - set_Eoff
setting new Energy offsets.
- Parameters
eoff (Iterable[Number]) – vector of new energy offsets
-
set_s
(s: numbers.Number)[source]¶ - set_s
setting a new s-value to the system.
- Parameters
s (Number) – the new smoothing parameter s
-
state
¶ alias of
__main__.EDS_State
-
ensembler.system.perturbed_system module¶
- Module: System
This module shall be used to implement subclasses of system. It wraps all information needed and generated by a simulation.
-
class
ensembler.system.perturbed_system.
perturbedSystem
(potential: ensembler.potentials._basicPotentials._potential1DClsPerturbed = <ensembler.potentials.OneD.linearCoupledPotentials object>, sampler: samplers = <ensembler.samplers.stochastic.metropolisMonteCarloIntegrator object>, conditions: Iterable[condition] = [], temperature: float = 298.0, start_position: Iterable[numbers.Number] = None, lam: float = 0.0)[source]¶ Bases:
ensembler.system.basic_system.system
-
__init__
(potential: ensembler.potentials._basicPotentials._potential1DClsPerturbed = <ensembler.potentials.OneD.linearCoupledPotentials object>, sampler: samplers = <ensembler.samplers.stochastic.metropolisMonteCarloIntegrator object>, conditions: Iterable[condition] = [], temperature: float = 298.0, start_position: Iterable[numbers.Number] = None, lam: float = 0.0)[source]¶ - __init__
construct a eds-System that can be used to manage a simulation.
- Parameters
potential (pot.envelopedPotential, optional) – potential function class to be explored by sampling
sampler (sampler, optional) – sampling method, that allows exploring the potential function
conditions (Iterable[condition], optional) – conditions that shall be applied to the system.
temperature (float, optional) – The temperature of the system (default: 298K)
start_position – starting position for the simulation and setup of the system.
lam (Number, optional) – the value of the copuling lambda
-
_update_dHdLambda
() → numbers.Number[source]¶ - _update_dHdlambda
update the current dHdLambda value
- Returns
dHdlambda
- Return type
Number
-
append_state
(new_position: Union[numbers.Number, Iterable[numbers.Number]], new_velocity: Union[numbers.Number, Iterable[numbers.Number]], new_forces: Union[numbers.Number, Iterable[numbers.Number]], new_lambda: numbers.Number) → NoReturn[source]¶ - append_state
Append a new state to the trajectory.
- Parameters
new_position (Union[Number, Iterable[Number]]) – new position for the system
new_velocity (Union[Number, Iterable[Number]]) – new velocity for the system
new_forces (Union[Number, Iterable[Number]]) – new forces for the system
new_lambda (Union[Number, Iterable[Number]]) – new lambda for the system
-
currentState
: __main__.Lambda_State¶
-
property
lam
¶
-
name
: str = 'perturbed system'¶
-
set_current_state
(current_position: Union[numbers.Number, Iterable[numbers.Number]], current_velocities: Union[numbers.Number, Iterable[numbers.Number]] = 0, current_force: Union[numbers.Number, Iterable[numbers.Number]] = 0, current_temperature: Union[numbers.Number, Iterable[numbers.Number]] = 298, current_lambda: Union[numbers.Number, Iterable[numbers.Number]] = 0, current_dHdLambda: Union[numbers.Number, Iterable[numbers.Number]] = 0)[source]¶ - set_current_state
set s the current state to the given variables.
- Parameters
current_position (Union[Number, Iterable[Number]]) – new current system position
current_velocities (Union[Number, Iterable[Number]], optional) – new current system velocity. (default: 0)
current_force (Union[Number, Iterable[Number]], optional) – new current system force. (default: 0)
current_temperature (Union[Number, Iterable[Number]], optional) – new current system temperature. (default: 298)
current_lam (Union[Number, Iterable[Number]],) – The new lambda value (default: 0)
current_dHdLam (Union[Number, Iterable[Number]],) – The new dHdLam(default: 0)
-
state
¶ alias of
__main__.Lambda_State
-
Module contents¶
Systems wrap the sampler and the potential class to allow easy orchestration of simulations.