calphy 1.3.11__tar.gz → 1.3.13__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {calphy-1.3.11/calphy.egg-info → calphy-1.3.13}/PKG-INFO +1 -1
- {calphy-1.3.11 → calphy-1.3.13}/calphy/__init__.py +1 -1
- {calphy-1.3.11 → calphy-1.3.13}/calphy/input.py +1 -1
- {calphy-1.3.11 → calphy-1.3.13}/calphy/phase.py +15 -7
- {calphy-1.3.11 → calphy-1.3.13}/calphy/postprocessing.py +82 -1
- {calphy-1.3.11 → calphy-1.3.13/calphy.egg-info}/PKG-INFO +1 -1
- {calphy-1.3.11 → calphy-1.3.13}/setup.py +1 -1
- {calphy-1.3.11 → calphy-1.3.13}/LICENSE +0 -0
- {calphy-1.3.11 → calphy-1.3.13}/MANIFEST.in +0 -0
- {calphy-1.3.11 → calphy-1.3.13}/README.md +0 -0
- {calphy-1.3.11 → calphy-1.3.13}/calphy/alchemy.py +0 -0
- {calphy-1.3.11 → calphy-1.3.13}/calphy/clitools.py +0 -0
- {calphy-1.3.11 → calphy-1.3.13}/calphy/composition_transformation.py +0 -0
- {calphy-1.3.11 → calphy-1.3.13}/calphy/errors.py +0 -0
- {calphy-1.3.11 → calphy-1.3.13}/calphy/helpers.py +0 -0
- {calphy-1.3.11 → calphy-1.3.13}/calphy/integrators.py +0 -0
- {calphy-1.3.11 → calphy-1.3.13}/calphy/kernel.py +0 -0
- {calphy-1.3.11 → calphy-1.3.13}/calphy/liquid.py +0 -0
- {calphy-1.3.11 → calphy-1.3.13}/calphy/phase_diagram.py +0 -0
- {calphy-1.3.11 → calphy-1.3.13}/calphy/queuekernel.py +0 -0
- {calphy-1.3.11 → calphy-1.3.13}/calphy/routines.py +0 -0
- {calphy-1.3.11 → calphy-1.3.13}/calphy/scheduler.py +0 -0
- {calphy-1.3.11 → calphy-1.3.13}/calphy/solid.py +0 -0
- {calphy-1.3.11 → calphy-1.3.13}/calphy/splines.py +0 -0
- {calphy-1.3.11 → calphy-1.3.13}/calphy/utils.py +0 -0
- {calphy-1.3.11 → calphy-1.3.13}/calphy.egg-info/SOURCES.txt +0 -0
- {calphy-1.3.11 → calphy-1.3.13}/calphy.egg-info/dependency_links.txt +0 -0
- {calphy-1.3.11 → calphy-1.3.13}/calphy.egg-info/entry_points.txt +0 -0
- {calphy-1.3.11 → calphy-1.3.13}/calphy.egg-info/not-zip-safe +0 -0
- {calphy-1.3.11 → calphy-1.3.13}/calphy.egg-info/requires.txt +0 -0
- {calphy-1.3.11 → calphy-1.3.13}/calphy.egg-info/top_level.txt +0 -0
- {calphy-1.3.11 → calphy-1.3.13}/setup.cfg +0 -0
- {calphy-1.3.11 → calphy-1.3.13}/tests/test_helpers.py +0 -0
- {calphy-1.3.11 → calphy-1.3.13}/tests/test_integrators.py +0 -0
- {calphy-1.3.11 → calphy-1.3.13}/tests/test_options.py +0 -0
- {calphy-1.3.11 → calphy-1.3.13}/tests/test_solid_methods.py +0 -0
|
@@ -598,8 +598,12 @@ class Phase:
|
|
|
598
598
|
|
|
599
599
|
#now we can check if it converted
|
|
600
600
|
file = os.path.join(self.simfolder, "avg.dat")
|
|
601
|
-
|
|
602
|
-
lxpc =
|
|
601
|
+
#we have to clean the data, so as just the last block is selected
|
|
602
|
+
lx, ly, lz, lxpc = np.loadtxt(file, usecols=(1, 2, 3, 4), unpack=True)
|
|
603
|
+
lx = lx[-ncount+1:]
|
|
604
|
+
ly = ly[-ncount+1:]
|
|
605
|
+
lz = lx[-ncount+1:]
|
|
606
|
+
lxpc = lxpc[-ncount+1:]
|
|
603
607
|
mean = np.mean(lxpc)
|
|
604
608
|
std = np.std(lxpc)
|
|
605
609
|
volatom = np.mean((lx*ly*lz)/self.natoms)
|
|
@@ -612,16 +616,20 @@ class Phase:
|
|
|
612
616
|
ncount = int(self.calc.md.n_small_steps)//int(self.calc.md.n_every_steps*self.calc.md.n_repeat_steps)
|
|
613
617
|
|
|
614
618
|
file = os.path.join(self.simfolder, "avg.dat")
|
|
615
|
-
lx, ly, lz,
|
|
616
|
-
|
|
619
|
+
lx, ly, lz, lxpc = np.loadtxt(file, usecols=(1, 2, 3, 4), unpack=True)
|
|
620
|
+
lx = lx[-ncount+1:]
|
|
621
|
+
ly = ly[-ncount+1:]
|
|
622
|
+
lz = lx[-ncount+1:]
|
|
623
|
+
lxpc = lxpc[-ncount+1:]
|
|
624
|
+
|
|
617
625
|
mean = np.mean(lxpc)
|
|
618
626
|
std = np.std(lxpc)
|
|
619
627
|
volatom = np.mean((lx*ly*lz)/self.natoms)
|
|
620
628
|
|
|
621
629
|
self.calc._pressure = mean
|
|
622
|
-
self.lx = np.round(np.mean(lx
|
|
623
|
-
self.ly = np.round(np.mean(ly
|
|
624
|
-
self.lz = np.round(np.mean(lz
|
|
630
|
+
self.lx = np.round(np.mean(lx), decimals=3)
|
|
631
|
+
self.ly = np.round(np.mean(ly), decimals=3)
|
|
632
|
+
self.lz = np.round(np.mean(lz), decimals=3)
|
|
625
633
|
self.volatom = volatom
|
|
626
634
|
self.vol = self.lx*self.ly*self.lz
|
|
627
635
|
self.rho = self.natoms/(self.lx*self.ly*self.lz)
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import os
|
|
2
2
|
import numpy as np
|
|
3
3
|
import yaml
|
|
4
|
+
import matplotlib.pyplot as plt
|
|
5
|
+
import warnings
|
|
4
6
|
|
|
5
7
|
def read_report(folder):
|
|
6
8
|
"""
|
|
@@ -145,4 +147,83 @@ def gather_results(mainfolder):
|
|
|
145
147
|
datadict['error_code'][-1] = _extract_error(errfile)
|
|
146
148
|
|
|
147
149
|
df = pd.DataFrame(data=datadict)
|
|
148
|
-
return df
|
|
150
|
+
return df
|
|
151
|
+
|
|
152
|
+
def find_transition_temperature(folder1, folder2, fit_order=4, plot=True):
|
|
153
|
+
"""
|
|
154
|
+
Find transition temperature where free energy of two phases are equal.
|
|
155
|
+
|
|
156
|
+
Parameters
|
|
157
|
+
----------
|
|
158
|
+
folder1: string
|
|
159
|
+
directory with temperature scale calculation
|
|
160
|
+
|
|
161
|
+
folder2: string
|
|
162
|
+
directory with temperature scale calculation
|
|
163
|
+
|
|
164
|
+
fit_order: int, optional
|
|
165
|
+
default 4. Order for polynomial fit of temperature vs free energy
|
|
166
|
+
|
|
167
|
+
plot: bool, optional
|
|
168
|
+
default True. Plot the results.
|
|
169
|
+
"""
|
|
170
|
+
file1 = os.path.join(folder1, 'temperature_sweep.dat')
|
|
171
|
+
file2 = os.path.join(folder2, 'temperature_sweep.dat')
|
|
172
|
+
if not os.path.exists(file1):
|
|
173
|
+
raise FileNotFoundError(f'{file1} does not exist')
|
|
174
|
+
if not os.path.exists(file2):
|
|
175
|
+
raise FileNotFoundError(f'{file2} does not exist')
|
|
176
|
+
|
|
177
|
+
t1, f1 = np.loadtxt(file1, unpack=True, usecols=(0,1))
|
|
178
|
+
t2, f2 = np.loadtxt(file2, unpack=True, usecols=(0,1))
|
|
179
|
+
|
|
180
|
+
#do some fitting to determine temps
|
|
181
|
+
t1min = np.min(t1)
|
|
182
|
+
t2min = np.min(t2)
|
|
183
|
+
t1max = np.max(t1)
|
|
184
|
+
t2max = np.max(t2)
|
|
185
|
+
|
|
186
|
+
tmin = np.min([t1min, t2min])
|
|
187
|
+
tmax = np.max([t1max, t2max])
|
|
188
|
+
|
|
189
|
+
#warn about extrapolation
|
|
190
|
+
if not t1min == t2min:
|
|
191
|
+
warnings.warn(f'free energy is being extrapolated!')
|
|
192
|
+
if not t1max == t2max:
|
|
193
|
+
warnings.warn(f'free energy is being extrapolated!')
|
|
194
|
+
|
|
195
|
+
#now fit
|
|
196
|
+
f1fit = np.polyfit(t1, f1, fit_order)
|
|
197
|
+
f2fit = np.polyfit(t2, f2, fit_order)
|
|
198
|
+
|
|
199
|
+
#reevaluate over the new range
|
|
200
|
+
fit_t = np.arange(tmin, tmax+1, 1)
|
|
201
|
+
fit_f1 = np.polyval(f1fit, fit_t)
|
|
202
|
+
fit_f2 = np.polyval(f2fit, fit_t)
|
|
203
|
+
|
|
204
|
+
#now evaluate the intersection temp
|
|
205
|
+
arg = np.argsort(np.abs(fit_f1-fit_f2))[0]
|
|
206
|
+
transition_temp = fit_t[arg]
|
|
207
|
+
|
|
208
|
+
#warn if the temperature is shady
|
|
209
|
+
if np.abs(transition_temp-tmin) < 1E-3:
|
|
210
|
+
warnings.warn('It is likely there is no intersection of free energies')
|
|
211
|
+
elif np.abs(transition_temp-tmax) < 1E-3:
|
|
212
|
+
warnings.warn('It is likely there is no intersection of free energies')
|
|
213
|
+
|
|
214
|
+
#plot
|
|
215
|
+
if plot:
|
|
216
|
+
c1lo = '#ef9a9a'
|
|
217
|
+
c1hi = '#b71c1c'
|
|
218
|
+
c2lo = '#90caf9'
|
|
219
|
+
c2hi = '#0d47a1'
|
|
220
|
+
|
|
221
|
+
plt.plot(fit_t, fit_f1, color=c1lo, label=f'{folder1} fit')
|
|
222
|
+
plt.plot(fit_t, fit_f2, color=c2lo, label=f'{folder2} fit')
|
|
223
|
+
plt.plot(t1, f1, color=c1hi, label=folder1, ls='dashed')
|
|
224
|
+
plt.plot(t2, f2, color=c2hi, label=folder2, ls='dashed')
|
|
225
|
+
plt.axvline(transition_temp, ls='dashed', c='#37474f')
|
|
226
|
+
plt.ylabel('Free energy (eV/atom)')
|
|
227
|
+
plt.xlabel('Temperature (K)')
|
|
228
|
+
plt.legend(frameon=False)
|
|
229
|
+
return transition_temp
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|