  We study a molecular engine constituted by a gas of $N \sim 10^2$ molecules
enclosed between a massive piston and a thermostat. The force acting on the
piston and the temperature of the thermostat are cyclically changed with a
finite period $\tau$. In the adiabatic limit $\tau \to \infty$, even for finite
size $N$, the average work and heats reproduce the thermodynamic values,
recovering the Carnot result for the efficiency. The system exhibits a stall
time $\tau^*$ where net work is zero: for $\tau<\tau^*$ it consumes work
instead of producing it, acting as a refrigerator or as a heat sink. At
$\tau>\tau^*$ the efficiency at maximum power is close to the Curzorn-Ahlborn
limit. The fluctuations of work and heat display approximatively a Gaussian
behavior. Based upon kinetic theory, we develop a three-variables Langevin
model where the piston's position and velocity are linearly coupled together
with the internal energy of the gas. The model reproduces many of the system's
features, such as the inversion of the work's sign, the efficiency at maximum
power and the approximate shape of fluctuations. A further simplification in
the model allows to compute analytically the average work, explaining its
non-trivial dependence on $\tau$.

Statistical Mechanics