calphy 1.2.14__py3-none-any.whl → 1.3.0__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/lattice.py DELETED
@@ -1,180 +0,0 @@
1
- """
2
- calphy: a Python library and command line interface for automated free
3
- energy calculations.
4
-
5
- Copyright 2021 (c) Sarath Menon^1, Yury Lysogorskiy^2, Ralf Drautz^2
6
- ^1: Max Planck Institut für Eisenforschung, Dusseldorf, Germany
7
- ^2: Ruhr-University Bochum, Bochum, Germany
8
-
9
- calphy is published and distributed under the Academic Software License v1.0 (ASL).
10
- calphy is distributed in the hope that it will be useful for non-commercial academic research,
11
- but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
12
- calphy API is published and distributed under the BSD 3-Clause "New" or "Revised" License
13
- See the LICENSE FILE for more details.
14
-
15
- More information about the program can be found in:
16
- Menon, Sarath, Yury Lysogorskiy, Jutta Rogal, and Ralf Drautz.
17
- “Automated Free Energy Calculation from Atomistic Simulations.” Physical Review Materials 5(10), 2021
18
- DOI: 10.1103/PhysRevMaterials.5.103801
19
-
20
- For more information contact:
21
- sarath.menon@ruhr-uni-bochum.de/yury.lysogorskiy@icams.rub.de
22
- """
23
-
24
- from mendeleev import element
25
- import os
26
- from pylammpsmpi import LammpsLibrary
27
- import numpy as np
28
- import pyscal.core as pc
29
- from ase.io import read
30
-
31
- """
32
- Conversion factors for creating initial lattices
33
- """
34
- latticedict = {
35
- "BCC" :{"LQD": 1.00000, "BCC":1.00000, "FCC":0.79370, "HCP":1.12246, "DIA":0.62996, "SC":1.25992, "N":2},
36
- "FCC" :{"LQD": 1.00000, "BCC":1.25992, "FCC":1.00000, "HCP":1.78179, "DIA":0.79370, "SC":1.58740, "N":4},
37
- "HCP" :{"LQD": 1.00000, "BCC":0.89090, "FCC":0.79370, "HCP":1.00000, "DIA":0.62996, "SC":0.89089, "N":4},
38
- "DIA" :{"LQD": 1.00000, "BCC":1.58740, "FCC":0.79370, "HCP":1.25992, "DIA":1.00000, "SC":2.00000, "N":8},
39
- "SC" :{"LQD": 1.00000, "BCC":0.79370, "FCC":0.62996, "HCP":1.12247, "DIA":0.50000, "SC":1.00000, "N":1},
40
- }
41
-
42
- def get_lattice(symbol, lat):
43
- """
44
- Find lattice constants of an element
45
-
46
- Parameters
47
- ----------
48
- symbol : string
49
- symbol of chemical element
50
-
51
- lattice_list : list of strings
52
- list of lattices
53
-
54
- Returns
55
- -------
56
- lattice_constants : list of floats
57
- list of lattice constant values
58
-
59
- atoms_per_cell : list of ints
60
- number of atoms per cell
61
-
62
- lammps_lattice : list of strings
63
- the main lattice to be used in lammps
64
- """
65
-
66
- chem = element(symbol)
67
-
68
- mainlat = chem.lattice_structure
69
-
70
- if mainlat == "HEX":
71
- mainlat = "HCP"
72
-
73
- mainalat = chem.lattice_constant
74
-
75
- #print(mainlat, lat)
76
- newlat = latticedict[mainlat][lat]*mainalat
77
- lattice_constant = newlat
78
-
79
- if lat == "LQD":
80
- atoms_per_cell = latticedict[mainlat]["N"]
81
- lammps_lattice = mainlat.lower()
82
- else:
83
- atoms_per_cell = latticedict[lat]["N"]
84
- lammps_lattice = lat.lower()
85
-
86
- return lattice_constant, atoms_per_cell, lammps_lattice
87
-
88
- def check_dump_file(infile):
89
- try:
90
- #now use pyscal to read it in,
91
- sys = pc.System()
92
- sys.read_inputfile(infile)
93
- atoms = sys.atoms
94
- natoms = len(atoms)
95
- types = [atom.type for atom in atoms]
96
- xx, xxcounts = np.unique(types, return_counts=True)
97
- conc = xxcounts/np.sum(xxcounts)
98
- return (natoms, conc)
99
- except:
100
- return None
101
-
102
- def check_data_file(infile, script_mode=False):
103
- try:
104
- if not script_mode:
105
- lmp = LammpsLibrary(cores=1,
106
- working_directory=os.getcwd())
107
- lmp.units("metal")
108
- lmp.boundary("p p p")
109
- lmp.atom_style("atomic")
110
- lmp.timestep(0.001)
111
- lmp.read_data(infile)
112
- natoms = lmp.natoms
113
- #now we convert to a dump file and read the concentration
114
- trajfile = ".".join([infile, "dump"])
115
- lmp.command("mass * 1.0")
116
- lmp.dump("2 all custom", 1, trajfile,"id type x y z")
117
- lmp.run(0)
118
- lmp.undump(2)
119
- lmp.close()
120
- format = 'lammps-dump'
121
- else:
122
- trajfile = read(infile, format='lammps-data', style='atomic')
123
- format = 'ase'
124
- #now use pyscal to read it in,
125
- sys = pc.System()
126
- sys.read_inputfile(trajfile, format=format)
127
- atoms = sys.atoms
128
- types = [atom.type for atom in atoms]
129
- xx, xxcounts = np.unique(types, return_counts=True)
130
- conc = xxcounts/np.sum(xxcounts)
131
- return (natoms, conc)
132
- except:
133
- return None
134
-
135
- def prepare_lattice(calc):
136
- #process lattice
137
- lattice = calc.lattice.upper()
138
- dumpfile = False
139
-
140
- if lattice in ["BCC", "FCC", "HCP", "DIA", "SC", "LQD"]:
141
- #process lattice
142
- #throw error for multicomponent
143
- if calc.n_elements > 1:
144
- raise ValueError("Only files supported for multicomponent")
145
-
146
- alat, apc, l = get_lattice(calc.element[0], calc.lattice)
147
-
148
- #replace lattice constant
149
- if calc.lattice_constant != 0:
150
- alat = calc.lattice_constant
151
-
152
- conc = [1,]
153
-
154
- elif os.path.exists(calc.lattice):
155
- calc.lattice = os.path.abspath(calc.lattice)
156
-
157
- res = check_dump_file(calc.lattice)
158
- dumpfile = True
159
-
160
- if res is None:
161
- res = check_data_file(calc.lattice)
162
- dumpfile = False
163
-
164
- if res is not None:
165
- natoms = res[0]
166
- conc = res[1]
167
- l = "file"
168
- alat = 1.00
169
- apc = natoms
170
- else:
171
- raise ValueError("An input file was provided but it was neither data or dump file")
172
-
173
- else:
174
- raise ValueError("Unknown lattice found. Allowed options are BCC, FCC, HCP, DIA, SC or LQD; or an input file.")
175
-
176
- if l == "dia":
177
- l = "diamond"
178
-
179
- return l, alat, apc, conc, dumpfile
180
-
@@ -1,25 +0,0 @@
1
- calphy/__init__.py,sha256=5_h8NJFQY1kKN7mVos6cNSp9bb4pZfevL9VYLC3JYBo,234
2
- calphy/alchemy.py,sha256=l9vs25NQ_ur46mLGRvG5tYGrbUmpENgSlwl9VElFu08,13143
3
- calphy/clitools.py,sha256=oDqaw0s-LJ7tAdW_Njk2SFljVx6K34Rs8sdMz48SNSI,4125
4
- calphy/composition_transformation.py,sha256=Hh240-iVGC8ATlJ3nQK757qVZIBrE2aw7dsF46mi3oo,15353
5
- calphy/errors.py,sha256=KN47RWTLbg1H_NZMrhCiJCbqjqJScJ1pgQAuzj1-l84,1268
6
- calphy/helpers.py,sha256=DY6KUr3I0m0UmWUKKRAMd5MJS0uGA1PN-cYYQ25m-lY,12977
7
- calphy/input.py,sha256=qKcngDN43PsPUo9J6NzCU-HIocZ__mmMvh78V64WMFo,28596
8
- calphy/inputbk.py,sha256=P1N35O7t8k0B2HW0M75Ivd8zvKjhLjQaRyl21KlnX50,29613
9
- calphy/integrators.py,sha256=PYeYHK-iuNPPTHxEI68uEakjIZEzmnKrmEC2lHLns4c,20524
10
- calphy/kernel.py,sha256=rd_-EfCiBhQjkxcVaoLtVJB2_qDgS-g-dQ0BZBTJQ_A,6190
11
- calphy/lattice.py,sha256=2Eu9hzLQ2iy1hXYeyUY8h_OCgn-7EcoLXpn8EaQ4tqU,5752
12
- calphy/liquid.py,sha256=-jBu8oP7AdPmbAaqvuiLNSvA1Teyep7FPBtB8W6IXw4,13380
13
- calphy/phase.py,sha256=Qb9QJZp8IS7Ca1qMZru8qc-3TLV6szSwMml_joyfkks,46211
14
- calphy/phase_diagram.py,sha256=qXB3E0v3HDDpujPXjhFbx7X_xLpTGQYoWIGXdC_0NA8,10242
15
- calphy/queuekernel.py,sha256=4GMIYnjMiAPipoLNKP5noYcfeEOI_vCqm84zgokk7Xw,5321
16
- calphy/routines.py,sha256=E6eQttuXGJKNK2mfMvTCy2J0D1tIegS0MyyXmUlJSiI,17221
17
- calphy/scheduler.py,sha256=TS6aOjp2JpudVWTOIEjptqeDfgruWLwUQ_JVvuUCUgg,8532
18
- calphy/solid.py,sha256=D-FDcHaHgxoDMqBKThdi1cVJbYTh_PxdQmcf_60itdY,19585
19
- calphy/splines.py,sha256=BGwUVz_qXQxUzpUCuZo6CsELcd5JVNWzI-Ttcz22G_E,61627
20
- calphy-1.2.14.dist-info/LICENSE,sha256=XIHGB5RZLIhOjjoO1bPf0II-qDbjhP5Cv5HJMRE9v1g,16651
21
- calphy-1.2.14.dist-info/METADATA,sha256=Ab20D6XMm3B-WnvtIztATit9YmPxWYDLxYJrpvNa1BQ,4238
22
- calphy-1.2.14.dist-info/WHEEL,sha256=oiQVh_5PnQM0E3gPdiz09WCNmwiHDMaGer_elqB3coM,92
23
- calphy-1.2.14.dist-info/entry_points.txt,sha256=W9qq254koyWnAgo1jtfQP9bO5Q7sgZrzc8BMnfo3vf4,386
24
- calphy-1.2.14.dist-info/top_level.txt,sha256=w871dhMqPwgjjbifBWdkT9_aOnK1ek4Odrh8UnSG3PE,7
25
- calphy-1.2.14.dist-info/RECORD,,