completed lj parameter set and compute functions for melt example
This commit is contained in:
@ -4,25 +4,32 @@ class LAMMPSLJCutPotential(object):
|
|||||||
|
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
self.pmap=dict()
|
self.pmap=dict()
|
||||||
# coefficients: epsilon, sigma
|
# set coeffs: eps, sig, 48*eps*sig**12, 24*eps*sig**6,
|
||||||
self.coeff = {'lj' : {'lj' : (1.0,1.0),
|
# 4*eps*sig**12, 4*eps*sig**6
|
||||||
'NULL': (0.0,1.0)},
|
self.coeff = {'lj' : {'lj' : (1.0,1.0,48.0,24.0,4.0,4.0),
|
||||||
'NULL': {'lj' : (0.0,1.0),
|
'NULL': (0.0,1.0, 0.0, 0.0,0.0,0.0)},
|
||||||
'NULL': (0.0,1.0)}}
|
'NULL': {'lj' : (0.0,1.0, 0.0, 0.0,0.0,0.0),
|
||||||
|
'NULL': (0.0,1.0, 0.0, 0.0,0.0,0.0)}}
|
||||||
|
|
||||||
def map_coeff(self,type,name):
|
def map_coeff(self,name,type):
|
||||||
if self.coeff.has_key(name):
|
if self.coeff.has_key(name):
|
||||||
print("map type %d to name %s" % (type,name))
|
|
||||||
self.pmap[type] = name
|
self.pmap[type] = name
|
||||||
else:
|
else:
|
||||||
print("cannot match atom type",name)
|
raise Exception("cannot match atom type %s" % name)
|
||||||
|
|
||||||
def compute_force(self,r,itype,jtype,factor_lj):
|
def compute_force(self,rsq,itype,jtype):
|
||||||
return 0.0
|
r2inv = 1.0/rsq
|
||||||
|
r6inv = r2inv*r2inv*r2inv
|
||||||
|
lj1 = self.coeff[self.pmap[itype]][self.pmap[jtype]][2]
|
||||||
|
lj2 = self.coeff[self.pmap[itype]][self.pmap[jtype]][3]
|
||||||
|
return (r6inv * (lj1*r6inv - lj2))
|
||||||
|
|
||||||
def compute_energy(self,r,itype,jtype,factor_lj):
|
def compute_energy(self,rsq,itype,jtype):
|
||||||
return 0.0
|
r2inv = 1.0/rsq
|
||||||
|
r6inv = r2inv*r2inv*r2inv
|
||||||
|
lj3 = self.coeff[self.pmap[itype]][self.pmap[jtype]][4]
|
||||||
|
lj4 = self.coeff[self.pmap[itype]][self.pmap[jtype]][5]
|
||||||
|
return (r6inv * (lj3*r6inv - lj4))
|
||||||
|
|
||||||
lammps_pair_style = LAMMPSLJCutPotential()
|
lammps_pair_style = LAMMPSLJCutPotential()
|
||||||
print ("lj-melt potential file loaded")
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user