Example #1
0
        def __init__(self,
                     system,
                     nodeGrid='auto',
                     cellGrid='auto',
                     nocheck=False):
            if nocheck:
                self.next_id = 0
                self.pmiinit(system, nodeGrid, cellGrid)
            else:
                if check.System(system, 'bc'):
                    if nodeGrid == 'auto':
                        nodeGrid = decomp.nodeGrid(system.comm.rank)
                    else:
                        nodeGrid = toInt3DFromVector(nodeGrid)
                    if cellGrid == 'auto':
                        raise Exception(
                            'Automatic cell size calculation not yet implemented'
                        )
                    else:
                        cellGrid = toInt3DFromVector(cellGrid)

                    for k in xrange(3):
                        if nodeGrid[k] * cellGrid[k] == 1:
                            print(("Warning! cellGrid[{}] has been "
                                   "adjusted to 2 (was={})".format(
                                       k, cellGrid[k])))
                            cellGrid[k] = 2
                    self.next_id = 0
                    self.pmiinit(system, nodeGrid, cellGrid)
                else:
                    raise Exception(
                        'Error: could not create DomainDecomposition object')
Example #2
0
 def __init__(self,
              system,
              nodeGrid='auto',
              cellGrid='auto',
              nocheck=False):
     # do sanity checks for the system first
     if nocheck:
         self.next_id = 0
         self.pmiinit(system, nodeGrid, cellGrid)
     else:
         if check.System(system, 'bc'):
             if nodeGrid == 'auto':
                 nodeGrid = decomp.nodeGrid(system.comm.rank)
             else:
                 nodeGrid = toInt3DFromVector(nodeGrid)
             if cellGrid == 'auto':
                 cellGrid = Int3D(2, 2, 2)
             else:
                 cellGrid = toInt3DFromVector(cellGrid)
             # minimum image convention check:
             for k in range(3):
                 if nodeGrid[k] * cellGrid[k] == 1:
                     print(("Warning! cellGrid[{}] has been "
                            "adjusted to 2 (was={})".format(
                                k, cellGrid[k])))
                     cellGrid[k] = 2
             self.next_id = 0
             self.pmiinit(system, nodeGrid, cellGrid)
         else:
             print 'Error: could not create DomainDecomposition object'
 def __init__(self, system, 
              nodeGrid='auto', 
              cellGrid='auto',
              nocheck=False):
     # do sanity checks for the system first
     if nocheck:
       self.next_id = 0
       self.pmiinit(system, nodeGrid, cellGrid)                
     else:
       if check.System(system, 'bc'):
         if nodeGrid == 'auto':
           nodeGrid = decomp.nodeGrid(system.comm.rank)
         else:
           nodeGrid = toInt3DFromVector(nodeGrid)
         if cellGrid == 'auto':
           cellGrid = Int3D(2,2,2)
         else:
           cellGrid = toInt3DFromVector(cellGrid)
         # minimum image convention check:
         for k in range(3):
           if nodeGrid[k]*cellGrid[k] == 1 :
             print(("Warning! cellGrid[{}] has been "
                    "adjusted to 2 (was={})".format(k, cellGrid[k])))
             cellGrid[k] = 2
         self.next_id = 0
         self.pmiinit(system, nodeGrid, cellGrid)
       else:
         print 'Error: could not create DomainDecomposition object'
