Skip to content

Commit 4f7ec5a

Browse files
authored
Merge pull request #51 from ICAMS/fix_mass
Fix mass
2 parents b307fa1 + a26b6e1 commit 4f7ec5a

File tree

9 files changed

+35
-23
lines changed

9 files changed

+35
-23
lines changed

.bumpversion.cfg

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
[bumpversion]
2-
current_version = 1.2.3
2+
current_version = 1.2.4
33
commit = True
44
tag = True
55

calphy/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
from calphy.alchemy import Alchemy
55
from calphy.routines import MeltingTemp
66

7-
__version__ = "1.2.3"
7+
__version__ = "1.2.4"
88

99
def addtest(a,b):
1010
return a+b

calphy/alchemy.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ def run_averaging(self):
8181
lmp = ph.create_structure(lmp, self.calc)
8282

8383
#set up potential
84-
lmp = ph.set_potential(lmp, self.calc)
84+
lmp = ph.set_potential(lmp, self.calc, ghost_elements=self.calc._ghost_element_count)
8585

8686
#add some computes
8787
lmp.command("variable mvol equal vol")
@@ -149,7 +149,7 @@ def run_integration(self, iteration=1):
149149

150150
#set up hybrid potential
151151
#here we only need to set one potential
152-
lmp = ph.set_potential(lmp, self.calc)
152+
lmp = ph.set_potential(lmp, self.calc, ghost_elements=self.calc._ghost_element_count)
153153
#lmp = ph.set_double_hybrid_potential(lmp, self.options, self.calc._pressureair_style, self.calc._pressureair_coeff)
154154

155155
#remap the box to get the correct pressure

calphy/helpers.py

Lines changed: 21 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,19 @@ def create_structure(lmp, calc, species=None):
9999
return lmp
100100

101101

