# Box coordinate change in structure optimization

Hi there,

When I was optimizing a bulk phase structure, I found that the minimum coordinates of the box in the x, y, and z directions have changed.

The coordinates before optimization are as follows，

``````0 180 xlo xhi
0 60 ylo yhi
0 150 zlo zhi

``````

The optimized coordinates are as follows，

``````37.545093762296034 142.4549062376968 xlo xhi
12.515031254098702 47.48496874590336 ylo yhi
31.287578135249063 118.71242186473575 zlo zhi

``````

How to make the minimum value of the three coordinate axes in the output box be zero after structure optimization (fix npt or nvt)?

Anyway, thank you all so much for your time and help.

Best wishes,
Zilin

Hi @wzlclhy,

What do you mean by “optimizing a bulk phase structure”? Minimizing the energy with box relaxation? Doing simulation at given pressure or temperature? Your description is vague.

The structure of the box should not change during NVT simulation. During NPT simulation, the default behavior of box change is to take the center of the box as a fixed point and dilate/compress around this point. With periodic boundary conditions, taking this point or another should have no effect on the trajectory. If you really need to keep the low boundary of your box at coordinates 0, please see the manual page of the NH fixes and look for the `fixedpoint` keyword. I advise you to have a detailed reading on how box behaves in NPT simulation. This keyword can also be used with `fix box/relax`.

Alternatively you can use the `change_box` command to change the coordinates of your box boundary without remaping the atoms coordinates after simulation or minimization. For example `change_box all x final 0 \$L units box` would change your xlo and xhi values to 0 and lx respectively if the variable L is defined to refer to value lx.

2 Likes

Thank you very much for your guidance, Dr. Germain.

Sorry for my vague description. “optimizing a bulk phase structure”
here means to have a simulation at given pressure or temperature.