zincware / MDSuite

A post-processing engine for particle simulations
https://mdsuite.readthedocs.io/
Eclipse Public License 2.0
36 stars 7 forks source link

On the error for RadialDistributionFunciton #603

Closed okunoyukihiro2 closed 6 months ago

okunoyukihiro2 commented 6 months ago

Dear MDSuite Developers.

I'm trying to use MDSuite for the analysis of LAMMPS trajectory file.

My trajectory file size is 3GB over, and the format is ITEM: ATOMS id type xu yu zu vx vy vz fx fy fz element , and dump date every 10 MD step with 0.0005 ps one MD step.

my script is,

h2o_lifsi_data = 'h2o_tfsi_beti.lammpstraj' # lammps trajectry file with id type xu yu zu vx vy vz fx fy fz element md_project = mds.Project(name="LiTFSI_H2O", storage_path='.')

LiTFSI_H2O_experiment = md_project.add_experiment( name="LiTFSI", timestep=0.0005, units='metal', temperature=300.0, simulation_data=h2o_lifsi_data ) # time step is MD time step and not time interval of dump data.

RDF_Data = md_project.run.RadialDistributionFunction(species=['Li','O'],number_of_bins = 100, cutoff=8.0)

Then, the error message occurred,

"Unable to synchronously open object (object 'Positions' doesn't exist)"

We also change input option for like, RadialDistrubutionFunction(zetas=6.0), same error occurred/

Is it due to the wrong database.hdf5 file generated ?

whole error message is below,


KeyError Traceback (most recent call last) /tmp/ipykernel_2451126/1439073905.py in 1 #RDF_Data = md_project.run.RadialDistributionFunction(species=['Li','O'],number_of_bins = 100, cutoff=8.0) ----> 2 RDF_Data = md_project.run.RadialDistributionFunction()

~/anaconda3/lib/python3.8/site-packages/mdsuite/calculators/calculator.py in inner(self, *args, **kwargs) 123 cls.prepare_db_entry() 124 cls.save_computation_args() --> 125 cls.run_analysis() 126 cls.save_db_data() 127 # Need to reset the user args, if they got change

~/anaconda3/lib/python3.8/site-packages/mdsuite/calculators/calculator.py in run_analysis(self) 315 "documentation before using the results." 316 ) --> 317 self.run_calculator()

~/anaconda3/lib/python3.8/site-packages/mdsuite/calculators/radial_distribution_function.py in run_calculator(self) 836 self.check_input() 837 --> 838 dict_keys, split_arr, batch_tqm = self.prepare_computation() 839 840 # Get the batch dataset

~/anaconda3/lib/python3.8/site-packages/mdsuite/calculators/radial_distribution_function.py in prepare_computation(self) 581 join_path(item, self.loaded_property.name) for item in self.args.species 582 ] --> 583 self._prepare_managers(path_list) 584 585 # batch loop correction

