Package: pydiagram
PyDiagram is a python package for generating a phase diagram from results output by polymer field-theoretic simulations. PyDiagram also provides functions for analysis of simulation results.Quickstart1. Install$ pip install pydiagramRequired PackagesnumpyscipymatplotlibmpltexattrdictPyYAMLImportant note: PyYAML cannot be installed by pip or easy_install. Please install it by downloading its source code and usepython setup.py installto install it, see details atPyYAML Documentation.2. Use PyDiagram as An ExecutableTo use the executable,pydiagram, you need to provide a project configuration file. The configuration file is in YAML format. Three sample configuration files,config_polyorder.yml,config_polyfts.yml, andconfig_pydiagram.yml, are shipped with PyDiagram package. You can copy one of them to your project root directory and make any necessary modifications to it.Typical usage.pydiagram[-v][-h][-p][-q][-s][-m]pydiagram-pThis command processes the simulation data in the current directory. It will savediagram,info_map, andboundaryobjects as Python pickle files. The parser can be specified in the project configuration file using thesolveroption.pydiagram-qAccording to the plot mode specified in the project configuration file, this command will plot requested figures and save them as files.pydiagram-sThis command will run pydiagram as a server.pydiagram-mThis command will run pydiagram in manual mode, which will submit additional simulation jobs specified in thepredictor.manualin the project configuration file.3. Use PyDiagram as A LibraryYou can customize your own processing, plotting and predicting scripts by utilizing PyDiagram functions. As described in the last section, your script will also depend on a project configuration file.Typical usage.importpydiagramimportmatplotlib.pyplotasplt# Generate diagram by specifying the folder where data locate.# This will require the output data files from supported solvers.# Here assume the project configuration file in the current directory.diagram=pydiagram.get_diagram()# Plot the raw diagramfig,ax=plt.subplots(1)pydiagram.plot_diagram(ax,diagram)# Or you can generate diagram from .dgm file# First load .dgm file to get info_mapxaxis,yaxis,info_map=pydiagram.load_dgm('phase_data.dgm')diagram=pydiagram.get_diagram_from_info_map(info_map)# You can find phase boundary from digaramboundary=pydiagram.get_boundary(diagram,info_map)# And plot it as scatter pointspydiagram.plot_boundary_point(ax,boundary)# Or plot it as linepydiagram.plot_boundary_line(ax,boundary)# PyDiagram also provides a plot function for plotting diagram points# and phase boundary together.pydiagram.plot_phase_diagram(diagram,boundary,settings,xaxis,yaxis)# To analyze the simulation results, PyDiagram also provides# a plotting function which will plot F vs. x or F vs. y,# a vs. x or a vs. y, and accuracy vs. x or accuracy vs. y.pydiagram(info_map,xaxis,yaxis,path,phases,val)All above mentioned functions have more available options to fine tune the processing and plotting. For more details, please consult the source code or directly contact me via E-mail.4. dgm File FormatFor nonPolyorderorPolyFTSusers, to use PyDiagram you have to generate your owndgmfile from your simulation results by following thedgmfile format.The format of thedgmfile.First line:[x-axis name] [y-axis name]Other lines:[x] [y] [phase] [F] [a] [accuracy] [separation state]x-axisname: the variable name of the x axis in the phase diagram.y-axisname: the variable name of the y axis in the phase diagram.xandy: the coordinates in the phase diagram.phase: the name of the phase structure.F: the Gibbs free energy of the corresponding phase structure.a: the stretch-free cell size.accuracy: the residual error for the corresponding simulation.separation state: Does the simulation yield phase separated structures? 0 for no and 1 for yes.The first five columns are mandatory while the last two are optional.
The optional values are assumed by their order.
For example, if only 6 columns are provided, then the 6th column is interpreted asaccuracy.Example:f   xN
0.1 12.5    HEX 3.953993    2.9543  8.7e-7  1
0.1 12.6    LAM 3.970134    2.5877  1.7e-8  1LinksYi-Xin Liu’s academic homepage