[ase-users] Question about error in VASP calculator

Jonas Björk jonas.bjork at liu.se
Sat Jun 4 10:49:01 CEST 2022


We have different views on the matter and it will be interesting to see other peoples’ thought. Meanwhile I’ll fork it.

Best wishes,
Jonas

On 4 Jun 2022, at 09:48, Gaël Donval <gdonval at pm.me<mailto:gdonval at pm.me>> wrote:

What you say is exactly the point of having explicit pbc. What you are asking about if for Vasp calculator to become magical.

With that train of thought, you could also consider that if all cartesian positions are between zero and one they should really be considered as scaled coordinates and make that the magic behaviour. Oh with a warning to say magic is going on in hope people might notice.

In your case, if you want your db to store the 2D-ness of the structure, again, you need a conversion: if my calculator supports native 2D computations, I don't want to see 30A of vacuum over the non periodic directions. That does not make sense. Make a function that creates a good pseudo-3D-periodic structure from 2D ones and create the reverse function that converts the structure back to something that is 2D-periodic without the artefacts of how it has been achieved.

Also warnings don't work. Only developers care about them generally: you'll always get people come over here to ask why pbcs are not honoured when using vasp (yes, in spite of how stupid that may seem to you, everyone is at a different stage of understanding).

Finally, if you are really unhappy with the behaviour of the Vasp calculator, this is python, by all means, just write a subclass with that error removed and use that in your project. It does what you want and does not change the behaviour for everyone.



-------- Original Message --------
On 4 Jun 2022, 08:12, Jonas Björk < jonas.bjork at liu.se<mailto:jonas.bjork at liu.se>> wrote:

I think you’re making it more complicated than it has to be when changing an error to a warning would suffice. VASP users who explicitly define a non-3D periodicity of the atoms object probably has a good reason for doing so.

The reason it became an issue for us is that we are working with 2D materials and their 3D precursors, keeping track of calculations using the ASE database functionality. It is convenient to define the 2D materials having PBC in two directions since we are using routines to optimize the unit cell of the 2D material and then we need to know which of the unit cell vectors to optimize. And it’s also good for identifying which materials in the database are 3D and which are 2D.

We have workarounds for all this, but which are more ad hoc than changing an error to a warning. Just my thoughts on the matter.

Best wishes,
Jonas



On 3 Jun 2022, at 19:24, Gaël Donval <gdonval at pm.me<mailto:gdonval at pm.me>> wrote:

Then we need another Atoms subclass for that (or probably a different Atoms ancestor). Ignoring attributes that are there and bear meaning is surprising (in bad sense). Just in the same way ignoring existing velocities or forces would be surprising and probably lead to mistakes. I can already see other people comming saying they don't understand why things are wrapping around when they've set pbc to False, thinking something magical might have happened.

I stand by what I said: to go from 1D or 2D to pseudo-3D, you need some sort of transformation. That transformation is not unique. There is not even a reasonable default for this. The fact that some tools provide pre-vacuumed structures does not change this (actually we should probably remove that functionality from those tools and factor that out in a function that does just that).






-------- Original Message --------
On 3 Jun 2022, 18:04, Tristan Maxson < tgmaxson at gmail.com<mailto:tgmaxson at gmail.com>> wrote:

I think the problem arises from doing something like fcc111("Pt") and getting a surface with the z-direction being non-periodic.  VASP users don't have the option to set which directions are periodic so I also agree personally that this property should more or less be ignored.  This is the sort of thing that tends to cause weird problems for new users who aren't even aware that the PBC property is there (because they don't need it since they only work in VASP for example).  It makes sense in codes which do something different with PBC set, but in codes that don't support PBC it should throw a warning rather than throwing an exception.

As a middle ground, we could make a tag on the VASP calculator of "ignore_pbc" to make it easy to write into the calculator definition that we are ignoring pbc.

Thank you,
Tristan Maxson


On Fri, Jun 3, 2022 at 11:56 AM Gaël Donval via ase-users <ase-users at listserv.fysik.dtu.dk<mailto:ase-users at listserv.fysik.dtu.dk>> wrote:
Hi both,

The reason it's like this is Vasp is using planewaves and is intrinsically 3D periodic.

There should be no reason ever to use a less-than-3D input file for use with Vasp or if that's the case, you have to specify how your less-than-3D structure must be converted to an approximately equivalent 3D one. There is *always* some amount of manual intervention involved. If that transform was unambiguous and unique, a warning might have been enough.

What I suggest instead is defining a function to explicitly transform non-pbc structures into 3D-periofic-with-vacuum ones, setting all pbcs to true. If it's not already in ASE, I would definitely be for adding something like that somewhere like in ase.geometry. It's clean, it does what you want and it does not have to break any assumption anywhere.

I also want to stress that

struct.pbc = True

is literally all you have to write if you don't care. ase.io.read might even have a pbc argument (don't quote me on this, I'm unsure).

Again, pbc is an important property and lying about them to everyone depending on the calculator is not a good idea.

Best,
Gaël






-------- Original Message --------
On 3 Jun 2022, 10:55, Petr Grigorev via ase-users < ase-users at listserv.fysik.dtu.dk<mailto:ase-users at listserv.fysik.dtu.dk>> wrote:

Hello everyone,

I oftenly use VASP in the scenario described by Jonas and would agree with him that warning would be more suitable.

Best regards,
Petr

Le ven. 3 juin 2022 à 10:02, Jonas Björk via ase-users <ase-users at listserv.fysik.dtu.dk<mailto:ase-users at listserv.fysik.dtu.dk>> a écrit :
Hi!

“Recent” versions of the VASP calculators give the following error when the Atoms object does not have periodic boundary conditions in all three directions:

ase.calculators.calculator.CalculatorSetupError: Vasp cannot handle non-periodic boundaries. Please enable all PBC, e.g. atoms.pbc=True

It seems a bit unnecessary. In some cases it is convenient to have the PBC of the Atoms object set in 1D or 2D even when performing calculations with VASP using vacuum in directions of non-periodicity, just to store information about the material’s periodicity.

To me, it seems appropriate to replace this error message with a warning.

Best wishes,
Jonas


---------------------------------------------------------------------
Jonas Björk, PhD
Senior Lecturer of Theoretical Chemistry

Materials Design Division
Department of Physics Chemistry and Biology, IFM
Linköping University
Sweden

Phone: +46 13 28 25 61
Google scholar: https://bit.ly/3GvptJQ
---------------------------------------------------------------------


_______________________________________________
ase-users mailing list
ase-users at listserv.fysik.dtu.dk<mailto:ase-users at listserv.fysik.dtu.dk>
https://listserv.fysik.dtu.dk/mailman/listinfo/ase-users
_______________________________________________
ase-users mailing list
ase-users at listserv.fysik.dtu.dk<mailto:ase-users at listserv.fysik.dtu.dk>
https://listserv.fysik.dtu.dk/mailman/listinfo/ase-users
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://listserv.fysik.dtu.dk/pipermail/ase-users/attachments/20220604/7f06fc5d/attachment-0001.htm>


More information about the ase-users mailing list