From 2b9c806afb54fc942590b780346f7e6ba9f23198 Mon Sep 17 00:00:00 2001 From: Shuhei Ohno Date: Wed, 29 Nov 2023 23:03:13 +0900 Subject: [PATCH] Update Antiq --- src/Antiq.jl | 25 ++++++++++++++++++++----- 1 file changed, 20 insertions(+), 5 deletions(-) diff --git a/src/Antiq.jl b/src/Antiq.jl index 7dbfbe1..96093dd 100644 --- a/src/Antiq.jl +++ b/src/Antiq.jl @@ -1,12 +1,21 @@ module Antiq - export antiq, InfinitePotentialWell, HarmonicOscillator, MorsePotential, HydrogenAtom + export antiq - include("./InfinitePotentialWell.jl") - include("./HarmonicOscillator.jl") - include("./MorsePotential.jl") - include("./HydrogenAtom.jl") + # Update this list when you add a model. + models = [ + :InfinitePotentialWell, + :HarmonicOscillator, + :MorsePotential, + :HydrogenAtom, + ] + # include statements + for model in models + include("./$(model).jl") + end + + # I/O function function save(path, text) mkpath(dirname(path)) file = open(path, "w") @@ -14,6 +23,7 @@ module Antiq close(file) end + # I/O function function load(path) file = open(path, "r") text = Base.read(file, String) @@ -21,7 +31,12 @@ module Antiq return text end + # main functions function antiq(model; parameters...) + # check existence of model + if model ∉ models + throw(ErrorException("\`:$(model)\` is not in the supported models $(models).")) + end # load source code file if Sys.iswindows() source = load("$(dirname(@__FILE__()))\\\\$(model).jl")