![]() append ( getAMoleculeData ( db, num_mol, i )) return mols_data MSD Calculation DataFrame ( data = ) return df_final def getAllMolData ( db, num_mol ): mols_data = for i in range ( 0, num_mol ): mols_data. ''' totalRows = len ( db ) coordX = coordY = coordZ = for i in range ( 0, totalRows, num_mol ): coordX. Returns the coordinate data of the first molecule as pandas dataframe To get only the data for the first molecule, we store the value and skip 1981 rows as we iterate through the whole dataset.ĭef getFirstMoleculeData ( db, num_mol ): '''ĭb -> the original dataset with undesired information removed So now we have the total number of frames, we can validate the number of coordinates obtained for the first molecule. Since we know the total number of rows and the total number of molecules, we can acquire the total number of frames by dividing the number of rows by the total number of molecules. First, we obtain information on the coordinates of the first molecule. To read and perform a preliminary analysis of the preprocessed coordinate files, we utilize the Pandas, Matplotlib, and Seaborn libraries. The ‘oxygen.xyz’ is the original file, and after removal of the undesired information, a new file, ‘oxygen_edited.xyz’, is written and contains only the coordinates and the molecule name. This is validated by the ‘num_mol’ variable, which contains the 1981 value. If we were only to observe the coordinates of the first molecule, we would see that after every 1981 row, the coordinate of the next time step is given. With open ( ' oxygen_edited.xyz ', ' w ' ) as file : file. replace ( str_to_rep, '' ) # Write the file out again split ( ' \n ' ) num_mol = int ( lines ) str_to_rep = lines + ' \n ' + lines + ' \n ' # Replace the target stringįiledata = filedata. read () # reading the first two lines to get knowledege about the atoms present With open ( ' oxygen.xyz ', ' r ' ) as file : filedata = file. Since this information is redundant for our analysis, it is removed from the file, and a new file is created by running the following code: This information is displayed in the file after every frame. In our case, we have 1981 molecules, and VMD has generated the coordinate files. The start of the file shows the number of molecules in the system and how the file has been generated. The figure below shows how the exported coordinate file looks. Now Python is used to read the coordinate files for further analysis. The coordinates obtained are in angstrom. We export the coordinate files in ‘xyz’ format. Then we use this option to get the oxygen coordinate data for MSD analysis. The trajectory (DCD) files and the structure (PSF) files should be loaded. Once the MD simulation is completed, VMD provides an option (‘save coordinates’) to export the values of the coordinates of all the molecules or specific molecules. For example, if a molecule has low diffusivity, then one can infer that the system could be highly viscous for that particular molecule.Įquation for calculation of diffusion coefficient : Preprocessing Data ![]() Diffusion is the process by which material is transported by the random thermal motion of the molecules within the fluid, even in the absence of any mean flow. Knowing the diffusivity gives us knowledge about how the mobility of that particular molecule in the system. One of the major reasons to calculate MSD is the calculation of the diffusivity (or the diffusion coefficient) of a molecule in a system. Mean Square Displacement for an MD simulation is defined as the measure of the change in a molecule’s position over time with respect to a reference point/position. To learn how to run a simple simulation using a remote high performance computing cluster read this. We attempt to obtain the MSD (Mean Square Displacement) and subsequently the diffusion coefficient of the ensemble of molecules of the system. More details about the configuration file are at Water Box System. We utilized VMD to create the PSF files and NAMD to run the MD simulation. This work represents my attempt at analyzing the DCD files obtained after simulating a water box for 12 nanoseconds at 310 K. One of the primary advantages of MD simulations is that the extensive data obtained can predict various transport phenomena like viscosity, conductivity, and diffusivity. This data can be used to gain more knowledge about the system. After running an MD (Molecular Dynamic) Simulation, we obtain a large amount of data about the simulated system. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |