Ejemplo n.º 1
0
def testNCoord():
	
	rdfcut = 7.5

	ld = __prepLD()
	ld.LammpsTraj = os.path.expanduser('~/benwat/data/gromacs/NB250NW250/NB250NW250_prod.lammpstrj.gz')
	ld.LDDelta = 1e-3
	ld.LDCut = rdfcut

	ld.Prefix = 'NCoord'
	ld.genFileNames()
	
	ld.Normalize = True ; ld.makeRDF([1], [1])
	r,g,e1,x1 = pickle.load(open(ld.rdfpickle, 'r'))
	ind = np.where(abs(r-rdfcut) < 0.1)[0][0]
	rho_bulk = (ld.NCentAtoms + ld.NNeighAtoms) / (np.mean(ld.BoxL)**3.)
	N_rdf = 4 * np.pi * rho_bulk * np.trapz(y = r[:ind+1]**2. * g[:ind+1], x = r[:ind+1])

	ld.Normalize = True ; ld.makeLD(1,1)
	rho, h, e2, x2, y2 = pickle.load(open(ld.ldpickle, 'r'))
	N_ld = np.trapz(y = h * rho, x = rho)
	#N_ld = np.mean(np.mean(y2, axis = 0))

	print '\n\n'
	print 'N_RDF = ', N_rdf
	print 'N_LD = ', N_ld

	ax = plt.subplot(1,2,1) ; ax.plot(r,g, label = r'$g(r)$') ; ax.legend()
	ax = plt.subplot(1,2,2) ; ax.plot(rho, h, label = r'$h(\rho)$') ; ax.legend()
	plt.show()

	os.remove(ld.rdfpickle)
	os.remove(ld.ldpickle)
Ejemplo n.º 2
0
def makeAllRDF():
	global Trj, BoxL, AtomNames, AtomTypes, NB, NW
	__prepHeadVars()

	if isMappedTrj:
		rdfPairs = {'BB': ([1], [1]), 'BW': ([1], [2]), 'WW': ([2], [2])}
	else:
		rdfPairs = {'BB': (range(1,13), range(1,13)), 'BW': (range(1,13), [13]), 'WW': ([13], [13])}
	
	if not NW: 
		rdfPairs.pop('BW'); rdfPairs.pop('WW')
	
	if not NB:
		rdfPairs.pop('BW'); rdfPairs.pop('BB')

	sc.LammpsTraj = Traj
	sc.Nbins = 100
	sc.TrjIter[2] = MeasureFreq
	sc.Normalize = Normalize
	sc.AtomNames2Types = AtomNames2Types
	if not isMappedTrj: sc.AtomNames2Types = False #(hotfix for a vmd screwup)

	sc.calcErrorBar = calcErrorBar
	sc.NBlocks = NBlocks
	
	for ext in rdfPairs.keys():
		print '\nCalculating rdf for %s\n\n' % ext
		sc.Prefix = Prefix + '_%s' % ext
		sc.genFileNames()
		if __isComputed(sc.rdfpickle): continue
		sc.makeRDF(CentAtomType = rdfPairs[ext][0], NeighAtomType = rdfPairs[ext][1])
Ejemplo n.º 3
0
#!/usr/bin/env python

import os, sys, pickle
import matplotlib.pyplot as plt

# dependencies
sys.path.append(os.path.expanduser('~/benwat')); import mysim
import sim
from selLDCut import structcorr as rdf

rdf.Normalize = True
rdf.MeasureFreq = 50
rdf.Normalize = True
rdf.Nbins = 50
rdf.AtomNames2Types = True																																																																																																																																																																																																																																																																																																																																																																																																																																								
rdf.LammpsTraj = os.path.expanduser('~/benwat/data/gromacs/NB250test/NB250NW250_prod.lammpstrj.gz')
rdf.Prefix = 'NB250_CG_BB'

rdf.calcErrorBar = False

rdf.genFileNames()
rdf.makeRDF([1], [1])

r,g,e,a  = pickle.load(open(rdf.rdfpickle, 'r'))
plt.errorbar(r,g, yerr = e)
plt.show()

Ejemplo n.º 4
0
#!/usr/bin/env python

import os, sys
import numpy as np

sys.path.append(os.path.expanduser('~/selLDCut'))
from selLDCut import structcorr as rdf

LammpsTraj = sys.argv[1]
Prefix = sys.argv[2]

rdf.AtomNames2Types = False
rdf.calcErrorBar = False
rdf.Nbins = 50
rdf.TrjIter = [0, -1, 10]

rdf.LammpsTraj = LammpsTraj
rdf.Prefix = Prefix
rdf.genFileNames()
rdf.makeRDF([0], [0])