From 30d823e3b11868925e17e0569930a99bfcefb0c3 Mon Sep 17 00:00:00 2001 From: Sebastian Kloth Date: Fri, 2 Feb 2024 13:28:53 +0100 Subject: [PATCH] Finished subset example --- examples/subsets.py | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 examples/subsets.py diff --git a/examples/subsets.py b/examples/subsets.py new file mode 100644 index 0000000..6c90172 --- /dev/null +++ b/examples/subsets.py @@ -0,0 +1,25 @@ +import mdevaluate as md +import numpy as np + +path_to_sim = "/data/skloth/sim/IL_water/C4MIM_BF4_x50/T300_nvt" +trajectory = md.open(path_to_sim, topology="run.tpr", trajectory="out/traj_full.xtc") + +print(trajectory[0].atom_names) +print(trajectory[0].residue_names) + +print(np.unique(trajectory[0].atom_names)) +print(np.unique(trajectory[0].residue_names)) + +print(np.unique(trajectory[0].atom_names[trajectory[0].residue_names == "amim"])) +print(np.unique(trajectory[0].atom_names[trajectory[0].residue_names == "BF4"])) +print(np.unique(trajectory[0].atom_names[trajectory[0].residue_names == "SOL"])) + +carbon_atoms = trajectory.subset(atom_name="C") +hydrogen_atoms = trajectory.subset(atom_name="H") +cation_chain_end_atoms = trajectory.subset(atom_name="CT") + +cation_atoms = trajectory.subset(residue_name="amim") +anion_atoms = trajectory.subset(residue_name="BF4") +water_atoms = trajectory.subset(residue_name="SOL") + +hydrogen_water = trajectory.subset(atom_name="HW", residue_name="SOL")