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 :
             cellGrid[k] = 2
             print 'cellGrid[%i] has been adjusted to 2'                  
         self.next_id = 0
         self.pmiinit(system, nodeGrid, cellGrid)
       else:
         print 'Error: could not create DomainDecomposition object'
# 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 = espresso.System()
system.rng = espresso.esutil.RNG()
system.bc = espresso.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 = espresso.storage.DomainDecompositionAdress(system, nodeGrid, cellGrid)


# prepare AT particles
allParticlesAT = []
allParticles = []
tuples = []
for pidAT in range(num_particles):#logging.getLogger("StorageAdress").setLevel(logging.DEBUG)
    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
######################################################################
##  IT SHOULD BE UNNECESSARY TO MAKE MODIFICATIONS BELOW THIS LINE  ##
######################################################################
sys.stdout.write('Setting up simulation ...\n')
bonds, angles, x, y, z, Lx, Ly, Lz = lammps.read(
    'espressopp_polymer_melt.start')
num_particles = len(x)
density = num_particles / (Lx * Ly * Lz)
size = (Lx, Ly, Lz)
system = espresso.System()
system.rng = espresso.esutil.RNG(54321)
system.bc = espresso.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 = espresso.storage.DomainDecomposition(system, nodeGrid,
                                                      cellGrid)

# add particles to the system and then decompose
for pid in range(num_particles):
    system.storage.addParticle(pid + 1, Real3D(x[pid], y[pid], z[pid]))
system.storage.decompose()

# Lennard-Jones with Verlet list
vl = espresso.VerletList(system, cutoff=rc + system.skin)
potTabLJ = espresso.interaction.Tabulated(itype=spline,
                                          filename=tabfileLJ,
                                          cutoff=rc)
potLJ = espresso.interaction.LennardJones(sigma=1.0,
示例#4
0
######################################################################
##  IT SHOULD BE UNNECESSARY TO MAKE MODIFICATIONS BELOW THIS LINE  ##
######################################################################
sys.stdout.write('Setting up simulation ...\n')
bonds, angles, x, y, z, Lx, Ly, Lz = lammps.read(
    'espressopp_polymer_melt.start')
num_particles = len(x)
density = num_particles / (Lx * Ly * Lz)
size = (Lx, Ly, Lz)
system = espresso.System()
system.rng = espresso.esutil.RNG(54321)
system.bc = espresso.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 = espresso.storage.DomainDecomposition(system, nodeGrid,
                                                      cellGrid)

# add particles to the system and then decompose
for pid in range(num_particles):
    system.storage.addParticle(pid + 1, Real3D(x[pid], y[pid], z[pid]))
system.storage.decompose()

# Lennard-Jones with Verlet list
vl = espresso.VerletList(system, cutoff=rc + system.skin)
potTabLJ = espresso.interaction.Tabulated(itype=spline,
                                          filename=tabfileLJ,
                                          cutoff=rc)
potLJ = espresso.interaction.LennardJones(sigma=1.0,

######################################################################
##  IT SHOULD BE UNNECESSARY TO MAKE MODIFICATIONS BELOW THIS LINE  ##
######################################################################
sys.stdout.write('Setting up simulation ...\n')
bonds, angles, x, y, z, Lx, Ly, Lz = lammps.read('espressopp_polymer_melt.start')
num_particles = len(x)
density = num_particles / (Lx * Ly * Lz)
size = (Lx, Ly, Lz)
system = espresso.System()
system.rng = espresso.esutil.RNG(54321)
system.bc = espresso.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 = espresso.storage.DomainDecomposition(system, nodeGrid, cellGrid)

# add particles to the system and then decompose
for pid in range(num_particles):
  system.storage.addParticle(pid + 1, Real3D(x[pid], y[pid], z[pid]))
system.storage.decompose()



# Lennard-Jones with Verlet list
vl = espresso.VerletList(system, cutoff = rc + system.skin)
potTabLJ = espresso.interaction.Tabulated(itype=spline, filename=tabfileLJ, cutoff=rc)
potLJ = espresso.interaction.LennardJones(sigma=1.0, epsilon=1.0, cutoff=rc, shift=False)
if sys.argv.count("tlj") > 0: