Skip to content

Commit

Permalink
v0.4.0 (#214)
Browse files Browse the repository at this point in the history
* cross-platform CI

* remove redundant file reads

* aqua

* docstrings

* fix bad dict key in Henry sim auto-save

* doctests
  • Loading branch information
eahenle authored Mar 14, 2022
1 parent edd6d8b commit 3a0ac8e
Show file tree
Hide file tree
Showing 19 changed files with 237 additions and 136 deletions.
9 changes: 7 additions & 2 deletions .github/workflows/TagBot.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,16 @@
name: TagBot
on:
schedule:
- cron: 0 * * * *
issue_comment:
types:
- created
workflow_dispatch:
jobs:
TagBot:
if: github.event_name == 'workflow_dispatch' || github.actor == 'JuliaTagBot'
runs-on: ubuntu-latest
steps:
- uses: JuliaRegistries/TagBot@v1
with:
token: ${{ secrets.GITHUB_TOKEN }}
ssh: ${{ secrets.DOCUMENTER_KEY }}

88 changes: 87 additions & 1 deletion .github/workflows/ci_testing.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ concurrency:
cancel-in-progress: true

env:
julia_version: '1.6.3'
julia_version: '1.7.2'



Expand All @@ -21,6 +21,7 @@ jobs:

unit-and-doc-tests:
runs-on: ubuntu-latest
timeout-minutes: 30

steps:
- name: checkout commit
Expand Down Expand Up @@ -52,8 +53,70 @@ jobs:
verbose: true


cross-platform-os:
if: github.ref_name == 'master'
strategy:
fail-fast: true
matrix:
os: [macos-latest, windows-latest, ubuntu-latest]
runs-on: ${{ matrix.os }}
timeout-minutes: 30

steps:
- name: checkout commit
uses: actions/checkout@master

- name: set up Julia
uses: julia-actions/setup-julia@latest
with:
version: ${{ env.julia_version }}

- name: build package
uses: julia-actions/julia-buildpkg@latest

- name: install dependencies
run: julia --project --color=yes -e 'import Pkg; Pkg.add("Documenter")'
shell: bash

- name: run tests
run: julia --project --color=yes -e 'import Pkg; Pkg.test()'
shell: bash


cross-platform-julia:
if: github.ref_name == 'master'
strategy:
fail-fast: true
matrix:
julia: ['1.6.4', '1.7.0']
runs-on: ubuntu-latest
timeout-minutes: 30

steps:
- name: checkout commit
uses: actions/checkout@master

- name: set up Julia
uses: julia-actions/setup-julia@latest
with:
version: ${{ matrix.julia }}

- name: build package
uses: julia-actions/julia-buildpkg@latest

- name: install dependencies
run: julia --project --color=yes -e 'import Pkg; Pkg.add("Documenter")'
shell: bash

- name: run tests
run: julia --project --color=yes -e 'import Pkg; Pkg.test()'
shell: bash


deploy-docs:
if: github.ref_name == 'master'
runs-on: ubuntu-latest
timeout-minutes: 30

env:
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
Expand All @@ -76,3 +139,26 @@ jobs:

- name: build and deploy docs
run: julia --project --color=yes ./docs/make.jl


aqua-jl:
runs-on: ubuntu-latest
timeout-minutes: 30

steps:
- name: checkout commit
uses: actions/checkout@v2

- name: set up Julia
uses: julia-actions/setup-julia@latest
with:
version: ${{ env.julia_version }}

- name: build package
uses: julia-actions/julia-buildpkg@latest

- name: install dependencies
run: julia --project --color=yes -e 'import Pkg; Pkg.add.(["Aqua"])'

- name: Aqua.jl
run: julia --project --color=yes ./test/aqua.jl
47 changes: 18 additions & 29 deletions Project.toml
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
name = "PorousMaterials"
uuid = "68953c7c-a3c7-538e-83d3-73516288599e"
authors = ["SimonEnsemble <[email protected]>"]
version = "0.3.4"
version = "0.4.0"

[deps]
Aqua = "4c88cf16-eb10-579e-8560-4a9242c79595"
CSV = "336ed68f-0bac-5ca0-87d4-7b16caf5d00b"
DataFrames = "a93c6f00-e57d-5684-b7b6-d8193f3e46c0"
Distributed = "8ba89e20-285c-5b6f-9357-94700520ee1b"
Documenter = "e30172f5-a6a5-5a46-863b-614d45cd2de4"
FIGlet = "3064a664-84fe-4d92-92c7-ed492f3d8fae"
FileIO = "5789e2e9-d7fb-5bc7-8068-2c6fae9b9549"
Graphs = "86223c79-3864-5bf0-83f7-82e725a168b6"
Expand All @@ -18,7 +18,6 @@ Optim = "429524aa-4258-5aef-a3af-852621145aeb"
Polynomials = "f27b6e38-b328-58d1-80ce-0feddd5e7a45"
Printf = "de0858da-6303-5e67-8744-51eddeeeb8d7"
ProgressMeter = "92933f4c-e287-5a05-a399-4b506db050ca"
PyCall = "438e738f-606a-5dbb-bf0a-cddfbfd45ab0"
Random = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c"
Reexport = "189a3867-3050-52da-a836-e630ba90ab69"
Roots = "f2b01f46-fcfa-551c-844a-d8ac1e96c665"
Expand All @@ -29,37 +28,27 @@ Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"
Xtals = "ede5f01d-793e-4c47-9885-c447d1f18d6d"

[compat]
CSV = "^0.8"
DataFrames = "^0.22, 1"
FIGlet = "^0.2"
FileIO = "^1.2"
Graphs = "^1.4"
JLD2 = "^0.4"
Aqua = "0.5"
CSV = "0.8"
DataFrames = "1"
FIGlet = "0.2"
FileIO = "1"
Graphs = "1"
JLD2 = "0.4"
OffsetArrays = "0.11"
Optim = "^0.19, 1"
Polynomials = "^0.6"
ProgressMeter = "^1.2"
PyCall = "^1.92"
Reexport = "^1.1"
Roots = "^0.8"
SpecialFunctions = "^0.10"
StatsBase = "~0.32, ^0.33"
Xtals = "^0.3"
Optim = "1"
Polynomials = "0.6"
ProgressMeter = "1"
Reexport = "1"
Roots = "0.8"
SpecialFunctions = "0.10"
StatsBase = "0.32"
Xtals = "0.3"
julia = "1.6"

[extras]
CSV = "336ed68f-0bac-5ca0-87d4-7b16caf5d00b"
DataFrames = "a93c6f00-e57d-5684-b7b6-d8193f3e46c0"
Documenter = "e30172f5-a6a5-5a46-863b-614d45cd2de4"
FileIO = "5789e2e9-d7fb-5bc7-8068-2c6fae9b9549"
JLD2 = "033835bb-8acc-5ee8-8aae-3f567f8a3819"
LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e"
OffsetArrays = "6fe1bfb0-de20-5000-8ca7-80f57d26f881"
Optim = "429524aa-4258-5aef-a3af-852621145aeb"
Printf = "de0858da-6303-5e67-8744-51eddeeeb8d7"
Random = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c"
Statistics = "10745b16-79ce-11e8-11f9-7d13ad32a3b2"
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"

[targets]
test = ["Test", "Documenter", "CSV", "DataFrames", "FileIO", "JLD2", "LinearAlgebra", "OffsetArrays", "Optim", "Printf", "Random", "Statistics"]
test = ["Test", "Documenter"]
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@

| **Documentation** | **DOI** | **Build Status** | **Test Coverage** |
|:---:|:---:|:---:|:---:|
| [![](https://img.shields.io/badge/docs-dev-blue.svg)](https://simonensemble.github.io/PorousMaterials.jl/dev) [![](https://img.shields.io/badge/docs-latest-blue.svg)](https://simonensemble.github.io/PorousMaterials.jl/stable) | [![DOI](https://zenodo.org/badge/102691401.svg)](https://zenodo.org/badge/latestdoi/102691401) | [![Build](https://github.com/SimonEnsemble/PorousMaterials.jl/actions/workflows/ci_testing.yml/badge.svg)](https://github.com/SimonEnsemble/PorousMaterials.jl/actions/workflows/ci_testing.yml) | [![codecov](https://codecov.io/gh/SimonEnsemble/PorousMaterials.jl/branch/master/graph/badge.svg?token=PWsgNnxfZI)](https://codecov.io/gh/SimonEnsemble/PorousMaterials.jl) |
| [![](https://img.shields.io/badge/docs-dev-blue.svg)](https://simonensemble.github.io/PorousMaterials.jl/dev) [![](https://img.shields.io/badge/docs-latest-blue.svg)](https://simonensemble.github.io/PorousMaterials.jl/stable) | [![DOI](https://zenodo.org/badge/102691401.svg)](https://zenodo.org/badge/latestdoi/102691401) | [![Build](https://github.com/SimonEnsemble/PorousMaterials.jl/actions/workflows/ci_testing.yml/badge.svg)](https://github.com/SimonEnsemble/PorousMaterials.jl/actions/workflows/ci_testing.yml) | [![codecov](https://codecov.io/gh/SimonEnsemble/PorousMaterials.jl/branch/master/graph/badge.svg?token=PWsgNnxfZI)](https://codecov.io/gh/SimonEnsemble/PorousMaterials.jl) [![Aqua QA](https://raw.githubusercontent.com/JuliaTesting/Aqua.jl/master/badge.svg)](https://github.com/JuliaTesting/Aqua.jl) |

A pure-[Julia](https://julialang.org/) package for classical molecular modeling of adsorption in porous crystals such as metal-organic frameworks (MOFs).
2 changes: 1 addition & 1 deletion docs/src/crystal.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ xtal.bonds # Bonding information in the structure. By d
xtal.symmetry # Symmetry information of the crystal. By default converts the symmetry to P1 symmetry.
# Use `convert_to_p1=false` argument in `Crystal` to keep original symmetry
# output
Xtals.SymmetryInfo(["x"; "y"; "z"], "P1", true)
Xtals.SymmetryInfo(["x"; "y"; "z";;], "P1", true)
```

## fixing atom species
Expand Down
2 changes: 1 addition & 1 deletion docs/src/energy_min.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ minimized_molecule, min_E = find_energy_minimum(xtal, minimized_molecule, ljff)
Computing energy grid of Xe in SBMOF-1.cif
Regular grid (in fractional space) of 13 by 7 by 24 points superimposed over the unit cell.
(Molecule species: Xe
Center of mass (fractional coords): Frac([0.01749943805846959; 0.9372916114895011; 0.011192272400742498])
Center of mass (fractional coords): Frac([0.01749943805846959; 0.9372916114895011; 0.011192272400742498;;])
Atoms:
atom = Xe, xf = [0.017, 0.937, 0.011], -37.69376112588296)
Expand Down
2 changes: 1 addition & 1 deletion docs/src/matter.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ length(coords) # number of particles, (5)
```jldoctest matter
coords.x = rand(3, 5)
# output
ERROR: setfield! immutable struct of type Cart cannot be changed
ERROR: setfield!: immutable struct of type Cart cannot be changed
```
but we can manipulate the values of `Array{Float64, 2}` where coordinates (through `coords.x` or `coords.xf`) are stored:

Expand Down
2 changes: 1 addition & 1 deletion docs/src/molecule.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ Molecule input files are stored in `PorousMaterials.PATH_TO_MOLECULES`. Each mol
molecule = Molecule("CO2")
# output
Molecule species: CO2
Center of mass (fractional coords): Cart([0.0; 0.0; 0.0])
Center of mass (fractional coords): Cart([0.0; 0.0; 0.0;;])
Atoms:
atom = C_CO2, x = [0.000, 0.000, 0.000]
Expand Down
12 changes: 9 additions & 3 deletions src/PorousMaterials.jl
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
module PorousMaterials

using Roots, OffsetArrays, SpecialFunctions, StatsBase, ProgressMeter, Polynomials,
JLD2, Statistics, Distributed, Optim, Printf, DataFrames, Graphs, CSV, LinearAlgebra
using CSV, DataFrames, Distributed, FIGlet, Graphs, JLD2, LinearAlgebra, OffsetArrays, Optim,
Polynomials, Printf, ProgressMeter, Roots, SpecialFunctions, Statistics, StatsBase

# extend Xtals
using Reexport
Expand Down Expand Up @@ -36,6 +36,12 @@ function __init__()
append_atomic_masses()
end

function banner()
font_num = 579
FIGlet.render("Porous", FIGlet.availablefonts()[font_num])
FIGlet.render("Materials", FIGlet.availablefonts()[font_num])
end


export
# isotherm_fitting.jl
Expand All @@ -54,7 +60,7 @@ export
lennard_jones, vdw_energy, vdw_energy_no_PBC,

# electrostatics.jl
electrostatic_potential, electrostatic_potential_energy, precompute_kvec_wts,
electrostatic_potential_energy, precompute_kvec_wts,
setup_Ewald_sum, total, Eikr, total_electrostatic_potential_energy,

# mc_helpers.jl
Expand Down
1 change: 1 addition & 0 deletions src/gcmc.jl
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,7 @@ translation.
- `density_grid_sim_box::Bool`: `true` if we wish for the density grid to be over the
entire simulation box as opposed to the box of the crystal passed in. `false` if we wish the
density grid to be over the original `xtal.box`, before replication, passed in.
- `autosave::Bool`: `true` if we wish to automatically save the simulation results to the standard path/filename.
- `results_filename_comment::AbstractString`: An optional comment that will be appended to the name of the saved file (if autosaved)
"""
function μVT_sim(xtal::Crystal, molecule::Molecule, temperature::Float64,
Expand Down
15 changes: 15 additions & 0 deletions test/aqua.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
using PorousMaterials
import Aqua

# ambiguity testing finds many "problems" outside the scope of this package
ambiguities=false

# to skip when checking for stale dependencies and missing compat entries
# Aqua is added in a separate CI job, so (ironically) does not work w/ itself
stale_deps = (ignore=[:Aqua],)

Aqua.test_all(
PorousMaterials;
ambiguities=ambiguities,
stale_deps=stale_deps
)
11 changes: 7 additions & 4 deletions test/energy_min.jl
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,13 @@ using JLD2
using Statistics
using Random

FIQCEN_clean = Crystal("FIQCEN_clean.cif")
Xe = Molecule("Xe")

@testset "Energy Minimizaiton Tests" begin
xtal = Crystal("FIQCEN_clean.cif")
xtal = deepcopy(FIQCEN_clean)
strip_numbers_from_atom_labels!(xtal)
molecule = Molecule("Xe")
molecule = deepcopy(Xe)
ljff = LJForceField("UFF")
n_pts = (15, 15, 15)

Expand All @@ -30,9 +33,9 @@ using Random
@test isapprox(vdw_energy(xtal, min_mol, ljff) * 8.314 / 1000, min_E, atol=0.1)

# make sure it works with cart coords too.
xtal = Crystal("FIQCEN_clean.cif")
xtal = deepcopy(FIQCEN_clean)
strip_numbers_from_atom_labels!(xtal)
molecule = Molecule("Xe")
molecule = deepcopy(Xe)
translate_to!(molecule, Cart(Frac([0.785, 0.785, 0.785]), xtal.box))
min_mol, min_E = find_energy_minimum(xtal, molecule, ljff)
@test isapprox(min_E, -27.0269, atol=0.01)
Expand Down
7 changes: 4 additions & 3 deletions test/forcefield.jl
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,9 @@ using Random
@test rep_factors == (25, 25, 25)

# test check for force field coverage
@test forcefield_coverage(Crystal("SBMOF-1.cif").atoms, ljforcefield)
@test forcefield_coverage(Crystal("SBMOF-1.cif"), ljforcefield)
@test ! forcefield_coverage(Crystal("SBMOF-1.cif").atoms, LJForceField("bogus"))
SBMOF1 = Crystal("SBMOF-1.cif")
@test forcefield_coverage(SBMOF1.atoms, ljforcefield)
@test forcefield_coverage(SBMOF1, ljforcefield)
@test ! forcefield_coverage(SBMOF1.atoms, LJForceField("bogus"))
end
end
15 changes: 9 additions & 6 deletions test/grid.jl
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ using JLD2
using Statistics
using Random

CH4 = Molecule("CH4")
UFF = LJForceField("UFF")

@testset "Grid Tests" begin
# required number of pts
box = Box(1.0, 10.0, 5.0, π/2, π/2, π/2)
Expand Down Expand Up @@ -40,8 +43,8 @@ using Random
for zeolite in ["LTA", "SOD"]
crystal = Crystal(zeolite * ".cif")
write_xyz(crystal)
molecule = Molecule("CH4")
forcefield = LJForceField("UFF")
molecule = deepcopy(CH4)
forcefield = deepcopy(UFF)
grid = energy_grid(crystal, molecule, forcefield, resolution=5.)

# endpoints included, ensure periodic since endpoints of grid pts included
Expand Down Expand Up @@ -98,8 +101,8 @@ using Random

# test accessibility interpolator when there are replications
crystal = Crystal("LTA.cif")
molecule = Molecule("CH4")
forcefield = LJForceField("UFF")
molecule = deepcopy(CH4)
forcefield = deepcopy(UFF)
accessibility_grid, nb_segments_blocked, porosity = compute_accessibility_grid(crystal,
molecule, forcefield, resolution=2., energy_tol=0.0, verbose=false,
write_b4_after_grids=true)
Expand All @@ -122,8 +125,8 @@ using Random
@test same_accessibility_repfactors

# SBMOF-1, CAXVILL_clean hv no pockets blocked. test accessibility grid w./o pocket blocking
molecule = Molecule("CH4")
forcefield = LJForceField("UFF")
molecule = deepcopy(CH4)
forcefield = deepcopy(UFF)
for crystal in [Crystal("SBMOF-1.cif"), Crystal("CAXVII_clean.cif")]

# w./ blocking
Expand Down
Loading

0 comments on commit 3a0ac8e

Please sign in to comment.