1
1
module PorousMaterials
2
2
3
- using CSV
4
- using DataFrames
5
- using Roots # for fzero
6
- using OffsetArrays # used for Ewald sum
7
- using SpecialFunctions # for erfc
8
- using StatsBase
9
- using ProgressMeter
10
- using Polynomials
11
- using JLD2
12
- using Statistics
13
- using Printf
14
- using LinearAlgebra
15
- using LightGraphs
16
- using Distributed
17
- using Optim
18
- using PyCall
19
- # import Base.push!
20
- #
21
-
22
- # atoms are considered to overlap if this close.
23
- const R²_OVERLAP = 0.1 # Units: Angstrom²
24
-
25
- """
26
- print_file_paths()
27
-
28
- print off paths where PorousMaterials.jl looks for input files and writes output files.
29
- """
30
- function print_file_paths ()
31
- println (" general data folder: " , PATH_TO_DATA)
32
- println (" \t crystal structures (.cif, .cssr): " , PATH_TO_CRYSTALS)
33
- println (" \t force field files (.csv): " , PATH_TO_FORCEFIELDS)
34
- println (" \t molecule input files: " , PATH_TO_MOLECULES)
35
- println (" \t simulation output files: " , PATH_TO_SIMS)
36
- println (" \t grids (.cube): " , PATH_TO_GRIDS)
37
- end
3
+ using Roots, OffsetArrays, SpecialFunctions, StatsBase, ProgressMeter, Polynomials,
4
+ JLD2, Statistics, Distributed, Optim, Printf, DataFrames, LightGraphs, CSV, LinearAlgebra
38
5
39
- """
40
- set_path_to_data(path; print_paths=true)
41
-
42
- Set the path variables: `PATH_TO_DATA`, `PATH_TO_CRYSTALS`, `PATH_TO_FORCEFIELDS`, `PATH_TO_MOLECULES`,
43
- `PATH_TO_GRIDS`, and `PATH_TO_SIMS`. The latter five paths are set relative to the root data path.
44
-
45
- # Arguments
46
- - `path::String`: the absolute path to the root of the data directory.
47
- - `print_paths::Bool`: set false to suppress printing of path values.
48
- """
49
- function set_path_to_data (path:: String ; print_paths:: Bool = true )
50
- global PATH_TO_DATA = path
51
- global PATH_TO_CRYSTALS = joinpath (PATH_TO_DATA, " crystals" )
52
- global PATH_TO_FORCEFIELDS = joinpath (PATH_TO_DATA, " forcefields" )
53
- global PATH_TO_MOLECULES = joinpath (PATH_TO_DATA, " molecules" )
54
- global PATH_TO_GRIDS = joinpath (PATH_TO_DATA, " grids" )
55
- global PATH_TO_SIMS = joinpath (PATH_TO_DATA, " simulations" )
56
-
57
- if print_paths
58
- print_file_paths ()
59
- end
60
- end
6
+ # extend Xtals
7
+ using Reexport
8
+ @reexport using Xtals
9
+ import Xtals. Cart, Xtals. Frac, Xtals. write_xyz
61
10
62
- """
63
- set_default_file_paths(print_paths=true)
64
-
65
- sets the default paths for where input files and some output files are stored.
66
- to see current set up, call [`print_file_paths`](@ref)
67
- """
68
- function set_default_file_paths (;print_paths:: Bool = true )
69
- # this is the main directory where crystal structures, forcefields, and molecules data is stored
70
- global PATH_TO_DATA = joinpath (pwd (), " data" )
71
-
72
- global PATH_TO_CRYSTALS = joinpath (PATH_TO_DATA, " crystals" )
73
- global PATH_TO_FORCEFIELDS = joinpath (PATH_TO_DATA, " forcefields" )
74
- global PATH_TO_MOLECULES = joinpath (PATH_TO_DATA, " molecules" )
75
- global PATH_TO_GRIDS = joinpath (PATH_TO_DATA, " grids" )
76
- global PATH_TO_SIMS = joinpath (PATH_TO_DATA, " simulations" )
77
-
78
- if print_paths
79
- print_file_paths ()
80
- end
81
- end
11
+ # physical constants
12
+ const UNIV_GAS_CONST = 8.3144598e-5 # m³-bar/(K-mol)
13
+ const K_TO_KJ_PER_MOL = 8.3144598e-3 # kJ/(mol-K)
14
+ const BOLTZMANN = 1.38064852e7 # Boltmann constant (Pa-m3/K --> Pa-A3/K)
82
15
83
- # this runs everytime porousmaterials is loaded, so if the user changes directory
84
- # then the path_to_data will change as well
85
- function __init__ ()
86
- set_default_file_paths (print_paths= false )
87
- end
88
-
89
- # """
90
- # set_tutorial_mode()
91
- #
92
- # places porousmaterials in "tutorial mode". it changes the `path_to_data` variable to
93
- # the directory where the porousmaterials test data is stored. it can be used to
94
- # follow examples shown in the readme. it displays a warning so that the user knows
95
- # they are no longer using their own data.
96
- # """
97
- # function set_tutorial_mode()
98
- # new_path = joinpath(dirname(pathof(porousmaterials)), "..", "test", "data")
99
- # if ! isdir(new_path)
100
- # @error @sprintf("directory for testing data %s does not exist.\nnot entering tutorial mode.\n", new_path)
101
- # else
102
- # global path_to_data = new_path
103
- # global path_to_crystals = joinpath(path_to_data, "crystals")
104
- # global path_to_forcefields = joinpath(path_to_data, "forcefields")
105
- # global path_to_molecules = joinpath(path_to_data, "molecules")
106
- # global path_to_grids = joinpath(path_to_data, "grids")
107
- # @warn "porousmaterials is now in tutorial mode. you have access to the testing data to experiment with porousmaterials.\nto reset to default file paths, call `set_default_file_paths()`\n"
108
- # end
109
- # end
110
- #
111
- include (" matter.jl" )
112
- include (" box.jl" )
113
- include (" distance.jl" )
114
- include (" misc.jl" )
115
16
include (" isotherm_fitting.jl" )
116
- include (" crystal.jl" )
117
- include (" bonds.jl" )
118
17
include (" forcefield.jl" )
119
18
include (" molecule.jl" )
120
19
include (" energy_utilities.jl" )
@@ -125,48 +24,23 @@ include("grid.jl")
125
24
include (" eos.jl" )
126
25
include (" henry.jl" )
127
26
include (" gcmc.jl" )
128
- # include("generic_rotations.jl")
129
27
include (" energy_min.jl" )
28
+ include (" atomic_masses.jl" )
130
29
30
+ function __init__ ()
31
+ rc[:paths ][:forcefields ] = joinpath (rc[:paths ][:data ], " forcefields" )
32
+ rc[:paths ][:molecules ] = joinpath (rc[:paths ][:data ], " molecules" )
33
+ rc[:paths ][:grids ] = joinpath (rc[:paths ][:data ], " grids" )
34
+ rc[:paths ][:sims ] = joinpath (rc[:paths ][:data ], " simulations" )
35
+ append_atomic_masses ()
36
+ @debug " Environment variables" rc
37
+ end
131
38
132
- export
133
- # porousmaterials.jl
134
- print_file_paths, set_path_to_data,
135
-
136
- # matter.jl
137
- Coords, Frac, Cart, Atoms, Charges, wrap!, neutral, net_charge, translate_by!, origin,
138
-
139
- # box.jl
140
- Box, replicate, unit_cube, write_vtk, inside, fractional_coords, cartesian_coords,
141
-
142
- # distance.jl
143
- nearest_image!, distance, overlap, remove_duplicates,
144
-
145
- # misc.jl
146
- read_xyz, read_cpk_colors, write_xyz, read_atomic_masses,
147
39
40
+ export
148
41
# isotherm_fitting.jl
149
42
fit_adsorption_isotherm,
150
43
151
- # crystal.jl
152
- Crystal, strip_numbers_from_atom_labels!, assign_charges,
153
- chemical_formula, molecular_weight, crystal_density, write_cif, has_charges,
154
- apply_symmetry_operations,
155
-
156
- # bonds.jl
157
- infer_bonds!, write_bond_information, BondingRule, bond_sanity_check, remove_bonds!,
158
- infer_geometry_based_bonds!, cordero_covalent_atomic_radii,
159
-
160
- # construct_box,
161
- # replicate, read_atomic_masses, charged, write_cif, assign_charges,
162
- # is_symmetry_equal, apply_symmetry_rules, assert_p1_symmetry, infer_bonds!,
163
- # remove_bonds!, compare_bonds_in_framework, wrap_atoms_to_unit_cell!,
164
- # write_bond_information, is_bonded, default_bondingrules, has_same_sets_of_atoms_and_charges,
165
- # distance, bond_sanity_check,
166
- #
167
- # # FrameworkOperations.jl
168
- # partition_framework, subtract_atoms,
169
- #
170
44
# molecule.jl
171
45
Molecule, translate_by!, translate_to!, random_rotation!, random_rotation_matrix, ion, distortion,
172
46
@@ -189,20 +63,17 @@ export
189
63
# Grid.jl
190
64
apply_periodic_boundary_condition!,
191
65
Grid, write_cube, read_cube, energy_grid, compute_accessibility_grid, accessible,
192
- required_n_pts, xf_to_id, id_to_xf, update_density!, find_energy_minimum,
193
- #
66
+ required_n_pts, xf_to_id, id_to_xf, update_density!, find_energy_minimum, origin,
67
+
194
68
# EOS.jl
195
69
calculate_properties, PengRobinsonFluid, VdWFluid,
196
70
197
71
# gcmc.jl
198
72
μVT_sim, adsorption_isotherm, stepwise_adsorption_isotherm,
199
73
μVT_output_filename, GCMCstats, MarkovCounts, isotherm_sim_results_to_dataframe,
200
- #
74
+
201
75
# henry.jl
202
76
henry_coefficient, henry_result_savename,
203
- #
204
- # # generic_rotations.jl
205
- # rotation_matrix
206
77
207
78
# energy_min.jl
208
79
find_energy_minimum, find_energy_minimum_gridsearch
0 commit comments