initializing particles

Overview

espressopp.tools.lattice

espressopp.tools.replicate(bonds, angles, x, ...)

Replicates configuration in each dimension.

espressopp.tools.topology

espressopp.tools.velocities

espressopp.tools.warmup(system, integrator)

Warm up for a system with a density of 0.85.

Details

espressopp.tools.lattice

espressopp.tools.lattice.createCubic(N, rho, perfect=True, RNG=None)

Initializes particles on the sites of a simple cubic lattice. By setting perfect=False the particle positions will be given random displacements with a magnitude of one-tenth the lattice spacing.

espressopp.tools.lattice.createDiamond(N, rho, perfect=True, RNG=None)

Initializes particles on the sites of a diamond lattice.

espressopp.tools.replicate

class espressopp.tools.replicate.ReplicateParallel(*args, **kwds)

Performs the replicate operation in parallel on all workers and creates the replicated particles, bonds and angles only when they are being added to the respective classes. They are also instantiated by batches of the same size as the original seed so memory footprint is reduced.

Usage:

replicate = (2,2,2) bonds, angles, x, y, z, Lx, Ly, Lz = espressopp.tools.lammps.read(‘polymer_melt.lammps’) rp = espressopp.tools.ReplicateParallel() num_particles, Lx, Ly, Lz = rp.replicate(bonds, angles, x, y, z, Lx, Ly, Lz, *replicate) box = (Lx, Ly, Lz) system, integrator = espressopp.standard_system.Default(box=box,…) … props = [‘type’, ‘mass’] num_particles_seed = len(x) seed_particles = [] for i in range(num_particles_seed):

part = [0, 1.0] seed_particles.append(part)

rp.addParticles(system.storage, 1, seed_particles, *props) system.storage.decompose() … fpl = espressopp.FixedPairList(system.storage) rp.addBonds(fpl) … ftl = espressopp.FixedTripleList(system.storage) rp.addTriples(ftl)

For a full working example see testsuite/ReplicateParallel/polymer_melt.py

espressopp.tools.replicate.replicate(bonds, angles, x, y, z, Lx, Ly, Lz, xdim=1, ydim=1, zdim=1)

Replicates configuration in each dimension.

This may be used to increase the size of an equilibrated melt by a factor of 8 or more.

Presently this routine works only for semiflexible polymers. A general class should be written to deal with files containing coordinates and topology data.

xdim = ydim = zdim = 1 returns the original system not replicated. xdim = ydim = zdim = 2 returns the original system replicated to 8x. xdim = ydim = zdim = 3 returns the original system replicated to 27x. xdim = ydim = 1, zdim = 2 returns the original system replicated in the z-direction.

espressopp.tools.topology

espressopp.tools.topology.polymerRW(pid, startpos, numberOfMonomers, bondlength, return_angles=False, return_dihedrals=False, mindist=None, rng=None)

Initializes polymers through random walk

espressopp.tools.velocities

espressopp.tools.velocities.gaussian(T, N, particle_mass=None, zero_momentum=True, seed=7654321, kb=1.0)

Generates velocities with temperature T according to a Maxwell-Boltzmann distribution.

Args:

T: The desired temperature expre. N: The number of particles. particle_mass: The list of particle mass if not then every particle has mass 1.0 zero_momentum: Remove the center-of-mass motion. seed: The seed for the random number generator. kb: The Boltzmann constant.

Returns:

The tuple with lists of x,y,z components of the velocity.

espressopp.tools.warmup

espressopp.tools.warmup.warmup(system, integrator, number=80)

Warm up for a system with a density of 0.85.

The method needs the following parameters:

  • system, integrator ESPResSo system which schoul be warmed up and the correspondig integrator e.g.:

    >>> system, integrator = espressopp.standard_system.LennardJones(100,(10,10,10))
    
  • number number of steps of the warm up

    for a system with a density of 0.85, if it explodes try a higher number