calphy 1.4.4__py3-none-any.whl → 1.4.5__py3-none-any.whl
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/__init__.py +1 -1
- calphy/clitools.py +1 -0
- calphy/input.py +42 -16
- calphy/postprocessing.py +9 -9
- {calphy-1.4.4.dist-info → calphy-1.4.5.dist-info}/METADATA +1 -1
- {calphy-1.4.4.dist-info → calphy-1.4.5.dist-info}/RECORD +10 -10
- {calphy-1.4.4.dist-info → calphy-1.4.5.dist-info}/WHEEL +0 -0
- {calphy-1.4.4.dist-info → calphy-1.4.5.dist-info}/entry_points.txt +0 -0
- {calphy-1.4.4.dist-info → calphy-1.4.5.dist-info}/licenses/LICENSE +0 -0
- {calphy-1.4.4.dist-info → calphy-1.4.5.dist-info}/top_level.txt +0 -0
calphy/__init__.py
CHANGED
calphy/clitools.py
CHANGED
calphy/input.py
CHANGED
|
@@ -49,7 +49,7 @@ from pyscal3.core import structure_dict, element_dict, _make_crystal
|
|
|
49
49
|
from ase.io import read, write
|
|
50
50
|
import shutil
|
|
51
51
|
|
|
52
|
-
__version__ = "1.4.
|
|
52
|
+
__version__ = "1.4.5"
|
|
53
53
|
|
|
54
54
|
|
|
55
55
|
def _check_equal(val):
|
|
@@ -181,10 +181,17 @@ class MeltingTemperature(BaseModel, title="Input options for melting temperature
|
|
|
181
181
|
step: Annotated[int, Field(default=200, ge=20)]
|
|
182
182
|
attempts: Annotated[int, Field(default=5, ge=1)]
|
|
183
183
|
|
|
184
|
-
|
|
184
|
+
|
|
185
|
+
class MaterialsProject(BaseModel, title="Input options for materials project"):
|
|
185
186
|
api_key: Annotated[str, Field(default="", exclude=True)]
|
|
186
187
|
conventional: Annotated[bool, Field(default=True)]
|
|
187
|
-
target_natoms: Annotated[
|
|
188
|
+
target_natoms: Annotated[
|
|
189
|
+
int,
|
|
190
|
+
Field(
|
|
191
|
+
default=1500,
|
|
192
|
+
description="The structure parsed from materials project would be repeated to approximately this value",
|
|
193
|
+
),
|
|
194
|
+
]
|
|
188
195
|
|
|
189
196
|
@field_validator("api_key", mode="after")
|
|
190
197
|
def resolve_api_key(cls, v: str) -> str:
|
|
@@ -198,6 +205,7 @@ class MaterialsProject(BaseModel, title='Input options for materials project'):
|
|
|
198
205
|
)
|
|
199
206
|
return value
|
|
200
207
|
|
|
208
|
+
|
|
201
209
|
class Calculation(BaseModel, title="Main input class"):
|
|
202
210
|
monte_carlo: Optional[MonteCarlo] = MonteCarlo()
|
|
203
211
|
composition_scaling: Optional[CompositionScaling] = CompositionScaling()
|
|
@@ -515,40 +523,58 @@ class Calculation(BaseModel, title="Main input class"):
|
|
|
515
523
|
self._original_lattice = self.lattice.lower()
|
|
516
524
|
write_structure_file = True
|
|
517
525
|
|
|
518
|
-
elif self.lattice.split(
|
|
519
|
-
#confirm here that API key exists
|
|
526
|
+
elif self.lattice.split("-")[0] == "mp":
|
|
527
|
+
# confirm here that API key exists
|
|
520
528
|
if not self.materials_project.api_key:
|
|
521
|
-
raise ValueError(
|
|
522
|
-
#now we need to fetch the structure
|
|
529
|
+
raise ValueError("could not find API KEY, pls set it.")
|
|
530
|
+
# now we need to fetch the structure
|
|
523
531
|
try:
|
|
524
532
|
from mp_api.client import MPRester
|
|
525
533
|
except ImportError:
|
|
526
|
-
raise ImportError(
|
|
527
|
-
|
|
534
|
+
raise ImportError(
|
|
535
|
+
"Could not import mp_api, make sure you install mp_api package!"
|
|
536
|
+
)
|
|
537
|
+
# now all good
|
|
528
538
|
rest = {
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
539
|
+
"use_document_model": False,
|
|
540
|
+
"include_user_agent": True,
|
|
541
|
+
"api_key": self.materials_project.api_key,
|
|
542
|
+
}
|
|
533
543
|
with MPRester(**rest) as mpr:
|
|
534
544
|
docs = mpr.materials.summary.search(material_ids=[self.lattice])
|
|
535
545
|
|
|
536
546
|
structures = []
|
|
537
547
|
for doc in docs:
|
|
538
|
-
struct = doc[
|
|
548
|
+
struct = doc["structure"]
|
|
539
549
|
if self.materials_project.conventional:
|
|
540
550
|
aseatoms = struct.to_conventional().to_ase_atoms()
|
|
541
551
|
else:
|
|
542
552
|
aseatoms = struct.to_primitive().to_ase_atoms()
|
|
543
553
|
structures.append(aseatoms)
|
|
544
554
|
structure = structures[0]
|
|
545
|
-
|
|
555
|
+
|
|
546
556
|
if np.prod(self.repeat) == 1:
|
|
547
|
-
x = int(
|
|
557
|
+
x = int(
|
|
558
|
+
np.ceil(
|
|
559
|
+
(self.materials_project.target_natoms / len(structure))
|
|
560
|
+
** (1 / 3)
|
|
561
|
+
)
|
|
562
|
+
)
|
|
548
563
|
structure = structure.repeat(x)
|
|
549
564
|
else:
|
|
550
565
|
structure = structure.repeat(self.repeat)
|
|
551
566
|
|
|
567
|
+
# extract composition
|
|
568
|
+
types, typecounts = np.unique(
|
|
569
|
+
structure.get_chemical_symbols(), return_counts=True
|
|
570
|
+
)
|
|
571
|
+
|
|
572
|
+
for c, t in enumerate(types):
|
|
573
|
+
self._element_dict[t]["count"] = typecounts[c]
|
|
574
|
+
self._element_dict[t]["composition"] = typecounts[c] / np.sum(
|
|
575
|
+
typecounts
|
|
576
|
+
)
|
|
577
|
+
|
|
552
578
|
self._natoms = len(structure)
|
|
553
579
|
self._original_lattice = self.lattice.lower()
|
|
554
580
|
write_structure_file = True
|
calphy/postprocessing.py
CHANGED
|
@@ -30,15 +30,15 @@ def read_report(folder):
|
|
|
30
30
|
|
|
31
31
|
def _extract_error(errfile):
|
|
32
32
|
error_code = None
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
33
|
+
try:
|
|
34
|
+
if os.path.exists(errfile):
|
|
35
|
+
with open(errfile, 'r') as fin:
|
|
36
|
+
for line in fin:
|
|
37
|
+
if 'calphy.errors' in line:
|
|
38
|
+
break
|
|
39
|
+
error_code = line.split(':')[0].split('.')[-1]
|
|
40
|
+
except:
|
|
41
|
+
pass
|
|
42
42
|
return error_code
|
|
43
43
|
|
|
44
44
|
def gather_results(mainfolder, reduce_composition=True,
|
|
@@ -1,25 +1,25 @@
|
|
|
1
|
-
calphy/__init__.py,sha256=
|
|
1
|
+
calphy/__init__.py,sha256=ajDpPU1OkfwLqHSjYro8IgKKujLpCZhkszpGfQHA_5U,233
|
|
2
2
|
calphy/alchemy.py,sha256=IEYLfsJRsjfB0zFfApmxGbYXif7IE6mUY_vjTZoXdII,17236
|
|
3
|
-
calphy/clitools.py,sha256=
|
|
3
|
+
calphy/clitools.py,sha256=ZUr6ZfdopFxWMbrzNT_TQaUA16iPmZ3144oPcwcDazY,4433
|
|
4
4
|
calphy/composition_transformation.py,sha256=z3X4fFVoym6QgRDpLBYZ_fM9V0IgJvBq-wITu1nwVmw,17247
|
|
5
5
|
calphy/errors.py,sha256=KN47RWTLbg1H_NZMrhCiJCbqjqJScJ1pgQAuzj1-l84,1268
|
|
6
6
|
calphy/helpers.py,sha256=goN_n5kceSaevjBilQDgHD5-QZxsQsOwTiWsY00jMcM,8411
|
|
7
|
-
calphy/input.py,sha256=
|
|
7
|
+
calphy/input.py,sha256=3xVoJcbwq3T7y_1drIvg1Erel9dz6y9A4rgNsncEfgw,36225
|
|
8
8
|
calphy/integrators.py,sha256=q5sIJX3nh4c9kmDQJ4Pqhvm38tRWKELoJwm5gW0lqws,21858
|
|
9
9
|
calphy/kernel.py,sha256=wjSpQ59PN-aqHQ1kvOxTYnP2d3wE1Zx4A9ZhqQFqGlI,6311
|
|
10
10
|
calphy/liquid.py,sha256=ECF3DxPZv7XHnmQzk_yz1fol-Vsd98lRojTMAR1YS3M,15025
|
|
11
11
|
calphy/phase.py,sha256=F4GRrEG0IDR6f0rFabQYP7aYBzpKAyxPvol-n7vAj08,53540
|
|
12
12
|
calphy/phase_diagram.py,sha256=Yu192y7bhWsj-xQL7ITSBdMHKXJ6I_4gV0cLfdXTOa4,27791
|
|
13
|
-
calphy/postprocessing.py,sha256=
|
|
13
|
+
calphy/postprocessing.py,sha256=XxpFGbR8dUoKhGb7GCPEWPA4CWl7ZftuM1cN4tz7-fQ,15164
|
|
14
14
|
calphy/queuekernel.py,sha256=4GMIYnjMiAPipoLNKP5noYcfeEOI_vCqm84zgokk7Xw,5321
|
|
15
15
|
calphy/routines.py,sha256=YaVoAbeAbZ3ytAP_A0o5ngkpPiXpc_lk2I0bN3nqhPs,17858
|
|
16
16
|
calphy/scheduler.py,sha256=nIxlKKGj8ol_FuYMMtXrQinPGhPlYs2h-JsEGHC7_wY,8666
|
|
17
17
|
calphy/solid.py,sha256=zHSqri8roW23hIQ21huxHHJqq3P5EklSj6Z0z9ywfbc,21911
|
|
18
18
|
calphy/splines.py,sha256=BGwUVz_qXQxUzpUCuZo6CsELcd5JVNWzI-Ttcz22G_E,61627
|
|
19
19
|
calphy/utils.py,sha256=0UpsYoxjS5N-iGs-cdm0YDMkLF8IHvKO3smXDHrj3eg,3818
|
|
20
|
-
calphy-1.4.
|
|
21
|
-
calphy-1.4.
|
|
22
|
-
calphy-1.4.
|
|
23
|
-
calphy-1.4.
|
|
24
|
-
calphy-1.4.
|
|
25
|
-
calphy-1.4.
|
|
20
|
+
calphy-1.4.5.dist-info/licenses/LICENSE,sha256=XIHGB5RZLIhOjjoO1bPf0II-qDbjhP5Cv5HJMRE9v1g,16651
|
|
21
|
+
calphy-1.4.5.dist-info/METADATA,sha256=za1qlwUMSyzxwl2bghD8i9HdGRMLKpxslgpkX-jiM2s,4469
|
|
22
|
+
calphy-1.4.5.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
23
|
+
calphy-1.4.5.dist-info/entry_points.txt,sha256=KX5dP2iYy9GB4Mo0lbCPAz6jo-8b1Gt9GDmsDFzt9pQ,439
|
|
24
|
+
calphy-1.4.5.dist-info/top_level.txt,sha256=w871dhMqPwgjjbifBWdkT9_aOnK1ek4Odrh8UnSG3PE,7
|
|
25
|
+
calphy-1.4.5.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|