Skip to content

Commit

Permalink
fix doc and tests
Browse files Browse the repository at this point in the history
  • Loading branch information
pierre-24 committed Jan 10, 2024
1 parent c6ffa2c commit f474157
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 4 deletions.
1 change: 1 addition & 0 deletions docs/use.rst
Original file line number Diff line number Diff line change
Expand Up @@ -596,6 +596,7 @@ The output depends on the value of ``-V``, which can be:
There is no way to change this behavior.
+ By default, the program also include the base tensors calculated in the process.
The ``-S`` option prevents this (that may be useful in the case of electric field differentiation)
+ If you want to add results to existing ``molecule_nd.h5`` file, you can use the ```--append`` option.
+ Projection over normal mode of all the geometrical derivatives is requested via the ``-p`` option, but you can also request that the cartesian hessian used to do so is different, with the ``-H`` option (which accepts FCHK and dalton archives with cartesian hessian in it as argument).


Expand Down
3 changes: 2 additions & 1 deletion nachos/bake.py
Original file line number Diff line number Diff line change
Expand Up @@ -148,10 +148,11 @@ def main():
storage = files.ComputationalResults(recipe, directory=recipe_directory)
storage.read(args.data)

original_cf = ChemistryDataFile()
original_cf = None
if args.append:
with open(args.output) as f:
try:
original_cf = ChemistryDataFile()
original_cf.read(f)
except BadChemistryDataFile as e:
return exit_failure('Cannot append data to `{}`: {}'.format(args.output, e))
Expand Down
10 changes: 7 additions & 3 deletions tests/tests_nachos_bake.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,9 @@ def test_bake_gaussian_F(self):

storage = files.ComputationalResults(r, directory=directory)
storage.read(storage_path)
baker = baking.Baker(r, storage, directory=directory)

# with energy:
baker = baking.Baker(r, storage, directory=directory)
cf_with_energy = baker.bake(only=[(derivatives.Derivative(), 3)])

self.assertIn('F', cf_with_energy.derivatives)
Expand All @@ -64,6 +64,7 @@ def test_bake_gaussian_F(self):
electrical_derivatives['FFF']['static'], cf_with_energy.derivatives['FFF']['static'])

# with mu:
baker = baking.Baker(r, storage, directory=directory)
cf_with_mu = baker.bake(only=[(derivatives.Derivative('F'), 2)])

self.assertIn('FF', cf_with_mu.derivatives)
Expand All @@ -79,6 +80,7 @@ def test_bake_gaussian_F(self):
delta=.01)

# with alpha:
baker = baking.Baker(r, storage, directory=directory)
cf_with_alpha = baker.bake(only=[(derivatives.Derivative('FF'), 1)])

self.assertIn('FFF', cf_with_alpha.derivatives)
Expand All @@ -89,6 +91,7 @@ def test_bake_gaussian_F(self):
cf_with_alpha.derivatives['FFF']['static'])

# dynamic
baker = baking.Baker(r, storage, directory=directory)
cf_with_alpha = baker.bake(only=[(derivatives.Derivative('dD'), 1)])

self.assertIn('dDF', cf_with_alpha.derivatives)
Expand Down Expand Up @@ -159,9 +162,8 @@ def test_bake_gaussian_G(self):

geometrical_derivatives = fchk.property('geometrical_derivatives')

baker = baking.Baker(r, storage, directory=directory)

# with energy:
baker = baking.Baker(r, storage, directory=directory)
cf_with_energy = baker.bake(only=[(derivatives.Derivative(), 2)])

self.assertIn('G', cf_with_energy.derivatives)
Expand All @@ -175,6 +177,7 @@ def test_bake_gaussian_G(self):
geometrical_derivatives['GG'], cf_with_energy.derivatives['GG'])

# try with all
baker = baking.Baker(r, storage, directory=directory)
cf = baker.bake()

self.assertIn('G', cf.derivatives)
Expand Down Expand Up @@ -212,6 +215,7 @@ def test_bake_gaussian_G(self):
math.fabs(ph[i, i]), mwh.frequencies[i] ** 2, places=5)

# now, bake and steal results from zero field
baker = baking.Baker(r, storage, directory=directory)
cf_with_copy = baker.bake(only=[(derivatives.Derivative(), 0)], copy_zero_field_basis=True)

# gradient and hessian ...
Expand Down

0 comments on commit f474157

Please sign in to comment.