calphy 1.2.17__tar.gz → 1.3.0__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 (34) hide show
  1. {calphy-1.2.17/calphy.egg-info → calphy-1.3.0}/PKG-INFO +1 -1
  2. {calphy-1.2.17 → calphy-1.3.0}/calphy/__init__.py +1 -1
  3. {calphy-1.2.17 → calphy-1.3.0}/calphy/alchemy.py +2 -2
  4. {calphy-1.2.17 → calphy-1.3.0}/calphy/helpers.py +3 -9
  5. {calphy-1.2.17 → calphy-1.3.0}/calphy/input.py +21 -20
  6. {calphy-1.2.17 → calphy-1.3.0}/calphy/integrators.py +58 -29
  7. {calphy-1.2.17 → calphy-1.3.0}/calphy/liquid.py +4 -3
  8. {calphy-1.2.17 → calphy-1.3.0}/calphy/phase.py +4 -9
  9. {calphy-1.2.17 → calphy-1.3.0}/calphy/solid.py +21 -13
  10. {calphy-1.2.17 → calphy-1.3.0/calphy.egg-info}/PKG-INFO +1 -1
  11. {calphy-1.2.17 → calphy-1.3.0}/setup.py +1 -1
  12. {calphy-1.2.17 → calphy-1.3.0}/tests/test_integrators.py +0 -4
  13. {calphy-1.2.17 → calphy-1.3.0}/LICENSE +0 -0
  14. {calphy-1.2.17 → calphy-1.3.0}/MANIFEST.in +0 -0
  15. {calphy-1.2.17 → calphy-1.3.0}/README.md +0 -0
  16. {calphy-1.2.17 → calphy-1.3.0}/calphy/clitools.py +0 -0
  17. {calphy-1.2.17 → calphy-1.3.0}/calphy/composition_transformation.py +0 -0
  18. {calphy-1.2.17 → calphy-1.3.0}/calphy/errors.py +0 -0
  19. {calphy-1.2.17 → calphy-1.3.0}/calphy/kernel.py +0 -0
  20. {calphy-1.2.17 → calphy-1.3.0}/calphy/phase_diagram.py +0 -0
  21. {calphy-1.2.17 → calphy-1.3.0}/calphy/queuekernel.py +0 -0
  22. {calphy-1.2.17 → calphy-1.3.0}/calphy/routines.py +0 -0
  23. {calphy-1.2.17 → calphy-1.3.0}/calphy/scheduler.py +0 -0
  24. {calphy-1.2.17 → calphy-1.3.0}/calphy/splines.py +0 -0
  25. {calphy-1.2.17 → calphy-1.3.0}/calphy.egg-info/SOURCES.txt +0 -0
  26. {calphy-1.2.17 → calphy-1.3.0}/calphy.egg-info/dependency_links.txt +0 -0
  27. {calphy-1.2.17 → calphy-1.3.0}/calphy.egg-info/entry_points.txt +0 -0
  28. {calphy-1.2.17 → calphy-1.3.0}/calphy.egg-info/not-zip-safe +0 -0
  29. {calphy-1.2.17 → calphy-1.3.0}/calphy.egg-info/requires.txt +0 -0
  30. {calphy-1.2.17 → calphy-1.3.0}/calphy.egg-info/top_level.txt +0 -0
  31. {calphy-1.2.17 → calphy-1.3.0}/setup.cfg +0 -0
  32. {calphy-1.2.17 → calphy-1.3.0}/tests/test_helpers.py +0 -0
  33. {calphy-1.2.17 → calphy-1.3.0}/tests/test_options.py +0 -0
  34. {calphy-1.2.17 → calphy-1.3.0}/tests/test_solid_methods.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: calphy
3
- Version: 1.2.17
3
+ Version: 1.3.0
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.2.17"
7
+ __version__ = "1.3.0"
8
8
 
9
9
  def addtest(a,b):
10
10
  return a+b
@@ -84,7 +84,7 @@ class Alchemy(cph.Phase):
84
84
 
85
85
  #set up potential
86
86
  lmp.command(f'pair_coeff {self.calc.pair_coeff[0]}')
87
- lmp = ph.set_mass(lmp, self.calc, ghost_elements=self.calc._ghost_element_count)
87
+ lmp = ph.set_mass(lmp, self.calc)
88
88
 
89
89
  #add some computes
90
90
  lmp.command("variable mvol equal vol")
