Greetings. I have an existing system, and I would like to know the potential energy when the system experiencing dilation/shrinkage.

I will make a fictitious system with the coordinate I want and replace the real system with the fictitious one…meanwhile, may I directly invoke pe_compute->compute_scalar() ?

The task is to be done in temper.cpp…I am not clear what the second statement means. Please kindly help. Thank you very much!

pe = pe_compute->compute_scalar();
pe_compute->addstep(update->ntimestep + nevery);

Greetings. I have an existing system, and I would like to know the potential
energy when the system experiencing dilation/shrinkage.

I will make a fictitious system with the coordinate I want and replace the
real system with the fictitious one.....meanwhile, may I directly invoke
pe_compute->compute_scalar() ?

it won't give you the information that you want.
if you look at the source code in compute_pe.cpp
you'll see that the computation that the compute
does is simply a collection and summation of the
various potential energy contributions from the
different force components.

The task is to be done in temper.cpp....I am not clear what the second
statement means. Please kindly help. Thank you very much!

pe = pe_compute->compute_scalar();
pe_compute->addstep(update->ntimestep + nevery);

as mentioned before the compute simply
collects and combines _already computed_
information. this information is gathered during
the calculation of the forces, but it is an optional
step, so it has to be signaled in advance. the
second statement does just that, it tells the
force compute at which time step the potential
energy components will be needed the next time.