Example #1
0
def genTabPotentials(tabfilesnb):
    potentials = {}
    for fg in tabfilesnb:
        fe = fg.split(".")[0]+".tab" # name of espressopp file
        gromacs.convertTable(fg, fe, sigma, epsilon, c6, c12)
        pot = espressopp.interaction.Tabulated(itype=spline, filename=fe, cutoff=rc)
        t1, t2 = fg[6], fg[8] # type 1, type 2
        potentials.update({t1+"_"+t2: pot})
    return potentials
Example #2
0
def genTabPotentials(tabfilesnb):
    potentials = {}
    for fg in tabfilesnb:
        fe = fg.split(".")[0] + ".tab"  # name of espressopp file
        gromacs.convertTable(fg, fe, sigma, epsilon, c6, c12)
        pot = espressopp.interaction.Tabulated(itype=3, filename=fe, cutoff=rc)
        t1, t2 = fg[6], fg[8]  # type 1, type 2
        potentials.update({t1 + "_" + t2: pot})
        print "created", t1, t2, fe
    return potentials
            force = pot.computeForce(Real3D(r, 0.0, 0.0))[0]
        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()

# write the espressopp++ tabulated file for a LJ potential
print 'Generating potential file ... (%2s)' % tabfile
potLJ = espressopp.interaction.LennardJones(epsilon=1.0, sigma=1.0, shift=0.0, cutoff=cutoff)
writeTabFile(potLJ, tabfile, N=1500, low=0.01, high=potLJ.cutoff)


# convert gromacs tabulated file to espressopp++ format
print 'Converting GROMACS file to ESPResSo++ file ... (%2s -> %2s)' % (filein, fileout)
gromacs.convertTable(filein, fileout, sigma, epsilon, c6, c12)

#exit() # exit if you just want to convert a file

# compute the number of cells on each node
def calcNumberCells(size, nodes, cutoff):
    ncells = 1
    while size / (ncells * nodes) >= cutoff:
       ncells = ncells + 1
    return ncells - 1


#start_time = time.clock()

# run simulation for all tabulated potential files
for potfile in files:
Example #4
0
particlePIDsADR = [mapAtToCgIndex[pid] for pid in particlePIDsADR]
verletlist = espressopp.VerletListAdress(system, cutoff=nbCutoff, adrcut=nbCutoff,
                                dEx=ex_size, dHy=hy_size,
                                pids=particlePIDsADR, sphereAdr=True)

# set up LJ interaction according to the parameters read from the .top file
lj_adres_interaction=gromacs.setLennardJonesInteractions(system, defaults, atomtypeparameters, verletlist, intCutoff, adress=True, ftpl=ftpl)

# set up coulomb interactions according to the parameters read from the .top file
print '#Note: Reaction Field method is used for Coulomb interactions'
qq_adres_interaction=gromacs.setCoulombInteractions(system, verletlist, intCutoff, atTypes, epsilon1=1, epsilon2=67.5998, kappa=0, adress=True, ftpl=ftpl)

# set the CG potential for water. Set for LJ interaction, and QQ interaction has no CG equivalent, also prot has no CG potential, is always in adres region
# load CG interaction from table
fe="table_CGwat_CGwat.tab"
gromacs.convertTable("table_CGwat_CGwat.xvg", fe, 1, 1, 1, 1)
potCG = espressopp.interaction.Tabulated(itype=3, filename=fe, cutoff=intCutoff)
lj_adres_interaction.setPotentialCG(type1=typeCG, type2=typeCG, potential=potCG)

## bonded (fixed list) interactions for protein (actually between CG particles in AA region) ##

## set up LJ 1-4 interactions
cgOnefourpairslist=[]
for (a1,a2) in atOnefourpairslist:
  cgOnefourpairslist.append((mapAtToCgIndex[a1],mapAtToCgIndex[a2]))
print '# ',len(cgOnefourpairslist),' 1-4 pairs in aa-hybrid region'
onefourlist = espressopp.FixedPairList(system.storage)
onefourlist.addBonds(cgOnefourpairslist)
lj14interaction=gromacs.setLennardJones14Interactions(system, defaults, atomtypeparameters, onefourlist, intCutoff)

# set up coulomb 1-4 interactions
Example #5
0
# set up LJ interaction according to the parameters read from the .top file
ljinteraction=gromacs.setLennardJonesInteractions(system, defaults, atomtypeparameters, verletlist,rca, hadress=True, ftpl=ftpl)

# set up angle interactions according to the parameters read from the .top file

#fpl = espressopp.FixedTripleListAdress(system.storage, ftpl)
angleinteractions=gromacs.setAngleInteractionsAdress(system, angletypes, angletypeparams, ftpl)

# set up coulomb interactions according to the parameters read from the .top file
# !! Warning: this only works for reaction-field now!
qq_interactions=gromacs.setCoulombInteractions(system, verletlist, rca, types, epsilon1=1, epsilon2=80, kappa=0, hadress=True, ftpl=ftpl)

# load CG interaction from table
fe="table_CG_CG.tab"
gromacs.convertTable("table_CG_CG.xvg", fe, 1, 1, 1, 1)
potCG = espressopp.interaction.Tabulated(itype=3, filename=fe, cutoff=rca) # CG


