calphy 2.1.2__tar.gz → 2.3.1__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 (75) hide show
  1. {calphy-2.1.2 → calphy-2.3.1}/PKG-INFO +4 -2
  2. {calphy-2.1.2 → calphy-2.3.1}/README.md +1 -0
  3. {calphy-2.1.2 → calphy-2.3.1}/calphy/__init__.py +1 -1
  4. {calphy-2.1.2 → calphy-2.3.1}/calphy/alchemy.py +3 -3
  5. {calphy-2.1.2 → calphy-2.3.1}/calphy/composition_transformation.py +15 -21
  6. calphy-2.3.1/calphy/dcci.py +703 -0
  7. {calphy-2.1.2 → calphy-2.3.1}/calphy/helpers.py +45 -14
  8. {calphy-2.1.2 → calphy-2.3.1}/calphy/input.py +167 -72
  9. {calphy-2.1.2 → calphy-2.3.1}/calphy/integrators.py +3 -2
  10. {calphy-2.1.2 → calphy-2.3.1}/calphy/library_runner.py +8 -1
  11. {calphy-2.1.2 → calphy-2.3.1}/calphy/liquid.py +2 -2
  12. {calphy-2.1.2 → calphy-2.3.1}/calphy/phase.py +116 -72
  13. {calphy-2.1.2 → calphy-2.3.1}/calphy/postprocessing.py +68 -1
  14. {calphy-2.1.2 → calphy-2.3.1}/calphy/queuekernel.py +15 -2
  15. {calphy-2.1.2 → calphy-2.3.1}/calphy/routines.py +73 -33
  16. {calphy-2.1.2 → calphy-2.3.1}/calphy/runner.py +30 -2
  17. {calphy-2.1.2 → calphy-2.3.1}/calphy/solid.py +34 -18
  18. calphy-2.3.1/calphy/structures.py +146 -0
  19. {calphy-2.1.2 → calphy-2.3.1}/calphy.egg-info/PKG-INFO +4 -2
  20. {calphy-2.1.2 → calphy-2.3.1}/calphy.egg-info/SOURCES.txt +12 -1
  21. {calphy-2.1.2 → calphy-2.3.1}/calphy.egg-info/requires.txt +2 -1
  22. {calphy-2.1.2 → calphy-2.3.1}/pyproject.toml +3 -2
  23. {calphy-2.1.2 → calphy-2.3.1}/tests/test_command_vocabulary.py +1 -1
  24. calphy-2.3.1/tests/test_dcci_driver.py +308 -0
  25. calphy-2.3.1/tests/test_dcci_input.py +117 -0
  26. calphy-2.3.1/tests/test_dcci_integrator.py +62 -0
  27. calphy-2.3.1/tests/test_dcci_lammps_e2e.py +109 -0
  28. calphy-2.3.1/tests/test_dcci_lammps_semantics.py +220 -0
  29. calphy-2.3.1/tests/test_disabled_phase_checks.py +46 -0
  30. {calphy-2.1.2 → calphy-2.3.1}/tests/test_golden_streams.py +1 -9
  31. {calphy-2.1.2 → calphy-2.3.1}/tests/test_helpers.py +17 -0
  32. {calphy-2.1.2 → calphy-2.3.1}/tests/test_input_validation.py +5 -0
  33. {calphy-2.1.2 → calphy-2.3.1}/tests/test_integration_lammps.py +5 -5
  34. calphy-2.3.1/tests/test_integrators.py +29 -0
  35. {calphy-2.1.2 → calphy-2.3.1}/tests/test_library_runner.py +41 -0
  36. {calphy-2.1.2 → calphy-2.3.1}/tests/test_runner.py +73 -0
  37. calphy-2.3.1/tests/test_spring_constants.py +131 -0
  38. calphy-2.3.1/tests/test_structures.py +175 -0
  39. calphy-2.3.1/tests/test_sweep_barostat_targets.py +142 -0
  40. calphy-2.1.2/tests/test_integrators.py +0 -10
  41. {calphy-2.1.2 → calphy-2.3.1}/LICENSE +0 -0
  42. {calphy-2.1.2 → calphy-2.3.1}/calphy/clitools.py +0 -0
  43. {calphy-2.1.2 → calphy-2.3.1}/calphy/errors.py +0 -0
  44. {calphy-2.1.2 → calphy-2.3.1}/calphy/kernel.py +0 -0
  45. {calphy-2.1.2 → calphy-2.3.1}/calphy/phase_diagram.py +0 -0
  46. {calphy-2.1.2 → calphy-2.3.1}/calphy/range_scan.py +0 -0
  47. {calphy-2.1.2 → calphy-2.3.1}/calphy/scheduler.py +0 -0
  48. {calphy-2.1.2 → calphy-2.3.1}/calphy/splines.py +0 -0
  49. {calphy-2.1.2 → calphy-2.3.1}/calphy/utils.py +0 -0
  50. {calphy-2.1.2 → calphy-2.3.1}/calphy.egg-info/dependency_links.txt +0 -0
  51. {calphy-2.1.2 → calphy-2.3.1}/calphy.egg-info/entry_points.txt +0 -0
  52. {calphy-2.1.2 → calphy-2.3.1}/calphy.egg-info/top_level.txt +0 -0
  53. {calphy-2.1.2 → calphy-2.3.1}/setup.cfg +0 -0
  54. {calphy-2.1.2 → calphy-2.3.1}/tests/test_composition_scaling_potential.py +0 -0
  55. {calphy-2.1.2 → calphy-2.3.1}/tests/test_composition_transformation_bug.py +0 -0
  56. {calphy-2.1.2 → calphy-2.3.1}/tests/test_dissipation_check.py +0 -0
  57. {calphy-2.1.2 → calphy-2.3.1}/tests/test_element_ordering.py +0 -0
  58. {calphy-2.1.2 → calphy-2.3.1}/tests/test_ex07.py +0 -0
  59. {calphy-2.1.2 → calphy-2.3.1}/tests/test_find_tm_crossing_error.py +0 -0
  60. {calphy-2.1.2 → calphy-2.3.1}/tests/test_fix_paths_user_expansion.py +0 -0
  61. {calphy-2.1.2 → calphy-2.3.1}/tests/test_gather_results_sweep_data.py +0 -0
  62. {calphy-2.1.2 → calphy-2.3.1}/tests/test_meam_pair_coeff.py +0 -0
  63. {calphy-2.1.2 → calphy-2.3.1}/tests/test_melting_temperature_n_iterations.py +0 -0
  64. {calphy-2.1.2 → calphy-2.3.1}/tests/test_options.py +0 -0
  65. {calphy-2.1.2 → calphy-2.3.1}/tests/test_phase_detection_defaults.py +0 -0
  66. {calphy-2.1.2 → calphy-2.3.1}/tests/test_phase_diagram.py +0 -0
  67. {calphy-2.1.2 → calphy-2.3.1}/tests/test_phase_diagram_validation.py +0 -0
  68. {calphy-2.1.2 → calphy-2.3.1}/tests/test_postprocessing.py +0 -0
  69. {calphy-2.1.2 → calphy-2.3.1}/tests/test_preflight.py +0 -0
  70. {calphy-2.1.2 → calphy-2.3.1}/tests/test_pressure_convergence_pv_fit.py +0 -0
  71. {calphy-2.1.2 → calphy-2.3.1}/tests/test_pressure_coupling.py +0 -0
  72. {calphy-2.1.2 → calphy-2.3.1}/tests/test_qtb_input.py +0 -0
  73. {calphy-2.1.2 → calphy-2.3.1}/tests/test_scheduler.py +0 -0
  74. {calphy-2.1.2 → calphy-2.3.1}/tests/test_seed.py +0 -0
  75. {calphy-2.1.2 → calphy-2.3.1}/tests/test_solid_methods.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: calphy
3
- Version: 2.1.2
3
+ Version: 2.3.1
4
4
  Summary: free energy calculation for python
5
5
  Author: Yury Lysogorskiy, Ralf Drautz
6
6
  Author-email: Sarath Menon <sarath.menon@ruhr-uni-bochum.de>
@@ -26,7 +26,8 @@ Requires-Dist: mendeleev
26
26
  Requires-Dist: tqdm
27
27
  Requires-Dist: scipy
28
28
  Requires-Dist: pydantic>=2.3.0
29
- Requires-Dist: pyscal3
29
+ Requires-Dist: ase
30
+ Requires-Dist: pyscal3>=4.0.0
30
31
  Provides-Extra: test
31
32
  Requires-Dist: pytest>=7; extra == "test"
32
33
  Provides-Extra: materials-project
@@ -42,6 +43,7 @@ Dynamic: license-file
42
43
  - <img src="https://render.githubusercontent.com/render/math?math=F(V_i,T_i)"> and <img src="https://render.githubusercontent.com/render/math?math=G(P_i,T_i)"> for both solid and liquid phases at the given thermodynamic conditions using [non-equilibrium Hamiltonian interpolation](https://linkinghub.elsevier.com/retrieve/pii/S0927025615007089).
43
44
  - <img src="https://render.githubusercontent.com/render/math?math=F(T_i \to T_f)"> and <img src="https://render.githubusercontent.com/render/math?math=G(T_i \to T_f)">, temperature dependence of Gibbs and Helmholtz free energies using the [reversible scaling](https://link.aps.org/doi/10.1103/PhysRevLett.83.3973) approach.
44
45
  - Calculation of solid-solid or solid-liquid phase transition temperatures.
46
+ - Calculation of solid-liquid coexistence lines <img src="https://render.githubusercontent.com/render/math?math=P_{coex}(T)"> over a wide pressure range from a single known coexistence point using [dynamic Clausius-Clapeyron integration](https://doi.org/10.1063/1.1420486).
45
47
  - Calculation of specific heat <img src="https://render.githubusercontent.com/render/math?math=c_P(T)"> as a function of temperature.
46
48
  - Calculation of <img src="https://render.githubusercontent.com/render/math?math=F(x, T)"> and <img src="https://render.githubusercontent.com/render/math?math=G(x, T)"> for multicomponent systems using [alchemical transformations](https://journals.aps.org/prmaterials/abstract/10.1103/PhysRevMaterials.5.103801).
47
49
  - [Upsampling calculations](https://journals.aps.org/prmaterials/abstract/10.1103/PhysRevMaterials.5.103801).
@@ -5,6 +5,7 @@
5
5
  - <img src="https://render.githubusercontent.com/render/math?math=F(V_i,T_i)"> and <img src="https://render.githubusercontent.com/render/math?math=G(P_i,T_i)"> for both solid and liquid phases at the given thermodynamic conditions using [non-equilibrium Hamiltonian interpolation](https://linkinghub.elsevier.com/retrieve/pii/S0927025615007089).
6
6
  - <img src="https://render.githubusercontent.com/render/math?math=F(T_i \to T_f)"> and <img src="https://render.githubusercontent.com/render/math?math=G(T_i \to T_f)">, temperature dependence of Gibbs and Helmholtz free energies using the [reversible scaling](https://link.aps.org/doi/10.1103/PhysRevLett.83.3973) approach.
7
7
  - Calculation of solid-solid or solid-liquid phase transition temperatures.
8
+ - Calculation of solid-liquid coexistence lines <img src="https://render.githubusercontent.com/render/math?math=P_{coex}(T)"> over a wide pressure range from a single known coexistence point using [dynamic Clausius-Clapeyron integration](https://doi.org/10.1063/1.1420486).
8
9
  - Calculation of specific heat <img src="https://render.githubusercontent.com/render/math?math=c_P(T)"> as a function of temperature.
9
10
  - Calculation of <img src="https://render.githubusercontent.com/render/math?math=F(x, T)"> and <img src="https://render.githubusercontent.com/render/math?math=G(x, T)"> for multicomponent systems using [alchemical transformations](https://journals.aps.org/prmaterials/abstract/10.1103/PhysRevMaterials.5.103801).
10
11
  - [Upsampling calculations](https://journals.aps.org/prmaterials/abstract/10.1103/PhysRevMaterials.5.103801).
@@ -28,7 +28,7 @@ from calphy.solid import Solid
28
28
  from calphy.alchemy import Alchemy
29
29
  from calphy.routines import MeltingTemp
30
30
 
31
- __version__ = "2.1.2"
31
+ __version__ = "2.3.1"
32
32
 
33
33
  def addtest(a,b):
34
34
  return a+b
@@ -175,7 +175,7 @@ class Alchemy(cph.Phase):
175
175
  """Coupling-mode integration: ramp ONLY the last component 0->1
176
176
  (forward) and 1->0 (backward) over the fixed base.
177
177
  W = int <U_last>_lam dlam; dF = (W_f + W_b)/2 per iteration."""
178
- lmp = ph.create_object(self.calc, self.simfolder)
178
+ lmp = self._open_lammps()
179
179
  conf = os.path.join(self.simfolder, "conf.equilibration.data")
180
180
  # style only before read_data (pair_coeff needs the box)
181
181
  ns = self.calc._pair_style_with_options
@@ -253,7 +253,7 @@ class Alchemy(cph.Phase):
253
253
  Fix lattice option is not implemented at present.
254
254
  At the end of the run, the averaged box dimensions are calculated.
255
255
  """
256
- lmp = ph.create_object(self.calc, self.simfolder)
256
+ lmp = self._open_lammps()
257
257
 
258
258
  if self.calc.alchemy_coupling:
259
259
  # equilibrate on the BASE system (lam = 0): full base, ramped
@@ -345,7 +345,7 @@ class Alchemy(cph.Phase):
345
345
  initial, final = self._end_states()
346
346
 
347
347
  # create lammps object
348
- lmp = ph.create_object(self.calc, self.simfolder)
348
+ lmp = self._open_lammps()
349
349
 
350
350
  # Adiabatic switching parameters.
351
351
  lmp.command("variable li equal 1.0")
@@ -27,11 +27,9 @@ import re
27
27
  import numpy as np
28
28
  import os
29
29
  import random
30
- import pyscal3.core as pc
31
30
  from mendeleev import element
32
31
  from ase.io import read, write
33
32
  from ase.atoms import Atoms
34
- from pyscal3.core import element_dict
35
33
  from calphy.integrators import kb
36
34
 
37
35
 
@@ -163,9 +161,9 @@ class CompositionTransformation:
163
161
  entropy_term = kb * np.sum(ents)
164
162
  return entropy_term
165
163
 
166
- def convert_to_pyscal(self):
164
+ def read_structure(self):
167
165
  """
168
- Convert a given system to pyscal and give a dict of type mappings
166
+ Read the input structure and set up the element <-> type mappings
169
167
  """
170
168
  # Create Z_of_type mapping to properly read LAMMPS data files
171
169
  # This ensures atoms are correctly identified by their element
@@ -178,20 +176,19 @@ class CompositionTransformation:
178
176
  aseobj = read(
179
177
  self.calc.lattice, format="lammps-data", style="atomic", Z_of_type=Z_of_type
180
178
  )
181
- pstruct = pc.System(aseobj, format="ase")
182
179
 
183
180
  # here we have to validate the input composition dict; and map it
184
- typelist = pstruct.atoms.species
181
+ typelist = aseobj.get_chemical_symbols()
185
182
  types, typecounts = np.unique(typelist, return_counts=True)
186
183
  composition = {types[x]: typecounts[x] for x in range(len(types))}
187
184
 
188
185
  atomsymbols = self.calc.element
189
186
  atomtypes = [x + 1 for x in range(len(self.calc.element))]
190
187
 
191
- self.pyscal_structure = pstruct
188
+ self.structure = aseobj
192
189
  self.typedict = dict(zip(atomsymbols, atomtypes))
193
190
  self.reversetypedict = dict(zip(atomtypes, atomsymbols))
194
- self.natoms = self.pyscal_structure.natoms
191
+ self.natoms = len(self.structure)
195
192
 
196
193
  # Count of actual unique atom types present in the structure
197
194
  # This matches what's declared in the LAMMPS data file header
@@ -239,8 +236,9 @@ class CompositionTransformation:
239
236
  self.atom_mark.append(False)
240
237
 
241
238
  # Use species (element symbols) instead of numeric types
242
- self.atom_species = self.pyscal_structure.atoms.species
243
- self.atom_type = self.pyscal_structure.atoms.types
239
+ self.atom_species = self.structure.get_chemical_symbols()
240
+ # placeholder types; update_types assigns the mapping type of every atom
241
+ self.atom_type = [1] * self.natoms
244
242
  self.mappings = [f"{x}-{x}" for x in self.atom_species]
245
243
 
246
244
  def update_mark_atoms(self):
@@ -378,9 +376,6 @@ class CompositionTransformation:
378
376
  for x in range(len(self.atom_type)):
379
377
  self.atom_type[x] = self.mappingdict[self.mappings[x]]
380
378
 
381
- # Update pyscal structure types
382
- self.pyscal_structure.atoms.types = self.atom_type
383
-
384
379
  def iselement(self, symbol):
385
380
  try:
386
381
  _ = element(symbol)
@@ -582,9 +577,8 @@ class CompositionTransformation:
582
577
  from ase.io import write as ase_write
583
578
  from ase import Atoms as ASEAtoms
584
579
 
585
- # Get positions and cell from pyscal structure
586
- positions = self.pyscal_structure.atoms.positions
587
- cell = self.pyscal_structure.box
580
+ positions = self.structure.positions
581
+ cell = self.structure.cell
588
582
 
589
583
  # Build per-atom type numbers and chemical symbols.
590
584
  # for_fe_mode: remap each atom to its TARGET element's typedict entry so
@@ -598,8 +592,8 @@ class CompositionTransformation:
598
592
  invert_typedict = {v: k for k, v in self.typedict.items()}
599
593
  symbols = [invert_typedict[t] for t in fe_types]
600
594
  else:
601
- fe_types = None # will use pyscal types below
602
- symbols = [self.reversetypedict[t] for t in self.pyscal_structure.atoms.types]
595
+ fe_types = None # will use the mapping types below
596
+ symbols = [self.reversetypedict[t] for t in self.atom_type]
603
597
 
604
598
  ase_atoms = ASEAtoms(symbols=symbols, positions=positions, cell=cell, pbc=True)
605
599
 
@@ -611,7 +605,7 @@ class CompositionTransformation:
611
605
  lines = f.readlines()
612
606
 
613
607
  # Choose which per-atom type list to use
614
- atom_types_to_write = fe_types if for_fe_mode else list(self.pyscal_structure.atoms.types)
608
+ atom_types_to_write = fe_types if for_fe_mode else list(self.atom_type)
615
609
 
616
610
  # Find the Atoms section and replace type numbers
617
611
  # Support different ASE formats: "Atoms # atomic", "Atoms # full", or just "Atoms"
@@ -635,7 +629,7 @@ class CompositionTransformation:
635
629
  break
636
630
 
637
631
  # Verify all atoms were updated
638
- expected_atoms = len(self.pyscal_structure.atoms.types)
632
+ expected_atoms = len(self.atom_type)
639
633
  if atom_idx != expected_atoms:
640
634
  raise RuntimeError(
641
635
  f"Failed to update all atoms in {outfilename}. "
@@ -666,7 +660,7 @@ class CompositionTransformation:
666
660
  self.unique_mappings = []
667
661
 
668
662
  self.get_composition_transformation()
669
- self.convert_to_pyscal()
663
+ self.read_structure()
670
664
 
671
665
  self.mark_atoms()
672
666
  self.update_mark_atoms()