示例#1
0
# FENE - uncomment to plot
#tabFENE = "pot-fene.txt"
#potFENE  = espressopp.interaction.FENE(K=30.0, r0=0.0, rMax=1.5)
#writeTabFile(potFENE, tabFENE, N=512, low=0.005, high=2.0)

# tabulated morse potential used for CG interactions
tabMorse = "pot-morse.txt"
potMorse = espressopp.interaction.Morse(epsilon=0.105,
                                        alpha=2.4,
                                        rMin=rc,
                                        cutoff=rc,
                                        shift="auto")
writeTabFile(potMorse, tabMorse, N=512, low=0.005, high=4.5)

# read ESPResSo configuration file
Lx, Ly, Lz, x, y, z, type, q, vx, vy, vz, fx, fy, fz, bonds = espresso_old.read(
    "adress.espressopp")
num_particlesCG = 5001  # number of VP/CG particles
#num_particles = len(x) - num_particlesCG  # 20004 = 25005 - 5001
num_particles = len(x)  # 20004

#Lx, Ly, Lz = 45, 45, 45

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

# end of the function readingDesernoForcesFile

# The script itself
import sys
import mpi4py.MPI as MPI
import espressopp

from espressopp import Real3D
from espressopp.tools.convert import espresso_old

# reading the particle coordinates, charges and box size from old espressopp data file
# file 'ini_struct_deserno.dat' contains the data we need
print "Reading system data:"
Lx, Ly, Lz, x, y, z, type, q, vx, vy, vz, fx, fy, fz, bondpairs = espresso_old.read(
    'ini_struct_deserno.dat')

# creating the system box
box = (Lx, Ly, Lz)
print "System box size:", box
# number of particles
num_particles = len(x)
print "Number of particles = ", num_particles
print "The first particle has coordinates", x[0], y[0], z[0]
'''
#  Ewald method suppose to calculate electrostatic interaction dividing it into R space and
#  K space part
#  
#  alpha - Ewald parameter
#  rspacecutoff - the cutoff in real space
#  kspacecutoff - the cutoff in reciprocal space   
示例#3
0
  return energy, fx, fy, fz
# end of the function readingDesernoForcesFile


# The script itself
import sys
import mpi4py.MPI as MPI
import espressopp

from espressopp import Real3D
from espressopp.tools.convert import espresso_old

# reading the particle coordinates, charges and box size from old espressopp data file
# file 'ini_struct_deserno.dat' contains the data we need
print "Reading system data:"
Lx, Ly, Lz, x, y, z, type, q, vx,vy,vz,fx,fy,fz,bondpairs = espresso_old.read('ewald.espressopp')

# creating the system box
box = (Lx, Ly, Lz)
print "System box size:", box
# number of particles
num_particles = len(x)
print "Number of particles = ", num_particles
print "The first particle has coordinates", x[0], y[0], z[0]

'''
#  Ewald method suppose to calculate electrostatic interaction dividing it into R space and
#  K space part
#  
#  alpha - Ewald parameter
#  rspacecutoff - the cutoff in real space
示例#4
0
        if body == 2:# this is for 2-body potentials
            force = pot.computeForce(Real3D(r, 0.0, 0.0))[0]
            #force /= r
        else: # this is for 3- and 4-body potentials
            force = pot.computeForce(r)
        outfile.write("%15.8g %15.8g %15.8g\n"%(r, energy, force))

    outfile.close()

# tabulated morse potential used for CG interactions
tabMorse = "pot-morse.txt"
potMorse = espressopp.interaction.Morse(epsilon=0.105, alpha=2.4, rMin=rc, cutoff=rc, shift="auto")
writeTabFile(potMorse, tabMorse, N=512, low=0.005, high=4.5)

# read ESPResSo configuration file
Lx, Ly, Lz, x, y, z, type, q, vx, vy, vz, fx, fy, fz, bonds = espresso_old.read("adress.espressopp")
num_particlesCG = 5001 # number of VP/CG particles
num_particles = len(x) # 20004

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)
示例#5
0

# end of the function readingDesernoForcesFile

# The script itself
import sys
import mpi4py.MPI as MPI
import espressopp

from espressopp import Real3D
from espressopp.tools.convert import espresso_old

# reading the particle coordinates, charges and box size from old espressopp data file
# file 'ini_struct_deserno.dat' contains the data we need
print "Reading system data:"
Lx, Ly, Lz, x, y, z, type, q, vx, vy, vz, fx, fy, fz, bondpairs = espresso_old.read(
    'ewald.espressopp')

# creating the system box
box = (Lx, Ly, Lz)
print "System box size:", box
# number of particles
num_particles = len(x)
print "Number of particles = ", num_particles
print "The first particle has coordinates", x[0], y[0], z[0]
'''
#  Ewald method suppose to calculate electrostatic interaction dividing it into R space and
#  K space part
#  
#  alpha - Ewald parameter
#  rspacecutoff - the cutoff in real space
#  kspacecutoff - the cutoff in reciprocal space