freenet is a Python package to cluster molecular dynamics trajectories into discrete states and calculate the free energy surface (FES) based on the resulting states. It is designed to provide tools for understanding conformational landscapes, equilibrium probabilities, and transition state free energies.
The free energy surface (FES) of a biomolecule encodes its structural and dynamical properties. To derive the FES from molecular dynamics (MD) simulations, the trajectory is discretized into microstates by clustering in a suitable metric space (e.g., DRID). Each state corresponds to a free-energy minimum.
The free energy of state
where
Transition state free energies between minima
where
This framework ensures that the equilibrium distribution and kinetic rates are faithfully reproduced on the network level.
Install directly into your environment
pip install git+https://github.com/MoSchaeffler/freeEnergyCalculation@main#egg=freenetor clone the repository and install with pip:
git clone https://github.com/MoSchaeffler/freeEnergyCalculation.git
cd freenet
pip install .Dependencies include:
- numpy
- networkx
- deeptime
- MDAnalysis
- PyYAML
Clusters trajectories into discrete states and builds the transition matrix. Trajectories are expected to be numpy arrays of size (n_frames, n_features) or (n_frames, n_features, n_dim).
Parameters:
prefix(str): Prefix of input trajectory *npy files.directory(str, default"./"): Path to data directory.cutoff(float, default0.02): Minimum distance cutoff for clustering.max_centers(int, default2000): Maximum number of clusters.outname(str, optional): Output file name for transition matrix.verbose(bool, defaultFalse): Print details if True.
Returns:
Transition matrix as a NumPy array.
Computes equilibrium and branching probabilities.
Parameters:
tm(np.array): Transition matrix.remove(bool, defaultTrue): Remove non-bidirectional transitions and disconnected states.save(bool, defaultFalse): Save results to file.sysname(str, default"system"): Prefix for saved files.
Returns:
state_probabilities: Equilibrium probabilities of minima.probability_matrix: Transition probability matrix.
Calculates free energies and transition states.
Initialization Parameters:
equiProb(array): Equilibrium probabilities.probMatrix(array): Transition probability matrix.temperature(float, default300): Temperature in Kelvin.timescale(float, default100e-12): Time between MD frames (s).
Main Methods:
run(mts=False, stateDictionary=None): Execute workflow, write minima and transition state files.checkData(prob, trans): Validate probability normalization.rateMatrix(probMatrix, timescale): Compute continuous-time rate matrix.freeEenergy(K, prob, T): Compute free energies of minima and barriers.effectiveBarrier(...): Compute symmetrized effective barriers.
A typical workflow:
import freenet as fn
# Step 1: Cluster trajectories
M = fn.clusterStates(prefix="traj", directory="./data/", cutoff=0.02, verbose=True)
# Step 2: Calculate equilibrium and branching probabilities
peq, probM = fn.calcProbabilities(M, remove=True, save=True, sysname="mySystem")
# Step 3: Compute free energies
energy = fn.getEnergy(peq, probM, temperature=300, timescale=100e-12)
energy.run(mts=True)This produces min.data, ts.data, and related files suitable for disconnectivity graph analysis.
- Schäffler, M., Wales, D.J., Strodel, B. The energy landscape of Aβ42: a funnel to disorder for the monomer becomes a folding funnel for self-assembly. ChemComm, 2024.
- Krivov, S.V. & Karplus, M. Hidden complexity of free energy surfaces for peptide (protein) folding. J. Chem. Phys. 117, 10894 (2002).