Lammps "if statement"

Hi Rashidul,

Welcome to the LAMMPS forums. Please read these guidelines to help you make the most of the forum.

In particular, you should include your script between three backticks,

```
like this,
```

to activate the “code mode” that properly handles special characters.

Also, because nanosystems are very small, their local pressure fluctuates significantly over time (search the forum for “pressure fluctuates” or “pressure varies” to see what other people have asked before). It is not feasible for you to just move the walls, take a single measurement, and stop when the measurement happens to meet your present value (due to the fluctuations). Instead, when you would like to simulate a nanosystem confined with a specific pressure, you should do one of two things:

  • run a long equilibration simulation where an average extra force is added to each wall to simulate its imposition of pressure (using pressure = force divided by area), or
  • establish a “bulk region” where the confined nanofluid looks somewhat like the bulk, and determine the wall separation where the average density of the bulk region equals the average density of a truly bulk, fully periodic NPT simulation of the same fluid (again over a long equilibration).
1 Like