Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions pyjulip.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
Main.eval("using ASE, JuLIP, ACE1")

from julia.JuLIP import energy, forces, stress, mat, positions, cell
from julia.ACE1 import co_energy

ASEAtoms = Main.eval("ASEAtoms(a) = ASE.ASEAtoms(a)")
ASECalculator = Main.eval("ASECalculator(c) = ASE.ASECalculator(c)")
Expand All @@ -30,7 +31,7 @@ class JulipCalculator(Calculator):
"""
ASE-compatible Calculator that calls JuLIP.jl for forces and energy
"""
implemented_properties = ['forces', 'energy', 'free_energy', 'stress']
implemented_properties = ['forces', 'energy', 'free_energy', 'stress', 'co_ene_std']
default_parameters = {}
name = 'JulipCalculator'

Expand All @@ -43,7 +44,7 @@ def calculate(self, atoms, properties, system_changes):
julia_atoms = ASEAtoms(atoms)
julia_atoms = convert(julia_atoms)
self.results = {}
if 'energy' in properties:
if 'energy' in properties or 'free_energy' in properties:
E = energy(self.julip_calculator, julia_atoms)
self.results['energy'] = E
self.results['free_energy'] = E
Expand All @@ -52,7 +53,9 @@ def calculate(self, atoms, properties, system_changes):
if 'stress' in properties:
voigt_stress = full_3x3_to_voigt_6_stress(np.array(stress(self.julip_calculator, julia_atoms)))
self.results['stress'] = voigt_stress

if 'co_ene_std' in properties:
m_E, co_E = co_energy(self.julip_calculator, julia_atoms)
self.results['co_ene_std'] = np.mean((np.array(co_E) - m_E)**2)**0.5

class JulipOptimizer(Optimizer):
"""
Expand Down