def segment_by_xyzFormat(self, Path_to_xyz_format:str):
     from MDAnalysis.coordinates.XYZ import XYZReader
     rd = XYZReader(Path_to_xyz_format)
     Structs = np.zeros((rd.n_frames,rd.n_atoms,3))
     for idx, ts in enumerate(rd.trajectory):
         tmp = ts.positions
         Structs[idx,:,:] = tmp
     PredLabels, ProtG = run_Alg(Structs,'Name',self.AA_cutoff_neighborhood,self.init_membership,
                          self.merging_threshold, self.rigidity_threshold)
     self.ProteinGraph = ProtG
     return PredLabels
Beispiel #2
0
from MDAnalysis.analysis.rms import rmsd
from MDAnalysis.coordinates.XYZ import XYZReader
import matplotlib.pyplot as plt

xyz = XYZReader(
    '/home/jinho93/slab/LAO/grimes/nvt/300k/dense/frame2/final.xyz')
xyz2 = XYZReader('/home/jinho93/slab/LAO/grimes/nvt/600k/final/lao.xyz')
arr = []
arr2 = []
index = []
for i, j in enumerate(xyz[0].positions.copy()):
    if j[2] > 20:
        index.append(i)
for i in range(xyz.n_frames):
    arr.append(
        rmsd(xyz[0].positions.copy()[index[0]:index[-1]],
             xyz[i].positions.copy()[index[0]:index[-1]]))

for i in range(xyz2.n_frames):
    arr2.append(
        rmsd(xyz2[0].positions.copy()[index[0]:index[-1]],
             xyz2[i].positions.copy()[index[0]:index[-1]]))

fig = plt.Figure()
fig.add_subplot(211)
plt.plot(arr)
fig.add_subplot(212)
plt.plot(arr2)
plt.show()
Beispiel #3
0
#%%

import os
from MDAnalysis.analysis.rms import rmsd
from MDAnalysis.coordinates.XYZ import XYZReader
from MDAnalysis.coordinates.base import Timestep
import matplotlib.pyplot as plt
# os.chdir('/home/jinho93/oxides/wurtzite/zno/cp2k/1.aimd/3.16A/30/3.fix')
os.chdir(
    '/home/jinho93/new/oxides/perobskite/lanthanum-aluminate/slab/gulp/nonstochio/La-vac/one'
)

xyz = XYZReader('lao-one.xyz')
xyz2 = XYZReader('../zero/lao.xyz')

xyz3 = XYZReader(
    '/home/jinho93/oxides/perobskite/lanthanum-aluminate/slab/gulp/nonstochio/La-vac/two/lao.xyz'
)

arr = []
arr2 = []
arr3 = []
index = []
index2 = []
index3 = []

for i, j in enumerate(xyz[0].positions.copy()):
    if 36 < j[2] and j[0] % 1.9 < 0.1:
        index.append(i)

for i in range(xyz.n_frames):
Beispiel #4
0
#%%

from MDAnalysis.analysis.rms import rmsd
from MDAnalysis.coordinates.XYZ import XYZReader
import matplotlib.pyplot as plt
# os.chdir('/home/jinho93/oxides/wurtzite/zno/cp2k/1.aimd/3.16A/30/3.fix')
os.chdir(
    '/home/jinho93/new/oxides/perobskite/lanthanum-aluminate/slab/gulp/nonstochio/La-vac/zero'
)

xyz = XYZReader('lao.xyz')
arr = []
arr2 = []
arr3 = []
arr4 = []
index = []
index2 = []
index3 = []
for i, j in enumerate(xyz[0].positions.copy()):
    if i < 300:
        continue
    if 12 < j[2] < 17:
        index.append(i)
    elif 17 < j[2] < 19:
        index2.append(i)
    elif 19 < j[2] > 21:
        index3.append(i)
for i in range(xyz.n_frames):
    arr.append(
        rmsd(xyz[0].positions.copy()[index[0]:index[-1]],
             xyz[i].positions.copy()[index[0]:index[-1]]))
# python this.py input.xyz boxsize hb_corr.dat
import MDAnalysis as mda
from MDAnalysis.coordinates.XYZ import XYZReader
from sys import argv
from autocorrelate import *
from time import time

rcut = 3.5  # in angstrom
acut = 30  # in degree

# read xyz and gather some basic info
xyz = XYZReader(argv[1])
box = float(argv[2])
box = np.array([box] * 3)
natoms = xyz.n_atoms
assert natoms % 3 == 0
nwat = natoms // 3
types = list()
with open(xyz.filename) as f:
    for i, l in enumerate(f):
        if i < 2:
            continue
        if i == natoms + 2:
            break
        types.append(l.split()[0])
types = np.array(types)
print(f"{nwat} waters read")
oindexes = np.where(types == 'O')[0]
hindexes = np.where(types == 'H')[0]
N_O = len(oindexes)
N_H = len(hindexes)
Beispiel #6
0
from MDAnalysis.coordinates.DCD import DCDReader
from MDAnalysis.coordinates.XYZ import XYZReader
from MDAnalysis.analysis.rms import RMSD
from MDAnalysis.core.universe import Universe, AtomGroup, Atom
from MDAnalysis.tests.datafiles import PSF, DCD
from MDAnalysis.coordinates.PDB import PDBReader
dcd = DCDReader('/home/jinho93/slab/LAO/grimes/opt/test/lao.dcd')
xyz = XYZReader('/home/jinho93/slab/LAO/grimes/opt/test/lao.xyz')
Universe(xyz)
for ts in dcd.trajectory:
    print(ts.forces)

    #print(f"Frame: {ts.frame:5d}, Time: {ts.time:8.3f} ps {dir(ts)}")