Skip to content

Commit

Permalink
Fix dump_input order in Cell.build (pyscf#2385)
Browse files Browse the repository at this point in the history
* Fix dump_input order in Cell.build

* Restores the test
  • Loading branch information
sunqm authored Aug 27, 2024
1 parent 3ca5a34 commit 44b2a20
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 6 deletions.
6 changes: 4 additions & 2 deletions pyscf/pbc/gto/cell.py
Original file line number Diff line number Diff line change
Expand Up @@ -1331,7 +1331,8 @@ def build(self, dump_input=True, parse_arg=mole.ARGPARSE,
if symmorphic is not None:
self.symmorphic = symmorphic

mole.MoleBase.build(self, dump_input, parse_arg, *args, **kwargs)
_built = self._built
mole.MoleBase.build(self, False, parse_arg, *args, **kwargs)

exp_min = np.array([self.bas_exp(ib).min() for ib in range(self.nbas)])
if self.exp_to_discard is None:
Expand Down Expand Up @@ -1448,7 +1449,8 @@ def build(self, dump_input=True, parse_arg=mole.ARGPARSE,
_check_mesh_symm = not self._mesh_from_build
self.build_lattice_symmetry(check_mesh_symmetry=_check_mesh_symm)

if dump_input:
if dump_input and not _built and self.verbose > logger.NOTE:
self.dump_input()
logger.info(self, 'lattice vectors a1 [%.9f, %.9f, %.9f]', *_a[0])
logger.info(self, ' a2 [%.9f, %.9f, %.9f]', *_a[1])
logger.info(self, ' a3 [%.9f, %.9f, %.9f]', *_a[2])
Expand Down
12 changes: 8 additions & 4 deletions pyscf/pbc/gto/test/test_cell.py
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,8 @@ def test_ewald_2d_inf_vacuum(self):
cell.atom = 'He 0 0 0; He 0 1 1'
cell.unit = 'B'
cell.mesh = [9,9,60]
cell.verbose = 0
cell.verbose = 5
cell.output = '/dev/null'
cell.dimension = 2
cell.low_dim_ft_type = 'inf_vacuum'
cell.rcut = 3.6
Expand All @@ -191,7 +192,8 @@ def test_ewald_1d_inf_vacuum(self):
cell.atom = 'He 0 0 0; He 0 1 1'
cell.unit = 'B'
cell.mesh = [9,60,60]
cell.verbose = 0
cell.verbose = 5
cell.output = '/dev/null'
cell.dimension = 1
cell.low_dim_ft_type = 'inf_vacuum'
cell.rcut = 3.6
Expand All @@ -204,7 +206,8 @@ def test_ewald_0d_inf_vacuum(self):
cell.atom = 'He 0 0 0; He 0 1 1'
cell.unit = 'B'
cell.mesh = [60] * 3
cell.verbose = 0
cell.verbose = 5
cell.output = '/dev/null'
cell.dimension = 0
cell.low_dim_ft_type = 'inf_vacuum'
cell.build()
Expand All @@ -217,7 +220,8 @@ def test_ewald_2d(self):
cell.atom = 'He 0 0 0; He 0 1 1'
cell.unit = 'B'
cell.mesh = [9,9,60]
cell.verbose = 0
cell.verbose = 5
cell.output = '/dev/null'
cell.dimension = 2
cell.rcut = 3.6
cell.build()
Expand Down

0 comments on commit 44b2a20

Please sign in to comment.