Skip to content

Commit

Permalink
Merge pull request #100 from SUNCAT-Center/compat-update-ase-3-21
Browse files Browse the repository at this point in the history
To release compat update for ASE 3.19.1 to 3.21
  • Loading branch information
mhangaard committed Feb 7, 2023
2 parents 42998f6 + a0af3d9 commit 6a307f3
Show file tree
Hide file tree
Showing 7 changed files with 30 additions and 13 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
# dev

# Version 0.7.0 (November 2022)

- Compatibility updated for ASE 3.19.1 to 3.21.0
- Bugfixes

# Version 0.6.2 (March 2020)

- Added module for site featurization and GA feature selection.
Expand Down
2 changes: 1 addition & 1 deletion catlearn/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = "0.6.2"
__version__ = "0.7.0"
11 changes: 6 additions & 5 deletions catlearn/optimize/mlmin.py
Original file line number Diff line number Diff line change
Expand Up @@ -266,10 +266,11 @@ def run(self, fmax=0.05, steps=200, kernel='SQE', max_step=0.25,
guess = self.ase_ini
guess_pos = np.array(self.list_train[-1])
guess.positions = guess_pos.reshape(-1, 3)
guess.set_calculator(ASECalc(gp=self.gp,
index_constraints=self.index_mask,
scaling_targets=self.u_prior)
)
guess.calc = ASECalc(
gp=self.gp,
index_constraints=self.index_mask,
scaling_targets=self.u_prior
)

# Optimization in the predicted landscape:
ml_opt = MDMin(guess, trajectory=None, logfile=None, dt=0.020)
Expand Down Expand Up @@ -333,7 +334,7 @@ def run(self, fmax=0.05, steps=200, kernel='SQE', max_step=0.25,
eval_atom = self.ase_ini
pos_atom = self.interesting_point
eval_atom.positions = np.array(pos_atom).reshape((-1, 3))
eval_atom.set_calculator(self.ase_calc)
eval_atom.calc = self.ase_calc
energy_atom = eval_atom.get_potential_energy(
force_consistent=self.fc)
forces_atom = -eval_atom.get_forces().reshape(-1)
Expand Down
2 changes: 1 addition & 1 deletion catlearn/optimize/tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ def plotneb(trajectory='ML_NEB_catlearn.traj', view_path=True):
xycoords='data', xytext=(x_pred[np.argmax(e_pred)], 0.0),
textcoords='data', arrowprops=prop_plots)

ax.annotate(s=str(np.round(e_barrier, 3))+' eV',
ax.annotate(str(np.round(e_barrier, 3))+' eV',
xy=(x_pred[np.argmax(e_pred)], np.max(e_pred)/1.65),
xycoords='data',
fontsize=15.0,
Expand Down
5 changes: 5 additions & 0 deletions docs/changelog.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
# Changelog

# Version 0.7.0 (November 2022)

- Compatibility updated for ASE 3.19.1 to 3.21.0
- Bugfixes

# Version 0.6.2 (March 2020)

- Added module for site featurization and GA feature selection.
Expand Down
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
ase>=3.17.0
ase>=3.21.0
click>=6.7
cycler>=0.10.0
decorator>=4.3.0
Expand Down
16 changes: 11 additions & 5 deletions test/test_mlmin.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ class TestMLMin(unittest.TestCase):
""" General test of the ML-Min algorithm."""
def test_minimize(self):
initial_structure = read('initial_mlmin.traj')
initial_structure.set_calculator(EMT())
initial_structure.calc = EMT()

initial_opt = MLMin(initial_structure,
trajectory='mlmin_structures.traj')
Expand All @@ -41,7 +41,7 @@ def test_acquisition(self):

# Test acquisition lcb:
initial_structure = read('initial_mlmin.traj')
initial_structure.set_calculator(EMT())
initial_structure.calc = EMT()

initial_opt = MLMin(initial_structure,
trajectory='mlmin_structures.traj')
Expand All @@ -62,7 +62,7 @@ def test_acquisition(self):

# Test acquisition ucb:
initial_structure = read('initial_mlmin.traj')
initial_structure.set_calculator(EMT())
initial_structure.calc = EMT()

initial_opt = MLMin(initial_structure,
trajectory='mlmin_structures.traj')
Expand All @@ -86,7 +86,7 @@ def test_kernel(self):

# Test kernel ARD fixed:
initial_structure = read('initial_mlmin.traj')
initial_structure.set_calculator(EMT())
initial_structure.calc = EMT()

initial_opt = MLMin(initial_structure,
trajectory='mlmin_structures.traj')
Expand All @@ -108,7 +108,7 @@ def test_kernel(self):

# Test ARD SQE kernel:
initial_structure = read('initial_mlmin.traj')
initial_structure.set_calculator(EMT())
initial_structure.calc = EMT()

initial_opt = MLMin(initial_structure,
trajectory='mlmin_structures.traj')
Expand All @@ -128,3 +128,9 @@ def test_kernel(self):
fmax_test = 0.00766
np.testing.assert_array_almost_equal(fmax_opt, fmax_test, decimal=5)


if __name__ == '__main__':
test_class = TestMLMin()
test_class.test_minimize()
test_class.test_acquisition()
test_class.test_kernel()

0 comments on commit 6a307f3

Please sign in to comment.