Skip to content

Commit e2cda7d

Browse files
committed
BUG: PR 4873 revisions
* Fixed an issue where `TPRReader` used `ts._velocities` instead of `ts.velocities` to assign the velocity array * Needed to improve the precision of the expected velocity values in `test_basic_read_tpr` after the above fix. * `TPR_xvf_2024_4` was missing from `__all__`, causing a test failure
1 parent 2f22fb5 commit e2cda7d

File tree

3 files changed

+47
-36
lines changed

3 files changed

+47
-36
lines changed

package/MDAnalysis/coordinates/TPR.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,6 @@ def _read_first_frame(self):
7272
self.ts._pos = np.asarray(tpr_utils.ndo_rvec(data, th.natoms),
7373
dtype=np.float32)
7474
if th.bV:
75-
self.ts._velocities = np.asarray(tpr_utils.ndo_rvec(data, th.natoms),
76-
dtype=np.float32)
75+
self.ts.velocities = np.asarray(tpr_utils.ndo_rvec(data, th.natoms),
76+
dtype=np.float32)
7777
self.ts.has_velocities = True

testsuite/MDAnalysisTests/coordinates/test_tpr.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,8 @@
4141
[3.19900e+00, 1.62970e+00, 1.54480e+00],
4242
[3.39350e+00, 3.49420e+00, 3.02400e+00],
4343
(19385, 3),
44-
[-2.06687e-01, 2.66782e-01, -1.05640e-01],
45-
[-3.38010e-02, -3.22064e-01, -1.98638e-01],
44+
[-0.20668714, 0.26678202, -0.10564042],
45+
[-3.38010e-02, -3.22064e-01, -1.9863836e-01],
4646
),
4747
(TPR2024, # tpx 133
4848
[3.25000e-01, 1.00400e+00, 1.03800e+00],

testsuite/MDAnalysisTests/datafiles.py

Lines changed: 43 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,7 @@
9696
"PDB_xvf",
9797
"TPR_xvf",
9898
"TRR_xvf", # Gromacs coords/veloc/forces (cobrotoxin, OPLS-AA, Gromacs 4.5.5 tpr)
99+
"TPR_xvf_2024_4",
99100
"H5MD_xvf", # TPR_xvf + TRR_xvf converted to h5md format
100101
"H5MD_energy", # H5MD trajectory with observables/atoms/energy
101102
"H5MD_malformed", # H5MD trajectory with malformed observable group
@@ -488,38 +489,48 @@
488489
PDB_CHECK_RIGHTHAND_PA = (_data_ref / "6msm.pdb.bz2").as_posix()
489490
FHIAIMS = (_data_ref / "fhiaims.in").as_posix()
490491

491-
GRO = (_data_ref / 'adk_oplsaa.gro').as_posix()
492-
GRO_velocity = (_data_ref / 'sample_velocity_file.gro').as_posix()
493-
GRO_incomplete_vels = (_data_ref / 'grovels.gro').as_posix()
494-
GRO_large = (_data_ref / 'bigbox.gro.bz2').as_posix()
495-
GRO_residwrap = (_data_ref / 'residwrap.gro').as_posix()
496-
GRO_residwrap_0base = (_data_ref / 'residwrap_0base.gro').as_posix()
497-
GRO_sameresid_diffresname = (_data_ref / 'sameresid_diffresname.gro').as_posix()
498-
PDB = (_data_ref / 'adk_oplsaa.pdb').as_posix()
499-
XTC = (_data_ref / 'adk_oplsaa.xtc').as_posix()
500-
TRR = (_data_ref / 'adk_oplsaa.trr').as_posix()
501-
TPR = (_data_ref / 'adk_oplsaa.tpr').as_posix()
502-
PDB_sub_dry = (_data_ref / 'cobrotoxin_dry_neutral_0.pdb').as_posix()
503-
TRR_sub_sol = (_data_ref / 'cobrotoxin.trr').as_posix()
504-
XTC_sub_sol = (_data_ref / 'cobrotoxin.xtc').as_posix()
505-
PDB_sub_sol = (_data_ref / 'cobrotoxin.pdb').as_posix()
506-
PDB_xlserial = (_data_ref / 'xl_serial.pdb').as_posix()
507-
GRO_MEMPROT = (_data_ref / 'analysis/YiiP_lipids.gro.gz').as_posix()
508-
XTC_MEMPROT = (_data_ref / 'analysis/YiiP_lipids.xtc').as_posix()
509-
XTC_multi_frame = (_data_ref / 'xtc_test_only_10_frame_10_atoms.xtc').as_posix()
510-
TRR_multi_frame = (_data_ref / 'trr_test_only_10_frame_10_atoms.trr').as_posix()
511-
TNG_traj = (_data_ref / 'argon_npt_compressed.tng').as_posix()
512-
TNG_traj_gro = (_data_ref / 'argon_npt_compressed.gro.gz').as_posix()
513-
TNG_traj_uneven_blocks = (_data_ref / 'argon_npt_compressed_uneven.tng').as_posix()
514-
TNG_traj_vels_forces = (_data_ref / 'argon_npt_compressed_vels_forces.tng').as_posix()
515-
PDB_xvf = (_data_ref / 'cobrotoxin.pdb').as_posix()
516-
TPR_xvf = (_data_ref / 'cobrotoxin.tpr').as_posix()
517-
TPR_xvf_2024_4 = (_data_ref / 'cobrotoxin_2024_4.tpr').as_posix()
518-
TRR_xvf = (_data_ref / 'cobrotoxin.trr').as_posix()
519-
H5MD_xvf = (_data_ref / 'cobrotoxin.h5md').as_posix()
520-
H5MD_energy = (_data_ref / 'cu.h5md').as_posix()
521-
H5MD_malformed = (_data_ref / 'cu_malformed.h5md').as_posix()
522-
XVG_BZ2 = (_data_ref / 'cobrotoxin_protein_forces.xvg.bz2').as_posix()
492+
GRO = (_data_ref / "adk_oplsaa.gro").as_posix()
493+
GRO_velocity = (_data_ref / "sample_velocity_file.gro").as_posix()
494+
GRO_incomplete_vels = (_data_ref / "grovels.gro").as_posix()
495+
GRO_large = (_data_ref / "bigbox.gro.bz2").as_posix()
496+
GRO_residwrap = (_data_ref / "residwrap.gro").as_posix()
497+
GRO_residwrap_0base = (_data_ref / "residwrap_0base.gro").as_posix()
498+
GRO_sameresid_diffresname = (
499+
_data_ref / "sameresid_diffresname.gro"
500+
).as_posix()
501+
PDB = (_data_ref / "adk_oplsaa.pdb").as_posix()
502+
XTC = (_data_ref / "adk_oplsaa.xtc").as_posix()
503+
TRR = (_data_ref / "adk_oplsaa.trr").as_posix()
504+
TPR = (_data_ref / "adk_oplsaa.tpr").as_posix()
505+
PDB_sub_dry = (_data_ref / "cobrotoxin_dry_neutral_0.pdb").as_posix()
506+
TRR_sub_sol = (_data_ref / "cobrotoxin.trr").as_posix()
507+
XTC_sub_sol = (_data_ref / "cobrotoxin.xtc").as_posix()
508+
PDB_sub_sol = (_data_ref / "cobrotoxin.pdb").as_posix()
509+
PDB_xlserial = (_data_ref / "xl_serial.pdb").as_posix()
510+
GRO_MEMPROT = (_data_ref / "analysis/YiiP_lipids.gro.gz").as_posix()
511+
XTC_MEMPROT = (_data_ref / "analysis/YiiP_lipids.xtc").as_posix()
512+
XTC_multi_frame = (
513+
_data_ref / "xtc_test_only_10_frame_10_atoms.xtc"
514+
).as_posix()
515+
TRR_multi_frame = (
516+
_data_ref / "trr_test_only_10_frame_10_atoms.trr"
517+
).as_posix()
518+
TNG_traj = (_data_ref / "argon_npt_compressed.tng").as_posix()
519+
TNG_traj_gro = (_data_ref / "argon_npt_compressed.gro.gz").as_posix()
520+
TNG_traj_uneven_blocks = (
521+
_data_ref / "argon_npt_compressed_uneven.tng"
522+
).as_posix()
523+
TNG_traj_vels_forces = (
524+
_data_ref / "argon_npt_compressed_vels_forces.tng"
525+
).as_posix()
526+
PDB_xvf = (_data_ref / "cobrotoxin.pdb").as_posix()
527+
TPR_xvf = (_data_ref / "cobrotoxin.tpr").as_posix()
528+
TPR_xvf_2024_4 = (_data_ref / "cobrotoxin_2024_4.tpr").as_posix()
529+
TRR_xvf = (_data_ref / "cobrotoxin.trr").as_posix()
530+
H5MD_xvf = (_data_ref / "cobrotoxin.h5md").as_posix()
531+
H5MD_energy = (_data_ref / "cu.h5md").as_posix()
532+
H5MD_malformed = (_data_ref / "cu_malformed.h5md").as_posix()
533+
XVG_BZ2 = (_data_ref / "cobrotoxin_protein_forces.xvg.bz2").as_posix()
523534

524535
XPDB_small = (_data_ref / "5digitResid.pdb").as_posix()
525536
# number is the gromacs version

0 commit comments

Comments
 (0)