From 00b2ea4c854a1197beeaa4c1e276c7c9aff9d464 Mon Sep 17 00:00:00 2001 From: Adrian Henle Date: Wed, 26 Jun 2024 14:26:42 -0700 Subject: [PATCH] precompile (#245) * precompile --- Project.toml | 2 + src/PorousMaterials.jl | 99 +++++++++++------------------------------- 2 files changed, 28 insertions(+), 73 deletions(-) diff --git a/Project.toml b/Project.toml index c20cc610e..d29690dd7 100644 --- a/Project.toml +++ b/Project.toml @@ -14,6 +14,7 @@ LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e" OffsetArrays = "6fe1bfb0-de20-5000-8ca7-80f57d26f881" Optim = "429524aa-4258-5aef-a3af-852621145aeb" Polynomials = "f27b6e38-b328-58d1-80ce-0feddd5e7a45" +PrecompileSignatures = "91cefc8d-f054-46dc-8f8c-26e11d7c5411" Printf = "de0858da-6303-5e67-8744-51eddeeeb8d7" ProgressMeter = "92933f4c-e287-5a05-a399-4b506db050ca" Random = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c" @@ -34,6 +35,7 @@ JLD2 = "0.4.22" OffsetArrays = "1" Optim = "1" Polynomials = "3" +PrecompileSignatures = "3.0" ProgressMeter = "1" Reexport = "1" Roots = "2" diff --git a/src/PorousMaterials.jl b/src/PorousMaterials.jl index 8587cbdd0..8e0d5fb0d 100644 --- a/src/PorousMaterials.jl +++ b/src/PorousMaterials.jl @@ -1,26 +1,13 @@ module PorousMaterials -using CSV, - DataFrames, - Distributed, - FIGlet, - Graphs, - JLD2, - LinearAlgebra, - OffsetArrays, - Optim, - Polynomials, - Printf, - ProgressMeter, - Roots, - SpecialFunctions, - Statistics, - StatsBase +using CSV, DataFrames, Distributed, FIGlet, Graphs, JLD2, LinearAlgebra, OffsetArrays, Optim, + Polynomials, Printf, ProgressMeter, Roots, SpecialFunctions, Statistics, StatsBase # extend Xtals using Reexport @reexport using Xtals import Xtals.Cart, Xtals.Frac, Xtals.write_xyz +using PrecompileSignatures: @precompile_signatures # physical constants const UNIV_GAS_CONST = 8.3144598e-5 # m³-bar/(K-mol) @@ -46,93 +33,59 @@ function __init__() rc[:paths][:molecules] = "" rc[:paths][:grids] = "" rc[:paths][:simulations] = "" - set_paths(joinpath(pwd(), "data"); no_warn=true) - return append_atomic_masses() + set_paths(joinpath(pwd(), "data"), no_warn=true) + append_atomic_masses() end function banner() font_num = 579 FIGlet.render("Porous", FIGlet.availablefonts()[font_num]) - return FIGlet.render("Materials", FIGlet.availablefonts()[font_num]) + FIGlet.render("Materials", FIGlet.availablefonts()[font_num]) end + export # isotherm_fitting.jl fit_adsorption_isotherm, # molecule.jl - Molecule, - translate_by!, - translate_to!, - random_rotation!, - random_rotation_matrix, - ion, - distortion, + Molecule, translate_by!, translate_to!, random_rotation!, random_rotation_matrix, ion, distortion, # forcefield.jl - LJForceField, - replication_factors, - forcefield_coverage, + LJForceField, replication_factors, forcefield_coverage, # energy_utilities.jl - PotentialEnergy, - SystemPotentialEnergy, + PotentialEnergy, SystemPotentialEnergy, # vdw_energetics.jl - lennard_jones, - vdw_energy, - vdw_energy_no_PBC, + lennard_jones, vdw_energy, vdw_energy_no_PBC, # electrostatics.jl - electrostatic_potential_energy, - precompute_kvec_wts, - setup_Ewald_sum, - total, - Eikr, - total_electrostatic_potential_energy, + electrostatic_potential_energy, precompute_kvec_wts, + setup_Ewald_sum, total, Eikr, total_electrostatic_potential_energy, # mc_helpers.jl - random_insertion!, - remove_molecule!, - random_translation!, - random_reinsertion!, - needs_rotations, + random_insertion!, remove_molecule!, random_translation!, random_reinsertion!, needs_rotations, AdaptiveTranslationStepSize, # Grid.jl apply_periodic_boundary_condition!, - Grid, - write_cube, - read_cube, - energy_grid, - compute_accessibility_grid, - accessible, - required_n_pts, - xf_to_id, - id_to_xf, - update_density!, - find_energy_minimum, - origin, - + Grid, write_cube, read_cube, energy_grid, compute_accessibility_grid, accessible, + required_n_pts, xf_to_id, id_to_xf, update_density!, find_energy_minimum, origin, + # EOS.jl - calculate_properties, - PengRobinsonFluid, - VdWFluid, + calculate_properties, PengRobinsonFluid, VdWFluid, # gcmc.jl - μVT_sim, - adsorption_isotherm, - stepwise_adsorption_isotherm, - μVT_output_filename, - GCMCstats, - MarkovCounts, - isotherm_sim_results_to_dataframe, - + μVT_sim, adsorption_isotherm, stepwise_adsorption_isotherm, + μVT_output_filename, GCMCstats, MarkovCounts, isotherm_sim_results_to_dataframe, + # henry.jl - henry_coefficient, - henry_result_savename, + henry_coefficient, henry_result_savename, # energy_min.jl - find_energy_minimum, - find_energy_minimum_gridsearch + find_energy_minimum, find_energy_minimum_gridsearch + +@precompile_signatures(PorousMaterials) + end