def init_julia(self): print("Waiting for Julia to compile...") j = Julia() j.include( os.path.join(os.path.dirname(__file__), 'n-dof', 'dynamics.jl')) j.using("Dynamics") return j
from julia.JuLIP import energy from julia.JuLIP import forces from julia.JuLIP import stress ASEAtoms = Main.eval("ASEAtoms(a) = ASE.ASEAtoms(a)") ASECalculator = Main.eval("ASECalculator(c) = ASE.ASECalculator(c)") fixedcell = Main.eval("fixedcell(a) = JuLIP.Constraints.FixedCell(a)") variablecell = Main.eval("variablecell(a) = JuLIP.Constraints.VariableCell(a)") convert = Main.eval("julip_at(a) = JuLIP.Atoms(a)") from julia import Julia julia = Julia() julia.using("JuLIP") def pot(potname, fast=False): try: julia.eval("IP = " + potname) ASE_IP = JulipCalculator("IP") return ASE_IP except: print("couldn't find potential") def NBodyIPs(potname, fast=False): try: julia.using("NBodyIPs") julia.eval("IP, info = load_ip(\"" + potname + "\")")
# coding: utf-8 # In[2]: import numpy as np from ase.calculators.calculator import Calculator import os from julia import Julia if not os.environ.has_key('JL_RUNTIME_PATH'): julia = Julia() else: # "/Users/ortner/gits/julia6bp/usr/bin/julia" julia = Julia(jl_runtime_path=os.environ['JL_RUNTIME_PATH']) julia.using("NBodyIPs") def import_IP(potname): #julia.eval("IP = load_ip(\"" + potname + "\")") julia.eval("IP = load_ip(\"" + potname + "\")") julia.eval("IPf = fast(IP)") IP = julia.eval("IPf") return IP
def setup(): jul = Julia() jul.using("DiffEqPy") return jul