Пример #1
0
  return energy, fx, fy, fz
# end of the function readingDesernoForcesFile


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

from espresso import Real3D
from espresso.tools.convert import espresso_old

# reading the particle coordinates, charges and box size from old espresso 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.espresso')

# 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
  return energy, fx, fy, fz
# end of the function readingDesernoForcesFile


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

from espresso import Real3D
from espresso.tools.convert import espresso_old

# reading the particle coordinates, charges and box size from old espresso 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
Пример #3
0
#writeTabFile(potLJ, tabWCA, N=512, low=0.005, high=rca)

# FENE - uncomment to plot
#tabFENE = "pot-fene.txt"
#potFENE  = espresso.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 = espresso.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.espresso")
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 = espresso.System()
system.rng = espresso.esutil.RNG()
system.bc = espresso.bc.OrthorhombicBC(system.rng, size)
system.skin = skin