Closed lacoperon closed 6 years ago
CRYST1
field, the box information won't show up.
Below example shows that the box information is still preserved.
(Basically the box
define the unitcell in your explicit water simulation).In [8]: traj = pt.load('tz2.ortho.nc', 'tz2.ortho.parm7')[:1]
In [9]: traj
Out[9]:
pytraj.Trajectory, 1 frames:
Size: 0.000118 (GB)
<Topology: 5293 atoms, 1704 residues, 1692 mols, PBC with box type = ortho>
In [10]: traj.save("hey.pdb")
In [12]: pt.load('hey.pdb')
Out[12]:
pytraj.Trajectory, 1 frames:
Size: 0.000118 (GB)
<Topology: 5293 atoms, 1704 residues, 1692 mols, PBC with box type = ortho>
traj.unitcells = an_array
with shape of (n_frames, 6)
and update the topology traj.top = some_topology
.Any help therein would be greatly appreciated.
I might help if you let me know your specific question here or a specific example. Cheers.
Another example about unitcell
In [31]: traj
Out[31]:
pytraj.Trajectory, 1 frames:
Size: 0.000118 (GB)
<Topology: 5293 atoms, 1704 residues, 1692 mols, non-PBC>
In [32]: traj.top.box = pt.core.Box([39.455974, 46.821517, 40.469541, 90.0, 90.0, 90.0])
In [33]: traj
Out[33]:
pytraj.Trajectory, 1 frames:
Size: 0.000118 (GB)
<Topology: 5293 atoms, 1704 residues, 1692 mols, PBC with box type = ortho>
Truncated box
In [35]: top = pt.load_topology('tz2.truncoct.parm7')
In [36]: top.box
Out[36]: <Box: truncoct, (x, y, z, alpha, beta, gamma) = (44.8903851, 44.8903851, 44.8903851, 109.471219, 109.471219, 109.471219)>
# convert to ortho-box
top.box = pt.core.Box([39.455974, 46.821517, 40.469541, 90.0, 90.0, 90.0])
In [40]: top
Out[40]: <Topology: 5827 atoms, 1882 residues, 1870 mols, PBC with box type = ortho>
Note: I'm trying to concatenate the trajectories so I can project the resulting combined trajectory using eigenvalues and eigenvectors obtained from the PCA function.
One of the easy ways is to combine numpy array then reassign the traj.xyz
traj.xyz = xyz # :D
Much appreciated!!! Apologies for the delay in responding.
thanks.
Hi there,
I was wondering how one would convert between box types within pytraj.
For example, I loaded in an AMBER trajectory, whose trajectory description is:
Whereas when I load in a PDB file, I get a description
What exactly does the difference between
PBC with box type = truncoct
andnon-PBC
correspond to?Note: I'm trying to concatenate the trajectories so I can project the resulting combined trajectory using eigenvalues and eigenvectors obtained from the PCA function. But, I can't do this unless I can align the PDB structure to the AMBER trajectory, which I can't do in pytraj without them being combined. Any help therein would be greatly appreciated.
Thanks