[ase-users] precon with NEB is not working for non periodic system
Alaithan, Zainab
z.alaithan17 at imperial.ac.uk
Sun Apr 25 14:59:47 CEST 2021
Dear James,
If I construct your own preconditioner object as you suggested I get the following error:
File "/rdsgpfs/general/user/za1417/home/anaconda3/lib/python3.7/site-packages/ase/neb.py", line 514, in get_forces
rank=0 L20: precon_forces = self.precon.apply(forces,index=slice(1, -1))
rank=0 L21: TypeError: apply() got an unexpected keyword argument 'index'
I think because the precon in the NEB object expects a string not and object. I also attempted to modify the optimize/precon/neighbors.py to set r_cut and r_NN as follows;
if max(extent) ==0:
r_cut = 2.5
r_NN = 1.8
return r_NN
but I got the following error:
rank=3 L16: self.atoms.get_forces()
rank=3 L17: File "/rdsgpfs/general/user/za1417/home/anaconda3/lib/python3.7/site-packages/ase/neb.py", line 753, in get_forces
rank=3 L18: forces = super().get_forces()
rank=3 L19: File "/rdsgpfs/general/user/za1417/home/anaconda3/lib/python3.7/site-packages/ase/neb.py", line 510, in get_forces
rank=3 L20: self.precon = PreconImages(self.precon, images)
rank=3 L21: File "/rdsgpfs/general/user/za1417/home/anaconda3/lib/python3.7/site-packages/ase/optimize/precon/precon.py", line 1278, in __init__
rank=3 L22: P0 = make_precon(precon, images[0], **kwargs)
rank=3 L23: File "/rdsgpfs/general/user/za1417/home/anaconda3/lib/python3.7/site-packages/ase/optimize/precon/precon.py", line 1218, in make_precon
rank=3 L24: precon.make_precon(atoms)
rank=3 L25: File "/rdsgpfs/general/user/za1417/home/anaconda3/lib/python3.7/site-packages/ase/optimize/precon/precon.py", line 621, in make_precon
rank=3 L26: self.estimate_mu(atoms)
rank=3 L27: File "/rdsgpfs/general/user/za1417/home/anaconda3/lib/python3.7/site-packages/ase/optimize/precon/precon.py", line 426, in estimate_mu
rank=3 L28: dE_p_plus_v = -atoms_v.get_forces().reshape(-1)
rank=3 L29: File "/rdsgpfs/general/user/za1417/home/anaconda3/lib/python3.7/site-packages/ase/atoms.py", line 714, in get_forces
rank=3 L30: forces = self._calc.get_forces(self)
rank=3 L31: File "/rdsgpfs/general/user/za1417/home/anaconda3/lib/python3.7/site-packages/ase/calculators/calculator.py", line 519, in get_forces
rank=3 L32: return self.get_property('forces', atoms)
rank=3 L33: File "/rdsgpfs/general/user/za1417/home/anaconda3/lib/python3.7/site-packages/ase/calculators/singlepoint.py", line 45, in get_property
rank=3 L34: 'The property "{0}" is not available.'.format(name))
rank=3 L35: ase.calculators.calculator.PropertyNotImplementedError: The property "forces" is not available.
Best Regards,
Zainab,
________________________________
From: James Kermode <james.kermode at gmail.com>
Sent: 23 April 2021 11:52
To: Alaithan, Zainab <z.alaithan17 at imperial.ac.uk>; Ase Developers <ase-users at listserv.fysik.dtu.dk>
Subject: Re: precon with NEB is not working for non periodic system
This email from james.kermode at gmail.com originates from outside Imperial. Do not click on links and attachments unless you recognise the sender. If you trust the sender, add them to your safe senders list<https://spam.ic.ac.uk/SpamConsole/Senders.aspx> to disable email stamping for this address.
Hi Zainab,
Thanks for reporting this.
As a short-term fix, you can construct your own preconditioner object with specified nearest neighbour and cutoff distances, e.g.
from ase.optimize.precon import Exp
precon = Exp(r_NN=1.5, r_cut=3.0)
…
neb = NEB(images, precon=precon)
In the longer term, I’m sure it will be possible to adapt these heuristics to work well also with non-periodic system. If you provide a complete script and ideally open an issue I’ll take a look.
Best wishes,
James
From: ase-users <ase-users-bounces at listserv.fysik.dtu.dk> on behalf of Alaithan, Zainab via ase-users <ase-users at listserv.fysik.dtu.dk>
Date: Wednesday, 21 April 2021 at 20:52
To: Ase Developers <ase-users at listserv.fysik.dtu.dk>
Subject: [ase-users] precon with NEB is not working for non periodic system
Dear ASE developers,
Thank you for your brilliant work. ASE has helped so much so far. However, I am running into a small problem with using NEB with precon for my system because it is not periodic. In estimating the nearest neighbour list there is the following code:
r_cut = 1.0
phi = (1.0 + np.sqrt(5.0)) / 2.0 # Golden ratio
# cell lengths and angles
a, b, c, alpha, beta, gamma = cell_to_cellpar(atoms.cell)
extent = [a, b, c]
# print('estimate_nearest_neighbour_distance(): extent=%r' % extent)
while r_cut < 2.0 * max(extent):
# print('estimate_nearest_neighbour_distance(): '
# 'calling neighbour_list with r_cut=%.2f A' % r_cut)
i, j, rij, fixed_atoms = get_neighbours(
atoms, r_cut, self_interaction=True,
neighbor_list=neighbor_list)
if len(i) != 0:
nn_i = np.bincount(i, minlength=len(atoms))
if (nn_i != 0).all():
break
r_cut *= phi
else:
raise RuntimeError('increased r_cut to twice system extent without '
'finding neighbours for all atoms. This can '
'happen if your system is too small; try '
'setting r_cut manually')
Because, my system is not periodic max extent = 0 and rcut is immediately bigger that 2.0 * max(extent), which gives me the error:
'increased r_cut to twice system extent without '
'finding neighbours for all atoms. This can '
'happen if your system is too small; try '
'setting r_cut manually'
What is the best way to overcome this problem, how can I manually set rcut from inside the NEB object?
Best Regards,
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://listserv.fysik.dtu.dk/pipermail/ase-users/attachments/20210425/06a490f3/attachment-0001.htm>
More information about the ase-users
mailing list