Amber-MD / cpptraj

Biomolecular simulation trajectory/data analysis.
Other
138 stars 64 forks source link

Can CPPTRAJ read the dat file which is produced by other tool? #1106

Closed MilesYyh closed 1 month ago

MilesYyh commented 1 month ago

Dear Sir, Hi! I want to use the CPPTRAJ hist command to turn my data into the population. I want to know that can CPPTRAJ read the dat file which is produced by other tool. If it can, could you tell me which command I need to use.

Thanks! Best regards to your team.

MilesYyh commented 1 month ago

I also notice the pytraj python package didn't included the hist command.

swails commented 1 month ago

Numpy supports creating histograms, so there's little point in including it in pytraj.

MilesYyh commented 1 month ago

Thanks. Actually, I want to realize the Normalize Population like this https://amberhub.chpc.utah.edu/generating-histograms-with-cpptraj/. So I want to use the hist command of CPPTRAJ to realize my idea.

swails commented 1 month ago

The density keyword to numpy's histogram method will normalize the histogram such that it integrates to 1.0

cpptraj has a readdata command that can be used to read in data written to a file, but that is written specifically to support data files generated by cpptraj itself. If external packages write compatible data files, then it will work. If not, you have two choices:

  1. Convert the data file into something cpptraj understands
  2. Learn how to use numpy's histogram method to do what you want if you read the file in Python.
MilesYyh commented 1 month ago

All right. I didn't notice the density keyword to numpy's histogram method ever before. I will try the two method you mentioned.

It helps me a lot. Thank u once more!