~/anaconda3/lib/python3.8/site-packages/mdsuite/calculators/trajectory_calculator.py in _prepare_managers(self, data_path, correct) 267 self.n_batches, 268 self.remainder, --> 269 ) = self.memory_manager.get_batch_size() 270 self.ensemble_loop, self.minibatch = self.memory_manager.get_ensemble_loop( 271 self.args.data_range, self.args.correlation_time

~/anaconda3/lib/python3.8/site-packages/mdsuite/memory_management/memory_manager.py in get_batch_size(self) 198 per_configuration_memory: float = 0.0 199 for item in self.data_path: --> 200 n_particles, n_configs, n_bytes = self.database.get_data_size(item) 201 per_configuration_memory += n_bytes / n_configs 202 per_configuration_memory = self.scale_function(

~/anaconda3/lib/python3.8/site-packages/mdsuite/database/simulation_database.py in get_data_size(self, data_path) 683 with hf.File(self.path, "r") as db: 684 data_tuple = ( --> 685 db[data_path].shape[0], 686 db[data_path].shape[1], 687 db[data_path].nbytes,

h5py/_objects.pyx in h5py._objects.with_phil.wrapper()

h5py/_objects.pyx in h5py._objects.with_phil.wrapper() ~/anaconda3/lib/python3.8/site-packages/h5py/_hl/group.py in getitem(self, name) 355 raise ValueError("Invalid HDF5 object reference") 356 elif isinstance(name, (bytes, str)): --> 357 oid = h5o.open(self.id, self._e(name), lapl=self._lapl) 358 else: 359 raise TypeError("Accessing a group is done with bytes or str, "

h5py/_objects.pyx in h5py._objects.with_phil.wrapper()

h5py/_objects.pyx in h5py._objects.with_phil.wrapper()

h5py/h5o.pyx in h5py.h5o.open()

KeyError: "Unable to synchronously open object (object 'Positions' doesn't exist)"

Sincerely,

Yukihiro Okuno.

SamTov commented 6 months ago

Hi @okunoyukihiro2, that is a bit strange. It looks like your database does not have the Positions key. This is likely because it was not read in. I would guess that this is because you did not dump then in your simulation and rather only dumped the unwrapped positions. Can you show me your simulation script, or at least the write out part of it? Alternatively, show me the header lines of the trajectory file you used if it is text-based.

okunoyukihiro2 commented 6 months ago

Thank you for your reply.

In my case, I tried to used jupyter-notebook for analysis the trajectory, the database.hdf5 is not created ( I don't know the reason), then I used MDsuite without jupyter-notebook and I could get database.hdf5.

The size of the trajectory file is about 4GB .

My lammps input for dump trajectory is

dump d1 all custom 10 h2o_litfsi_beti.lmptraj id type xu yu zu vx vy vz fx fy fz element dump_modify d1 element N S O C F Li H

and the header of trajectory file are (text based trajectory file)

ITEM: TIMESTEP 0 ITEM: NUMBER OF ATOMS 1904 ITEM: BOX BOUNDS pp pp pp 0.0000000000000000e+00 2.9742050999625430e+01 0.0000000000000000e+00 2.9742050999625430e+01 0.0000000000000000e+00 2.9742050999625430e+01 ITEM: ATOMS id type xu yu zu vx vy vz fx fy fz element 365 3 3.51313 31.7075 3.62118 -2.0826 3.07134 0.421238 -0.0630388 -0.502639 0.503173 O 421 1 2.90564 1.62025 29.9226 -1.99039 0.99054 -0.243871 -0.534978 -1.493 0.1039 N 422 2 2.31966 0.0910024 30.0649 1.74891 -0.8824 -2.02428 -0.622282 1.41198 0.881964 S 428 4 0.52556 0.567435 29.7697 -4.98053 2.20032 -2.09288 1.49745 0.789468 -0.0831241 C 430 5 0.128021 1.67479 30.4453 -2.17416 -3.73761 2.78068 0.365546 0.209368 0.601593 F 1375 7 31.0543 4.07664 30.3111 8.22273 34.888 6.67016 0.261137 1.29207 -0.371323 H 1376 3 30.5385 4.91162 30.503 1.21727 5.43267 -7.96076 -0.442916 -2.51274 0.75748 O 1377 7 29.9101 4.41356 31.1005 14.5222 3.68476 -6.18048 -0.036446 1.50617 -0.124038 H 368 4 4.54476 33.9875 2.92022 0.637611 -4.33134 -1.73996 1.57175 0.57441 -0.198037 C 371 5 5.65941 33.3605 2.63972 -1.47051 0.216664 -1.37071 1.91561 -2.11251 -0.0263852 F 372 5 3.97656 34.2504 1.77965 0.304634 0.291046 -6.62234 -2.28337 -0.334296 -1.93225 F

Sincerely,

Yukihiro Okuno .

okunoyukihiro2 commented 6 months ago

I had change the head of trajectory file

from ITEM: ATOMS id type xu yu zu vx vy vz fx fy fz element to ITEM: ATOMS id type x y z vx vy vz fx fy fz element

Then, MDSuite can read the trajectory.

Can MDSuite read the line like xu yu zu (lammps un-wrapped coordinates) for lammps trajectory format ? (Are there option that can read xu yu zu as coordinate ? )

Sincerely,

Yukihiro Okuno.

SamTov commented 6 months ago

Hi @okunoyukihiro2,

Yes, MDSuite can read these lines, it's just that they are stored in the Unwrapped_Positions group. You can wrap these coordinates with the CoordinateWrapper transformation. Try something like:

project.run.CoordinateWrapper()

This will produce the required group in the hdf5 database and then the RDF should run without any issues. I am concerned with the issue in Jupyter. The use of a notebook should not break anything on the Python-side, do you have more information about what went wrong?

okunoyukihiro2 commented 6 months ago

Thank you for your suggestion. I can get RDF structures with lammps upwrapped trajectory file.

The jupyter problem may be due to my environment. (Maybe memory problem.)

I begun to enjoy MDSuite.

Sincerely.

Yukihiro Okuno

SamTov commented 6 months ago

Hi, that is fantastic to hear. We are happy that you are using it. Please let us know if there is more we can do for you.