@@ -157,7 +157,7 @@ class Alchemy(cph.Phase):
157
157
  #set up hybrid potential
158
158
  #here we only need to set one potential
159
159
  lmp.command(f'pair_coeff {self.calc.pair_coeff[0]}')
160
- lmp = ph.set_mass(lmp, self.calc, ghost_elements=self.calc._ghost_element_count)
160
+ lmp = ph.set_mass(lmp, self.calc)
161
161
 
162
162
  #lmp = ph.set_double_hybrid_potential(lmp, self.options, self.calc._pressureair_style, self.calc._pressureair_coeff)
163
163
 
@@ -118,19 +118,13 @@ def create_structure(lmp, calc):
118
118
  return lmp
119
119
 
120
120
 
121
- def set_mass(lmp, options, ghost_elements=0):
122
- count = 1
121
+ def set_mass(lmp, options):
123
122
  for i in range(options.n_elements):
124
123
  lmp.command(f'mass {i+1} {options.mass[i]}')
125
- count += 1
126
-
127
- for i in range(ghost_elements):
128
- lmp.command(f'mass {count+i} 1.00')
129
-
130
124
  return lmp
131
125
 
132
126
 
133
- def set_potential(lmp, options, ghost_elements=0):
127
+ def set_potential(lmp, options):
134
128
  """
135
129
  Set the interatomic potential
136
130
 
@@ -149,7 +143,7 @@ def set_potential(lmp, options, ghost_elements=0):
149
143
  lmp.command(f'pair_style {options._pair_style_with_options[0]}')
150
144
  lmp.command(f'pair_coeff {options.pair_coeff[0]}')
151
145
 
152
- lmp = set_mass(lmp, options, ghost_elements=ghost_elements)
146
+ lmp = set_mass(lmp, options)
153
147
 
154
148
  return lmp
155
149
 
@@ -202,7 +202,6 @@ class Calculation(BaseModel, title='Main input class'):
202
202
 
203
203
  #add second level options; for example spring constants
204
204
  spring_constants: Annotated[List[float], Field(default = None)]
205
- _ghost_element_count: int = PrivateAttr(default=0)
206
205
 
207
206
  #structure items
208
207
  _structure: Any = PrivateAttr(default=None)
@@ -329,6 +328,7 @@ class Calculation(BaseModel, title='Main input class'):
329
328
  self._element_dict[element]['mass'] = self.mass[count]
330
329
  self._element_dict[element]['count'] = 0
331
330
  self._element_dict[element]['composition'] = 0.0
331
+ self._element_dict[element]['atomic_number'] = mendeleev.element(element).atomic_number
332
332
 
333
333
  #generate temporary filename if needed
334
334
  write_structure_file = False
@@ -336,7 +336,7 @@ class Calculation(BaseModel, title='Main input class'):
336
336
  if self.lattice == "":
337
337
  #fetch from dict
338
338
  if len(self.element) > 1:
339
- raise ValueError("Cannot create lattice for more than one element")
339
+ raise ValueError("Cannot create lattice for more than one element, provide a lammps-data file explicitly")
340
340
  if self.element[0] in element_dict.keys():
341
341
  self.lattice = element_dict[self.element[0]]['structure']
342
342
  self.lattice_constant = element_dict[self.element[0]]['lattice_constant']
@@ -350,20 +350,23 @@ class Calculation(BaseModel, title='Main input class'):
350
350
  lattice_constant=self.lattice_constant,
351
351
  repetitions=self.repeat,
352
352
  element=self.element)
353
+ structure = structure.write.ase()
353
354
 
354
355
  #extract composition
355
- typelist = structure.atoms.species
356
- types, typecounts = np.unique(typelist, return_counts=True)
356
+ types, typecounts = np.unique(structure.get_chemical_symbols(), return_counts=True)
357
357
 
358
358
  for c, t in enumerate(types):
359
359
  self._element_dict[t]['count'] = typecounts[c]
360
360
  self._element_dict[t]['composition'] = typecounts[c]/np.sum(typecounts)
361
361
 
362
- self._natoms = structure.natoms
362
+ self._natoms = len(structure)
363
363
  self._original_lattice = self.lattice.lower()
364
364
  write_structure_file = True
365
365
 
366
366
  elif self.lattice.lower() in structure_dict.keys():
367
+ if len(self.element) > 1:
368
+ raise ValueError("Cannot create lattice for more than one element, provide a lammps-data file explicitly")
369
+
367
370
  #this is a valid structure
368
371
  if self.lattice_constant == 0:
369
372
  #we try try to get lattice_constant
@@ -376,10 +379,10 @@ class Calculation(BaseModel, title='Main input class'):
376
379
  lattice_constant=self.lattice_constant,
377
380
  repetitions=self.repeat,
378
381
  element=self.element)
382
+ structure = structure.write.ase()
379
383
 
380
384
  #extract composition
381
- typelist = structure.atoms.species
382
- types, typecounts = np.unique(typelist, return_counts=True)
385
+ types, typecounts = np.unique(structure.get_chemical_symbols(), return_counts=True)
383
386
 
384
387
  for c, t in enumerate(types):
385
388
  self._element_dict[t]['count'] = typecounts[c]
@@ -389,7 +392,7 @@ class Calculation(BaseModel, title='Main input class'):
389
392
  #concdict_frac = {str(t): typecounts[c]/np.sum(typecounts) for c, t in enumerate(types)}
390
393
  #self._composition = concdict_frac
391
394
  #self._composition_counts = concdict_counts
392
- self._natoms = structure.natoms
395
+ self._natoms = len(structure)
393
396
  self._original_lattice = self.lattice.lower()
394
397
  write_structure_file = True
395
398
 
@@ -398,20 +401,21 @@ class Calculation(BaseModel, title='Main input class'):
398
401
  if not os.path.exists(self.lattice):
399
402
  raise ValueError(f'File {self.lattice} could not be found')
400
403
  if self.file_format == 'lammps-data':
401
- aseobj = read(self.lattice, format='lammps-data', style='atomic')
402
- structure = System(aseobj, format='ase')
404
+ #create atomic numbers for proper reading
405
+ Z_of_type = dict([(count+1, self._element_dict[element]['atomic_number']) for count, element in enumerate(self.element)])
406
+ structure = read(self.lattice, format='lammps-data', style='atomic', Z_of_type=Z_of_type)
407
+ #structure = System(aseobj, format='ase')
403
408
  else:
404
409
  raise TypeError('Only lammps-data files are supported!')
405
410
 
406
411
  #extract composition
407
- typelist = structure.atoms.types
408
- #convert to species
409
- typelist = [self.element[x-1] for x in typelist]
410
- types, typecounts = np.unique(typelist, return_counts=True)
412
+ #this is the types read in from the file
413
+ types, typecounts = np.unique(structure.get_chemical_symbols(), return_counts=True)
411
414
  for c, t in enumerate(types):
412
415
  self._element_dict[t]['count'] = typecounts[c]
413
416
  self._element_dict[t]['composition'] = typecounts[c]/np.sum(typecounts)
414
- self._natoms = structure.natoms
417
+
418
+ self._natoms = len(structure)
415
419
  self._original_lattice = os.path.basename(self.lattice)
416
420
  self.lattice = os.path.abspath(self.lattice)
417
421
 
@@ -419,13 +423,10 @@ class Calculation(BaseModel, title='Main input class'):
419
423
  if write_structure_file:
420
424
  structure_filename = ".".join([self.create_identifier(), str(self.kernel), "data"])
421
425
  structure_filename = os.path.join(os.getcwd(), structure_filename)
422
- structure.write.file(structure_filename, format='lammps-data')
426
+ write(structure_filename, structure, format='lammps-data')
423
427
  self.lattice = structure_filename
424
428
 
425
429
  if self.mode == 'composition_scaling':
426
- aseobj = read(self.lattice, format='lammps-data', style='atomic')
427
- structure = System(aseobj, format='ase')
428
-
429
430
  #we also should check if actual contents are present
430
431
  input_chem_comp = {}
431
432
  for key, val in self._element_dict.items():
@@ -439,7 +440,7 @@ class Calculation(BaseModel, title='Main input class'):
439
440
 
440
441
  natoms1 = np.sum([val for key, val in self.composition_scaling._input_chemical_composition.items()])
441
442
  natoms2 = np.sum([val for key, val in self.composition_scaling.output_chemical_composition.items()])
442
- if not (natoms1==natoms2==structure.natoms):
443
+ if not (natoms1==natoms2):
443
444
  raise ValueError(f"Input and output number of atoms are not conserved! Input {self.dict_to_string(self.input_chemical_composition)}, output {self.dict_to_string(self.output_chemical_composition)}, total atoms in structure {structure.natoms}")
444
445
  return self
445
446
 
@@ -46,10 +46,12 @@ eV2J = const.eV
46
46
  # TI PATH INTEGRATION ROUTINES
47
47
  #--------------------------------------------------------------------
48
48
 
49
- def integrate_path(fwdfilename, bkdfilename,
50
- nelements=1, concentration=[1,],
51
- usecols=(0, 1, 2), solid=True,
52
- alchemy=False, composition_integration=False):
49
+ def integrate_path(calc,
50
+ fwdfilename,
51
+ bkdfilename,
52
+ solid=True,
53
+ alchemy=False,
54
+ composition_integration=False):
53
55
  """
