-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathplot_rdf_melt.py
executable file
·55 lines (50 loc) · 1.73 KB
/
plot_rdf_melt.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
#!/usr/bin/env python3
import os, glob
from molecule_db import *
from collect_dynamics import sim_status
from get_csv_rows import *
molrename = { "menh2": "methylamine", "acooh": "acetic acid" }
def get_ref(mol:str):
with open("../../../allresults.csv", "r") as inf:
for line in inf:
if line.find("#") < 0:
row = line.split(",")
if len(row) > 21:
if row[0] == mol and row[20] != "liquid":
return row[1], row[20], ("../../solid/%s/%s/rdf.xvg" % ( mol, row[1] ))
return 0, "", ""
def plot_it(mol:str):
temps = sim_status[mol]["success"]
if len(temps) == 0:
return
title = mol
if title in molrename:
title = molrename[title]
filelist = ""
templist = ""
reftemp, refphase, reffile = get_ref(mol)
if len(reffile) > 0:
filelist = reffile
templist = ( "%s@%s" % ( refphase, reftemp ) )
found_data = False
sorted_temps = sorted(temps)
ndelta = 1
if len(sorted_temps) > 12:
ndelta = 2
if len(sorted_temps) > 24:
ndelta = 3
for t in range(0, len(sorted_temps), ndelta):
rdf = ( "rdf_%g.xvg" % sorted_temps[t])
if os.path.exists(rdf):
filelist += (" %s" % rdf)
templist += (" %g" % sorted_temps[t])
found_data = True
if found_data:
os.system("viewxvg -f %s -alfs 18 -lfs 14 -tfs 18 -legend_out -ymin -0.02 -ymax 4 -xmin 0 -xmax 1.2 -label %s -title '%s' -pdf ../RDF/%s_rdf.pdf -noshow" % ( filelist, templist, title, mol ))
moldb = get_moldb(False)
os.chdir("bcc/melt")
for mol in moldb.keys():
if os.path.isdir(mol):
os.chdir(mol)
plot_it(mol)
os.chdir("..")