%load_ext autoreload
%autoreload 2
import molsysmt as msm
import numpy as np
import matplotlib.pyplot as plt

Wrap to PBC#

molsys = msm.convert(msm.systems['two LJ particles']['traj_two_lj_particles.trjpk'],
                     to_form='molsysmt.StructuresDict')
for particle, coordinate in [(0, 0), (0, 1), (0, 2), (1, 0), (1, 1), (1, 2)]:
    plt.scatter(molsys['time'], molsys['coordinates'][:, particle, coordinate], s=1, color='gray', marker='.')
plt.show()
MOLSYSMT WARNING | UnitStrippedWarning: The unit of the quantity is stripped when downcasting to ndarray.
../../../../_images/b95e0ff297db64fbbd67bbdaf92b11624c5d780bf1e40198527fd297633bae9e.png
distance = msm.structure.get_distances(molsys, selection=0, selection_2=1, pbc=False)
plt.scatter(molsys['time'], distance[:,0,0], s=1, color='gray', marker='.')
plt.show()
../../../../_images/d0ea576c0dafa6720e77d8a00cdd3e12dda6a288a36a0bcf358dddeb4899a6c1.png
msm.get(molsys, box=True)
Magnitude
[[[3.0 0.0 0.0]  [0.0 3.0 0.0]  [0.0 0.0 3.0]] [[3.0 0.0 0.0]  [0.0 3.0 0.0]  [0.0 0.0 3.0]] [[3.0 0.0 0.0]  [0.0 3.0 0.0]  [0.0 0.0 3.0]] ... [[3.0 0.0 0.0]  [0.0 3.0 0.0]  [0.0 0.0 3.0]] [[3.0 0.0 0.0]  [0.0 3.0 0.0]  [0.0 0.0 3.0]] [[3.0 0.0 0.0]  [0.0 3.0 0.0]  [0.0 0.0 3.0]]]
Unitsnanometer
distance = msm.structure.get_distances(molsys, selection=0, selection_2=1, pbc=True)
plt.scatter(molsys['time'], distance[:,0,0], s=1, color='gray', marker='.')
plt.show()
../../../../_images/ad973fd012b3bff6fcb8998517a078b4e30935df4507b4fec073a1eb69133b8b.png
molsys_wrapped = msm.pbc.wrap_to_pbc(molsys)
for particle, coordinate in [(0, 0), (0, 1), (0, 2), (1, 0), (1, 1), (1, 2)]:
    plt.scatter(molsys_wrapped['time'], molsys_wrapped['coordinates'][:, particle, coordinate], s=1, color='grey', marker='.')
plt.show()
MOLSYSMT WARNING | UnitStrippedWarning: The unit of the quantity is stripped when downcasting to ndarray.
../../../../_images/f4e97896203a8a1c139ca8c10729e332922296f3463f1005aa84792e463c44dc.png
distance_wrapped = msm.structure.get_distances(molsys_wrapped, selection=0, selection_2=1, pbc=True)
np.allclose(distance[:,:,:], distance_wrapped[:,:,:])
True
molecular_system = msm.convert('pdb_id:1vii', to_form='molsysmt.MolSys')
molecular_system = msm.remove(molecular_system, selection='atom_type=="H"')
molecular_system = msm.build.add_missing_terminal_cappings(molecular_system, N_terminal='ACE', C_terminal='NME')
molecular_system = msm.build.add_missing_hydrogens(molecular_system, pH=7.4)
molecular_system = msm.build.solvate(molecular_system, box_shape='truncated octahedral',
                         clearance='14.0 angstroms', engine='PDBFixer')
molecular_system = msm.pbc.wrap_to_pbc(molecular_system, center_of_selection='molecule_type=="peptide"')
msm.view(molecular_system, standard=True, with_water_as='surface')