Пример #1
0
    E = getEnergy(xyz)
    fout.write( str(S) + " " + str(E) + "\n")




lj = LJ()
natoms = 17
X1 = np.random.uniform(-1,1,[natoms*3])*(float(natoms))**(1./3)
ret = quench( X1, lj.getEnergyGradient)
X1 = ret[0]
X2 = np.random.uniform(-1,1,[natoms*3])*(float(natoms))**(1./3)
ret = quench( X2, lj.getEnergyGradient)
X2 = ret[0]

dist, X1, X2 = minpermdist( X1, X2, niter = 100 )
distf = np.linalg.norm(X1 - X2)
print "dist returned        ", dist
print "dist from structures ", distf

#X1 = np.array( [ 0., 0., 0., 1., 0., 0., 0., 0., 1.,] )
#X2 = np.array( [ 0., 0., 0., 1., 0., 0., 0., 1., 0.,] )
import copy
X1i = copy.copy(X1)
X2i = copy.copy(X2)

print "setting up path" 
neb = NEB.NEB(X1, X2, lj, k = 100. ,nimages=10)
print "saving intial path to path.init.xyz"
with open("path.init.xyz", "w") as fout:
    printpath(fout, neb.coords)
Пример #2
0
from potentials.ljpshift import LJpshift

natoms = 17
ntypea = int(natoms * 0.8)
lj = LJpshift(natoms, ntypea)
permlist = [range(ntypea), range(ntypea, natoms)]


X1 = np.random.uniform(-1, 1, [natoms * 3]) * (float(natoms)) ** (1.0 / 3) * 0.8
ret = quench(X1, lj.getEnergyGradient)
X1 = ret[0]
X2 = np.random.uniform(-1, 1, [natoms * 3]) * (float(natoms)) ** (1.0 / 3) * 0.8
ret = quench(X2, lj.getEnergyGradient)
X2 = ret[0]

dist, X1, X2 = minpermdist(X1, X2, niter=100, permlist=permlist)
distf = np.linalg.norm(X1 - X2)
print "dist returned        ", dist
print "dist from structures ", distf
print "energies ", lj.getEnergy(X1), lj.getEnergy(X2)
print X2

# X1 = np.array( [ 0., 0., 0., 1., 0., 0., 0., 0., 1.,] )
# X2 = np.array( [ 0., 0., 0., 1., 0., 0., 0., 1., 0.,] )
import copy

X1i = copy.copy(X1)
X2i = copy.copy(X2)

atomtypes = ["L" for i in range(ntypea)]  # for printing binary systems
for i in range(natoms - ntypea):
Пример #3
0
        S += dist
    xyz = neb.coords[-1, :]
    E = getEnergy(xyz)
    fout.write(str(S) + " " + str(E) + "\n")


lj = LJ()
natoms = 17
X1 = np.random.uniform(-1, 1, [natoms * 3]) * (float(natoms))**(1. / 3)
ret = quench(X1, lj.getEnergyGradient)
X1 = ret[0]
X2 = np.random.uniform(-1, 1, [natoms * 3]) * (float(natoms))**(1. / 3)
ret = quench(X2, lj.getEnergyGradient)
X2 = ret[0]

dist, X1, X2 = minpermdist(X1, X2, niter=100)
distf = np.linalg.norm(X1 - X2)
print "dist returned        ", dist
print "dist from structures ", distf

#X1 = np.array( [ 0., 0., 0., 1., 0., 0., 0., 0., 1.,] )
#X2 = np.array( [ 0., 0., 0., 1., 0., 0., 0., 1., 0.,] )
import copy
X1i = copy.copy(X1)
X2i = copy.copy(X2)

print "setting up path"
neb = NEB.NEB(X1, X2, lj, k=100., nimages=10)
print "saving intial path to path.init.xyz"
with open("path.init.xyz", "w") as fout:
    printpath(fout, neb.coords)
Пример #4
0
from potentials.ljpshift import LJpshift
natoms = 17
ntypea = int(natoms*.8)
lj = LJpshift(natoms, ntypea)
permlist = [range(ntypea), range(ntypea, natoms)]


X1 = np.random.uniform(-1,1,[natoms*3])*(float(natoms))**(1./3) * .8
ret = quench( X1, lj.getEnergyGradient)
X1 = ret[0]
X2 = np.random.uniform(-1,1,[natoms*3])*(float(natoms))**(1./3) * .8
ret = quench( X2, lj.getEnergyGradient)
X2 = ret[0]

dist, X1, X2 = minpermdist( X1, X2, niter = 100, permlist=permlist )
distf = np.linalg.norm(X1 - X2)
print "dist returned        ", dist
print "dist from structures ", distf
print "energies ", lj.getEnergy(X1), lj.getEnergy(X2)
print X2

#X1 = np.array( [ 0., 0., 0., 1., 0., 0., 0., 0., 1.,] )
#X2 = np.array( [ 0., 0., 0., 1., 0., 0., 0., 1., 0.,] )
import copy
X1i = copy.copy(X1)
X2i = copy.copy(X2)

atomtypes = ["L" for i in range(ntypea)] #for printing binary systems
for i in range(natoms - ntypea):
    atomtypes.append("O")