Factors.PyChemLib3D#
PyChemLib3D.py
functions borrowed from https://pythoninchemistry.org/sim_and_scat/intro
Copyright (c) 2023, SAXS Team, KEK-PF
- compute_min_dist(points)#
- demo_accel()#
- demo_lj()#
- demo_run_md(num_particles)#
- generate_ensemble(num_particles, box_limits, min_dist=None)#
- generate_ensemble_impl(num_particles, box_limits)#
- get_accelerations(positions, mass, epsilon, sigma, closure_radius)#
Calculate the acceleration on each particle as a result of each other particle. N.B. We use the Python convention of numbering from 0.
- Parameters:
positions (ndarray of floats) – The positions, in a single dimension, for all of the particles (Å)
- Returns:
The acceleration on each particle (eV/Åamu)
- Return type:
ndarray of floats
- init_velocity(T, num_particles, mass)#
Initialise the velocities for a series of particles.
- Parameters:
T (float) – Temperature of the system at initialisation (K)
number_of_particles (int) – Number of particles in the system
- Returns:
Initial velocities for a series of particles (eVs/Åamu)
- Return type:
ndarray of floats
- run_md(num_particles, dt, number_of_steps, initial_temp, x, mass, box_limits, epsilon, sigma, closure_radius)#
Run a MD simulation.
- Parameters:
dt (float) – The timestep length (s)
number_of_steps (int) – Number of iterations in the simulation
initial_temp (float) – Temperature of the system at initialisation (K)
x (ndarray of floats) – The initial positions of the particles in a single dimension (Å)
- Returns:
The positions for all of the particles throughout the simulation (Å)
- Return type:
ndarray of floats
- update_pos(x, v, a, dt, box_limits)#
Update the particle positions.
- Parameters:
x (ndarray of floats) – The positions of the particles in a single dimension
v (ndarray of floats) – The velocities of the particles in a single dimension
a (ndarray of floats) – The accelerations of the particles in a single dimension
dt (float) – The timestep length
- Returns:
New positions of the particles in a single dimension
- Return type:
ndarray of floats
- update_velo(v, a, a1, dt)#
Update the particle velocities.
- Parameters:
v (ndarray of floats) – The velocities of the particles in a single dimension (eVs/Åamu)
a (ndarray of floats) – The accelerations of the particles in a single dimension at the previous timestep (eV/Åamu)
a1 (ndarray of floats) – The accelerations of the particles in a single dimension at the current timestep (eV/Åamu)
dt (float) – The timestep length
- Returns:
New velocities of the particles in a single dimension (eVs/Åamu)
- Return type:
ndarray of floats