Using ACE as a ASE calculator

Install pyjulip from https://github.com/casv2/pyjulip

This requires pyjulia to be set up properly first: https://github.com/JuliaPy/pyjulia

In [1]:
import pyjulip
from ase.build import bulk
import time
In [2]:
at = bulk("Al") * (2,2,2)
In [3]:
calc = pyjulip.ACE("./ACE_Al.json")
In [4]:
at.rattle(0.01)
In [5]:
at.set_calculator(calc)
In [6]:
at.get_forces()
Out[6]:
array([[-0.00014092, -0.02436524, -0.04762882],
       [-0.042433  ,  0.02391434, -0.02832742],
       [-0.01745242, -0.05401593,  0.02261669],
       [-0.00415915,  0.01636964,  0.05024348],
       [ 0.00684032,  0.07615094,  0.04716693],
       [-0.00229448, -0.02161298, -0.00072229],
       [ 0.03770642,  0.04145959, -0.06849356],
       [ 0.02193323, -0.05790036,  0.02514498]])
In [7]:
at.get_potential_energy()
Out[7]:
-878.3044107083637
In [8]:
def get_forces(at):
    at.rattle(0.01)
    return at.get_forces()

Timing (ms/atom)

In [9]:
N = 100

t1 = time.time()
for i in range(N):
    get_forces(at)
t2 = time.time()

print("FORCE CALL/ATOM [ms]:", ((t2-t1)/N)/len(at) * 1E3)
FORCE CALL/ATOM [ms]: 1.214248538017273
In [ ]:
 
In [ ]: