calphy 1.4.4__tar.gz → 1.4.5__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.
Files changed (37) hide show
  1. {calphy-1.4.4/calphy.egg-info → calphy-1.4.5}/PKG-INFO +1 -1
  2. {calphy-1.4.4 → calphy-1.4.5}/calphy/__init__.py +1 -1
  3. {calphy-1.4.4 → calphy-1.4.5}/calphy/clitools.py +1 -0
  4. {calphy-1.4.4 → calphy-1.4.5}/calphy/input.py +42 -16
  5. {calphy-1.4.4 → calphy-1.4.5}/calphy/postprocessing.py +9 -9
  6. {calphy-1.4.4 → calphy-1.4.5/calphy.egg-info}/PKG-INFO +1 -1
  7. {calphy-1.4.4 → calphy-1.4.5}/setup.py +1 -1
  8. {calphy-1.4.4 → calphy-1.4.5}/LICENSE +0 -0
  9. {calphy-1.4.4 → calphy-1.4.5}/MANIFEST.in +0 -0
  10. {calphy-1.4.4 → calphy-1.4.5}/README.md +0 -0
  11. {calphy-1.4.4 → calphy-1.4.5}/calphy/alchemy.py +0 -0
  12. {calphy-1.4.4 → calphy-1.4.5}/calphy/composition_transformation.py +0 -0
  13. {calphy-1.4.4 → calphy-1.4.5}/calphy/errors.py +0 -0
  14. {calphy-1.4.4 → calphy-1.4.5}/calphy/helpers.py +0 -0
  15. {calphy-1.4.4 → calphy-1.4.5}/calphy/integrators.py +0 -0
  16. {calphy-1.4.4 → calphy-1.4.5}/calphy/kernel.py +0 -0
  17. {calphy-1.4.4 → calphy-1.4.5}/calphy/liquid.py +0 -0
  18. {calphy-1.4.4 → calphy-1.4.5}/calphy/phase.py +0 -0
  19. {calphy-1.4.4 → calphy-1.4.5}/calphy/phase_diagram.py +0 -0
  20. {calphy-1.4.4 → calphy-1.4.5}/calphy/queuekernel.py +0 -0
  21. {calphy-1.4.4 → calphy-1.4.5}/calphy/routines.py +0 -0
  22. {calphy-1.4.4 → calphy-1.4.5}/calphy/scheduler.py +0 -0
  23. {calphy-1.4.4 → calphy-1.4.5}/calphy/solid.py +0 -0
  24. {calphy-1.4.4 → calphy-1.4.5}/calphy/splines.py +0 -0
  25. {calphy-1.4.4 → calphy-1.4.5}/calphy/utils.py +0 -0
  26. {calphy-1.4.4 → calphy-1.4.5}/calphy.egg-info/SOURCES.txt +0 -0
  27. {calphy-1.4.4 → calphy-1.4.5}/calphy.egg-info/dependency_links.txt +0 -0
  28. {calphy-1.4.4 → calphy-1.4.5}/calphy.egg-info/entry_points.txt +0 -0
  29. {calphy-1.4.4 → calphy-1.4.5}/calphy.egg-info/not-zip-safe +0 -0
  30. {calphy-1.4.4 → calphy-1.4.5}/calphy.egg-info/requires.txt +0 -0
  31. {calphy-1.4.4 → calphy-1.4.5}/calphy.egg-info/top_level.txt +0 -0
  32. {calphy-1.4.4 → calphy-1.4.5}/setup.cfg +0 -0
  33. {calphy-1.4.4 → calphy-1.4.5}/tests/test_ex07.py +0 -0
  34. {calphy-1.4.4 → calphy-1.4.5}/tests/test_helpers.py +0 -0
  35. {calphy-1.4.4 → calphy-1.4.5}/tests/test_integrators.py +0 -0
  36. {calphy-1.4.4 → calphy-1.4.5}/tests/test_options.py +0 -0
  37. {calphy-1.4.4 → calphy-1.4.5}/tests/test_solid_methods.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: calphy
3
- Version: 1.4.4
3
+ Version: 1.4.5
4
4
  Summary: free energy calculation for python
5
5
  Home-page: https://github.com/ICAMS/calphy
6
6
  Author: Sarath Menon, Yury Lysogorskiy, Ralf Drautz
@@ -4,7 +4,7 @@ from calphy.solid import Solid
4
4
  from calphy.alchemy import Alchemy
5
5
  from calphy.routines import MeltingTemp
6
6
 
7
- __version__ = "1.4.4"
7
+ __version__ = "1.4.5"
8
8
 
9
9
  def addtest(a,b):
10
10
  return a+b
@@ -125,4 +125,5 @@ def phase_diagram():
125
125
  arg = ap.ArgumentParser()
126
126
  arg.add_argument("-i", "--input", required=True, type=str,
127
127
  help="name of the input file")
128
+ args = vars(arg.parse_args())
128
129
  prepare_inputs_for_phase_diagram(args['input'])
@@ -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.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
- class MaterialsProject(BaseModel, title='Input options for materials project'):
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[int, Field(default=1500, description='The structure parsed from materials project would be repeated to approximately this value')]
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('-')[0] == 'mp':
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('could not find API KEY, pls set it.')
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('Could not import mp_api, make sure you install mp_api package!')
527
- #now all good
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
- "use_document_model": False,
530
- "include_user_agent": True,
531
- "api_key": self.materials_project.api_key,
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['structure']
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(np.ceil((self.materials_project.target_natoms/len(structure))**(1/3)))
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
@@ -30,15 +30,15 @@ def read_report(folder):
30
30
 
31
31
  def _extract_error(errfile):
32
32
  error_code = None
33
- if os.path.exists(errfile):
34
- with open(errfile, 'r') as fin:
35
- for line in fin:
36
- if 'calphy.errors' in line:
37
- break
38
- try:
39
- error_code = line.split(':')[0].split('.')[-1]
40
- except:
41
- pass
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,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: calphy
3
- Version: 1.4.4
3
+ Version: 1.4.5
4
4
  Summary: free energy calculation for python
5
5
  Home-page: https://github.com/ICAMS/calphy
6
6
  Author: Sarath Menon, Yury Lysogorskiy, Ralf Drautz
@@ -53,7 +53,7 @@ setup(
53
53
  packages=find_packages(include=['calphy', 'calphy.*']),
54
54
  test_suite='tests',
55
55
  url='https://github.com/ICAMS/calphy',
56
- version='1.4.4',
56
+ version='1.4.5',
57
57
  zip_safe=False,
58
58
  entry_points={
59
59
  'console_scripts': [
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