54
56
  Get a filename with columns du and dlambda and integrate
55
57
 
@@ -72,23 +74,36 @@ def integrate_path(fwdfilename, bkdfilename,
72
74
  q : float
73
75
  heat dissipation during switching of system
74
76
  """
77
+ natoms = np.array([calc._element_dict[x]['count'] for x in calc.element])
78
+ concentration = np.array([calc._element_dict[x]['composition'] for x in calc.element])
79
+ fdata = np.loadtxt(fwdfilename, unpack=True, comments="#")
80
+ bdata = np.loadtxt(bkdfilename, unpack=True, comments="#")
81
+
75
82
  if solid:
76
- fdui = np.loadtxt(fwdfilename, unpack=True, comments="#", usecols=(0,))
77
- bdui = np.loadtxt(bkdfilename, unpack=True, comments="#", usecols=(0,))
83
+ fdui = fdata[0]
84
+ bdui = bdata[0]
78
85
 
79
86
  fdur = np.zeros(len(fdui))
80
87
  bdur = np.zeros(len(bdui))
81
88
 
82
- for i in range(nelements):
83
- fdur += concentration[i]*np.loadtxt(fwdfilename, unpack=True, comments="#", usecols=(i+1,))
84
- bdur += concentration[i]*np.loadtxt(bkdfilename, unpack=True, comments="#", usecols=(i+1,))
89
+ for i in range(calc.n_elements):
90
+ if natoms[i] > 0:
91
+ fdur += concentration[i]*fdata[i+1]/natoms[i]
92
+ bdur += concentration[i]*bdata[i+1]/natoms[i]
85
93
 
86
- flambda = np.loadtxt(fwdfilename, unpack=True, comments="#", usecols=(nelements+1,))
87
- blambda = np.loadtxt(bkdfilename, unpack=True, comments="#", usecols=(nelements+1,))
94
+ flambda = fdata[calc.n_elements+1]
95
+ blambda = bdata[calc.n_elements+1]
88
96
 
89
97
  else:
90
- fdui, fdur, flambda = np.loadtxt(fwdfilename, unpack=True, comments="#", usecols=usecols)
91
- bdui, bdur, blambda = np.loadtxt(bkdfilename, unpack=True, comments="#", usecols=usecols)
98
+ fdui = fdata[0]
99
+ bdui = bdata[0]
100
+
101
+ fdur = fdata[1]
102
+ bdur = bdata[1]
103
+
104
+ flambda = fdata[2]
105
+ blambda = bdata[2]
106
+
92
107
 
93
108
  fdu = fdui - fdur
94
109
  bdu = bdui - bdur
@@ -106,11 +121,12 @@ def integrate_path(fwdfilename, bkdfilename,
106
121
  return w, q, flambda
107
122
 
108
123
 
109
- def find_w(mainfolder, nelements=1,
110
- concentration=[1,], nsims=5,
111
- full=False, usecols=(0,1,2),
124
+ def find_w(mainfolder,
125
+ calc,
126
+ full=False,
112
127
  solid=True,
113
- alchemy=False, composition_integration=False):
128
+ alchemy=False,
129
+ composition_integration=False):
114
130
  """
115
131
  Integrate the irreversible work and dissipation for independent simulations
116
132
 
@@ -142,15 +158,20 @@ def find_w(mainfolder, nelements=1,
142
158
  ws = []
143
159
  qs = []
144
160
 
145
- for i in range(nsims):
161
+ for i in range(calc.n_iterations):
146
162
  fwdfilestring = 'forward_%d.dat' % (i+1)
147
163
  fwdfilename = os.path.join(mainfolder,fwdfilestring)
164
+
148
165
  bkdfilestring = 'backward_%d.dat' % (i+1)
149
166
  bkdfilename = os.path.join(mainfolder,bkdfilestring)
150
- w, q, flambda = integrate_path(fwdfilename, bkdfilename,
151
- nelements=nelements, concentration=concentration,
152
- usecols=usecols, solid=solid,
153
- alchemy=alchemy, composition_integration=composition_integration)
167
+
168
+ w, q, flambda = integrate_path(calc,
169
+ fwdfilename,
170
+ bkdfilename,
171
+ solid=solid,
172
+ alchemy=alchemy,
173
+ composition_integration=composition_integration)
174
+
154
175
  ws.append(w)
155
176
  qs.append(q)
156
177
 
@@ -444,7 +465,11 @@ def integrate_dcc(folder1, folder2, nsims=1, scale_energy=True,
444
465
  # REF. STATE ROUTINES: SOLID
445
466
  #--------------------------------------------------------------------
446
467
 
447
- def get_einstein_crystal_fe(temp, natoms, mass, vol, k, concentration, cm_correction=True):
468
+ def get_einstein_crystal_fe(
469
+ calc,
470
+ vol,
471
+ k,
472
+ cm_correction=True):
448
473
  """
449
474
  Get the free energy of einstein crystal
450
475
 
@@ -475,7 +500,10 @@ def get_einstein_crystal_fe(temp, natoms, mass, vol, k, concentration, cm_correc
475
500
 
476
501
  """
477
502
  #convert mass first for single particle in kg
478
- mass = (np.array(mass)/Na)*1E-3
503
+ mass = np.array([calc._element_dict[x]['mass'] for x in calc.element])
504
+ mass = (mass/Na)*1E-3
505
+ natoms = np.sum([calc._element_dict[x]['count'] for x in calc.element])
506
+ concentration = np.array([calc._element_dict[x]['composition'] for x in calc.element])
479
507
 
480
508
  #convert k from ev/A2 to J/m2
481
509
  k = np.array(k)*(eV2J/1E-20)
@@ -488,12 +516,13 @@ def get_einstein_crystal_fe(temp, natoms, mass, vol, k, concentration, cm_correc
488
516
  F_cm = 0
489
517
 
490
518
  for count, om in enumerate(omega):
491
- F_harm += concentration[count]*np.log((hbar*om)/(kb*temp))
492
- if cm_correction:
493
- F_cm += np.log((natoms*concentration[count]/vol)*(2*np.pi*kbJ*temp/(natoms*concentration[count]*k[count]))**1.5)
519
+ if concentration[count] > 0:
520
+ F_harm += concentration[count]*np.log((hbar*om)/(kb*calc._temperature))
521
+ if cm_correction:
522
+ F_cm += np.log((natoms*concentration[count]/vol)*(2*np.pi*kbJ*calc._temperature/(natoms*concentration[count]*k[count]))**1.5)
494
523
  #F_cm = 0
495
- F_harm = 3*kb*temp*F_harm
496
- F_cm = (kb*temp/natoms)*F_cm
524
+ F_harm = 3*kb*calc._temperature*F_harm
525
+ F_cm = (kb*calc._temperature/natoms)*F_cm
497
526
 
498
527
  F_harm = F_harm + F_cm
499
528
 
@@ -120,7 +120,7 @@ class Liquid(cph.Phase):
120
120
 
121
121
  #set up potential
122
122
  lmp.command(f'pair_coeff {self.calc.pair_coeff[0]}')
123
- lmp = ph.set_mass(lmp, self.calc, ghost_elements=self.calc._ghost_element_count)
123
+ lmp = ph.set_mass(lmp, self.calc)
124
124
 
125
125
  #Melt regime for the liquid
126
126
  lmp.velocity("all create", self.calc._temperature_high, np.random.randint(1, 10000))
@@ -189,7 +189,7 @@ class Liquid(cph.Phase):
189
189
  #set hybrid ufm and normal potential
190
190
  #lmp = ph.set_hybrid_potential(lmp, self.options, self.eps)
191
191
  lmp.command(f'pair_coeff {self.calc.pair_coeff[0]}')
192
- lmp = ph.set_mass(lmp, self.calc, ghost_elements=self.calc._ghost_element_count)
192
+ lmp = ph.set_mass(lmp, self.calc)
193
193
 
194
194
  #remap the box to get the correct pressure
195
195
  lmp = ph.remap_box(lmp, self.lx, self.ly, self.lz)
@@ -331,7 +331,8 @@ class Liquid(cph.Phase):
331
331
  self.rho, 50, 1.5)
332
332
 
333
333
  #Get ideal gas fe
334
- f2 = get_ideal_gas_fe(self.calc._temperature, self.rho,
334
+ f2 = get_ideal_gas_fe(self.calc._temperature,
335
+ self.rho,
335
336
  self.natoms,
336
337
  [val['mass'] for key, val in self.calc._element_dict.items()],
337
338
  [val['composition'] for key, val in self.calc._element_dict.items()])
@@ -56,11 +56,6 @@ class Phase:
56
56
  logfile = os.path.join(self.simfolder, "calphy.log")
57
57
  self.logger = ph.prepare_log(logfile, screen=log_to_screen)
58
58
 
59
- self.logger.info("---------------input file----------------")
60
- self.logger.info("commented out as causes crash when we're expanding the T range after a fail run")
61
- # self.logger.info(yaml.safe_dump(self.calc.to_dict()))
62
- self.logger.info("------------end of input file------------")
63
-
64
59
  if self.calc._pressure is None:
65
60
  pressure_string = "None"
66
61
  else:
@@ -737,7 +732,7 @@ class Phase:
737
732
 
738
733
  #set up potential
739
734
  lmp.command(f'pair_coeff {self.calc.pair_coeff[0]}')
740
- lmp = ph.set_mass(lmp, self.calc, ghost_elements=self.calc._ghost_element_count)
735
+ lmp = ph.set_mass(lmp, self.calc)
741
736
 
742
737
  #remap the box to get the correct pressure
743
738
  lmp = ph.remap_box(lmp, self.lx, self.ly, self.lz)
@@ -826,7 +821,7 @@ class Phase:
826
821
  else:
827
822
  self.check_if_solidfied(lmp, "traj.temp.dat")
828
823
 
829
- lmp = ph.set_potential(lmp, self.calc, ghost_elements=self.calc._ghost_element_count)
824
+ lmp = ph.set_potential(lmp, self.calc)
830
825
 
831
826
  #reverse scaling
832
827
  lmp.command("variable flambda equal ramp(${li},${lf})")
@@ -928,7 +923,7 @@ class Phase:
928
923
 
929
924
  #set up potential
930
925
  lmp.command(f'pair_coeff {self.calc.pair_coeff[0]}')
931
- lmp = ph.set_mass(lmp, self.calc, ghost_elements=self.calc._ghost_element_count)
926
+ lmp = ph.set_mass(lmp, self.calc)
932
927
 
933
928
  #remap the box to get the correct pressure
934
929
  lmp = ph.remap_box(lmp, self.lx, self.ly, self.lz)
@@ -1020,7 +1015,7 @@ class Phase:
1020
1015
 
1021
1016
  #set up potential
1022
1017
  lmp.command(f'pair_coeff {self.calc.pair_coeff[0]}')
1023
- lmp = ph.set_mass(lmp, self.calc, ghost_elements=self.calc._ghost_element_count)
1018
+ lmp = ph.set_mass(lmp, self.calc)
1024
1019
 
1025
1020
  #remap the box to get the correct pressure
1026
1021
  lmp = ph.remap_box(lmp, self.lx, self.ly, self.lz)
@@ -109,9 +109,13 @@ class Solid(cph.Phase):
109
109
  k_std = []
110
110
  for i in range(self.calc.n_elements):
111
111
  quant = np.loadtxt(file, usecols=(i+1, ), unpack=True)[-ncount+1:]
112
- quant = 3*kb*self.calc._temperature/quant
113
- k_mean.append(np.round(np.mean(quant), decimals=2))
114
- k_std.append(np.round(np.std(quant), decimals=2))
112
+ mean_quant = np.round(np.mean(quant), decimals=2)
113
+ std_quant = np.round(np.std(quant), decimals=2)
114
+ if mean_quant == 0:
115
+ mean_quant = 1.00
116
+ mean_quant = 3*kb*self.calc._temperature/mean_quant
117
+ k_mean.append(mean_quant)
118
+ k_std.append(std_quant)
115
119
  return k_mean, k_std
116
120
 
117
121
 
@@ -222,7 +226,7 @@ class Solid(cph.Phase):
222
226
  lmp.command(f'pair_coeff {self.calc.pair_coeff[0]}')
223
227
  else:
224
228
  lmp.command("include %s"%self.calc.potential_file)
225
- lmp = ph.set_mass(lmp, self.calc, ghost_elements=self.calc._ghost_element_count)
229
+ lmp = ph.set_mass(lmp, self.calc)
226
230
 
227
231
  #add some computes
228
232
  lmp.command("variable mvol equal vol")
@@ -301,7 +305,7 @@ class Solid(cph.Phase):
301
305
  lmp.command(f'pair_coeff {self.calc.pair_coeff[0]}')
302
306
  else:
303
307
  lmp.command("include %s"%self.calc.potential_file)
304
- lmp = ph.set_mass(lmp, self.calc, ghost_elements=self.calc._ghost_element_count)
308
+ lmp = ph.set_mass(lmp, self.calc)
305
309
 
306
310
 
307
311
  #add some computes
@@ -384,7 +388,7 @@ class Solid(cph.Phase):
384
388
  lmp.command(f'pair_coeff {self.calc.pair_coeff[0]}')
385
389
  else:
386
390
  lmp.command("include %s"%self.calc.potential_file)
387
- lmp = ph.set_mass(lmp, self.calc, ghost_elements=self.calc._ghost_element_count)
391
+ lmp = ph.set_mass(lmp, self.calc)
388
392
 
389
393
  #remap the box to get the correct pressure
390
394
  lmp = ph.remap_box(lmp, self.lx, self.ly, self.lz)
@@ -419,7 +423,7 @@ class Solid(cph.Phase):
419
423
  lmp.command("variable step equal step")
420
424
  lmp.command("variable dU1 equal pe/atoms")
421
425
  for i in range(self.calc.n_elements):
422
- lmp.command("variable dU%d equal f_ff%d/v_count%d"%(i+2, i+1, i+1))
426
+ lmp.command("variable dU%d equal f_ff%d"%(i+2, i+1))
423
427
 
424
428
  lmp.command("variable lambda equal f_ff1[1]")
425
429
 
@@ -443,6 +447,7 @@ class Solid(cph.Phase):
443
447
  str2 = []
444
448
  for i in range(self.calc.n_elements):
445
449
  str2.append("${dU%d}"%(i+2))
450
+
446
451
  str2.append("${lambda}\"")
447
452
  str2 = " ".join(str2)
448
453
  str3 = " screen no file forward_%d.dat"%iteration
@@ -468,6 +473,7 @@ class Solid(cph.Phase):
468
473
  str2 = []
469
474
  for i in range(self.calc.n_elements):
470
475
  str2.append("${dU%d}"%(i+2))
476
+
471
477
  str2.append("${lambda}\"")
472
478
  str2 = " ".join(str2)
473
479
  str3 = " screen no file backward_%d.dat"%iteration
@@ -510,13 +516,15 @@ class Solid(cph.Phase):
510
516
  Calculates the final work, energy dissipation and free energy by
511
517
  matching with Einstein crystal
512
518
  """
513
- f1 = get_einstein_crystal_fe(self.calc._temperature,
514
- self.natoms, [val['mass'] for key, val in self.calc._element_dict.items()],
515
- self.vol, self.k, [val['composition'] for key, val in self.calc._element_dict.items()])
519
+ f1 = get_einstein_crystal_fe(
520
+ self.calc,
521
+ self.vol,
522
+ self.k)
523
+
516
524
  w, q, qerr = find_w(self.simfolder,
517
- nelements=self.calc.n_elements,
518
- concentration=[val['composition'] for key, val in self.calc._element_dict.items()], nsims=self.calc.n_iterations,
519
- full=True, solid=True)
525
+ self.calc,
526
+ full=True,
527
+ solid=True)
520
528
 
521
529
  self.fref = f1
522
530
  self.w = w
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: calphy
3
- Version: 1.2.17
3
+ Version: 1.3.0
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.2.17',
56
+ version='1.3.0',
57
57
  zip_safe=False,
58
58
  entry_points={
59
59
  'console_scripts': [
@@ -8,7 +8,3 @@ def test_ideal_gas():
8
8
  def test_uf():
9
9
  a = get_uhlenbeck_ford_fe(1000, 0.07, 50, 2)
10
10
  assert np.abs(a-5.37158083028874) < 1E-5
11
-
12
- def test_solid_ref():
13
- a = get_einstein_crystal_fe(1000, 1000, [26], 200, [1.2], [1])
14
- assert np.abs(a+0.4727067261423942) < 1E-5
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