102-
def set_potential(lmp, options):
102+
def set_mass(lmp, options, ghost_elements=0):
103+
count = 1
104+
for i in range(options.n_elements):
105+
lmp.mass(i+1, options.mass[i])
106+
count += 1
107+
108+
for i in range(ghost_elements):
109+
lmp.mass(count+i, 1.00)
110+
111+
return lmp
112+
113+
114+
def set_potential(lmp, options, ghost_elements=0):
103115
"""
104116
Set the interatomic potential
105117
@@ -116,8 +128,8 @@ def set_potential(lmp, options):
116128
lmp.pair_style(options.pair_style[0])
117129
lmp.pair_coeff(options.pair_coeff[0])
118130

119-
for i in range(options.n_elements):
120-
lmp.mass(i+1, options.mass[i])
131+
lmp = set_mass(lmp, options, ghost_elements=ghost_elements)
132+
121133
return lmp
122134

123135

@@ -158,7 +170,7 @@ def get_structures(file, species, index=None):
158170
aseobjs = traj[index].to_ase(species=species)
159171
return aseobjs
160172

161-
def set_hybrid_potential(lmp, options, eps):
173+
def set_hybrid_potential(lmp, options, eps, ghost_elements=0):
162174
pc = options.pair_coeff[0]
163175
pcraw = pc.split()
164176
pcnew = " ".join([*pcraw[:2], *[options.pair_style[0],], *pcraw[2:]])
@@ -167,11 +179,11 @@ def set_hybrid_potential(lmp, options, eps):
167179
lmp.command("pair_coeff %s"%pcnew)
168180
lmp.command("pair_coeff * * ufm %f 1.5"%eps)
169181

170-
for i in range(options.n_elements):
171-
lmp.mass(i+1, options.mass[i])
182+
lmp = set_mass(lmp, options, ghost_elements=ghost_elements)
183+
172184
return lmp
173185

174-
def set_double_hybrid_potential(lmp, options, pair_style, pair_coeff):
186+
def set_double_hybrid_potential(lmp, options, pair_style, pair_coeff, ghost_elements=0):
175187

176188
pc1 = pair_coeff[0]
177189
pcraw1 = pc1.split()
@@ -191,8 +203,8 @@ def set_double_hybrid_potential(lmp, options, pair_style, pair_coeff):
191203
lmp.command("pair_coeff %s"%pcnew1)
192204
lmp.command("pair_coeff %s"%pcnew2)
193205

194-
for i in range(options.n_elements):
195-
lmp.mass(i+1, options.mass[i])
206+
lmp = set_mass(lmp, options, ghost_elements=ghost_elements)
207+
196208
return lmp
197209

198210
def remap_box(lmp, x, y, z):

calphy/input.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,7 @@ def __init__(self):
209209

210210
self.tolerance = InputTemplate()
211211
self.tolerance.lattice_constant = 0.0002
212-
self.tolerance.spring_constant = 0.01
212+
self.tolerance.spring_constant = 0.1
213213
self.tolerance.solid_fraction = 0.7
214214
self.tolerance.liquid_fraction = 0.05
215215
self.tolerance.pressure = 0.5

calphy/liquid.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ def run_averaging(self):
118118
lmp = ph.create_structure(lmp, self.calc, species=self.calc.n_elements+self.calc._ghost_element_count)
119119

120120
#set up potential
121-
lmp = ph.set_potential(lmp, self.calc)
121+
lmp = ph.set_potential(lmp, self.calc, ghost_elements=self.calc._ghost_element_count)
122122

123123
#Melt regime for the liquid
124124
lmp.velocity("all create", self.calc._temperature_high, np.random.randint(0, 10000))
@@ -183,7 +183,7 @@ def run_integration(self, iteration=1):
183183

184184
#set hybrid ufm and normal potential
185185
#lmp = ph.set_hybrid_potential(lmp, self.options, self.eps)
186-
lmp = ph.set_potential(lmp, self.calc)
186+
lmp = ph.set_potential(lmp, self.calc, ghost_elements=self.calc._ghost_element_count)
187187

188188
#remap the box to get the correct pressure
189189
lmp = ph.remap_box(lmp, self.lx, self.ly, self.lz)

calphy/phase.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -675,7 +675,7 @@ def reversible_scaling(self, iteration=1):
675675
lmp = ph.read_dump(lmp, conf, species=self.calc.n_elements+self.calc._ghost_element_count)
676676

677677
#set up potential
678-
lmp = ph.set_potential(lmp, self.calc)
678+
lmp = ph.set_potential(lmp, self.calc, ghost_elements=self.calc._ghost_element_count)
679679

680680
#remap the box to get the correct pressure
681681
lmp = ph.remap_box(lmp, self.lx, self.ly, self.lz)
@@ -755,7 +755,7 @@ def reversible_scaling(self, iteration=1):
755755
else:
756756
self.check_if_solidfied(lmp, "traj.temp.dat")
757757

758-
lmp = ph.set_potential(lmp, self.calc)
758+
lmp = ph.set_potential(lmp, self.calc, ghost_elements=self.calc._ghost_element_count)
759759

760760
#reverse scaling
761761
lmp.command("variable flambda equal ramp(${li},${lf})")
@@ -850,7 +850,7 @@ def temperature_scaling(self, iteration=1):
850850
lmp = ph.read_dump(lmp, conf, species=self.calc.n_elements+self.calc._ghost_element_count)
851851

852852
#set up potential
853-
lmp = ph.set_potential(lmp, self.calc)
853+
lmp = ph.set_potential(lmp, self.calc, ghost_elements=self.calc._ghost_element_count)
854854

855855
#remap the box to get the correct pressure
856856
lmp = ph.remap_box(lmp, self.lx, self.ly, self.lz)
@@ -936,7 +936,7 @@ def pressure_scaling(self, iteration=1):
936936
lmp = ph.read_dump(lmp, conf, species=self.calc.n_elements+self.calc._ghost_element_count)
937937

938938
#set up potential
939-
lmp = ph.set_potential(lmp, self.calc)
939+
lmp = ph.set_potential(lmp, self.calc, ghost_elements=self.calc._ghost_element_count)
940940

941941
#remap the box to get the correct pressure
942942
lmp = ph.remap_box(lmp, self.lx, self.ly, self.lz)

calphy/solid.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ def run_averaging(self):
143143

144144
#set up potential
145145
if self.calc.potential_file is None:
146-
lmp = ph.set_potential(lmp, self.calc)
146+
lmp = ph.set_potential(lmp, self.calc, ghost_elements=self.calc._ghost_element_count)
147147
else:
148148
lmp.command("include %s"%self.calc.potential_file)
149149

@@ -214,7 +214,7 @@ def run_integration(self, iteration=1):
214214

215215
#set up potential
216216
if self.calc.potential_file is None:
217-
lmp = ph.set_potential(lmp, self.calc)
217+
lmp = ph.set_potential(lmp, self.calc, ghost_elements=self.calc._ghost_element_count)
218218
else:
219219
lmp.command("include %s"%self.calc.potential_file)
220220

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@
6060
test_suite='tests',
6161
tests_require=test_requirements,
6262
url='https://github.com/ICAMS/calphy',
63-
version='1.2.3',
63+
version='1.2.4',
6464
zip_safe=False,
6565
entry_points={
6666
'console_scripts': [

0 commit comments

Comments
 (0)