-
Notifications
You must be signed in to change notification settings - Fork 838
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Handling partial periodic boundary conditions #2364
Comments
This is definitely desired. I would be happy to discuss. |
Thanks for the interest. Here are some considerations that I hope will be useful as a starting point. The distinction between the That said, and given that this would be a new feature in an already existing and widely used package, I don't think there are too many options to add the support for PPBC. I will list those that I can think of, in order of increasing impact for the rest of the existing code. I also tried to outline a (non exhaustive) list of pros and cons.
These were my personal thoughts about it. I would be glad to hear comments and if other options should be considered. |
Thanks for the thoughtful suggestions. Oddly, my inclination is to do the last one - a new SiteCollection subclass for all kinds of PBC. The general idea is that this new class would mainly be used for 1D and 2D for now, and the design should be such that we can make Molecule and Structure to subclass it with little difficulty. There are some codes where we'd want to support any PBC, and there are some codes where only certain types of PBC are supported (molecules and 3D crystals). The analogy I would make is that you should write a Polygon class from which specific implementations like Square, Triangle, Hexagon, Pentagon can be derived. Maybe 90% of the time people only work with Squares and Triangles and so, we have special subclasses for them. But Hexagons, Pentagons or even Heptadecagons can be defined as just polygons in general. Your second suggestion is fine too, though preferably, I don't want to treat Molecules separate from other kinds of PBC. |
@mkhorton You should weigh in since this is a major change. |
I should add that you should not worry about IStructure for now. The intent is really to get rid of it soon. There is very little benefit to keeping IStructure and IMolecule. |
Thanks @shyuep. For the motivation of this feature, I agree and I also have been in touch with several people who would like PPBCs. They're useful for a number of reasons (2D materials, mixed basis set codes, classical modelling codes, etc.). For the implementation, I think we should first acknowledge that to define PBCs, a So one option to consider might be a property on In this way, the periodicity of a |
Thanks for your comments. So let me try to summarize your main suggestions. One option would be to have a single a tree like this: I think this is not so dissimilar from what I had in mind in my second option in the previous post: The first being @shyuep preferred option. The suggestion from @mkhorton seems to go in the opposite direction. No new classes and instead add the Does this summarizes correctly your positions? While we personally have a slight preference for the creation of a new class (let's call it
Handling all the different cases in the base class can be more challenging to implement and maintain. If to avoid these kind of issues all the methods and properties of If you are interested, I would be available to try to work on this. In that case I can open a WIP PR to discuss other points in more details. However, since this is a major change, I think that a clear decision about which solution to implement should preferably come from your side. |
Thanks. I have thought about it further. I think we can go with your original scheme (option B), i.e., keep Molecule and Structure as separate branches. We then adopt @mkhorton suggestion that we define PBC in terms of the lattice basis vectors. This will be integrated into PeriodicSites and Structure, which can be something with arbitrary PBC (with 3D being default). To be honest, I think it is difficult to do pure strategization without seeing a real concrete example of what it would look like. I think a WIP PR with a barebones implementation (maybe it does not need to be in Structure in the first instance if it makes it easier to write) would be useful to stimulate ideas and discussion. |
Is your feature request related to a problem? Please describe.
We (I and @davidwaroquiers) were thinking about what would be the best option to handle objects with partial periodic boundary conditions.
In particular this would be helpful for defining the inputs of codes that support calculations with this option.
Describe the solution you'd like
A potential solution would be to extend the Structure object to support partial PBC or introduce a new object specific to these cases.
We mainly wanted to know if this was ever considered in pymatgen and, if not, start a discussion about whether this could be a desirable feature to implement.
Describe alternatives you've considered
A trivial solution is to use a Structure with some vacuum in the non-periodic directions. This, however, forces to keep somewhere else the information about which directions are periodic and all the operations on the Structure need to pass through a series of if statements.
The text was updated successfully, but these errors were encountered: