Skip to content

Commit

Permalink
Change names of calc and conf easyxtb modules
Browse files Browse the repository at this point in the history
  • Loading branch information
matterhorn103 committed Nov 26, 2024
1 parent 729c535 commit f7435cc
Show file tree
Hide file tree
Showing 16 changed files with 29 additions and 29 deletions.
2 changes: 1 addition & 1 deletion about.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@
# Do nothing to data other than add message with version and path info
output["message"] = (
"avo_xtb plugin\n"
+ f"easyxtb version: {easyxtb.conf.easyxtb_VERSION}\n"
+ f"easyxtb version: {easyxtb.configuration.easyxtb_VERSION}\n"
+ f"xtb version: {xtb_version}\n"
+ f"xtb path: {easyxtb.XTB_BIN}\n"
+ f"CREST version: {crest_version}\n"
Expand Down
4 changes: 2 additions & 2 deletions config.py
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@
# Save change to user_dir if there has been one
if avo_input["user_dir"] != str(easyxtb.CALC_DIR):
easyxtb.CALC_DIR = Path(avo_input["user_dir"])
easyxtb.conf.TEMP_DIR = easyxtb.CALC_DIR / "last"
easyxtb.configuration.TEMP_DIR = easyxtb.CALC_DIR / "last"
try:
easyxtb.TEMP_DIR.mkdir(parents=True, exist_ok=True)
except PermissionError:
Expand Down Expand Up @@ -171,4 +171,4 @@
# Update optimization level
easyxtb.config["opt_lvl"] = avo_input["opt_lvl"]

easyxtb.conf.save_config()
easyxtb.configuration.save_config()
2 changes: 1 addition & 1 deletion conformers.py
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@
solvation = avo_input["solvent"]

# Run calculation; returns set of conformers as well as Calculation object
conformers, calc = easyxtb.calc.conformers(
conformers, calc = easyxtb.calculate.conformers(
geom,
solvation=solvation,
method=2,
Expand Down
2 changes: 1 addition & 1 deletion deprotonate.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
geom = easyxtb.Geometry.from_cjson(avo_input["cjson"])

# Run calculation; returns set of tautomers as well as Calculation object
tautomers, calc = easyxtb.calc.deprotonate(
tautomers, calc = easyxtb.calculate.deprotonate(
geom,
solvation=easyxtb.config["solvent"],
method=2,
Expand Down
4 changes: 2 additions & 2 deletions easyxtb/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ Note that `easyxtb` follows the convention used by `xtb` itself, where `spin` is
The package provides a function API for basic xtb calculation types (`energy`, `optimize`, `frequencies`, `opt_freq`, `orbitals`):

```python
>>> optimized = py_xtb.calc.optimize(input_geom, solvation="water", method=2, level="normal")
>>> optimized = py_xtb.calculate.optimize(input_geom, solvation="water", method=2, level="normal")
>>> for atom in optimized:
... print(atom)
...
Expand Down Expand Up @@ -78,7 +78,7 @@ The xtb team recommend generally using the `ohess` (optimization followed by a f
The `opt_freq()` calculation function takes advantage of this and will continue reoptimizing using these distorted geometries until a minimum is reached, so is more reliable in getting what we want:

```python
>>> output_geom, output_freqs, calc = py_xtb.calc.opt_freq(input_geom, solvation="water", return_calc=True)
>>> output_geom, output_freqs, calc = py_xtb.calculate.opt_freq(input_geom, solvation="water", return_calc=True)
>>> output_freqs[0]
{'mode': 1, 'symmetry': 'a', 'frequency': 70.0622, 'reduced_mass': 13.4154, 'ir_intensity': 6.422, 'raman_scattering_activity': 0.0, 'eigenvectors': [[0.0, 0.0, -0.28], [-0.0, 0.0, -0.0], [-0.0, -0.0, 0.25], [0.0, -0.0, 0.04], [0.0, -0.0, -0.24], [-0.0, 0.0, -0.0], [-0.0, 0.0, 0.29], [-0.0, 0.0, 0.15], [0.0, -0.0, 0.02], [0.0, -0.0, -0.12], [0.0, 0.0, -0.15], [0.0, -0.0, 0.55], [0.0, 0.01, -0.56], [0.0, 0.0, -0.19]]}
```
Expand Down
8 changes: 4 additions & 4 deletions easyxtb/src/easyxtb/__init__.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import logging

from .conf import config, config_file
from .conf import PLUGIN_DIR, CALC_DIR, TEMP_DIR, BIN_DIR, XTB_BIN, CREST_BIN
from .configuration import config, config_file
from .configuration import PLUGIN_DIR, CALC_DIR, TEMP_DIR, BIN_DIR, XTB_BIN, CREST_BIN
from .geometry import Atom, Geometry
from .calc import Calculation
from . import calc, conf, convert, format
from .calculate import Calculation
from . import calculate, configuration, convert, format


logger = logging.getLogger(__name__)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
from pathlib import Path
from shutil import rmtree

from .conf import config, XTB_BIN, CREST_BIN, TEMP_DIR
from .configuration import config, XTB_BIN, CREST_BIN, TEMP_DIR
from .geometry import Geometry
from .parse import parse_energy, parse_g98_frequencies

Expand Down
File renamed without changes.
16 changes: 8 additions & 8 deletions easyxtb/tests/test_calc.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

from pathlib import Path

from easyxtb import Geometry, calc, parse
from easyxtb import Geometry, calculate, parse
from . import equal_geom


Expand All @@ -23,7 +23,7 @@
def test_opt_neutral_singlet():
for mol in ["acetic_acid", "acetone", "benzene"]:
in_geom = Geometry.from_file(input_dir / f"{mol}.cjson")
out_geom = calc.optimize(in_geom)
out_geom = calculate.optimize(in_geom)
ref_geom = Geometry.from_file(results_dir / f"{mol}_opt.xyz")
print(f"Testing {mol}:")
assert equal_geom(out_geom, ref_geom)
Expand All @@ -32,7 +32,7 @@ def test_opt_neutral_singlet():
def test_opt_charged():
for mol in ["benzoate", "bu4n"]:
in_geom = Geometry.from_file(input_dir / f"{mol}.cjson")
out_geom = calc.optimize(in_geom)
out_geom = calculate.optimize(in_geom)
ref_geom = Geometry.from_file(results_dir / f"{mol}_opt.xyz")
print(f"Testing {mol}:")
assert equal_geom(out_geom, ref_geom)
Expand All @@ -41,7 +41,7 @@ def test_opt_charged():
def test_opt_doublet():
for mol in ["tempo"]:
in_geom = Geometry.from_file(input_dir / f"{mol}.cjson")
out_geom = calc.optimize(in_geom)
out_geom = calculate.optimize(in_geom)
ref_geom = Geometry.from_file(results_dir / f"{mol}_opt.xyz")
print(f"Testing {mol}:")
assert equal_geom(out_geom, ref_geom)
Expand All @@ -50,7 +50,7 @@ def test_opt_doublet():
def test_freq_neutral_singlet():
for mol in ["acetic_acid", "acetone", "benzene"]:
opt_geom = Geometry.from_file(results_dir / f"{mol}_opt.xyz")
freqs = calc.frequencies(opt_geom)
freqs = calculate.frequencies(opt_geom)
with open(results_dir / f"{mol}_g98.out", encoding="utf-8") as f:
ref_freqs = parse.parse_g98_frequencies(f.read())
print(f"Testing {mol}:")
Expand All @@ -60,7 +60,7 @@ def test_freq_neutral_singlet():
def test_freq_anion():
for mol in ["benzoate"]:
opt_geom = Geometry.from_file(results_dir / f"{mol}_opt.xyz", charge=-1)
freqs = calc.frequencies(opt_geom)
freqs = calculate.frequencies(opt_geom)
with open(results_dir / f"{mol}_g98.out", encoding="utf-8") as f:
ref_freqs = parse.parse_g98_frequencies(f.read())
print(f"Testing {mol}:")
Expand All @@ -70,7 +70,7 @@ def test_freq_anion():
def test_freq_cation():
for mol in ["bu4n"]:
opt_geom = Geometry.from_file(results_dir / f"{mol}_opt.xyz", charge=1)
freqs = calc.frequencies(opt_geom)
freqs = calculate.frequencies(opt_geom)
with open(results_dir / f"{mol}_g98.out", encoding="utf-8") as f:
ref_freqs = parse.parse_g98_frequencies(f.read())
print(f"Testing {mol}:")
Expand All @@ -80,7 +80,7 @@ def test_freq_cation():
def test_freq_doublet():
for mol in ["tempo"]:
opt_geom = Geometry.from_file(results_dir / f"{mol}_opt.xyz", spin=1)
freqs = calc.frequencies(opt_geom)
freqs = calculate.frequencies(opt_geom)
with open(results_dir / f"{mol}_g98.out", encoding="utf-8") as f:
ref_freqs = parse.parse_g98_frequencies(f.read())
print(f"Testing {mol}:")
Expand Down
2 changes: 1 addition & 1 deletion energy.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@

# Run calculation; returns energy as float in hartree
logger.debug("avo_xtb is requesting a single point energy calculation")
energy_hartree = easyxtb.calc.energy(
energy_hartree = easyxtb.calculate.energy(
geom,
solvation=easyxtb.config["solvent"],
method=easyxtb.config["method"],
Expand Down
2 changes: 1 addition & 1 deletion freq.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@

# Run calculation; returns set of frequency data
logger.debug("avo_xtb is requesting a frequency calculation")
freqs = easyxtb.calc.frequencies(
freqs = easyxtb.calculate.frequencies(
geom,
solvation=easyxtb.config["solvent"],
method=easyxtb.config["method"],
Expand Down
6 changes: 3 additions & 3 deletions install.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ def link_xtb_bin(xtb_folder):
# Add to config
easyxtb.config["xtb_bin"] = str(easyxtb.XTB_BIN)
# Save config
easyxtb.conf.save_config()
easyxtb.configuration.save_config()


def link_crest_bin(crest_folder):
Expand All @@ -116,7 +116,7 @@ def link_crest_bin(crest_folder):
# Add to config
easyxtb.config["crest_bin"] = str(easyxtb.CREST_BIN)
# Save config
easyxtb.conf.save_config()
easyxtb.configuration.save_config()


if __name__ == "__main__":
Expand Down Expand Up @@ -157,7 +157,7 @@ def link_crest_bin(crest_folder):
"install_dir": {
"type": "string",
"label": "Install in",
"default": str(easyxtb.conf.BIN_DIR),
"default": str(easyxtb.configuration.BIN_DIR),
"order": 5.0,
},
"notice": {
Expand Down
2 changes: 1 addition & 1 deletion ohess.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@

# Run calculation; returns path to Gaussian file containing frequencies
logger.debug("avo_xtb is requesting an opt+freq calculation")
opt_geom, freqs, calc = easyxtb.calc.opt_freq(
opt_geom, freqs, calc = easyxtb.calculate.opt_freq(
geom,
solvation=easyxtb.config["solvent"],
method=easyxtb.config["method"],
Expand Down
2 changes: 1 addition & 1 deletion opt.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ def cleanup_after_opt(cjson: dict) -> dict:

# Run calculation; returns optimized geometry as well as Calculation object
logger.debug("avo_xtb is requesting a geometry optimization")
opt_geom, calc = easyxtb.calc.optimize(
opt_geom, calc = easyxtb.calculate.optimize(
geom,
solvation=easyxtb.config["solvent"],
method=easyxtb.config["method"],
Expand Down
2 changes: 1 addition & 1 deletion orbitals.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@

# Run calculation; returns Molden output file as string
logger.debug("avo_xtb is requesting a molecular orbitals calculation")
molden_string = easyxtb.calc.orbitals(
molden_string = easyxtb.calculate.orbitals(
geom,
solvation=easyxtb.config["solvent"],
method=easyxtb.config["method"],
Expand Down
2 changes: 1 addition & 1 deletion protonate.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ def cleanup_after_taut(cjson: dict) -> dict:
geom = easyxtb.Geometry.from_cjson(avo_input["cjson"])

# Run calculation; returns set of tautomers as well as Calculation object
tautomers, calc = easyxtb.calc.protonate(
tautomers, calc = easyxtb.calculate.protonate(
geom,
solvation=easyxtb.config["solvent"],
method=2,
Expand Down

0 comments on commit f7435cc

Please sign in to comment.