Issues with hands-on exercise 2

Hi all,

I am having issues with exercise 2. I wrote and compiled the model just fine, but when I run the bulk statics calculation (fcc-cu-bulk.in), I get that the potential energy is positive, but the numerical value per atom is precisely the correct binding energy, 3.54 eV/atom. The default density without changing anything in the file is 0.08469, and corresponds to the optimal lattice parameter 3.615 A. If I start varying the density, I find that there does not seem to be an extremum of any kind around 0.085, and in the range 0.05-0.1, the potential energy just monotonically increases with density.

Normally, I would think this is just an error in my programming, but if I run the same calculations with the Johnson pair functional that is already installed as an example (ex_model_Cu_PF_Johnson), I get identical results! The fcc-cu-bulk.atoms file is clearly a reasonable fcc initial configuration, and the density is correct. What could be the problem here?

When I ran example 1, everything was fine and I got a negative potential energy with a minimum at the correct density.

Regards, ilia

There is a bug in the c template file “model_El_PF_Template.c”. Lines 529-536 of the template read

if (comp_particleEnergy)

{

particleEnergy[i] += U;

}

else if (comp_energy)

{

*energy += U;

}

which causes the total energy to not be accumulated whenever the particle energy is computed, which is always with MiniMol. The lines should instead read

if (comp_particleEnergy)

{

particleEnergy[i] = U;

}

if (comp_energy)

{

*energy += U;

}

(the replacement of += with = is another unrelated bugfix).