Get together 2 simulation box with periodic boundary condition

I did two simulation with periodic boundary condition in all direction (fluid simulations)and equilibrated with npt ensemble
These two boxes will be get together in z direction ، how is this possible ?

First off, please post LAMMPS questions in the LAMMPS categories and not under “Materials Project”. We are sharing the same forum server for several projects and communities and thus need to pay attention to sending messages to the right people. Otherwise, you are not likely to get some help.

This can be very tricky. In general, it is usually better to set up a binary system directly and then just equilibrate each part individually by using a group for each part and applying time integration to only the desired group and then alternate. Another approach would be to set up the systems with periodicity only in x- and y- direction and then use a reflecting or harmonic wall on the fixed boundaries in +/- z direction.

You can merge systems with the read_data command, but there are some particular details to take care of.

  • since you say you have equilibrated two liquid systems with full PBC, you will have a significant number of atoms with non-zero image flags. Those will be displaced in unexpected ways when merging systems and/or overlap with other atoms. So those image flags should be reduced to the minimum (see the reset_atoms command) and then the box extended in z-direction so the few atoms that still “stick out” can also be included. This is straightforward to do with atomic systems, but can be tricky with small molecules and next to impossible with longer chains or polymers.
  • you will have very high potential energy at the interfaces, since either side was previously in contact with a completely different set of atoms (through PBC) at different position. This potential energy must be very carefully dissipated since otherwise you will create some shockwave that can travel through the system for a long time and will taint your simulation result.
  • it is also possible to use some external software (e.g. VMD) to merge the two systems and use its tools and scripting to combine the two systems.

This is not a new problem, so it is always worth to search through the mailing list archives and see what other people did try out and ended up doing that had similar plans.
These are just the most important issues.

Thanks Dear akohlmey
Npt ensemble was only obtained in z direction (because surface area in xy plane must be constant) for this , apply fix wall in z direction is not possible
What solution do you suggest
Thank you

To be honest, I’d start mixed simulations from scratch for the reasons @akohlmey has stated. Start a new box, build molecules of type 1 in one region and molecules of type 2 in another region (create_atoms documentation here and example of create_atoms with molecule templates here), and equilibrate from there.

You will still have all the issues associated with equilibrating from scratch but at least you don’t have the headache of “managing” boundary-crossing molecules from the earlier runs.

Your earlier simulations will not be wasted – they give crucial data about how each molecule behaves by itself under NPT. For example, you can build a density profile across the new simulation box and see whether the molecular densities in the mix correspond to each molecule type’s “pure” density. There may be regions where each molecule type is “bulk-like”, or far enough from the interface to be minimally affected – or the interactions may be genuinely perturbed throughout the box, sort of like a forced periodic spinodal state.

You may also get better help if you tell us why you are doing the simulations you are doing. It sounds like you are modelling a planar interfluid interface, but I don’t know whether that is (for examples) a lipid bilayer membrane, or a section of a surface of immiscible bubbles, or a mixing region in a nanofluidic device, or something else. Each of these scenarios might have different little aspects (or you may get advice that what you’re trying to do is too difficult until you are more familiar with earlier points).

I just gave you a whole bunch of suggestions. Study them carefully, search the archives, read the LAMMPS manual and so on. Just do what is common sense to do. You cannot expect a fully formed list of “do this, not that” set of instructions, especially since you shared no specific information of any kind about your system and what kind of problems you have encountered or didn’t discuss why any of the the suggestions were not applicable in your situation.

If you want good help, you have to do your part of the process. Please see the forum guidelines.

In my simulation , water and oil are placed on calcite surface (in z direction) . Subsequently the surface area between solid surface and fluid must be constant and fluid pressure/temp must be 1 atm/298 kelvin

And what of this prevents to you from setting this up in a single system simulation as I suggested?

I’m sorry but
1- How is that applying time integration for oil and water in individually?
2- (Npt run and solid surface ) They have no problem with each other

I don’t really understand what you’re trying to say / ask here.

The best way to engage with these forums (or indeed with science) is to

  1. Write down the results R you want
  2. Work out a procedure X that you think will result in R
  3. Try X
  4. See if you got R
  5. If yes, publish and celebrate
  6. If not, work out a new procedure Y that you think will result in R
  7. Repeat until step 5 is achieved (or sadly funding / computer time runs out)

If we can’t really work out what you are trying, what results you expect, and what results you’re actually getting, it’s very difficult for us to help you.