Binpos or multiple files

Issue #150 resolved
Mohit Mazumder created an issue

Hi guys,

I am very new to bio3D, just intalled it yesterday. I have a very simple query. I ran 150ns of MDsims using Amber 12 and the trajectories are saved in 30 crd files each for 5 ns. like prod1.mdcrd, prod2.mdcd..n so on. I want to load all of them for analysis, so how do i do that ? I have a combined .binpos file but when i load the file : ncdf <- read.ncdf("prod_1-30.binpos") Error in R_nc_open: NetCDF: Unknown file format Error in ncdf::open.ncdf(fnm, readunlim = FALSE) : Error in open.ncdf

The individual file say prod1.mdcrd loads fine. ncdf <- read.ncdf("prod1.mdcrd") [1] "Reading file prod1.mdcrd" [1] "Produced by program: pmemd" [1] "File conventions AMBER version 1.0" [1] "Frames: 2500" [1] "Atoms: 27631"

so my question is "How to read the binpos file or use all the files " ?

Comments (4)

  1. Lars Skjærven

    Hi Mohit, One option (which might be the most effective if you have a large system) is to pre-process your 30 trajectory files with CPPTRAJ prior to importing it into Bio3D (e.g by stripping away water molecules). Make sure you write your new trajectory in NetCDF format (i.e. in your cpptraj script: trajout prod.nc netcdf). You would then also need CPPTRAJ to output a PDB file for you containing the same atoms as your stripped trajectory (e.g the first frame).

    Another option would the following:

    prmtop = read.prmtop("prot_sol.prmtop")
    inds = atom.select(prmtop, "notwater")
    #trj <- read.ncdf("01_classA_prod1.nc", at.sel=inds)
    
    trj <- NULL
    for ( i in 1:5 ) {
       fname <- paste("01_classA_prod", i, ".nc", sep="")
       tmp <- read.ncdf(fname, at.sel=inds)
       trj <- rbind(trj, tmp)
    }
    

    Note that you will need the development version of Bio3D for read.prmtop to work.

    Let me know if this helps

  2. Mohit Mazumder reporter

    Dear Lars, Thank you so much for your reply , converting it to nc (netcdf) worked

    ncdf <- read.ncdf("prod.nc") [1] "Reading file prod.nc" [1] "Produced by program: cpptraj" [1] "File conventions AMBER version 1.0" [1] "Frames: 75000" [1] "Atoms: 1000"

    Meanwhile i tried to convert the binpos into DCD by installing MDtraj (Command-line trajectory conversion: mdconvert). Although I have not tested the 2nd option. Thank you again
    regards Mohit

  3. Xinqiu Yao

    Hi,

    Just quick reference: read.ncdf() can read multiple input NCDF files, e.g.

    files = list.files(".", ".*nc$")
    trj = read.ncdf(files, at.sel=inds)
    
  4. Log in to comment