[ase-users] bugs for lammps as a calculator to calculate NEB

Wang, Haidi [PHYSA] haidi at iastate.edu
Thu Jul 19 22:54:34 CEST 2018


Hi all,
Recently I try to use lammps as a calculator to calculate the NEB, but it doesn’t work. My script is :

from __future__ import print_function
from math import sqrt
from ase.calculators.lammpsrun import LAMMPS
import numpy as np
import os

from ase import Atoms, Atom
from ase.io import write
from ase.visualize import view
from ase.constraints import FixAtoms
from ase.optimize import QuasiNewton, MDMin
from ase.neb import NEB
from ase.calculators.emt import EMT

potential ='/home/haidi/tmp/lmp_test/new/al-cu-set.alloy'
#/home/vasp/study/ase/al-cu-set.txt'
files=[potential]
#parameters = {"mass": ["* 1.0"],
parameters = {  "pair_style": "eam",
                "pair_coeff": ['* * ' + potential + ' Al Cu']}
calc = LAMMPS(parameters=parameters, files=files)

a = 5.0614
b = a / sqrt(2)
h = b / 2
initial = Atoms('Cu2',
                positions=[(0, 0, 0),
                           (a / 2, b / 2, -h)],
                cell=(a, b, 2 * h),
                pbc=(1, 1, 0))
initial *= (2, 2, 2)
initial.append(Atom('Al', (a / 2, b / 2, 3 * h)))
initial.center(vacuum=4.0, axis=2)

final = initial.copy()
final.positions[-1, 1] += b

#view([initial, final])

# Construct a list of images:
images = [initial]
for i in range(5):
    images.append(initial.copy())
images.append(final)

# Make a mask of zeros and ones that select fixed atoms (the
# two bottom layers):
mask = initial.positions[:, 2] - min(initial.positions[:, 2]) < 1.5 * h
constraint = FixAtoms(mask=mask)
print(mask)

for image in images:
    # Let all images use an EMT calculator:
    image.set_calculator(calc)
    #image.set_calculator(EMT())
    image.set_constraint(constraint)

# Relax the initial and final states:
QuasiNewton(initial).run(fmax=0.05)
QuasiNewton(final).run(fmax=0.05)

# Create a Nudged Elastic Band:
neb = NEB(images)

# Make a starting guess for the minimum energy path (a straight line
# from the initial to the final state):
neb.interpolate()

# Relax the NEB path:
minimizer = MDMin(neb)
minimizer.run(fmax=0.05)

# Write the path to a trajectory:
#view(images)  # 126 meV
write('jump1.traj', images)


The ERROR information:

[ True  True False False  True  True False False  True  True False False
  True  True False False False]
Traceback (most recent call last):
  File "run.py", line 60, in <module>
    QuasiNewton(initial).run(fmax=0.05)
  File "/home/haidi/.pyenv/versions/anaconda2-4.3.0/envs/mpt_a2/lib/python2.7/site-packages/ase/optimize/optimize.py", line 170, in run
    self.set_force_consistent()
  File "/home/haidi/.pyenv/versions/anaconda2-4.3.0/envs/mpt_a2/lib/python2.7/site-packages/ase/optimize/optimize.py", line 223, in set_force_consistent
    self.atoms.get_potential_energy(force_consistent=True)
  File "/home/haidi/.pyenv/versions/anaconda2-4.3.0/envs/mpt_a2/lib/python2.7/site-packages/ase/atoms.py", line 683, in get_potential_energy
    self, force_consistent=force_consistent)
TypeError: get_potential_energy() got an unexpected keyword argument 'force_consistent'


Would you please help me to fix this problem. Thank you!

Haidi @ physics & astronomy department of ISU

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://listserv.fysik.dtu.dk/pipermail/ase-users/attachments/20180719/95949453/attachment.html>


More information about the ase-users mailing list