Example #4
0
def generate_system(add_particles_array):
    rc = 2.5
    skin = 0.3
    timestep = 0.005
    temperature = 1.0
    comm = MPI.COMM_WORLD

    particles_per_direction = 64
    x, y, z, Lx, Ly, Lz, vx, vy, vz = generate_particles(
        particles_per_direction)

    num_particles = len(x)
    density = num_particles / (Lx * Ly * Lz)
    size = (Lx, Ly, Lz)

    system = espressopp.System()
    system.rng = espressopp.esutil.RNG()
    system.bc = espressopp.bc.OrthorhombicBC(system.rng, size)
    system.skin = skin
    nodeGrid = decomp.nodeGrid(comm.size, size, rc, skin)
    cellGrid = decomp.cellGrid(size, nodeGrid, rc, skin)
    system.storage = espressopp.storage.DomainDecomposition(
        system, nodeGrid, cellGrid)

    if add_particles_array:

        tstart = time.time()
        props = [
            'id', 'type', 'mass', 'posx', 'posy', 'posz', 'vx', 'vy', 'vz'
        ]
        ids = np.arange(1, num_particles + 1)
        types = np.zeros(num_particles)
        mass = np.ones(num_particles)
        new_particles = np.stack((ids, types, mass, x, y, z, vx, vy, vz),
                                 axis=-1)
        tprep = time.time() - tstart

        tstart = time.time()
        system.storage.addParticlesArray(new_particles, *props)
        tadd = time.time() - tstart

    else:

        tstart = time.time()
        props = ['id', 'type', 'mass', 'pos', 'v']
        new_particles = []
        for i in range(num_particles):
            new_particles.append([
                i + 1, 0, 1.0,
                Real3D(x[i], y[i], z[i]),
                Real3D(vx[i], vy[i], vz[i])
            ])
        tprep = time.time() - tstart

        tstart = time.time()
        system.storage.addParticles(new_particles, *props)
        tadd = time.time() - tstart

    return num_particles, tprep, tadd
Example #5
0
def generate_system():
    rc = 2.5
    skin = 0.3
    timestep = 0.005
    temperature = 1.0
    comm = MPI.COMM_WORLD
    density = num_particles / (Lx * Ly * Lz)
    size = (Lx, Ly, Lz)

    system = espressopp.System()
    system.rng = espressopp.esutil.RNG()
    system.bc = espressopp.bc.OrthorhombicBC(system.rng, size)
    system.skin = skin
    nodeGrid = decomp.nodeGrid(comm.size, size, rc, skin)
    cellGrid = decomp.cellGrid(size, nodeGrid, rc, skin)
    system.storage = espressopp.storage.DomainDecomposition(system, nodeGrid, cellGrid)

    return system
Example #6
0
 def __init__(self,
              system,
              nodeGrid='auto',
              neiListx='auto',
              neiListy='auto',
              neiListz='auto',
              nocheck=False):
     # do sanity checks for the system first
     if nocheck:
         self.next_id = 0
         self.pmiinit(system, nodeGrid, neiListx, neiListy,
                      neiListz)  # H check
     else:
         if check.System(system, 'bc'):
             if nodeGrid == 'auto':
                 nodeGrid = decomp.nodeGrid(system.comm.rank)
             else:
                 nodeGrid = toInt3DFromVector(nodeGrid)
             #if cellGrid == 'auto':
             #  cellGrid = Int3D(2,2,2)
             #else:
             #  cellGrid = cellGrid
             if neiListx == 'auto':
                 neiListx = neiListx
             else:
                 neiListx = neiListx
             if neiListy == 'auto':
                 neiListy = neiListy
             else:
                 neiListy = neiListy
             if neiListz == 'auto':
                 neiListz = neiListz
             else:
                 neiListz = neiListz
             # minimum image convention check:
             self.next_id = 0
             self.pmiinit(system, nodeGrid, neiListx, neiListy,
                          neiListz)
         else:
             print 'Error: could not create DomainDecomposition object'
        def __init__(self, system, nodeGrid='auto', cellGrid='auto', nocheck=False):
            if nocheck:
                self.next_id = 0
                self.pmiinit(system, nodeGrid, cellGrid)
            else:
                if check.System(system, 'bc'):
                    if nodeGrid == 'auto':
                        nodeGrid = decomp.nodeGrid(system.comm.rank)
                    else:
                        nodeGrid = toInt3DFromVector(nodeGrid)
                    if cellGrid == 'auto':
                        raise Exception('Automatic cell size calculation not yet implemented')
                    else:
                        cellGrid = toInt3DFromVector(cellGrid)

                    for k in xrange(3):
                        if nodeGrid[k]*cellGrid[k] == 1:
                            print(("Warning! cellGrid[{}] has been "
                                   "adjusted to 2 (was={})".format(k, cellGrid[k])))
                            cellGrid[k] = 2
                    self.next_id = 0
                    self.pmiinit(system, nodeGrid, cellGrid)
                else:
                    raise Exception('Error: could not create DomainDecomposition object')
