TSASE with lammps

Python framework for working with atomic configurations, potentials, and algorithms.

Moderator: moderators

Post Reply
haidi
Posts: 1
Joined: Tue Jul 24, 2018 8:47 pm

TSASE with lammps

Post by haidi »

Hi all,
Recently, I try to use TS-ASE to do some NEB work for LiFeSiO4 system, but some bugs occur, would you please help me to fix the problem?
My input file is as follow:

#!/usr/bin/env python
from __future__ import print_function
#from tsase.calculators.vasp_ext import Vasp
from ase.io import read
import os, numpy
from tsase import neb
from tsase.calculators.lammps_ext import LAMMPS

'''
#-------------- uncomment if parallelize over image ------------------
# parallelize over images with mpi4py
from mpi4py import MPI
'''

# read geometry and set charges
p1 = read('0.vasp',format='vasp')
p2 = read('6.vasp',format='vasp')
'''
#-------------- uncomment if parallelize over image ------------------
# parallelize over images with mpi4py
from mpi4py import MPI
'''
#for p in p1:
# if p.symbol=='Li':
# p.charge =1.0
# if p.symbol=='Fe':
# p.charge =3.0
# if p.symbol=='Si':
# p.charge =4.0
# if p.symbol=='O':
# p.charge =-2.0
#for p in p2:
# if p.symbol=='Li':
# p.charge =1.0
# if p.symbol=='Fe':
# p.charge =3.0
# if p.symbol=='Si':
# p.charge =4.0
# if p.symbol=='O':
# p.charge =-2.0

potential ='/home/haidi/soft/tsase/tsase/examples/t1/pot.lammps'
files=[potential]
parameters = { "pair_style": "eam/alloy",
"pair_coeff": ['* * ' + potential + ' Li Fe Si O']}
calc = LAMMPS(parameters=parameters, tmp_dir='trash',files=files)
p1.set_calculator(calc)
p2.set_calculator(calc)

# external stress applied in the unit of GPa
stress=numpy.zeros((3,3))
#stress[2,2] = -1.0 #negative is tension

# initialize the band
nim = 7 # number of images, including end points
# no climbing image first
band = neb.ssneb(p1, p2, numImages = nim, express = stress, ss = True)
#band = neb.ssneb(p1, p2, numImages = nim, method = 'ci', express = stress)
'''
#-------------- substitute for the above line if parallelize over image ------------------
band = neb.ssneb(p1, p2, numImages = nim, method = 'ci', express = stress, parallel = True)
'''
# to restart, uncomment the following lines which read the previous optimized images into the band
#for i in range(1,nim-1):
# filename = str(i)+'.CON'
# b = read(filename,format='vasp')
# band.path[i].set_positions(b.get_positions())
# band.path[i].set_cell(b.get_cell())

#opt = neb.qm_ssneb(band, maxmove = 0.10, dt = 0.05)
opt = neb.fire_ssneb(band, maxmove =0.1, dtmax = 0.1, dt=0.1)
opt.minimize(forceConverged=0.01, maxIterations = 300)


the error info:

Traceback (most recent call last):
File "ssneb_my.py", line 71, in <module>
band = neb.ssneb(p1, p2, numImages = nim, express = stress, ss = True)
File "/home/haidi/soft/tsase/tsase/neb/ssneb.py", line 137, in __init__
self.path[i].u = self.path[i].get_potential_energy()
File "/home/haidi/.pyenv/versions/anaconda2-4.3.0/envs/mpt_a2/lib/python2.7/site-packages/ase/atoms.py", line 685, in get_potential_energy
energy = self._calc.get_potential_energy(self)
File "/home/haidi/soft/tsase/tsase/calculators/lammps_ext.py", line 145, in get_potential_energy
self.update(atoms)
File "/home/haidi/soft/tsase/tsase/calculators/lammps_ext.py", line 184, in update
atoms[i].charge = self.charges[i]
IndexError: index 0 is out of bounds for axis 0 with size 0


Thanks very much!
Post Reply