Skip to content

Commit

Permalink
update forcefield test forms
Browse files Browse the repository at this point in the history
  • Loading branch information
htz1992213 committed Feb 5, 2024
1 parent 4ab775d commit 54953f2
Showing 1 changed file with 7 additions and 8 deletions.
15 changes: 7 additions & 8 deletions tests/test_forcefield.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@

import numpy as np
import pytest
from numpy.testing import assert_allclose
from pymatgen.io.lammps.data import LammpsData

from mdgo.forcefield.aqueous import Aqueous, Ion
Expand Down Expand Up @@ -47,26 +46,26 @@ def test_chrome(self) -> None:
assert os.path.exists(os.path.join(download_dir, "EMC.itp"))
with open(os.path.join(download_dir, "EMC.lmp")) as f:
pdf_actual = f.readlines()
assert_allclose(pdf, pdf_actual)
assert pdf == pdf_actual
with open(os.path.join(download_dir, "EMC.lmp.xyz")) as f:
xyz_actual = f.readlines()
assert_allclose(xyz, xyz_actual)
assert xyz == xyz_actual
with open(os.path.join(download_dir, "EMC.gro")) as f:
gro_actual = f.readlines()
assert_allclose(gro, gro_actual)
assert gro == gro_actual
with open(os.path.join(download_dir, "EMC.itp")) as f:
itp_actual = f.readlines()
assert_allclose(itp, itp_actual)
assert itp == itp_actual
lpg = FFcrawler(download_dir)
lpg.data_from_smiles("CCOC(=O)OC")
with open(os.path.join(download_dir, "CCOC(=O)OC.lmp")) as f:
smiles_actual = f.readlines()
assert_allclose(smiles[:13], smiles_actual[:13])
assert_allclose(smiles[18:131], smiles_actual[18:131])
assert smiles_actual[:13] == smiles[:13]
assert smiles_actual[18:131] == smiles[18:131]
assert smiles_actual[131][:26] == " 1 1 1 -0.28"
assert smiles_actual[132][:25] == " 2 1 2 0.01"
assert smiles_actual[145][:25] == " 15 1 15 0.10"
assert_allclose(smiles_actual[146:], smiles[146:])
assert smiles_actual[146:] == smiles[146:]
finally:
sys.stdout = saved_stdout
shutil.rmtree(download_dir)
Expand Down

0 comments on commit 54953f2

Please sign in to comment.