Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

LJ SinglePoint #19

Merged
merged 3 commits into from
Mar 28, 2023
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions ipsuite/calculators/__init__.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
from ipsuite.calculators.ase_geoopt import ASEGeoOpt
from ipsuite.calculators.ase_md import ASEMD, FixedSphereASEMD
from ipsuite.calculators.cp2k import CP2KSinglePoint, CP2KYaml
from ipsuite.calculators.lj import LJSinglePoint
from ipsuite.calculators.xtb import xTBSinglePoint

__all__ = [
Expand All @@ -10,4 +11,5 @@
"ASEMD",
"FixedSphereASEMD",
"xTBSinglePoint",
"LJSinglePoint",
]
29 changes: 29 additions & 0 deletions ipsuite/calculators/lj.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
import tqdm
from ase.calculators.lj import LennardJones

from ipsuite import base


class LJSinglePoint(base.ProcessAtoms):
"""This is a testing Node!
It uses ASE'S Lennard-Jones calculator with default arguments.
The calculator accept all elements and implements energy, forces and stress,
making it very useful for creating dummy data.
"""

def run(self):
self.atoms = self.get_data()

calculator = self.calc

for atom in tqdm.tqdm(self.atoms):
atom.calc = calculator
atom.get_potential_energy()
atom.get_stress()

@property
def calc(self):
"""Get an LJ ase calculator."""

calculator = LennardJones()
return calculator
4 changes: 2 additions & 2 deletions tests/integration/test_i_geometry.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import pytest
import numpy as np
from ase import Atoms
import pytest
from ase import Atoms

import ipsuite as ips


Expand Down
Empty file.
23 changes: 23 additions & 0 deletions tests/unit_tests/calculators/test_u_lj.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import pathlib
import shutil

import ipsuite as ips


def test_lj_single_point(proj_path, traj_file):
traj_file = pathlib.Path(traj_file)
shutil.copy(traj_file, ".")

with ips.Project() as project:
data = ips.AddData(file=traj_file.name)

lj = ips.calculators.LJSinglePoint(
data=data.atoms,
)
project.run()

lj.load()
results = lj.atoms[0].calc.results

assert "energy" in results.keys()
assert "forces" in results.keys()