QuantumATK Forum

QuantumATK => General Questions and Answers => Topic started by: Lim changmin on June 12, 2024, 06:52

Title: Radial distribution
Post by: Lim changmin on June 12, 2024, 06:52
I am trying to make radial distribution graph from the quantumatk option :

https://docs.quantumatk.com/manual/Types/RadialDistribution/RadialDistribution.html#radialdistribution-c

When I tried to make graph with the python file example above the link, the calculation was finished but nothing appeared.

How can I solve this problem? Here's the code that I made based on the example link.

Thank you!!

md_trajectory = nlread('216csi_TFMC_1.hdf5')[-1]

rdf = RadialDistribution(md_trajectory,
                         cutoff_radius=3.0*Angstrom,
                         pair_selection=[Silicon, Silicon])

# Get the bin_centers and the histogram of the radial distribution.
distances = rdf.distances().inUnitsOf(Angstrom)
histogram = rdf.data()

# Plot the data using pylab.
import pylab

pylab.plot(distances, histogram, label='Si RDF')
pylab.xlabel('r (Ang)')
pylab.ylabel('g(r)')
pylab.legend()

pylab.show()
Title: Re: Radial distribution
Post by: Lim changmin on June 12, 2024, 06:54
Or are there any other methods that I can use to calculate radial distribution graph?
Title: Re: Radial distribution
Post by: AsifShah on June 12, 2024, 09:21
You can use inbuilt function in QATK to plot radial and angular distribution.
When you single click on MD trajectory, there will be an option to the right where you can choose "MD Analyzer"
Title: Re: Radial distribution
Post by: Lim changmin on June 12, 2024, 10:37
Thank you!!
I finally found MD analyzer that you mentioned!
Title: Re: Radial distribution
Post by: Anders Blom on July 29, 2024, 23:54
Indeed the GUI function is most versatile, but using your script, the plot should pop up as a separate window, but in case you are running in a terminal without a graphical connection, you can replace pylab.show with pylab.savefig("plot.png", dpi=150) to make a plot file