From 54d5420210fe36984e7b25310f26d24af12ed384 Mon Sep 17 00:00:00 2001 From: samwaseda Date: Sat, 5 Oct 2024 08:40:40 +0000 Subject: [PATCH] run black --- stinx/input.py | 41 +++++++++++++++++---------------------- stinx/output.py | 8 ++------ tests/unit/test_input.py | 2 +- tests/unit/test_output.py | 2 +- 4 files changed, 22 insertions(+), 31 deletions(-) diff --git a/stinx/input.py b/stinx/input.py index 674c11c..766f248 100644 --- a/stinx/input.py +++ b/stinx/input.py @@ -17,18 +17,18 @@ def create( main: Optional[dict] = None, ): """ - Args: - structure (dict): (Optional) - basis (dict): (Optional) - pawPot (dict): The pawPot group defines the PAW potentials, by a sequence of species groups. The order of species must agree with the structure group. (Optional) - PAWHamiltonian (dict): (Optional) - spinConstraint (dict): (Optional) - initialGuess (dict): In order to start a DFT calculations, one must set up an initial guess for the density and for the wave functions. The initialGuess group defines how this is done, as well as a few other settings (such as keeping the waves on disk to save RAM). The default is to set up the density from a superposition of atomic densities, and the wave-functions from a single-step LCAO calculation, using the atomic valence orbitals. This works exceptionally well. If you want to finetune the behavior, the initialGuess group must contain a waves or a rho group. Otherwise, you may omit the waves and rho groups to get the default behavior. Additionally, the initialGuess group may contain an occupations group to set up initial occupations (notably when keeping them fixed), and an exchange group for hybrid functionals. (Optional) - pseudoPot (dict): The pseudoPot group defines the norm-conserving pseudopotentials by a sequence of species groups. The order of species must agree with the structure group. - -Note: PAW and norm-conserving pseudopotentials cannot be mixed. Using pseudoPot requires to use PWHamiltonian to define the Hamiltonian. (Optional) - PWHamiltonian (dict): (Optional) - main (dict): (Optional) + Args: + structure (dict): (Optional) + basis (dict): (Optional) + pawPot (dict): The pawPot group defines the PAW potentials, by a sequence of species groups. The order of species must agree with the structure group. (Optional) + PAWHamiltonian (dict): (Optional) + spinConstraint (dict): (Optional) + initialGuess (dict): In order to start a DFT calculations, one must set up an initial guess for the density and for the wave functions. The initialGuess group defines how this is done, as well as a few other settings (such as keeping the waves on disk to save RAM). The default is to set up the density from a superposition of atomic densities, and the wave-functions from a single-step LCAO calculation, using the atomic valence orbitals. This works exceptionally well. If you want to finetune the behavior, the initialGuess group must contain a waves or a rho group. Otherwise, you may omit the waves and rho groups to get the default behavior. Additionally, the initialGuess group may contain an occupations group to set up initial occupations (notably when keeping them fixed), and an exchange group for hybrid functionals. (Optional) + pseudoPot (dict): The pseudoPot group defines the norm-conserving pseudopotentials by a sequence of species groups. The order of species must agree with the structure group. + + Note: PAW and norm-conserving pseudopotentials cannot be mixed. Using pseudoPot requires to use PWHamiltonian to define the Hamiltonian. (Optional) + PWHamiltonian (dict): (Optional) + main (dict): (Optional) """ return fill_values( structure=structure, @@ -873,12 +873,12 @@ def create( species: Optional[dict] = None, ): """ - The pseudoPot group defines the norm-conserving pseudopotentials by a sequence of species groups. The order of species must agree with the structure group. + The pseudoPot group defines the norm-conserving pseudopotentials by a sequence of species groups. The order of species must agree with the structure group. -Note: PAW and norm-conserving pseudopotentials cannot be mixed. Using pseudoPot requires to use PWHamiltonian to define the Hamiltonian. + Note: PAW and norm-conserving pseudopotentials cannot be mixed. Using pseudoPot requires to use PWHamiltonian to define the Hamiltonian. - Args: - species (dict): (Optional) + Args: + species (dict): (Optional) """ return fill_values( species=species, @@ -969,9 +969,7 @@ def create( class main: @staticmethod - def create( - **kwargs - ): + def create(**kwargs): """ Args: scfDiag (dict): The scfDiag group selects and controls the iterative diagonalization + density mixing algorithm for the solution of the Kohn-Sham DFT equations. (Optional) @@ -981,9 +979,7 @@ def create( ric (dict): The ric group defines the parameters for internal coordinate generation. (Optional) ricTS (dict): The ricTS group requests a quasi-Newton optimization for 1st-order saddle points (transition states) using updates [11] of an on-the-fly optimized internal-coordinate based initial guess for the Hessian [10]. An initial guess for the reaction coordinate must be known. Note: This is an experimental feature. The optimization should be started within the saddle point region (one negative eigenvalue of the Hesse matrix), otherwise, the algorithm may converge to a different stationary point (a minimum, or a higher-order saddle point). (Optional) """ - return fill_values( - **kwargs - ) + return fill_values(**kwargs) class scfDiag: @staticmethod @@ -2296,4 +2292,3 @@ def create( spinScaling=spinScaling, dielecConstant=dielecConstant, ) - diff --git a/stinx/output.py b/stinx/output.py index 13a4310..4877db4 100644 --- a/stinx/output.py +++ b/stinx/output.py @@ -109,9 +109,7 @@ def collect_energy_struct(file_name="energy-structOpt.dat", cwd=None): path = Path(file_name) if cwd is not None: path = Path(cwd) / path - return { - "energy_free": np.loadtxt(str(path), ndmin=2).reshape(-1, 2)[:, 1] - } + return {"energy_free": np.loadtxt(str(path), ndmin=2).reshape(-1, 2)[:, 1]} def _check_permutation(index_permutation): @@ -282,9 +280,7 @@ def get_bands_k_weights(self): @property def _rec_cell(self): log_extract = re.findall("b[1-3]:.*$", self.log_file, re.MULTILINE) - return ( - np.array([ll.split()[1:4] for ll in log_extract]).astype(float) - )[:3] + return (np.array([ll.split()[1:4] for ll in log_extract]).astype(float))[:3] def get_kpoints_cartesian(self): return np.einsum("ni,ij->nj", self.k_points, self._rec_cell) diff --git a/tests/unit/test_input.py b/tests/unit/test_input.py index bb71592..f50bbc9 100644 --- a/tests/unit/test_input.py +++ b/tests/unit/test_input.py @@ -18,5 +18,5 @@ def test_stinx(self): self.assertTrue("def create" in generator.get_class(all_data)) -if __name__ == '__main__': +if __name__ == "__main__": unittest.main() diff --git a/tests/unit/test_output.py b/tests/unit/test_output.py index 2dba219..9b75af2 100644 --- a/tests/unit/test_output.py +++ b/tests/unit/test_output.py @@ -22,5 +22,5 @@ def test_output(self): self.assertIsInstance(energy["scf_energy_free"], list) -if __name__ == '__main__': +if __name__ == "__main__": unittest.main()