Example #8
0
#types, bonds, angles, dihedrals, x, y, z, vx, vy, vz, Lx, Ly, Lz = gromacs.read(grofile,topfile)
#defaults, types, masses, charges, atomtypeparameters, bondtypes, bondtypeparams, angletypes, angletypeparams, exclusions, x, y, z, vx, vy, vz, Lx, Ly, Lz = gromacs.read(grofile,topfile)
num_particles = len(x)

density = num_particles / (Lx * Ly * Lz)
size = (Lx, Ly, Lz)
print size

sys.stdout.write('Setting up simulation ...\n')
system = espressopp.System()
system.rng = espressopp.esutil.RNG()
system.bc = espressopp.bc.OrthorhombicBC(system.rng, size)
system.skin = skin

comm = MPI.COMM_WORLD
nodeGrid = decomp.nodeGrid(comm.size)
cellGrid = decomp.cellGrid(size, nodeGrid, rc, skin)
system.storage = espressopp.storage.DomainDecomposition(
    system, nodeGrid, cellGrid)

# setting up GROMACS interaction stuff
# create a force capped Lennard-Jones interaction that uses a verlet list
verletlist = espressopp.VerletList(system, rc)
interaction = espressopp.interaction.VerletListLennardJonesGromacs(verletlist)

# add particles to the system and then decompose
props = ['id', 'pos', 'v', 'type', 'mass', 'q']
allParticles = []
for pid in range(num_particles):
    part = [
        pid + 1,
Example #9
0
# number of AT particles
num_particles = len(x)

# set up the system
sys.stdout.write('Setting up simulation ...\n')
density = num_particles / (Lx * Ly * Lz)
size = (Lx, Ly, Lz)

system = espressopp.System()
system.rng = espressopp.esutil.RNG()
system.bc = espressopp.bc.OrthorhombicBC(system.rng, size)
system.skin = skin

comm = MPI.COMM_WORLD
nodeGrid = decomp.nodeGrid(comm.size)
cellGrid = decomp.cellGrid(size, nodeGrid, rc, skin)

# (H-)AdResS domain decomposition
system.storage = espressopp.storage.DomainDecompositionAdress(system, nodeGrid, cellGrid)


# prepare AT particles
allParticlesAT = []
allParticles = []
tuples = []
for pidAT in range(num_particles):
    allParticlesAT.append([pidAT, # add here these particles just temporarily
                         Real3D(x[pidAT], y[pidAT], z[pidAT]), # position
                         Real3D(vx[pidAT], vy[pidAT], vz[pidAT]), # velocity
                         Real3D(0, 0, 0), # force
Example #10
0
# number of AT particles
num_particles = len(x)

# set up the system
sys.stdout.write('Setting up simulation ...\n')
density = num_particles / (Lx * Ly * Lz)
size = (Lx, Ly, Lz)

system = espressopp.System()
system.rng = espressopp.esutil.RNG()
system.bc = espressopp.bc.OrthorhombicBC(system.rng, size)
system.skin = skin

comm = MPI.COMM_WORLD
nodeGrid = decomp.nodeGrid(comm.size, size, rc, skin)
cellGrid = decomp.cellGrid(size, nodeGrid, rc, skin)

# (H-)AdResS domain decomposition
system.storage = espressopp.storage.DomainDecompositionAdress(
    system, nodeGrid, cellGrid)

# prepare AT particles
allParticlesAT = []
allParticles = []
tuples = []
for pidAT in range(num_particles):
    allParticlesAT.append([
        pidAT,  # add here these particles just temporarily!
        Real3D(x[pidAT], y[pidAT], z[pidAT]),  # position
        Real3D(vx[pidAT], vy[pidAT], vz[pidAT]),  # velocity
Example #11
0
# Random Number Generator
xs = time.time()
seed = int(xs % int(xs) * 10000000000)
print "RNG Seed:", seed
rng = espressopp.esutil.RNG()
rng.seed(seed)
system.rng = rng

# Boundary conditions and skin
system.bc = espressopp.bc.OrthorhombicBC(system.rng, size)
system.skin = skin

# H-New
# Communication, storage and grids
comm = MPI.COMM_WORLD
nodeGrid = decomp.nodeGrid(size, rc, skin, comm.size, ex_size + hy_size,
                           ratioMS, 0, [1, 0, 0])  # The 0 is for the IdealGas
print nodeGrid
cellGrid = decomp.cellGrid(size, nodeGrid, rc, skin)
cellGrid, neiListx, neiListy, neiListz = decomp.neiListAdress(
    nodeGrid, cellGrid, rc, skin, ex_size + hy_size, adrCenter, ratioMS, False,
    False, [1, 0, 0])  # The 0 is for the IdealGas
print 'nei List x', neiListx
print 'nei List y', neiListy
print 'nei List z', neiListz

system.storage = espressopp.storage.DomainDecompositionAdress(
    system, nodeGrid, cellGrid, neiListx, neiListy, neiListz)

# setting up GROMACS interaction stuff
# create a force capped Lennard-Jones interaction that uses a verlet list
verletlist = espressopp.VerletListAdress(system,
Example #12
0
    def test_PIAdResS(self):
        print 'param =', self.param

        constkinmass = self.param['constkinmass']
        PILE = self.param['PILE']
        realkinmass = self.param['realkinmass']
        centroidthermostat = self.param['centroidthermostat']
        KTI = self.param['KTI']
        speedupInterAtom = self.param['speedupInterAtom']
        speedupFreezeRings = self.param['speedupFreezeRings']
        spherical_adress = self.param['spherical_adress']
        nb_forcefield_setup = self.param['nb_forcefield_setup']
        energy_before = self.param['energy_before']
        energy_after = self.param['energy_after']

        steps = 10
        timestep_short = 0.001 / 16.0
        multiplier_short_to_medium = 4
        multiplier_medium_to_long = 4
        interaction_cutoff = 0.84
        potential_cutoff = 0.78
        skin = 0.1
        gamma = 0.0
        temp = 2.50266751
        if KTI:
            ex_size = 100.0
        else:
            ex_size = 1.0
        hy_size = 1.5
        nTrotter = 4
        clmassmultiplier = 100.0
        PILElambda = 0.0
        CMDparameter = 1.0

        tabFEC_H = "FEC_H.dat"
        tabFEC_O = "FEC_O.dat"
        tabTHDF_H = "ThdForce_H.dat"
        tabTHDF_O = "ThdForce_O.dat"
        tabAngle = "tableESP_angle.dat"
        tabBondHH = "tableESP_bondHH.dat"
        tabBondOH = "tableESP_bondOH.dat"
        tabHW_HW = "tableESP_HW_HW.dat"
        tabHW_OW = "tableESP_HW_OW.dat"
        tabOW_OW = "tableESP_OW_OW.dat"

        pid, types, x, y, z, vx, vy, vz, Lx, Ly, Lz = espressopp.tools.readxyz(
            "input_test.xyz")
        masses = []
        for item in types:
            if item == 1:
                masses.append(15.9994)
            else:
                masses.append(1.008)

        num_Trotter_beads = len(x)
        num_atoms = len(x) / nTrotter
        size = (Lx, Ly, Lz)

        system = espressopp.System()
        system.bc = espressopp.bc.OrthorhombicBC(system.rng, size)
        system.skin = skin
        comm = MPI.COMM_WORLD
        nodeGrid = decomp.nodeGrid(comm.size)
        cellGrid = decomp.cellGrid(size, nodeGrid, interaction_cutoff, skin)
        system.rng = espressopp.esutil.RNG()
        system.storage = espressopp.storage.DomainDecompositionAdress(
            system, nodeGrid, cellGrid)

        props = ['id', 'pos', 'v', 'f', 'pib', 'type', 'mass', 'adrat']
        allParticlesAT = []
        allParticles = []
        tuples = []

        for pid_trotter in range(num_Trotter_beads):
            allParticlesAT.append([
                pid_trotter + 1,
                Real3D(x[pid_trotter], y[pid_trotter], z[pid_trotter]),
                Real3D(vx[pid_trotter], vy[pid_trotter], vz[pid_trotter]),
                Real3D(0, 0, 0), pid_trotter % nTrotter + 1,
                types[pid_trotter], masses[pid_trotter], 1
            ])
        for pid_atom in range(num_atoms):
            tmptuple = [pid_atom + num_Trotter_beads + 1]
            for pid_trotter in range(nTrotter):
                pid = pid_atom * nTrotter + pid_trotter
                tmptuple.append((allParticlesAT[pid])[0])
            firstParticleId = tmptuple[1]
            cmp = allParticlesAT[firstParticleId - 1][1]
            cmv = allParticlesAT[firstParticleId - 1][2]
            allParticles.append([
                pid_atom + num_Trotter_beads + 1,
                Real3D(cmp[0], cmp[1], cmp[2]),
                Real3D(cmv[0], cmv[1], cmv[2]),
                Real3D(0, 0, 0), 0, types[pid_atom * nTrotter],
                masses[pid_atom * nTrotter], 0
            ])
            for pid_trotter in range(nTrotter):
                pid = pid_atom * nTrotter + pid_trotter
                allParticles.append([(allParticlesAT[pid])[0],
                                     (allParticlesAT[pid])[1],
                                     (allParticlesAT[pid])[2],
                                     (allParticlesAT[pid])[3],
                                     (allParticlesAT[pid])[4],
                                     (allParticlesAT[pid])[5],
                                     (allParticlesAT[pid])[6],
                                     (allParticlesAT[pid])[7]])
            tuples.append(tmptuple)

        system.storage.addParticles(allParticles, *props)
        ftpl = espressopp.FixedTupleListAdress(system.storage)
        ftpl.addTuples(tuples)
        system.storage.setFixedTuplesAdress(ftpl)
        system.storage.decompose()

        bondsOH = []
        bondsHH = []
        for part in range(num_atoms / 3):
            bondsOH.append((num_Trotter_beads + 1 + 3 * part,
                            num_Trotter_beads + 1 + 3 * part + 1))
            bondsOH.append((num_Trotter_beads + 1 + 3 * part,
                            num_Trotter_beads + 1 + 3 * part + 2))
            bondsHH.append((num_Trotter_beads + 1 + 3 * part + 1,
                            num_Trotter_beads + 1 + 3 * part + 2))
        fplOH = espressopp.FixedPairList(system.storage)
        fplHH = espressopp.FixedPairList(system.storage)
        fplOH.addBonds(bondsOH)
        fplHH.addBonds(bondsHH)

        angles = []
        for part in range(num_atoms / 3):
            angles.append((num_Trotter_beads + 1 + 3 * part + 1,
                           num_Trotter_beads + 1 + 3 * part,
                           num_Trotter_beads + 1 + 3 * part + 2))
        ftl = espressopp.FixedTripleList(system.storage)
        ftl.addTriples(angles)

        vl = espressopp.VerletListAdress(system,
                                         cutoff=interaction_cutoff,
                                         adrcut=interaction_cutoff,
                                         dEx=ex_size,
                                         dHy=hy_size,
                                         adrCenter=[Lx / 2, Ly / 2, Lz / 2],
                                         exclusionlist=bondsOH + bondsHH,
                                         sphereAdr=spherical_adress)

        if nb_forcefield_setup == 1:
            interNB = espressopp.interaction.VerletListPIadressTabulatedLJ(
                vl, ftpl, nTrotter, speedupInterAtom)
        elif nb_forcefield_setup == 2:
            interNB = espressopp.interaction.VerletListPIadressNoDriftTabulated(
                vl, ftpl, nTrotter, speedupInterAtom)
        elif nb_forcefield_setup == 3:
            interNB = espressopp.interaction.VerletListPIadressTabulated(
                vl, ftpl, nTrotter, speedupInterAtom)
        else:
            raise ValueError(
                "Wrong nb_forcefield_setup integer (only 1,2,3 accepted.")
        potOOqm = espressopp.interaction.Tabulated(itype=3,
                                                   filename=tabOW_OW,
                                                   cutoff=potential_cutoff)
        potHOqm = espressopp.interaction.Tabulated(itype=3,
                                                   filename=tabHW_OW,
                                                   cutoff=potential_cutoff)
        potHHqm = espressopp.interaction.Tabulated(itype=3,
                                                   filename=tabHW_HW,
                                                   cutoff=potential_cutoff)
        if nb_forcefield_setup == 1:
            interNB.setPotentialQM(type1=1, type2=1, potential=potOOqm)
            interNB.setPotentialQM(type1=1, type2=0, potential=potHOqm)
            interNB.setPotentialQM(type1=0, type2=0, potential=potHHqm)
            potOOcl = espressopp.interaction.LennardJones(
                epsilon=temp,
                sigma=0.25,
                shift='auto',
                cutoff=1.122462048309373 * 0.25)
            interNB.setPotentialCL(type1=1, type2=1, potential=potOOcl)
        elif nb_forcefield_setup == 2:
            interNB.setPotential(type1=1, type2=1, potential=potOOqm)
            interNB.setPotential(type1=1, type2=0, potential=potHOqm)
            interNB.setPotential(type1=0, type2=0, potential=potHHqm)
        elif nb_forcefield_setup == 3:
            interNB.setPotentialQM(type1=1, type2=1, potential=potOOqm)
            interNB.setPotentialQM(type1=1, type2=0, potential=potHOqm)
            interNB.setPotentialQM(type1=0, type2=0, potential=potHHqm)
            interNB.setPotentialCL(type1=1, type2=1, potential=potOOqm)
            interNB.setPotentialCL(type1=1, type2=0, potential=potHOqm)
            interNB.setPotentialCL(type1=0, type2=0, potential=potHHqm)
        system.addInteraction(interNB)

        potBondHH = espressopp.interaction.Tabulated(itype=3,
                                                     filename=tabBondHH)
        potBondOH = espressopp.interaction.Tabulated(itype=3,
                                                     filename=tabBondOH)
        interBondedHH = espressopp.interaction.FixedPairListPIadressTabulated(
            system, fplHH, ftpl, potBondHH, nTrotter, speedupInterAtom)
        interBondedOH = espressopp.interaction.FixedPairListPIadressTabulated(
            system, fplOH, ftpl, potBondOH, nTrotter, speedupInterAtom)
        system.addInteraction(interBondedHH)
        system.addInteraction(interBondedOH)

        potAngle = espressopp.interaction.TabulatedAngular(itype=3,
                                                           filename=tabAngle)
        interAngle = espressopp.interaction.FixedTripleListPIadressTabulatedAngular(
            system, ftl, ftpl, potAngle, nTrotter, speedupInterAtom)
        system.addInteraction(interAngle)

        integrator = espressopp.integrator.PIAdressIntegrator(
            system=system,
            verletlist=vl,
            timestep=timestep_short,
            sSteps=multiplier_short_to_medium,
            mSteps=multiplier_medium_to_long,
            nTrotter=nTrotter,
            realKinMass=realkinmass,
            constKinMass=constkinmass,
            temperature=temp,
            gamma=gamma,
            centroidThermostat=centroidthermostat,
            CMDparameter=CMDparameter,
            PILE=PILE,
            PILElambda=PILElambda,
            CLmassmultiplier=clmassmultiplier,
            speedup=speedupFreezeRings,
            KTI=KTI)

        if not KTI:
            fec = espressopp.integrator.FreeEnergyCompensation(
                system, center=[Lx / 2, Ly / 2, Lz / 2], ntrotter=nTrotter)
            fec.addForce(itype=3, filename=tabFEC_O, type=1)
            fec.addForce(itype=3, filename=tabFEC_H, type=0)
            integrator.addExtension(fec)
            thdf = espressopp.integrator.TDforce(system, vl)
            thdf.addForce(itype=3, filename=tabTHDF_O, type=1)
            thdf.addForce(itype=3, filename=tabTHDF_H, type=0)
            integrator.addExtension(thdf)

        if KTI:
            for i in range(1, num_Trotter_beads + num_atoms + 1):
                system.storage.modifyParticle(i, 'lambda_adrd', 0.0)
                system.storage.modifyParticle(i, 'lambda_adr', 0.0)
                system.storage.modifyParticle(
                    i, 'varmass',
                    clmassmultiplier * system.storage.getParticle(i).mass)
            system.storage.decompose()

        espressopp.tools.AdressDecomp(system, integrator)

        Eb = interBondedOH.computeEnergy() + interBondedHH.computeEnergy()
        EAng = interAngle.computeEnergy()
        ELj = interNB.computeEnergy()
        Ek = integrator.computeKineticEnergy()
        EPI = integrator.computeRingEnergy()
        if KTI == False:
            Ecorr = fec.computeCompEnergy() + thdf.computeTDEnergy()
        else:
            Ecorr = 0.0
        energy_before_thistest = Ek + Eb + EAng + ELj + EPI + Ecorr

        integrator.run(steps)

        Eb = interBondedOH.computeEnergy() + interBondedHH.computeEnergy()
        EAng = interAngle.computeEnergy()
        ELj = interNB.computeEnergy()
        Ek = integrator.computeKineticEnergy()
        EPI = integrator.computeRingEnergy()
        if KTI == False:
            Ecorr = fec.computeCompEnergy() + thdf.computeTDEnergy()
        else:
            Ecorr = 0.0
        energy_after_thistest = Ek + Eb + EAng + ELj + EPI + Ecorr

        self.assertAlmostEqual(energy_before_thistest, energy_before, places=5)
        self.assertAlmostEqual(energy_after_thistest, energy_after, places=5)

######################################################################
### IT SHOULD BE UNNECESSARY TO MAKE MODIFICATIONS BELOW THIS LINE ###
######################################################################
sys.stdout.write('Setting up simulation ...\n')
x, y, z, Lx, Ly, Lz, vx, vy, vz = lammps.read('espressopp_lennard_jones.start')
num_particles = len(x)
density = num_particles / (Lx * Ly * Lz)
size = (Lx, Ly, Lz)
system = espressopp.System()
system.rng = espressopp.esutil.RNG()
system.bc = espressopp.bc.OrthorhombicBC(system.rng, size)
system.skin = skin
comm = MPI.COMM_WORLD
nodeGrid = decomp.nodeGrid(comm.size,size,rc,skin)
cellGrid = decomp.cellGrid(size, nodeGrid, rc, skin)
system.storage = espressopp.storage.DomainDecomposition(system, nodeGrid, cellGrid)

# add particles to the system and then decompose
props = ['id', 'type', 'mass', 'pos', 'v']
new_particles = []
for i in range(num_particles):
  part = [i + 1, 0, 1.0, Real3D(x[i], y[i], z[i]), Real3D(vx[i], vy[i], vz[i])]
  new_particles.append(part)
system.storage.addParticles(new_particles, *props)
system.storage.decompose()

# all particles interact via a LJ interaction (use Verlet lists)
vl = espressopp.VerletList(system, cutoff=rc+system.skin)
#potLJ = espressopp.interaction.LennardJones(epsilon=1.0, sigma=1.0, cutoff=rc, shift=False)