sha256
stringlengths
64
64
language
stringclasses
27 values
size
int32
1
491k
lines
int32
1
10.7k
content
stringlengths
1
200k
eb6d7a1e69e0c571d9b04250ee6fba15313219fcff5fedec632ee90b7135ecb0
Julia
3,891
143
using Molly using ParallelTestRunner using Suppressor # Suppress warnings for unavailable backends, warn later @suppress_err using AMDGPU @suppress_err using CUDA @suppress_err using Metal @suppress_err using oneAPI const n_threads_per_job = 4 const run_visualize_tests = get(ENV, "VISTESTS", "1") != "0" if !run_visu...
633b52a05e9302ed0f86d809f6850fea9d21b2ebb3b8413b03f60cc76272343a
Julia
3,901
137
export Mie @doc raw""" Mie(; m, n, cutoff, use_neighbors, shortcut, σ_mixing, ϵ_mixing, weight_special) The Mie generalized interaction between two atoms. When `m` equals 6 and `n` equals 12 this is equivalent to the Lennard-Jones interaction. The potential energy is defined as ```math V(r_{ij}) = C \varepsilon_...
8f62741a464fc7c6b5be811dd4e7181af76ab927e34f3e173834fadd56b36d3c
Julia
4,529
131
# Mixing functions for non-bonded parameters shortcut_pair(::Nothing, args...) = false struct LJZeroShortcut end function shortcut_pair(::LJZeroShortcut, atom_i, atom_j, args...) return iszero_value(atom_i.ϵ) || iszero_value(atom_j.ϵ) || iszero_value(atom_i.σ) || iszero_value(atom_j.σ) || i...
fcaf3b4a23533fd80504088d951f5f6677d9e00875eb24d20f25446f6f52ee5e
Julia
4,623
126
# -*- coding: utf-8 -*- https://github.com/bkamins/Julia-DataFrames-Tutorial repository). #[confidence intervals](https://en.wikipedia.org/wiki/Confidence_interval) #[density estimators](https://en.wikipedia.org/wiki/Density_estimation) #[probit model](https://en.wikipedia.org/wiki/Probit_model) #[bootstrapping](https:...
4f9c760d1aadb720c3c25b8f75f0a59639e1f4ab197e44798f47d83a6e3d07d2
Julia
4,655
97
# Machine-learning interatomic potentials (core definitions). # # The ANIPotential struct, the scalar AEV helpers (cosine_cutoff, celu01) and the public # function stubs live here in core Molly. The implementations that need Lux/HDF5/ # KernelAbstractions are in ext/MollyLuxExt.jl (loaded when Lux and HDF5 are availabl...
c6da9c0a584b25ee22bc3fe4561e896ed00c80e87276a4f1e070790ccbca5dd5
Julia
4,715
112
@testset "Differentiable protein" begin function create_sys(AT, n_threads, nonbonded_method) ff = MolecularForceField(joinpath.(ff_dir, ["ff99SBildn.xml"])...; units=false) return System( joinpath(data_dir, "6mrr_nowater.pdb"), ff; units=false, array_t...
84f18813f7bab32dd606c80fcd99ba0f072346a38cb8f3b9d7cb967141877b5b
Julia
4,779
127
export PeriodicTorsion @doc raw""" PeriodicTorsion(; periodicities, phases, ks, proper) A periodic torsion angle between four atoms. `phases` are in radians. The potential energy is defined as ```math V(\phi) = \sum_{n=1}^N k_n (1 + \cos(n \phi - \phi_{s,n})) ``` where `ϕ` is the angle between the planes defined...
cf240601195cdce0b8306836c22bb0c3342eefc36df4377034eabb12cff83e24
Julia
4,941
149
export DPDInteraction @doc raw""" DPDInteraction(; a, γ, σ, r_c, dt, use_neighbors, key) The dissipative particle dynamics (DPD) interaction between two particles. Combines conservative, dissipative, and random pairwise forces as described in [Groot and Warren 1997](https://doi.org/10.1063/1.474784). The total ...
4c29284494bd68e331a069ead88a8db76fcba3730147b5361598fb6a12b861b7
Julia
5,387
140
# Python ASE interface # This file is only loaded when PythonCall is imported module MollyPythonCallExt using Molly using Molly: from_device, to_device using PythonCall import AtomsCalculators using GPUArrays using StaticArrays using Unitful # See PythonCall precompilation documentation const ase = Ref{Py}() functi...
345d9c388272260fe2e66ec7f9a38b04ec93a7175abf8959a2b8585868fade6a
Julia
5,486
262
## using Molly using CUDA using GLMakie using Random CUDA.device!(parse(Int, get(ENV, "MOLLY_CUDA_DEVICE", "0"))) ## FT = Float32 AT = CuArray RNG_SEED = 42 OUTPUT_PREFIX = "awh_dipeptide" rng = MersenneTwister(RNG_SEED) DT = FT(4)u"fs" TIME_EQ = FT(100)u"ps" STEPS_EQ = Int(floor(TIME_EQ/DT)) TEMP = FT(310)u"K" T...
d04a2f88858587241e9b13aca6817c9c97f9f9548899b237f37940a7687454ec
Julia
5,551
116
@testset "Analysis" begin # Displacements and distances coords = [SVector(1.0, 1.0, 1.0), SVector(2.0, 2.0, 2.0)] boundary = CubicBoundary(10.0) disps = displacements(coords, boundary) @test disps[1, 2] == SVector(1.0, 1.0, 1.0) @test disps[2, 1] == SVector(-1.0, -1.0, -1.0) dists = distance...
513af1f49e5a3ecb4022d175d308d57d6dda6547ff4892f6093862fb1e273df9
Julia
5,625
165
using CUDA using BenchmarkTools using StaticArrays using Unitful using LinearAlgebra using Random using Printf include("gpu_profile_utils.jl") env_int(name::AbstractString, default::Int) = something(tryparse(Int, get(ENV, name, string(default))), default) function setup_benchmark_system(n_atoms; ...
eed238603c3402fb54c9d2d1a785dad083d8596ce4f74e9a9085b7a1f405d7fd
Julia
5,660
140
# Visualize simulations # This file is only loaded when GLMakie is imported module MollyGLMakieExt using Molly using GLMakie import AtomsBase using Colors using Unitful using LinearAlgebra function Molly.visualize(coord_logger, boundary, out_filepath::AbstractString...
828a41eb4703da4bd4de3a80ef942e4e852d40426971a98968601a469bfc2443
Julia
6,457
175
# Analysis tools export displacements, distances, rmsd, radius_gyration, hydrodynamic_radius, visualize, rdf """ displacements(coords, boundary) Calculate the pairwise vector displacements of a set of coordinates, accounting for the periodic boundary conditions. """ function displacem...
18c9621d6a3cedfde610a85d22a845f67509c4621fecce4a4f81b304b17baccd
Julia
6,489
158
# Benchmark suite for Molly # Run with something like: # using Molly, PkgBenchmark # results = benchmarkpkg(Molly, BenchmarkConfig(env=Dict("JULIA_NUM_THREADS" => 16))) # export_markdown(out_file, results) using Molly using BenchmarkTools using CUDA using DelimitedFiles const run_parallel_tests = Threads.nthre...
6b761114a372c0dbb726b5a0458b01899da8e20cf00302744ac4fd6d5ad864df
Julia
7,465
322
## using Molly using CUDA using GLMakie using Random CUDA.device!(parse(Int, get(ENV, "MOLLY_CUDA_DEVICE", "0"))) ## FT = Float32 AT = CuArray RNG_SEED = 42 OUTPUT_PREFIX = "tss_dipeptide" rng = MersenneTwister(RNG_SEED) DT = FT(4)u"fs" TIME_EQ = FT(100)u"ps" STEPS_EQ = Int(floor(TIME_EQ/DT)) TEMP = FT(310)u"K" T...
f96dc6282c61710bc9b713ea07e3ec9ac5421cb914c9acd0d7169e4ecac44b66
Julia
8,635
280
# Cutoff strategies for long-range interactions export NoCutoff, DistanceCutoff, ShiftedPotentialCutoff, ShiftedForceCutoff, CubicSplineCutoff, PolynomialCutoff abstract type AbstractCutoff{P} end Base.:+(c1::T, ::T) where {T <: AbstractCutoff} = c1 cutoff_sqdist(::AbstractCutoff{0}) = nothi...
939ef8397782fd845838a414dd0ebb05ee72ecdb4b580cc05bd213eb4df84d09
Julia
9,015
257
mutable struct TSSPMFEpochAccumulator{A} index::Int accumulator::A end mutable struct TSSPMFDeconvolutionBackend{N, T, S, F_CV, G, C, A} state::S cv_function::F_CV grid::G log_coupling_matrix::C accumulator::A epoch_accumulators::Vector{TSSPMFEpochAccumulator{A}} end function tss_auto_...
8b30bada32e82928212bde66351bae357442c05868111079e91e5102a65a2521
Julia
9,091
236
# Handle units export ustrip_vec # Unit types to dispatch on @derived_dimension MolarMass Unitful.𝐌/Unitful.𝐍 @derived_dimension BoltzmannConstUnits Unitful.𝐌*Unitful.𝐋^2*Unitful.𝐓^-2*Unitful.𝚯^-1 @derived_dimension MolarBoltzmannConstUnits Unitful.𝐌*Unitful.𝐋^2*Unitful.𝐓^-2*Unitful.𝚯^-1*Unitful.𝐍^-1 add_...
e9d17b7c27c13f2a25cee1bae87ca46939063b861bc6c51f5013b23e37909f5b
Julia
9,838
329
# Bias potentials export LinearBias, bias_gradient, SquareBias, FlatBottomSquareBias, PeriodicFlatBottomBias, BiasPotential @doc raw""" LinearBias(k, cv_target) A linear bias on a collective variable (CV) towards a target value. The potential energy is defined as ```math V(\boldsymbol{s...
15b2ee48b3226849a825e813729924327e02f861661e268a10b488cfd512a6d5
Julia
9,851
225
@testset "Differentiable simulation" begin runs = [ # gpu par fwd f32 obc2 gbn2 tol_σ tol_r0 ("CPU" , Array, false, false, false, false, false, 1e-8, 1e-5), ("CPU forward" , Array, false, true , false, false, false, 0.5 , 0.1 ), ("CPU f32" ...
178782df7632b5d79d821c052008f21b292f004ae940081fcefe402ef198aa79
Julia
9,956
334
export DoubleExponential, DoubleExponentialSoftCore @doc raw""" DoubleExponential(; cutoff, use_neighbors, α, β, shortcut, σ_mixing, ϵ_mixing, weight_special) The double exponential interaction between two atoms. The potential energy is defined as ```math V(r_{ij}) = \varepsilon_{i...
bbd19a17c950320512b8737af2959b1b7dd3c22974f85ea739a4be8029a5f817
Julia
9,985
215
@testset "CHARMM OpenMM protein comparison" begin pme_mesh_dims = (46, 46, 51) ff = MolecularForceField( joinpath.(ff_dir, ["charmm36.xml", "charmm36_water.xml"])...; strictness=:nowarn, ) show(devnull, ff) @test_throws ForceFieldXMLError MolecularForceField( joinpath.(ff_dir...
76e285a767659dd8f7c4c76d0923253845e9c9b791a70d509b8cc227d5594c10
Julia
10,398
303
@inline function online_pmf_logaddexp(a::T, b::T) where T if a == -T(Inf) return b elseif b == -T(Inf) return a end m = max(a, b) return m + log(exp(a - m) + exp(b - m)) end function online_pmf_tuple(values::Tuple, ::Type{T}) where T return tuple((safe_ustrip(T, value) for value...
2fe491fc6115cc52f62338e29d1a4bdae1c4aa34151c604a9b1aa759555698d9
Julia
10,730
319
""" TSSHistoryForgetting(; alpha=0.19, n_epochs=16, phi=nothing) Configure geometric history forgetting for TSS free-energy estimates. `alpha` controls the retained fraction of the current history time, `n_epochs` sets the target number of retained epochs, and `phi` optionally overrides the epoch growth factor in...
2549c292fefc9fbb0169839262a0bd5f842a57565f8600d0a1249e7e38ff22c1
Julia
11,078
287
const TSS_COVDET_GAMMA_EPSILON = 0.01 struct TSSCovDetAdaptiveGamma{T} epsilon_gamma::T rung_neighbors::Vector{Vector{NTuple{3, Int}}} rung_volumes::Vector{T} dimension::Int end function validate_tss_local_adaptive_gamma(adaptive_gamma) isnothing(adaptive_gamma) && return nothing adaptive_gamm...
da77a69c38152c5097a2b329fca5076c9d504b29f760fb3e6e6fead53d9f8bfa
Julia
11,753
346
export CMAPTorsion """ CMAPTorsion(index, size) Torsional correction map (CMAP) for sets of five atoms, for example protein ϕ and ψ backbone torsion angles. The CMAP data is stored in the `data` field of the associated [`InteractionList5Atoms`](@ref). Only compatible with 3D systems. """ struct CMAPTorsion ...
4c4ccb45464d5946a40b966beeba416a1502809af8da29283ea18b46c3123fe8
Julia
11,991
252
@testset "GPU Optimizations" begin if run_cuda_tests n_atoms = 100 D = 3 T = Float64 coords = [SVector{D, T}(0.1 * i, 0.1 * i, 0.1 * i) for i in 1:n_atoms] boundary = CubicBoundary(T(20.0), T(20.0), T(20.0)) atoms = [Atom(index=i, mass=T(1.0), charge=T(0.0), σ=T(0.3),...
9883682121e3bc2ed91a3009470342936891a7280f779a2a8e87f166f7ac96f1
Julia
13,588
345
# Convenience struct that stores the interaction lists that change # across thermodynamic states (e.g., along a reaction coordinate or replica states). struct LambdaHamiltonian{PI, SI, GI} pairwise_inters::PI specific_inter_lists::SI general_inters::GI end # AlchemicalPartition(thermo_states::AbstractArray...
747118452ff5d851a47254f71f0aa6659811b29c48d36a483e109c6ae6ce281d
Julia
13,994
482
## using Molly using CUDA using Unitful using GLMakie using Random ## # --- Simulation Constants --- CUDA.device!(parse(Int, get(ENV, "MOLLY_CUDA_DEVICE", "0"))) FT = Float32 AT = CuArray Δt = FT(4)u"fs" T0 = FT(310)u"K" P0 = FT(1)u"bar" RNG_SEED = 20240520 OUTPUT_PREFIX = "awh_solvation" N_LAMBDA_STATES = 20 N_MD_ST...
b9333c665b5f25e6d6a165d3ebc573f4f6094b7f6c67dcf4e6638f656efa929d
Julia
14,030
363
# Virtual sites export OneParticleSite, TwoParticleAverageSite, ThreeParticleAverageSite, OutOfPlaneSite, place_virtual_sites! struct VirtualSite{T, IC} type::Int # 1/2/3/4 for OneParticleSite/TwoParticleAverageSite/ThreeParticleAverageSite/OutOfPlaneSite atom_ind::Int atom_1::Int ...
c3004a704da17ced74efc643f88927f40accac12ead07935da3cf969bd37648b
Julia
14,386
415
using Molly using Molly: box_sides, sorted_morton_seq! using CUDA using StaticArrays function gpu_cuda_ext() ext = Base.get_extension(Molly, :MollyCUDAExt) isnothing(ext) && error("MollyCUDAExt is not loaded, import CUDA before profiling GPU kernels") return ext end function gpu_stage_time_ms!(f::F) where...
24a5933bbe442b286cf91c063267b5f6fcb00c933c19c8cc534d913757ae9e97
Julia
14,676
447
BigInt(9)^9^9 #setup using Pkg ]add https://github.com/kskyten/Transpilers.jl using Transpilers transpile(Expr, py"1 + 1") transpile(String, py"lambda x, y: x * y") open("output.jl", "w") do f transpile(f, py""" import numpy as np def foo(x, y): x + y * np.dot(x, y) """) end P...
43242030a97b8352be7420d2076ab7c6e410594e052e45491906b4abf3a71633
Julia
14,707
363
export ActiveThermoState # ExtendedStateSpace(thermo_states; reuse_neighbors=true) # # An expanded ensemble over a collection of thermodynamic states. # # `thermo_states` supplies the systems, integrators, temperatures, and optional # pressures for each state. The resulting state space stores shared alchemical # p...
6e0fead50181432a46a82488657c3ff88586cd23388cedbac5c03507eba4759a
Julia
15,733
444
mutable struct TSSLocalEstimator{T, ES, AS, ST, AG} state_space::ES # The different hamiltonians active_state::AS # The hamiltonian that is currently active state_indices::Vector{Int} # Local index to global state index local_index_by_state::Vector{Int} # Global index to local index, 0 mean not in lo...
8d045129ecad2db92c43937897c3727a51d3e6c9df5d870973664b37421f89eb
Julia
16,260
557
## using Molly using CUDA using Unitful using GLMakie using Random ## # --- Simulation Constants --- CUDA.device!(parse(Int, get(ENV, "MOLLY_CUDA_DEVICE", "0"))) FT = Float32 AT = CuArray Δt = FT(4)u"fs" T0 = FT(310)u"K" P0 = FT(1)u"bar" RNG_SEED = 20240520 OUTPUT_PREFIX = "tss_solvation" N_LAMBDA_STATES = 20 TSS_WIN...
59fad8999972528108e691e2c60b9e1db83eb5d0379e9d716f7b4d6c17bd8693
Julia
17,929
422
# Taking gradients with respect to force field parameters export parameter_prefix, parameter_fields, ParameterPlan, extract_parameters, inject_gradients """ parameter_prefix(inter) parameter_prefix(inter, inter_type) The prefix that the parameters of an interaction have in a parameter dic...
d4e7c5e31d383ba9422f91ab537a748f1a824ebe4f9567b4149defafa8b8dfd7
Julia
18,991
506
export PMFDeconvolution, pmf struct PMFGrid{N, T, E, C, W, V} edges::E centers::C widths::W shape::NTuple{N, Int} volumes::V end function PMFGrid(grid; T::Type = Float64) edges = online_pmf_edges(grid, T) centers = online_pmf_centers(edges) widths = online_pmf_widths(edges) ...
8868560c32c7c81c843faf559f2a8423540a12c8c09ec91228901148f4dff784
Julia
20,611
470
@testset "Energy gradients" begin inter = LennardJones() boundary = CubicBoundary(5.0) a1, a2 = Atom(σ=0.3, ϵ=0.5), Atom(σ=0.3, ϵ=0.5) function force_direct(dist) c1 = SVector(1.0, 1.0, 1.0) c2 = SVector(dist + 1.0, 1.0, 1.0) vec = vector(c1, c2, boundary) F = force(inte...
823ce03dd3dafdb2a791ee29194c9813e5b3873834319121e663c3bf377acf61
Julia
20,711
664
struct BiasNaNGradient end Molly.bias_gradient(::BiasNaNGradient, cv_sim) = NaN * u"kJ * mol^-1 * nm^-1" @testset "Collective variables" begin c1 = SVector(1.0, 1.0, 1.0)u"nm" c2 = SVector(1.3, 1.0, 1.0)u"nm" c3 = SVector(0.1, 1.0, 1.0)u"nm" c4 = SVector(1.8, 1.0, 1.0)u"nm" c5 = SVector(1.0, 1.2, ...
48c28cbbdf05f74a08fc69824a4207a4d210ab8eb8ec3dc8d7d14f8c1728227e
Julia
21,798
696
### A Pluto.jl notebook ### # v0.17.1 using Markdown using InteractiveUtils # ╔═╡ 18e4f150-1eaf-11ec-0dfa-5feeb4c0626b using Distributed # ╔═╡ 8073be21-c42d-4616-9c62-32f47115334a using NetworkInference # ╔═╡ 33b974c0-ad65-4ef4-ba75-d6a00a184664 using LightGraphs # ╔═╡ ad2c4547-1e59-4b33-9631-cccaa908df78 using Gr...
5aa4002046c9f807da491727aa3fc1561b1aa953afd70d05cbc85c042e1f9223
Julia
22,324
617
export AWHState, AWHSimulation awh_count(n::Integer, singular::AbstractString, plural::AbstractString=string(singular, "s")) = string(n, " ", n == 1 ? singular : plural) # Convenience struct to store relevant things # when running an AWH simulation. mutable struct AWHStats{T} step_indices::Vector...
e5e99323e75f777d9a3bd4b7f81be107a2586528f3ddd12e05edb9ba7d6ce4af
Julia
23,464
619
@testset "Immediate thermostat" begin n_atoms = 100 n_steps = 10_000 temp = 10.0u"K" boundary = CubicBoundary(4.0u"nm") for AT in array_list sys = System( atoms=to_device([Atom(mass=10.0u"g/mol", σ=0.04u"nm", ϵ=0.1u"kJ * mol^-1") for _ in 1:n_atoms],...
dbd6d43d48028c48fa167ab20f048e29a94e6a9b2aeaceca87a523efd42f8457
Julia
24,266
660
export DistanceConstraint, AngleConstraint, apply_position_constraints!, apply_velocity_constraints!, check_position_constraints, check_velocity_constraints, check_constraints # Split `n_items` constraints or clusters over at most `n_threads` chunks on CPU # The ranges are contiguous rather...
2a4e8a4769522d8aa9af5664e7c9347ee3b1163eba01c8c4d4ba983eaac17ef6
Julia
25,623
578
# Energy calculation export total_energy, kinetic_energy_tensor, kinetic_energy, virial, scalar_virial, temperature, potential_energy, pairwise_pe """ total_energy(system, neighbors=find_neighbors(sys), step_n=0, buffers=nothing; n_threads=Threads.nthreads(), pairw...
9aacc3f8538871ee2cbe43cd57bd56966f5da5f92e415224b837b5f91b8b8cf9
Julia
26,590
655
tss_step_wrapper(sys, neighbors, step_n, buffers; kwargs...) = step_n tss_step_logger() = (step=GeneralObservableLogger(tss_step_wrapper, Int, 1),) function make_tss_thermo_states(; n_atoms=6, n_states=3) atom_mass = 10.0u"g/mol" boundary = CubicBoundary(2.0u"nm") coords = place_atoms(n_atoms, boundary; mi...
646237c2c950bf97ac8e0ac0c007c55a8b8634175dd8f7c62ba5f3d71f3ac7ca
Julia
27,062
677
@testset "GPU Consistency" begin if run_cuda_tests @testset "33-atom (No Cancellation)" begin n_atoms = 33 D = 3 T = Float64 coords = [SVector{D, T}(0.5 * i, 0.5 * i, 0.5 * i) for i in 1:n_atoms] boundary = CubicBoundary(T(20.0), T(20.0), T(20.0)) ...
61bdf63c9e0ee2b7585d56021fb0e1510f1f581cc1df3b4ed14a1e044f04a10e
Julia
27,466
633
@testset "Amber OpenMM protein comparison" begin ff = MolecularForceField(joinpath.(ff_dir, ["ff99SBildn.xml", "tip3p_standard.xml"])...) show(devnull, ff) pme_mesh_dims = (46, 46, 51) sys = System( joinpath(data_dir, "6mrr_equil.pdb"), ff; nonbonded_method=SetupCoulombReactionFi...
dbb5db460342b14b8a5227b1b9035e109ea8e7adedf71beaf7bec6a892e8d19d
Julia
28,501
509
# Static analysis of the main code paths with JET # Error analysis (test_call) is run on every entry point here. Optimization analysis # (test_opt) is only run where it can be clean, which is the analysis, spatial and # thermostat code: forces! and potential_energy deliberately use function barriers, since # Val...
ef30161e8d9afb23623c07e2984b26e214ff13101b88bbafed52658fa3a3cde3
Julia
29,589
861
# Calculate collective variables export CalcMinDist, CalcMaxDist, CalcCMDist, CalcSingleDist, CalcDist, calculate_cv, cv_gradient, CalcRg, CalcRMSD, CalcTorsion # Does not account for periodic boundary conditions, assumes appropriate unwrapping function center_of_mass(coords, a...
548e4fd7f94d591018dc4999a9d8fbb6bcfefb0fe15d8c667d58f080b4eaa30b
Julia
30,982
957
export LennardJones, LJDispersionCorrection, LennardJonesSoftCoreBeutler, LennardJonesSoftCoreGapsys, AshbaughHatch @doc raw""" LennardJones(; cutoff, use_neighbors, shortcut, σ_mixing, ϵ_mixing, weight_special) The Lennard-Jones 6-12 interaction between two atoms. The potential energy is def...
87a0a19178f59037eae19749b4c465e8c20ebda7e3e10d67cab0454196281007
Julia
33,830
966
struct TSSWindow index::Int state_indices::Vector{Int} evaluation_state_indices::Vector{Int} function TSSWindow(index::Integer, state_indices; evaluation_state_indices = state_indices, check_contiguous::Bool = true) if !(index > 0) throw(...
ff24ec202f41b4c86b33031abbe85bdd48b27613eb72031f69ad1ec6a8249b8a
Julia
34,384
923
simulation_step_wrapper(sys, neighbors, step_n, buffers; kwargs...) = step_n mutable struct StepTrackingCoupler n_steps::Int history::Vector{Int} end StepTrackingCoupler(n_steps::Integer) = StepTrackingCoupler(Int(n_steps), Int[]) function Molly.apply_coupling!(sys, buffers, coupler::StepTrackingCoupler, sim...
21b101f83aa09d7bfb44fb1cc3c4c894a6dc3c0bbbbdc5371a8dc14973be7bee
Julia
35,267
740
# ML potential tests, reference data is generated by test/reference/torchani_reference.py # Small reference data (committed); the model weights ani2x.h5 and the large 6mrr_ani2x.json # come from the lazily-downloaded ANI-2x artifact. const REF_DIR = joinpath(@__DIR__, "..", "data", "ani_reference") const ANI_DIR = Mol...
7725b3116439f8e8e50a61d3087d88c2714ba2182309b935c81110700ee91572
Julia
35,676
1,022
export assemble_mbar_inputs, iterate_mbar, mbar_weights, mbar_pmf, pmf_with_uncertainty const LOG_PREVFLOAT0 = log(nextfloat(0.0)) # ≈ -744 const LOG_FLOATMAX = log(floatmax(Float64)) # ≈ 709 # Evaluate potential energy for a state i on a frame (coords, boundary) @inline function calc_energy!...
222320d2fb02ec4ccd2b842f1097dd41184f8a9e043faa21d7ec601f5fa5acee
Julia
36,689
964
function windowed_tss_coupling(state::TSSState) if isnothing(state.coupling) throw(ArgumentError("global TSS visit control is not enabled for this TSSState.")) end return state.coupling end function validate_windowed_tss_coupling_params(::Type{FT}; to...
4845a498f6fb4262d3c1cac83a3a05e8d5a96d2b2b922d1db8cc4003abb762be
Julia
36,928
958
# Neighbor finders export use_neighbors, NoNeighborFinder, find_neighbors, GPUNeighborFinder, DistanceNeighborFinder, TreeNeighborFinder, CellListMapNeighborFinder """ use_neighbors(inter) Whether a pairwise interaction uses the neighbor list, default `false`. Custom pairwise interac...
2bf7802a2eabe6f17978c4a6283f42f3adeaf5358d4c446569ced97eee7ef666
Julia
39,053
826
# KernelAbstractions.jl kernels, CUDA kernels are in an extension kernel_maybe_velocity(velocities, i) = velocities[i] kernel_maybe_velocity(::Nothing, i) = nothing @inline function sum_pairwise_forces_gpu(inters::Tuple{T}, dr, atom_i, atom_j, ::Val{F}, special, coord_i, coord...
8fd3e849cda75fd484128e1551af8545ebe37bb335c928cb0ce958e19798f15e
Julia
40,566
1,065
function log_windowed_tss_stats!( stats::WindowedTSSStats{FT}, state::TSSState{FT}, update_window::Int, visited_state::Int, next_state::Int, max_delta_f::FT; replica_indices = [1], replica_update_windows = [update_window], replica_visited_states = [visited_state], replica_sampled...
86e0e3809bc5f3bdbaebe9de9da88d7487823c909acf86e0497db403170324a6
Julia
42,946
1,014
const temp_fp_dcd = tempname(cleanup=true) * ".dcd" const temp_fp_trr = tempname(cleanup=true) * ".trr" const temp_fp_pdb = tempname(cleanup=true) * ".pdb" const temp_fp_xyz = tempname(cleanup=true) * ".xyz" const temp_fp_mol2 = tempname(cleanup=true) * ".mol2" const temp_fp_mp4 = tempname(cleanup=true) * ".mp4" ...
1b00b241202c45f83adce3eb5e0596226ce90f5f00c4aa9cbbb7d8747844c570
Julia
43,344
1,094
# Temperature and pressure coupling methods export apply_coupling!, ImmediateThermostat, VelocityRescaleThermostat, AndersenThermostat, BerendsenThermostat, BerendsenBarostat, CRescaleBarostat, MonteCarloBarostat """ apply_coupling!(system, buffers, coupling, simulator, neighbors=n...
513541fc30b26f40bdf22ee7ebf863c34ecb60ef59c5c9b713131d03e8ddf5a2
Julia
44,858
1,159
# Deal with residues # Struct to carry the information necessary to represent the residue templates # defined in the force field XML files struct ResidueTemplate{T, IC} name::String atoms::Vector{String} elements::Vector{Symbol} types::Vector{String} virtual_sites::Vector{VirtualSiteTemplate{T, I...
87e121041c223a26535a7db087da73bf605d638dc18aab2a867b2d452947c8ed
Julia
44,971
1,123
@testset "Virial correctness" begin FT = Float64 AT = Array function potential_deformation(sys, neighbors, q) T = eltype(q) z, o = zero(T), one(T) F = @SMatrix [ o + q[1] q[4] q[5]; z o + q[2] q[6]; z z o + q[3] ...
e2dea87e23165622a8b1a1426bb6a7f85a6278af01409fda78424a263cc8863e
Julia
48,057
1,355
# Spatial calculations export CubicBoundary, RectangularBoundary, TriclinicBoundary, volume, density, box_center, scale_boundary, random_coord, vector_1D, vector, wrap_coord_1D, wrap_coords, random_velocity, maxwell_boltzmann, random_velocities, random_ve...
7c118d3b2f5f8349132200c00695cba885a2cd52441189ca20b8e6bb8193c6bc
Julia
49,162
1,274
# Loggers to record properties throughout a simulation export apply_loggers!, GeneralObservableLogger, values, log_property!, logger_virial_interval, logger_pressure_interval, TemperatureLogger, CoordinatesLogger, BoxLogger, VelocitiesLogger, TotalEnergyLogger, KineticEn...
75ecb040963801722acdd6a25e0200708d510267c3f8d20aea1faf586f5ede91
Julia
52,869
1,420
export LINCS, SetupLINCS # Internal types for LINCS algorithm struct LincsCouplingMatrix{R, N, C} range::R # length K+1, row pointers (CSR format) neighbors::N # coupled constraint indices coef::C # mass-weighted coupling coefficients end struct LincsCouplingDense{CI, CC, NC} c...
b543133282d22538db0f4cfae2b4ee4b79e1acca0ffc5928e448797e5f56cda1
Julia
57,506
1,401
export SHAKE_RATTLE, SetupSHAKE_RATTLE """ SHAKE_RATTLE(; n_atoms, dist_tolerance=1e-8u"nm", vel_tolerance=1e-8u"nm^2 * ps^-1", dist_constraints=nothing, angle_constraints=nothing, gpu_block_size=128, max_iters=25, strictness=:warn) Constrain distances during a simulation...
15598e0c4139ff08511d4b446de0cc8f47535dfc161087c6be13648b455c974e
Julia
58,518
1,331
# See https://arxiv.org/pdf/1401.1181.pdf for applying forces to atoms # See OpenMM documentation and Gromacs manual for other aspects of forces export accelerations, force, pairwise_force, SpecificForce1Atoms, SpecificForce2Atoms, SpecificForce3Atoms, SpecificForce4Atoms, SpecificForce...
4cba9a45fa366d912a8249c1e0cee85aeecbc87c52f306e166972985d3a18ff6
Julia
58,722
1,410
# Long range electrostatic summation methods # Based on the OpenMM source code import Base: ==, hash export Ewald, SetupEwald, PME, SetupPME, EwaldExclusion abstract type AbstractEwald end const default_ewald_error_tol = 0.0005 AtomsCalculators.@generate_interface function AtomsCalculators.poten...
493146a37b36d65e515115def3b05745b2517883d33ec43ac743a5e0a9248ca9
Julia
59,897
1,324
# Read in a force field export MolecularForceField struct ForceFieldXMLError <: Exception msg::String end Base.showerror(io::IO, e::ForceFieldXMLError) = print(io, "ForceFieldXMLError: ", e.msg) @enum SpecKind::UInt8 WILD=0 TYPE=1 CLASS=2 struct AtomPattern kind::SpecKind val::String end function ...
60d65a6befd7aab781a240e4c80735ab7d17ed428866c7bc54be917e0d0a3b0f
Julia
63,028
1,483
@testset "Spatial" begin @test vector_1D(4.0, 6.0, 10.0) == 2.0 @test vector_1D(1.0, 9.0, 10.0) == -2.0 @test vector_1D(6.0, 4.0, 10.0) == -2.0 @test vector_1D(9.0, 1.0, 10.0) == 2.0 @test vector_1D(4.0u"nm", 6.0u"nm", 10.0u"nm") == 2.0u"nm" @test vector_1D(1.0u"m" , 9.0u"m" , 10.0u"m" ) == ...
3c30832fde703c186a03294a613316cf92d345574d7b0e7b2272a3fce648a815
Julia
70,352
1,339
# Code for taking gradients with Enzyme # This file is only loaded when Enzyme is imported module MollyEnzymeExt using Molly using Enzyme using Enzyme.EnzymeCore.EnzymeRules: EnzymeRules, RevConfig, Annotation using FFTW using GPUArrays using KernelAbstractions const GPUArraysCore = GPUArrays.GPUArraysCore function...
eb43097f7e948404d465fb5f7eb5d2afec2859534e21a93a9873497be3cba2b7
Julia
70,397
2,105
export Coulomb, CoulombScaled, CoulombSoftCoreBeutler, CoulombSoftCoreGapsys, CoulombReactionField, SetupCoulombReactionField, CoulombReactionFieldScaled, CoulombSoftCoreBeutlerReactionField, CoulombSoftCoreGapsysReactionField, CoulombEwald, CoulombEwaldScaled, CoulombSof...
e10f3cb1ce509da356af4877f4b4579f99e2fba81712e70d740d8c4c55a688cf
Julia
72,821
1,891
# Allocation measurements are made through this so that the call is cleanly inferred, # rather than from the `@testset` scope where the arguments are captured locals function apply_constraints_n_threads!(sys, coords_ref, n_threads) apply_position_constraints!(sys, coords_ref; n_threads=n_threads) apply_velocity...
ed9f571b1735cc553a95a509ae864f6694df64c59b5312f4971edefe1caef331
Julia
76,777
1,800
# Read files to set up a system # See OpenMM source code export place_atoms, place_diatomics, is_any_atom, is_heavy_atom, add_position_restraints """ place_atoms(n_atoms, boundary; min_dist=nothing, max_attempts=100, rng=Random.default_rng()) Generate random coordinates. Obtain `n_atoms` coo...
53ab8905840b87f52af05a370190afe633c92d2e84d1dc32c37f5f6f949aac80
Julia
83,117
1,835
# Implicit solvent models # Based on the OpenMM source code export ImplicitSolventOBC, SetupImplicitSolventOBC, ImplicitSolventGBN2, SetupImplicitSolventGBN2 # Generalized Born (GB) implicit solvent models augmented with the # hydrophobic solvent accessible surface area (SA) term # Custom GBSA metho...
d0d19abc8313158804875318fbb038bce0bf704421b2e1261ee711a20e68e0ce
Julia
86,008
1,817
# ANI (and future ML potential) support via Lux.jl + HDF5.jl # Loaded when both Lux and HDF5 are in the user environment. # # =========================================================================== # How ANI works (and where each equation lives in this file) # =======================================================...
b6c9468fc4ccd17225e5fc803b60c8970ba44caf30d48034d1f0b6b188339f99
Julia
86,846
2,212
# Types import Base: ==, hash export PairwiseInteraction, InteractionList1Atoms, InteractionList2Atoms, InteractionList3Atoms, InteractionList4Atoms, InteractionList5Atoms, Atom, mass, charge, AtomData, MolecularTopology, NeighborList, System, ThermoState, Re...
a4e964e71d448839ca658896eef2ae11529cc669ac2916c6e85aaa34c528e0c6
Julia
86,875
2,059
@testset "Interactions" begin c1 = SVector(1.0, 1.0, 1.0)u"nm" c2 = SVector(1.3, 1.0, 1.0)u"nm" c3 = SVector(1.4, 1.0, 1.0)u"nm" c4 = SVector(1.1, 1.0, 1.0)u"nm" a1 = Atom(atom_type=1, charge=1.0, σ=0.3u"nm", ϵ=0.2u"kJ * mol^-1", λ=1.0) a2 = Atom(atom_type=2, charge=1.0, σ=0.2u"nm", ϵ=0.1u"kJ * ...
387c716fda3f111367db0f973cead45d1ca640491d2a245cca667a37981fe9be
Julia
112,824
2,429
# Different ways to simulate molecules export SteepestDescentMinimizer, simulate!, VelocityVerlet, DPDVelocityVerlet, Verlet, StormerVerlet, Langevin, LangevinSplitting, OverdampedLangevin, NoseHoover, MTSIntegrator, MTSLangevinIntegrator, ReplicaExchangeMD, simu...
bc1d2ef1dab99a94b7564f741eab95b26e8dff128178bf6ac579c75f0a536cc8
Julia
114,120
2,839
""" MollyCUDAExt CUDA extension for Molly.jl. This module provides highly optimized CUDA kernels for pairwise force and energy calculations, utilizing warp-level primitives, Morton ordering for spatial locality, and a tiled preprocessing pipeline. The pipeline generally follows these steps: 1. **Reordering**: At...
9472f3f323363ba61a08e4c2ed602b36ac6ec2675f9a79fff1ff118608b1b925
Julia
198,348
4,081
# Train Garnet model to assign force field parameters # Runs multithreaded on CPU, spawns training simulations after a few epochs to run on GPU # See https://github.com/greener-group/garnet/tree/main/training for how to run this script # Change submit_training_sims to launch an appropriate job on your system # License ...
11ef874a170ebab0532bc7f9f6854ab59ba3c89d2ecb2ef9f88ea146643e289e
Jupyter
239
10
# %% #select branch from dataset and go inside dataSet=STEDdata['5wk'] name='dendrite38-1' #plot_dsc(dataSet) file_path = dataSet[name]['path'] dataSet[name] = branch_dsc(file_path, dataSet[name]['res'], dataSet[name]['ex_factor'])
d58abe487c7124913632170d565a05fccae0e2936d242987e54723abd3a39363
Jupyter
556
28
# %% %load_ext autoreload %autoreload 2 # %% from data import dataloaders trainloader,valloader,testloader = dataloaders( modalities=['lab','cxr','med','ecg'] ) # %% sample = trainloader.dataset[0] # %% import numpy as np import matplotlib.pyplot as plt fig, axs = plt.subplots(1,4) axs[0].imshow(np.einsum('chw-...
9f45cb43c05769420dae717fa1c39ad0c0d81725454ef79ee57538bdb06c0971
Jupyter
777
46
# %% from iehm import * import glob # %% # Get project root import os from pathlib import Path # Go up from notebook to project root notebook_dir = Path().resolve() project_root = notebook_dir.parent # Define test data path data_dir = project_root / "data" / "test" # get all .lsm files in directory files = glob.gl...
77a3b1205176c63afac09b1db5729dbf6118bd555bb3be84257fba6930a5f5a5
Jupyter
934
36
# %% [markdown] # ## Activation # %% from chemprop.nn.utils import Activation # %% [markdown] # ### Activation functions # # The following activation functions can be specified by name (e.g., `activation = "relu"`): # %% for activation in Activation: print(activation) # %% from chemprop.nn import AtomMessagePa...
f6fa5cefde053dd900a872ae1891e0e55bff8913e21163437c6b2a2b0790a280
Jupyter
990
53
# %% [markdown] # # Clustering # %% import scanpy as sc sc.settings.verbosity = 0 sc.settings.set_figure_params(dpi=80, facecolor="white", frameon=False) # %% #Change working Directory import os os.chdir('/Users/veronica/Desktop/CSTB_Analysis/') # %% #Load the data adata = sc.read_h5ad('02_Results/CSTB_dimension...
ce12d933336dade5dd3a5e01c952db2b2f1c452cb149279e30e0558642247643
Jupyter
1,012
34
# %% import pickle import pandas as pd import sys from pathlib import Path NOTEBOOK_DIR = Path().resolve() PROJECT_ROOT = NOTEBOOK_DIR.parent # Mapping_Recurrent_Inhibition/ if str(PROJECT_ROOT) not in sys.path: sys.path.append(str(PROJECT_ROOT)) # Import from other files in the project from simulator import ( ...
b58d15c00bfc9c6befc2c298f69b149465ac8f114a4d5dbd3bb527d0184ca428
Jupyter
1,228
59
# %% #default_exp stats.coverage # %% [markdown] # # stats.coverage # # > A submodule for computing statistics and making estimates related to read coverage # %% #export import numpy import scipy from matplotlib import pyplot import seaborn import pandas as pd import pyfastx import pyfaidx from tqdm import tqdm impo...
a1f23162c7d7b5b0225e7e976ec383b037bf66675671279c8fa275b735d37131
Jupyter
1,281
46
# %% [markdown] # ## Ensembling # %% from lightning import pytorch as pl import numpy as np import torch from chemprop import data, models, nn # %% [markdown] # This is an example [dataloader](./data/dataloaders.ipynb). # %% smis = ["C" * i for i in range(1, 4)] ys = np.random.rand(len(smis), 1) dset = data.Molecule...
7a6daaf1cef075bc6a94e753b3e5db62cbfa2bb4b983305684893979877951cb
Jupyter
1,307
41
# %% [markdown] # This example implements the first model from "Modeling civil violence: An agent-based computational approach," by Joshua Epstein. The paper (pdf) can be found [here](http://www.uvm.edu/~pdodds/files/papers/others/2002/epstein2002a.pdf). # # The model consists of two types of agents: "Citizens" (call...
485df5206815e4b34cf092d094fa44c414e133cb6fd578cb8e2edf9f2c42bfca
Jupyter
1,331
47
# %% import os import numpy as np import pandas as pd import anndata as ad import numpy as np import scanpy as sc import time import glob import matplotlib.pyplot as plt import scvelo as scv from TSvelo.TSvelo_utils import project_t, get_colors_step_subs, analyze_g_subs, analyze_g dataset_name = 'dentategyrus' save_f...
95f0c452ef6d7456258b456c64291a95763460d3a4ccde4be9ffd0a0d2958dbb
Jupyter
1,398
44
# %% [markdown] # # Running Pangolin on Colab # %% [markdown] # 0. By default, Colab will not use a GPU. To use a GPU, choose: Runtime -> Change runtime type -> GPU. # %% [markdown] # 1. Install Pangolin and dependencies # %% !pip install pyvcf gffutils biopython pandas pyfastx !git clone https://github.com/tkzeng...
b8c61ceb1b3559a40c5f7a6462b11a9f63741fa4454d3b1c774971f35ea91436
Jupyter
1,520
78
# %% [markdown] # # Feature selection # %% import scanpy as sc import anndata2ri import logging import matplotlib.pyplot as plt import numpy as np import seaborn as sns import rpy2.rinterface_lib.callbacks as rcb import rpy2.robjects as ro sc.settings.verbosity = 0 sc.settings.set_figure_params( dpi=80, face...
8c3c225ecb5ce644f4dcc6ba8cc9daa6063b8f290deadae1c6c50309acd4c4eb
Jupyter
1,577
57
# %% import sys import matplotlib.pyplot as plt import seaborn as sns import pandas as pd from tqdm import tqdm ###changes default of autoreloader to continually reload (2) rather than only on restart ####good for debuggin but does slow code as it is continully reloading modules %load_ext autoreload %autoreload 2 #...
6b24758325d61cc16d1360e3d32a98dc0054a4dcd326dbdd889e528372c11ce3
Jupyter
1,682
68
# %% [markdown] # ## Bond featurizers # %% from chemprop.featurizers.bond import MultiHotBondFeaturizer # %% [markdown] # This is an example bond to featurize. # %% from rdkit import Chem bond_to_featurize = Chem.MolFromSmiles("CC").GetBondBetweenAtoms(0, 1) # %% [markdown] # ### Bond features # %% [markdown] # T...
fea844c076d1ead245b883af0238f83c0e120ecc6bbc2d30994ec76546d21158
Jupyter
1,695
51
# %% import numpy as np import skimage.io import h5py import matplotlib.pyplot as plt from tqdm.auto import tqdm # %% # Load image and set kernel size and stride to match from simulations image = skimage.io.imread("CL.bmp")/255 image = image.astype(int) H_full, W_full = image.shape H_kernel, W_kernel = 8, 8 H_stride,...
177307145b81bd6124cec486241a7ce3a88786ff3a03d590e3d745e40aa18215
Jupyter
1,718
91
# %% [markdown] # # Dimensionality Reduction # %% import scanpy as sc sc.settings.verbosity = 0 sc.settings.set_figure_params( dpi=80, facecolor="white", frameon=False, ) # %% #Change working Directory import os os.chdir('/Users/veronica/Desktop/CSTB_Analysis/') # %% #Load the data adata = sc.read_h5...
90f4214c2ddc49b6f1891da7ac528052a246df8401872e73d7b6a8ad704d4287
Jupyter
1,789
50
# %% import pymaid import navis as nv import matplotlib.pyplot as plt from mpl_toolkits.axes_grid1.anchored_artists import AnchoredSizeBar import matplotlib.axes as axx import matplotlib.font_manager as fm fontprops = fm.FontProperties(size=18) import time from navis.interfaces import neuprint as nvneu from neuroboom i...
436365c7f7bb072dc952cbb46acb9e98bbe3a7016351096a07c4fb49041519c4
Jupyter
1,791
66
# %% # Compute global stats for intensity normalization import os import numpy as np import nibabel as nib import matplotlib.pyplot as plt from tqdm.notebook import tqdm PATH = "/path/to/AbdomenCT-1K/" ID_FILE = "/path/to/train_ids.txt" OUT_FILE = "/path/to/intensity_stats.csv" # %% # Foreground voxels i_vals_fg = [...