API Documentation

Initialize the system

For initialize the sysetm, the generate_initial_state() will generate an initial state either in a random way or import from a .xyz file.

mc_lj_potential.generate_initial_state([…])

Generates initial state of the system.

Tip

The .xyz file will give the coordinates of all the particles. If the method is random, num_particles and box_length are required arguments.

Class Box

This is the class to generate a box, with the particles parameters.

mc_lj_potential.Box(box_length[, coordinates])

In the class, we have functions as follows:

mc_lj_potential.Box.wrap(coordinates, box_length)

This is for wraping all particles in the box, updating the coordinates.

mc_lj_potential.Box.minimum_image_distance(…)

Computes the minimum image distance between two particles.

And we set the volume and num_particles as properties, can be called as:

mc_lj_potential.Box.volume

Property decorator function which calculates the volume of the cubic simulation box :param box_length: Side of cubic simulation box.

mc_lj_potential.Box.num_particles

Property decorator function which calculates the number of particles in the cubic simulation box :param coordinates: A numpy array with the x,y and z coordinates of each atom in the simulation box.

Class MCState

In the class MCState, we will have functions for the energies in the defined system:

mc_lj_potential.MCState(box1, cutoff)

In the class, we can calculate total pair energy, tail correction, unit energy and particle energy by functions as follows:

mc_lj_potential.MCState.calculate_total_pair_energy()

Computes the total energy of the system.

mc_lj_potential.MCState.calculate_tail_correction()

Computes the standard tail correction for Lennard Jones potential.

mc_lj_potential.MCState.calculate_unit_energy()

Compute the unit energy of per particles in the system.

mc_lj_potential.MCState.get_particle_energy(…)

This function computes the energy of a particle with the rest of the system.

Monte Carlo Steps

After that the Monte Carlo will determine the acceptance of each movement with accept_or_reject():

mc_lj_potential.accept_or_reject(delta_e, beta)

Accepts or rejects a move based on the energy difference between initial and updated state along with system temperature

Optimization

Optimization of the scale of displacement can be done by adjust_displacement():

mc_lj_potential.adjust_displacement(…)

Adjusts the maximum value allowed for a displacement move.