-
Notifications
You must be signed in to change notification settings - Fork 52
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
Periodic boundary condition #71
Conversation
Thanks. This is very interesting. One thing that prevented me from implementing that was what to do with the relation of other constraints with the coordinates. For example, if the user sets In your implementation, can we guarantee that the atoms are always in the (I'll take a look carefully now, but I think we can discuss a little bit these details at the same time, as we will need to update the documentation) |
In other words, for PBCs to support most generally the constraints the Packmol supports, we need to With that, we should remove the obligatory definition of constraints for the types of molecules. For example, in the example you provided:
The
One alternative could be to define the PBCs with box constraints, like:
which would mean that atoms will be always wrapped into the box with those maximum and minimum coordinates, and the box lengths are |
Yes, I totally agree that constraints and periodic boundary conditions are not compatible mathematically, given that non of these constraints are periodic functions. However, the constraints can still be helpful. That's why I hope to keep the approach I take. In the implementation, I didn't wrap the atoms. The atoms still hold their cartesian coordinates; and, the constraints are still there applied based on these cartesian coordinates. Only when calculating the atom pair interaction for the f value, I used the periodic minimum image convention definition of their distance/displacement. I hope to keep it this way since it gave me the flexibility to combine the use of constraints and periodic boundary condition. That's also why I hope to keep the As an example, this input can help generate a box of water-air interface like the one in this paper https://doi.org/10.1021/jp1067022
|
So I think what we have to do, which would be fine, would be to automatically add a constraint to every atom which consisted in the limits of the PBC plus half of the tolerance. Meaning, if one sets:
This should be equivalent to
and the same Do you think you can try to implement that? I'm really out of time now. |
I believe these commits complete the request of adding an implicit constraint for all the atoms. |
For being reassured about the implications of this and future updates of the package, I have implemented a new testing framework. It is merged into
The tests run packmol and then check for the minimum distance obtained taking into consideration the periodic boundary conditions, if they were defined. With that, we can test more exhaustively the approach taken here. |
d72eb0d
to
6836021
Compare
Not very familiar with Julia. Do you know how to do that? |
fixed, I think (I didn't know that I could directly modify your code here) |
Thanks!
|
I saw the same error in the master branch. |
that's strange, it is working here and on CI. Let's focus on your new test first, than I check that. |
Thanks very much for the contribution. I'll make some tests and document and then release it. |
Implement the periodic boundary condition.
pbc cellx celly cellz