[ase-users] speeding up thermochemistry calculations

Jens Jørgen Mortensen jensj at fysik.dtu.dk
Wed Mar 22 14:26:05 CET 2017


Den 20-03-2017 kl. 15:32 skrev Claudio A. Perottoni via ase-users:
>
> Dear Eric,
>
> The performance issue I referred to may be observed even in the 
> example for gold bulk provided at 
> https://wiki.fysik.dtu.dk/ase/ase/thermochemistry/thermochemistry.html 
> and listed below:
>
> from  ase.spacegroup  import  crystal
> from  ase.calculators.emt  import  EMT
> from  ase.optimize  import  QuasiNewton
> from  ase.phonons  import  Phonons
> from  ase.thermochemistry  import  CrystalThermo
>
> # Set up gold bulk and attach EMT calculator
> a  =  4.078
> atoms  =  crystal('Au',  (0.,  0.,  0.),
>                  spacegroup=225,
>                  cellpar=[a,  a,  a,  90,  90,  90],
>                  pbc=(1,  1,  1))
> calc  =  EMT()
> atoms.set_calculator(calc)
> qn  =  QuasiNewton(atoms)
> qn.run(fmax=0.05)
> potentialenergy  =  atoms.get_potential_energy()
>
> # Phonon analysis
> N  =  5
> ph  =  Phonons(atoms,  calc,  supercell=(N,  N,  N),  delta=0.05)
> ph.run()
> ph.read(acoustic=True)
> phonon_energies,  phonon_DOS  =  ph.dos(kpts=(40,  40,  40),  npts=3000,
>                                       delta=5e-4)
>
> # Calculate the Helmholtz free energy
> thermo  =  CrystalThermo(phonon_energies=phonon_energies,
>                         phonon_DOS=phonon_DOS,
>                         potentialenergy=potentialenergy,
>                         formula_units=4)
> F  =  thermo.get_helmholtz_energy(temperature=298.15)
>
> This example takes about one minute on a 12-core shared-memory 
> machine. However fast, it seems to take longer than expected to 
> perform the (mostly) linear algebra operations after calculation of 
> the numerical derivatives and creation of the phonon.*.pckl files. I 
> observed the same on my calculations: creation of phonon.*.pckl files 
> (in my case calculations are performed in parallel using 
> LAMMPS/OpenMP) is relatively fast while the last portion of the code 
> (which, I believe, uses numpy) is taking longer than expected (in 
> fact, calculations using numpy compiled against OpenBLAS are taking 
> longer when using OMP_NUM_THREADS=12 than OMP_NUM_THREADS=1). I know 
> that sometimes running in parallel will take longer than running on a 
> single core. However, I would expect that after generation of the 
> dynamical matrix (which is relatively fast) the remaining calculations 
> should be much faster...
>

Try running the last part (after generation of the pickle files) of your 
calculation through a profiler:

     $ python3 -m profile -s time your-script.py > profile.txt

Maybe we can learn something from that.

Jens Jørgen

> Thank you very much for your interest in this issue!
>
> Best regards,
>
> Claudio
>
>
> Em 20-Mar-17 11:05, Eric Hermes via ase-users escreveu:
>> On Mon, 2017-03-20 at 09:28 -0300, Claudio A. Perottoni via ase-users
>> wrote:
>>> Dear ASE Users,
>>>
>>> I am using ase.thermochemistry.CrystalThermo class to calculate the
>>> Helmholtz free energy of crystals and I wonder is there any way to
>>> speed
>>> up these calculations. It is taking over a day to calculate the
>>> Helmholtz free energy of a 64 atom unit cell, replicated to a 5x5x5
>>> supercell, in a 20-core shared-memory machine using numpy compiled
>>> against multithreading OpenBLAS.  Comments on this execution time
>>> and
>>> how to improve this performance  would be very much appreciated!
>>>
>>> Best regards,
>>>
>>> Claudio
>> Claudio,
>>
>> Can you please provide an example script that exhibits this problem? If
>> possible, a smaller example (one that still takes longer to run than
>> expected) would be preferable.
>>
>> Eric
>>
>> _______________________________________________
>> ase-users mailing list
>> ase-users at listserv.fysik.dtu.dk
>> https://listserv.fysik.dtu.dk/mailman/listinfo/ase-users
>
> -- 
> *********************************************************************
> Cláudio A. Perottoni
>
> Universidade de Caxias do Sul
> Programa de Pós-Graduação em Engenharia e Ciência dos Materiais
> Rua Francisco Getúlio Vargas, 1130
> 95070-560 Caxias do Sul - RS - Brazil
> Phone: +55 54 3218-2607
>
> Universidade de Caxias do Sul
> IMC - Instituto de Materiais Cerâmicos
> Rua Irmão Moretto, 75
> 95765-000  Bom Princípio - RS - Brazil
> Phone: +55 51 3634-1100
>
> http://www.ucs.br/ccet/defq/caperott/
> *********************************************************************
>
>
> ------------------------------------------------------------------------
> Avast logo <https://www.avast.com/antivirus> 	
>
> This email has been checked for viruses by Avast antivirus software.
> www.avast.com <https://www.avast.com/antivirus>
>
>
>
>
> _______________________________________________
> ase-users mailing list
> ase-users at listserv.fysik.dtu.dk
> https://listserv.fysik.dtu.dk/mailman/listinfo/ase-users

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://listserv.fysik.dtu.dk/pipermail/ase-users/attachments/20170322/173cab6a/attachment-0001.html>


More information about the ase-users mailing list