When converting from constant P to constant V, such as after an initial constant P equilibration, I've used a script such as the following one. A new simulation is then started, using the extracted coordinate set which is the closest to the average.

* get frame closest to average box size @A for NVT
*

! parameter files
read rtf card name -
"$HOME/bigbox2/NewCarb/toppar/top_all36_carb.rtf"
read para card name -
"$HOME/bigbox2/NewCarb/toppar/par_all36_carb.prm"

! structure files
read psf card name wtrisacch.psf
read coor card name heat.crd

! crystal and image setup with desired average size
crystal define cubic @A @A @A 90. 90. 90.
crystal build noper 0
image byseg sele segid T+ end
image byres sele resn TIP3 end

! large initial value
set del = 100.

! trajectory I/O setup
open read file unit 12 name npt.trj
traj firstu 12 nunit 1

! loop over frames
set k = 1
label trjlp

! read a frame, which updates unit cell data (XTLA)
traj read
calc dff = abs( ?XTLA - @A )

! write out a file whenever DFF is less than DEL
if dff lt @DEL then
set del = @DFF
write coor card name nptavg.crd
* npt frame @K closest to @A ; ?XTLA diff = @DEL
*
! write crystal setup file
open unit 2 write card name cryst.str
echu 2
echo * crystal setup
echo *
echo crystal define cubic ?XTLA ?XTLA ?XTLA 90. 90. 90.
echo crystal build noper 0
echo image byseg sele segid T+ end
echo image byres sele resn TIP3 end
echo return
endif

! loop exit test
incr k by 1
if k le ?NFILE goto trjlp

stop
_________________________
Rick Venable
computational chemist