# set the CG potential. There are two non-bonded interactions, we pick only the first one 
for n in range(system.getNumberOfInteractions()):
    interaction=system.getInteraction(n)
    if interaction.bondType() == espressopp.interaction.Nonbonded:
	print "Setting CG interaction", typeCG
	interaction.setPotentialCG(type1=typeCG, type2=typeCG, potential=potCG)
	break

#fpl = espressopp.FixedPairListAdress(system.storage, ftpl)
bondedinteractions=gromacs.setBondedInteractionsAdress(system, bondtypes, bondtypeparams, ftpl)

Example #6
0
comm = MPI.COMM_WORLD
nodeGrid = decomp.nodeGrid(comm.size)
cellGrid = decomp.cellGrid(size, nodeGrid, rc, skin)
system.storage = espressopp.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.addParticles([[pid + 1, Real3D(x[pid], y[pid], z[pid]), types[pid]]], "id", "pos", "type")
system.storage.decompose()


# convert gromacs tabulated files to espressopp++ format
gromacs.convertTable(tabAAg, tabAA, sigma, epsilon, c6, c12)
gromacs.convertTable(tabABg, tabAB, sigma, epsilon, c6, c12)
gromacs.convertTable(tabBBg, tabBB, sigma, epsilon, c6, c12)
gromacs.convertTable(tab2bg, tab2b, sigma, epsilon, c6, c12)
gromacs.convertTable(tab3bg, tab3b, sigma, epsilon, c6, c12)



# non-bonded interactions, B is type 0, A is type 1
# Verlet list
vl = espressopp.VerletList(system, cutoff = rc + system.skin)
# note: in the previous version of this example, exclusions were treated
# incorrectly. Here the nrexcl=3 parameter is taken into account 
# which excludes all neighbors up to 3 bonds away
vl.exclude(exclusions)
Example #7
0
comm = MPI.COMM_WORLD
nodeGrid = decomp.nodeGrid(comm.size)
cellGrid = decomp.cellGrid(size, nodeGrid, rc, skin)
system.storage = espressopp.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.addParticles(
        [[pid + 1, Real3D(x[pid], y[pid], z[pid]), types[pid]]], "id", "pos",
        "type")
system.storage.decompose()

# convert gromacs tabulated files to espressopp++ format
gromacs.convertTable(tabAAg, tabAA, sigma, epsilon, c6, c12)
gromacs.convertTable(tabABg, tabAB, sigma, epsilon, c6, c12)
gromacs.convertTable(tabBBg, tabBB, sigma, epsilon, c6, c12)
gromacs.convertTable(tab2bg, tab2b, sigma, epsilon, c6, c12)
gromacs.convertTable(tab3bg, tab3b, sigma, epsilon, c6, c12)

# non-bonded interactions, B is type 0, A is type 1
# Verlet list
vl = espressopp.VerletList(system, cutoff=rc + system.skin)
# note: in the previous version of this example, exclusions were treated
# incorrectly. Here the nrexcl=3 parameter is taken into account
# which excludes all neighbors up to 3 bonds away
vl.exclude(exclusions)

internb = espressopp.interaction.VerletListTabulated(vl)
# A-A with Verlet list
Example #8
0
# set up coulomb interactions according to the parameters read from the .top file
# !! Warning: this only works for reaction-field now!
qq_interactions = gromacs.setCoulombInteractions(system,
                                                 verletlist,
                                                 rca,
                                                 types,
                                                 epsilon1=1,
                                                 epsilon2=80,
                                                 kappa=0,
                                                 hadress=True,
                                                 ftpl=ftpl)

# load CG interaction from table
fe = "table_CG_CG.tab"
gromacs.convertTable("table_CG_CG.xvg", fe, 1, 1, 1, 1)
potCG = espressopp.interaction.Tabulated(itype=3, filename=fe,
                                         cutoff=rca)  # CG

# set the CG potential. There are two non-bonded interactions, we pick only the first one
for n in range(system.getNumberOfInteractions()):
    interaction = system.getInteraction(n)
    if interaction.bondType() == espressopp.interaction.Nonbonded:
        print "Setting CG interaction", typeCG
        interaction.setPotentialCG(type1=typeCG, type2=typeCG, potential=potCG)
        break

#fpl = espressopp.FixedPairListAdress(system.storage, ftpl)
bondedinteractions = gromacs.setBondedInteractionsAdress(
    system, bondtypes, bondtypeparams, ftpl)
Example #9
0
    outfile.close()


# write the espressopp++ tabulated file for a LJ potential
print 'Generating potential file ... (%2s)' % tabfile
potLJ = espressopp.interaction.LennardJones(epsilon=1.0,
                                            sigma=1.0,
                                            shift=0.0,
                                            cutoff=cutoff)
writeTabFile(potLJ, tabfile, N=1500, low=0.01, high=potLJ.cutoff)

# convert gromacs tabulated file to espressopp++ format
print 'Converting GROMACS file to ESPResSo++ file ... (%2s -> %2s)' % (filein,
                                                                       fileout)
gromacs.convertTable(filein, fileout, sigma, epsilon, c6, c12)

#exit() # exit if you just want to convert a file


# compute the number of cells on each node
def calcNumberCells(size, nodes, cutoff):
    ncells = 1
    while size / (ncells * nodes) >= cutoff:
        ncells = ncells + 1
    return ncells - 1


#start_time = time.clock()

# run simulation for all tabulated potential files