diff --git a/pymuonsuite/io/castep.py b/pymuonsuite/io/castep.py index 417b77e..7a0bbb2 100644 --- a/pymuonsuite/io/castep.py +++ b/pymuonsuite/io/castep.py @@ -144,7 +144,7 @@ def _read_castep_gamma_phonons( if gamma_i is None: raise CastepError( - "Could not find gamma point phonons in" " CASTEP phonon file" + "Could not find gamma point phonons in CASTEP phonon file" ) atoms.info["ph_evals"] = evals[gamma_i] @@ -364,10 +364,8 @@ def _create_geom_opt_castep_calculator(self): self._calc.param.geom_force_tol = 0.05 max_scf_cycles_param = self.params.get("max_scc_steps") - if max_scf_cycles_param is not None: - self._calc.param.max_scf_cycles.value = max_scf_cycles_param - + self._calc.param.max_scf_cycles = max_scf_cycles_param else: if self._calc.param.max_scf_cycles.value is None: self._calc.param.max_scf_cycles = 30 @@ -376,7 +374,7 @@ def _create_geom_opt_castep_calculator(self): # Remove settings for magres calculator: self._calc.param.magres_task = None - + print(self._calc.param.max_scf_cycles.value) return self._calc diff --git a/pymuonsuite/test/test_castep.py b/pymuonsuite/test/test_castep.py index ec75634..3796935 100644 --- a/pymuonsuite/test/test_castep.py +++ b/pymuonsuite/test/test_castep.py @@ -1,5 +1,6 @@ """Tests for ReadWriteCastep methods""" +import tempfile import unittest import os @@ -7,6 +8,7 @@ import numpy as np from ase import Atoms, io +from ase.calculators.castep import Castep from ase.io.castep import read_param from pymuonsuite.utils import list_to_string, get_element_from_custom_symbol @@ -80,6 +82,7 @@ def test_write(self): cell_file = os.path.join(input_folder, "Si2.cell") param_file = os.path.join(input_folder, "Si2.param") input_params = load_input_file(yaml_file, MuAirssSchema) + input_params["max_scc_steps"] = 31 with silence_stdio(): castep_param = read_param(param_file).param @@ -93,6 +96,7 @@ def test_write(self): sname="Si2_geom_opt", calc_type="GEOM_OPT", ) + self.assertEqual(reader._calc.param.max_scf_cycles.value, "31") reader.write(atoms, output_folder, sname="Si2_magres", calc_type="MAGRES") @@ -267,6 +271,98 @@ def test_write_uses_correct_particle_mass_and_element(self): finally: shutil.rmtree(output_folder) + def test_calc_overwrite(self): + # Ensure that if a calculator is provided, it is initialised properly + calculator = Castep() + read_write_castep = ReadWriteCastep(calc=calculator) + + # Original calculator should have been deep copied, so remain as it was + self.assertNotEqual( + "radsectesla\nH:mu 851615456.5978916\n", + calculator.cell.species_gamma.value, + ) + self.assertNotEqual( + "AMU\nH:mu 0.1134289259\n", + calculator.cell.species_mass.value, + ) + + # Copy stored should have appropriate muon values set + self.assertEqual( + "radsectesla\nH:mu 851615456.5978916\n", + read_write_castep._calc.cell.species_gamma.value, + ) + self.assertEqual( + "AMU\nH:mu 0.1134289259\n", + read_write_castep._calc.cell.species_mass.value, + ) + + def test_set_params(self): + # Ensure set_params changes the calculator object + read_write_castep = ReadWriteCastep() + read_write_castep.set_params({"mu_symbol": "H:nu"}) + + self.assertEqual( + "radsectesla\nH:nu 851615456.5978916\n", + read_write_castep._calc.cell.species_gamma.value, + ) + self.assertEqual( + "AMU\nH:nu 0.1134289259\n", + read_write_castep._calc.cell.species_mass.value, + ) + + def test_read_error(self): + # Ensure user receives an error if .castep output file is missing + read_write_castep = ReadWriteCastep() + si_folder = _TESTDATA_DIR + "/Si2" + ethylene_mu_folder = _TESTDATA_DIR + "/ethyleneMu" + + with self.assertRaises(IOError) as e: + read_write_castep.read(".") + self.assertIn("ERROR: No .castep files found in", str(e.exception)) + + with self.assertRaises(IOError) as e: + read_write_castep.read(folder=si_folder, read_magres=True) + self.assertIn("No .magres files found in", str(e.exception)) + + with self.assertRaises(IOError) as e: + read_write_castep.read(folder=si_folder, read_phonons=True) + self.assertIn("No .phonon files found in", str(e.exception)) + + with self.assertRaises(IOError) as e: + read_write_castep.read( + folder=ethylene_mu_folder, + sname="ethyleneMu_no_gamma", + read_phonons=True, + ) + self.assertIn( + "Could not find gamma point phonons in CASTEP phonon file", + str(e.exception), + ) + + def test_write_cell_calc_type(self): + # Ensure calc_type is propagated by write_cell + read_write_castep = ReadWriteCastep() + + with tempfile.TemporaryDirectory() as tmp_dir: + read_write_castep.write_cell( + a=Atoms(["H"]), folder=tmp_dir, sname="H", calc_type="MAGRES" + ) + self.assertEqual("Magres", read_write_castep._calc.param.task.value) + + def test_write_cell_calc_type_error(self): + # Ensure user receives an error if using a bad calc_type + read_write_castep = ReadWriteCastep() + + with self.assertRaises(NotImplementedError) as e: + read_write_castep.write_cell( + a=None, folder=None, sname=None, calc_type=None + ) + self.assertIn( + "Calculation type None is not implemented. " + "Please choose 'GEOM_OPT' or 'MAGRES'", + str(e.exception), + ) + if __name__ == "__main__": diff --git a/pymuonsuite/test/test_data/ethyleneMu/ethyleneMu_no_gamma.castep b/pymuonsuite/test/test_data/ethyleneMu/ethyleneMu_no_gamma.castep new file mode 100644 index 0000000..04ad209 --- /dev/null +++ b/pymuonsuite/test/test_data/ethyleneMu/ethyleneMu_no_gamma.castep @@ -0,0 +1,634 @@ + +-------------------------------------------------+ + | | + | CCC AA SSS TTTTT EEEEE PPPP | + | C A A S T E P P | + | C AAAA SS T EEE PPPP | + | C A A S T E P | + | CCC A A SSS T EEEEE P | + | | + +-------------------------------------------------+ + | | + | Welcome to Academic Release CASTEP version 19.11| + | Ab Initio Total Energy Program | + | | + | Authors: | + | M. Segall, M. Probert, C. Pickard, P. Hasnip, | + | S. Clark, K. Refson, J. R. Yates, M. Payne | + | | + | Contributors: | + | P. Lindan, P. Haynes, J. White, V. Milman, | + | N. Govind, M. Gibson, P. Tulip, V. Cocula, | + | B. Montanari, D. Quigley, M. Glover, | + | L. Bernasconi, A. Perlov, M. Plummer, | + | E. McNellis, J. Meyer, J. Gale, D. Jochym | + | J. Aarons, B. Walker, R. Gillen, D. Jones | + | T. Green, I. J. Bush, C. J. Armstrong, | + | E. J. Higgins, E. L. Brown, M. S. McFly, | + | J. Wilkins, B-C. Shih, P. J. P. Byrne | + | | + | Copyright (c) 2000 - 2018 | + | | + | Distributed under the terms of an | + | Agreement between the United Kingdom | + | Car-Parrinello (UKCP) Consortium, | + | Daresbury Laboratory and Accelrys, Inc. | + | | + | Please cite | + | | + | "First principles methods using CASTEP" | + | | + | Zeitschrift fuer Kristallographie | + | 220(5-6) pp. 567-570 (2005) | + | | + | S. J. Clark, M. D. Segall, C. J. Pickard, | + | P. J. Hasnip, M. J. Probert, K. Refson, | + | M. C. Payne | + | | + | in all publications arising from | + | your use of CASTEP | + | | + +-------------------------------------------------+ + | | + | http://www.castep.org | + | | + +-------------------------------------------------+ + + + + Compiled for linux_x86_64_ifort18 on Fri, 05 Jul 2019 15:43:56 +0100 + from code version + 0a9e5daac2f4+ Castep191_branch Wed, 03 Jul 2019 08:43:28 +0000 + Compiler: Intel Fortran 18.0.3.222; Optimisation: fast + MATHLIBS: Intel MKL(2018.0.3) (LAPACK version 3.7.0) + FFT Lib : default + Fundamental constants values: CODATA 2014 + + Run started: Tue, 13 Oct 2020 22:53:10 +0100 + +-------------------------------------------------+ + | | + | N N M M RRRR | + | NN N MM MM R R | + | N N N M M M RRRR | + | N NN M M R R | + | N N M M R R | + | | + +-------------------------------------------------+ + | | + | Welcome to Materials Studio CASTEP-NMR | + | | + | Authors: | + | J.R. Yates, C.J. Pickard, F. Mauri | + | | + | Contributors: | + | T.F.G. Green, S.A. Joyce, R.T. Strong, | + | B-C. Shih | + | | + | Copyright (c) 2004 - 2018 | + | | + | Please cite the appropriate publications in all | + | work arising from your use of CASTEP NMR. | + | | + | For NMR Shielding Tensors cite: | + | "All-electron magnetic response with | + | pseudopotentials: NMR chemical shifts", | + | C. J. Pickard, F. Mauri; | + | Physical Review B63 245101 (2001), and | + | | + | "Calculation of NMR Chemical Shifts | + | for extended systems using | + | Ultrasoft Pseudopotentials", | + | J. R. Yates, C. J. Pickard and F. Mauri | + | Physical Review B76 024401 (2007) | + | | + | For Electric Field Gradients cite: | + | "Accurate First Principles Prediction of 17O | + | NMR Parameters in SiO2: Assignment of the | + | Zeolite Ferrierite Spectrum" | + | M. Profeta, F. Mauri and C. J. Pickard | + | J. Amer. Chem. Soc. 125 541 (2003) | + | | + | For Spin-Spin (J) Couplings cite: | + | "A first principles theory of NMR J-coupling | + | in solid-state systems" | + | S.A. Joyce, J.R. Yates, C.J. Pickard, F. Mauri| + | J. Chem. Phys. 127 204107 (2007) | + | | + | "Relativistic NMR J-coupling with ultrasoft | + | pseudopotentials and the zeroth-order regular | + | approximation" | + | T.F.G. Green and J.R. Yates | + | J. Chem. Phys. 140 234106 (2014) | + | | + +-------------------------------------------------+ + + + Atomic calculation performed for H: 1s1 + + Converged in 41 iterations to an ae energy of -12.134 eV + + ============================================================ + | Pseudopotential Report - Date of generation 13-10-2020 | + ------------------------------------------------------------ + | Element: H Ionic charge: 1.00 Level of theory: LDA | + | Atomic Solver: Koelling-Harmon | + | | + | Reference Electronic Structure | + | Orbital Occupation Energy | + | 1s 1.000 -0.234 | + | | + | Pseudopotential Definition | + | Beta l e Rc scheme norm | + | 1 0 -0.234 0.599 qc 0 | + | 2 0 0.250 0.599 qc 0 | + | loc 1 0.000 0.599 pn 0 | + | | + | Augmentation charge Rinner = 0.421 | + | No partial core correction | + ------------------------------------------------------------ + | "1|0.6|13|15|17|10(qc=8)" | + ------------------------------------------------------------ + | Author: Chris J. Pickard, Cambridge University | + ============================================================ + + Atomic calculation performed for C: 1s2 2s2 2p2 + + Converged in 56 iterations to an ae energy of -1018.807 eV + + ============================================================ + | Pseudopotential Report - Date of generation 13-10-2020 | + ------------------------------------------------------------ + | Element: C Ionic charge: 4.00 Level of theory: LDA | + | Atomic Solver: Koelling-Harmon | + | | + | Reference Electronic Structure | + | Orbital Occupation Energy | + | 2s 2.000 -0.501 | + | 2p 2.000 -0.199 | + | | + | Pseudopotential Definition | + | Beta l e Rc scheme norm | + | 1 0 -0.501 1.395 qc 0 | + | 2 0 0.250 1.395 qc 0 | + | 3 1 -0.199 1.395 qc 0 | + | 4 1 0.250 1.395 qc 0 | + | loc 2 0.000 1.395 pn 0 | + | | + | Augmentation charge Rinner = 0.983 | + | Partial core correction Rc = 0.983 | + ------------------------------------------------------------ + | "2|1.4|10|12|13|20:21(qc=7)" | + ------------------------------------------------------------ + | Author: Chris J. Pickard, Cambridge University | + ============================================================ + + Atomic calculation performed for H:mu: 1s1 + + Converged in 41 iterations to an ae energy of -12.134 eV + + ============================================================ + | Pseudopotential Report - Date of generation 13-10-2020 | + ------------------------------------------------------------ + | Element: H Ionic charge: 1.00 Level of theory: LDA | + | Atomic Solver: Koelling-Harmon | + | | + | Reference Electronic Structure | + | Orbital Occupation Energy | + | 1s 1.000 -0.234 | + | | + | Pseudopotential Definition | + | Beta l e Rc scheme norm | + | 1 0 -0.234 0.599 qc 0 | + | 2 0 0.250 0.599 qc 0 | + | loc 1 0.000 0.599 pn 0 | + | | + | Augmentation charge Rinner = 0.421 | + | No partial core correction | + ------------------------------------------------------------ + | "1|0.6|13|15|17|10(qc=8)" | + ------------------------------------------------------------ + | Author: Chris J. Pickard, Cambridge University | + ============================================================ + + Pseudo atomic calculation performed for H 1s1 + + Converged in 21 iterations to a total energy of -12.1075 eV + + Pseudo atomic calculation performed for C 2s2 2p2 + + Converged in 19 iterations to a total energy of -148.1382 eV + + Pseudo atomic calculation performed for H:mu 1s1 + + Converged in 21 iterations to a total energy of -12.1075 eV + Calculation parallelised over 8 processes. + Data is distributed by G-vector(8-way) + + ************************************ Title ************************************ + + + ***************************** General Parameters ****************************** + + output verbosity : normal (1) + write checkpoint data to : ./ethyleneMu_opt_displaced_0/ethyleneMu_opt_displaced_0.check + type of calculation : Magnetic Resonance + stress calculation : off + density difference calculation : off + electron localisation func (ELF) calculation : off + Hirshfeld analysis : off + unlimited duration calculation + timing information : on + memory usage estimate : on + write extra output files : on + write final potential to formatted file : off + write final density to formatted file : off + write BibTeX reference list : on + write OTFG pseudopotential files : on + write electrostatic potential file : on + write bands file : on + checkpoint writing : both castep_bin and check files + + output length unit : A + output mass unit : amu + output time unit : ps + output charge unit : e + output spin unit : hbar/2 + output energy unit : eV + output force unit : eV/A + output velocity unit : A/ps + output pressure unit : GPa + output inv_length unit : 1/A + output frequency unit : cm-1 + output force constant unit : eV/A**2 + output volume unit : A**3 + output IR intensity unit : (D/A)**2/amu + output dipole unit : D + output efield unit : eV/A/e + output entropy unit : J/mol/K + + wavefunctions paging : none + random number generator seed : randomised (225310386) + data distribution : optimal for this architecture + optimization strategy : balance speed and memory + + *********************** Exchange-Correlation Parameters *********************** + + using functional : Local Density Approximation + relativistic treatment : Koelling-Harmon + DFT+D: Semi-empirical dispersion correction : off + + ************************* Pseudopotential Parameters ************************** + + pseudopotential representation : reciprocal space + representation : reciprocal space + spin-orbit coupling : off + + **************************** Basis Set Parameters ***************************** + + basis set accuracy : FINE + plane wave basis set cut-off : 462.5936 eV + size of standard grid : 1.7500 + size of fine gmax : 19.2831 1/A + finite basis set correction : none + + **************************** Electronic Parameters **************************** + + number of electrons : 13.00 + net charge of system : 0.000 + net spin of system : 1.000 + number of up spins : 7.000 + number of down spins : 6.000 + treating system as spin-polarized + number of bands : 11 + + ********************* Electronic Minimization Parameters ********************** + + Method: Treating system as metallic with density mixing treatment of electrons, + and number of SD steps : 1 + and number of CG steps : 4 + + total energy / atom convergence tol. : 0.1000E-07 eV + eigen-energy convergence tolerance : 0.1000E-07 eV + max force / atom convergence tol. : ignored + convergence tolerance window : 3 cycles + max. number of SCF cycles : 200 + number of fixed-spin iterations : 10 + smearing scheme : Gaussian + smearing width : 0.2000 eV + Fermi energy convergence tolerance : 0.2721E-13 eV + periodic dipole correction : NONE + + ************************** Density Mixing Parameters ************************** + + density-mixing scheme : Broyden + max. length of mixing history : 20 + charge density mixing amplitude : 0.8000 + spin density mixing amplitude : 2.000 + + *********************** Population Analysis Parameters ************************ + + Population analysis with cutoff : 3.000 A + Population analysis output : summary and pdos components + + ************************ Magnetic Resonance Parameters ************************ + + Magnetic Resonance Property : Hyperfine Tensors + band convergence tolerance : 0.1000E-08 eV + + ******************************************************************************* + + + ------------------------------- + Unit Cell + ------------------------------- + Real Lattice(A) Reciprocal Lattice(1/A) + 10.0000000 0.0000000 0.0000000 0.628318531 0.000000000 0.000000000 + 0.0000000 10.0000000 0.0000000 0.000000000 0.628318531 0.000000000 + 0.0000000 0.0000000 10.0000000 0.000000000 0.000000000 0.628318531 + + Lattice parameters(A) Cell Angles + a = 10.000000 alpha = 90.000000 + b = 10.000000 beta = 90.000000 + c = 10.000000 gamma = 90.000000 + + Current cell volume = 1000.000000 A**3 + density = 0.029061 AMU/A**3 + = 0.048257 g/cm^3 + + ------------------------------- + Cell Contents + ------------------------------- + Total number of ions in cell = 7 + Total number of species in cell = 3 + Max number of any one species = 4 + + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + x Element Atom Fractional coordinates of atoms x + x Number u v w x + x----------------------------------------------------------x + x H 1 -0.015513 0.088836 0.120216 x + x H 2 -0.015513 -0.088836 0.120216 x + x H 3 -0.008274 0.092870 -0.129387 x + x H 4 -0.008274 -0.092870 -0.129387 x + x C 1 0.023266 0.000000 0.069730 x + x C 2 -0.007971 0.000000 -0.073525 x + x H:mu 1 0.132278 0.000000 0.088885 x + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + + + No user defined ionic velocities + + ------------------------------- + Details of Species + ------------------------------- + + Mass of species in AMU + H 1.0079400 + C 12.0107000 + H:mu 1.0079400 + + Files used for pseudopotentials: + H 1|0.6|13|15|17|10(qc=8) + C 2|1.4|10|12|13|20:21(qc=7) + H:mu 1|0.6|13|15|17|10(qc=8) + + ------------------------------- + k-Points For BZ Sampling + ------------------------------- + MP grid size for SCF calculation is 1 1 1 + with an offset of 0.000 0.000 0.000 + Number of kpoints used = 1 + + ------------------------------- + Symmetry and Constraints + ------------------------------- + + Maximum deviation from symmetry = 0.00000 ANG + + Number of symmetry operations = 1 + Number of ionic constraints = 3 + Point group of crystal = 1: C1, 1, 1 + Space group of crystal = 6: Pm, P -2y + + Set iprint > 1 for details on symmetry rotations/translations + + Centre of mass is constrained + Set iprint > 1 for details of linear ionic constraints + + Number of cell constraints= 0 + Cell constraints are: 1 2 3 4 5 6 + + External pressure/stress (GPa) + 0.00000 0.00000 0.00000 + 0.00000 0.00000 + 0.00000 + ++---------------- MEMORY AND SCRATCH DISK ESTIMATES PER PROCESS --------------+ +| Memory Disk | +| Baseline code, static data and system overhead 463.0 MB 0.0 MB | +| BLAS internal memory storage 0.0 MB 0.0 MB | +| Model and support data 17.0 MB 10.7 MB | +| Electronic energy minimisation requirements 6.5 MB 0.0 MB | +| Force calculation requirements 4.9 MB 0.0 MB | +| ----------------------------- | +| Approx. total storage required per process 486.5 MB 10.7 MB | +| | +| Requirements will fluctuate during execution and may exceed these estimates | ++-----------------------------------------------------------------------------+ +Calculating total energy with cut-off of 462.594 eV. +------------------------------------------------------------------------ <-- SCF +SCF loop Energy Fermi Energy gain Timer <-- SCF + energy per atom (sec) <-- SCF +------------------------------------------------------------------------ <-- SCF +Initial 7.22721753E+001 0.00000000E+000 4.10 <-- SCF + 1 -3.18022199E+002 3.14121004E+000 5.57563392E+001 4.30 <-- SCF + 2 -3.94577209E+002 -6.27914766E+000 1.09364299E+001 4.43 <-- SCF + 3 -3.97741403E+002 -6.88907755E+000 4.52027731E-001 4.59 <-- SCF + 4 -3.93078760E+002 -5.25117500E+000 -6.66091816E-001 4.78 <-- SCF + 5 -3.93018615E+002 -5.06883973E+000 -8.59213989E-003 4.98 <-- SCF + 6 -3.92985905E+002 -4.86218827E+000 -4.67289638E-003 5.17 <-- SCF + 7 -3.92970186E+002 -4.70595649E+000 -2.24552772E-003 5.37 <-- SCF + 8 -3.92961147E+002 -4.57425174E+000 -1.29130787E-003 5.57 <-- SCF + 9 -3.92943088E+002 -4.36742446E+000 -2.57985284E-003 5.77 <-- SCF + 10 -3.92945934E+002 -3.54452788E+000 4.06632643E-004 5.99 <-- SCF + 11 -3.92956224E+002 -3.54468442E+000 1.47003107E-003 6.19 <-- SCF + 12 -3.92962192E+002 -3.54311883E+000 8.52431571E-004 6.41 <-- SCF + 13 -3.92969256E+002 -3.53909168E+000 1.00915445E-003 6.64 <-- SCF + 14 -3.92980863E+002 -3.51591933E+000 1.65819913E-003 6.85 <-- SCF + 15 -3.92982119E+002 -3.50416168E+000 1.79390271E-004 7.06 <-- SCF + 16 -3.92982650E+002 -3.50116355E+000 7.59491420E-005 7.27 <-- SCF + 17 -3.92983274E+002 -3.49602102E+000 8.91259993E-005 7.48 <-- SCF + 18 -3.92983966E+002 -3.48987536E+000 9.88230476E-005 7.69 <-- SCF + 19 -3.92984099E+002 -3.48971122E+000 1.89615547E-005 7.89 <-- SCF + 20 -3.92984131E+002 -3.49019871E+000 4.66078683E-006 8.08 <-- SCF + 21 -3.92984173E+002 -3.49058883E+000 5.91497170E-006 8.27 <-- SCF + 22 -3.92984218E+002 -3.49117414E+000 6.40748773E-006 8.45 <-- SCF + 23 -3.92984221E+002 -3.49129235E+000 4.20201011E-007 8.64 <-- SCF + 24 -3.92984222E+002 -3.49129297E+000 1.48137785E-007 8.83 <-- SCF + 25 -3.92984222E+002 -3.49131477E+000 1.13615213E-007 9.02 <-- SCF + 26 -3.92984223E+002 -3.49136137E+000 1.24284253E-007 9.21 <-- SCF + 27 -3.92984224E+002 -3.49138422E+000 5.36245993E-008 9.39 <-- SCF + 28 -3.92984224E+002 -3.49138554E+000 3.34678290E-008 9.58 <-- SCF + 29 -3.92984224E+002 -3.49138910E+000 3.16341253E-008 9.77 <-- SCF + 30 -3.92984224E+002 -3.49138574E+000 2.12020815E-008 9.96 <-- SCF + 31 -3.92984224E+002 -3.49138329E+000 4.16037692E-009 10.15 <-- SCF + 32 -3.92984224E+002 -3.49138287E+000 2.35789909E-009 10.33 <-- SCF +------------------------------------------------------------------------ <-- SCF + +Integrated Spin Density = 1.00000 hbar/2 +Integrated |Spin Density| = 1.07734 hbar/2 + +Final energy, E = -392.9842242092 eV +Final free energy (E-TS) = -392.9842242879 eV +(energies not corrected for finite basis set) + +NB est. 0K energy (E-0.5TS) = -392.9842242485 eV + + +Writing analysis data to ./ethyleneMu_opt_displaced_0/ethyleneMu_opt_displaced_0.castep_bin + +Writing model to ./ethyleneMu_opt_displaced_0/ethyleneMu_opt_displaced_0.check + ===================================================================== + + Calculation of Electron Paramagnetic Resonance Parameters + + + ================================================================= + + ===================================================================== + + Calculation of Hyperfine Tensors + + + ------------------- + + + + + + + + + ================================================================= + + + + + + + + + + + + ================================================================= + + + + ============================================================== + | Hyperfine Tensor | + |------------------------------------------------------------| + | Nucleus Hyperfine tensor | + | Species Ion Iso(MHz) | + | H 1 -3.707E+01 | + | H 2 -3.707E+01 | + | H 3 4.274E+01 | + | H 4 4.274E+01 | + | C 1 2.866E+01 | + | C 2 -1.640E+02 | + | H:mu 1 -5.286E+02 | + ============================================================== + + + ************************** Forces ************************** + * * + * Cartesian components (eV/A) * + * -------------------------------------------------------- * + * x y z * + * * + * H 1 -0.12000 0.27940 0.18613 * + * H 2 -0.11999 -0.27940 0.18613 * + * H 3 -0.06166 0.27329 -0.20618 * + * H 4 -0.06166 -0.27329 -0.20617 * + * C 1 -0.07696 -0.00000 -0.44603 * + * C 2 0.21647 -0.00001 0.46777 * + * H:mu 1 0.22381 0.00001 0.01835 * + * * + ************************************************************ + + Pseudo atomic calculation performed for H 1s1 + + Converged in 21 iterations to a total energy of -12.1075 eV + + Pseudo atomic calculation performed for C 2s2 2p2 + + Converged in 19 iterations to a total energy of -148.1382 eV + + Pseudo atomic calculation performed for H:mu 1s1 + + Converged in 21 iterations to a total energy of -12.1075 eV +Charge spilling parameter for spin component 1 = 1.95% +Charge spilling parameter for spin component 2 = 2.09% + + Orbital Populations + --------------------------------------------------------------- + Ion Atom Orbital Up Down Spin + --------------------------------------------------------------- + H 1 S 0.351 0.337 0.014 + H 2 S 0.351 0.337 0.014 + H 3 S 0.327 0.364 -0.036 + H 4 S 0.327 0.364 -0.036 + C 1 S 0.703 0.713 -0.010 + C 1 Px 0.601 0.612 -0.011 + C 1 Py 0.616 0.619 -0.004 + C 1 Pz 0.514 0.537 -0.023 + C 2 S 0.698 0.646 0.052 + C 2 Px 0.952 0.063 0.889 + C 2 Py 0.639 0.609 0.031 + C 2 Pz 0.538 0.492 0.045 + H:mu 1 S 0.382 0.309 0.074 + --------------------------------------------------------------- + Total: 7.000 6.000 1.000 + --------------------------------------------------------------- + + Atomic Populations (Mulliken) + ----------------------------- +Species Ion Spin s p d f Total Charge(e) Spin(hbar/2) +========================================================================================= + H 1 up: 0.35 0.00 0.00 0.00 0.35 0.31 0.01 + 1 dn: 0.34 0.00 0.00 0.00 0.34 + H 2 up: 0.35 0.00 0.00 0.00 0.35 0.31 0.01 + 2 dn: 0.34 0.00 0.00 0.00 0.34 + H 3 up: 0.33 0.00 0.00 0.00 0.33 0.31 -0.04 + 3 dn: 0.36 0.00 0.00 0.00 0.36 + H 4 up: 0.33 0.00 0.00 0.00 0.33 0.31 -0.04 + 4 dn: 0.36 0.00 0.00 0.00 0.36 + C 1 up: 0.70 1.73 0.00 0.00 2.43 -0.92 -0.05 + 1 dn: 0.71 1.77 0.00 0.00 2.48 + C 2 up: 0.70 2.13 0.00 0.00 2.83 -0.64 1.02 + 2 dn: 0.65 1.16 0.00 0.00 1.81 + H:mu 1 up: 0.38 0.00 0.00 0.00 0.38 0.31 0.07 + 1 dn: 0.31 0.00 0.00 0.00 0.31 +========================================================================================= + + Bond Population Spin Length (A) +================================================================================ + H 4 -- C 2 0.81 -0.01 1.08376 + H 3 -- C 2 0.81 -0.01 1.08376 + H 2 -- C 1 0.79 0.01 1.09291 + H 1 -- C 1 0.79 0.01 1.09291 + C 1 -- H:mu 1 0.74 0.02 1.10682 + C 1 -- C 2 0.68 -0.04 1.46621 + H 2 -- H:mu 1 -0.12 -0.02 1.75259 + H 1 -- H:mu 1 -0.12 -0.02 1.75259 + H 1 -- H 2 -0.10 0.01 1.77673 + H 3 -- H 4 -0.12 0.00 1.85739 + H 2 -- C 2 -0.14 -0.01 2.13270 + H 1 -- C 2 -0.14 -0.01 2.13270 + C 2 -- H:mu 1 -0.15 -0.05 2.14585 + H 4 -- C 1 -0.13 0.00 2.21961 + H 3 -- C 1 -0.13 0.00 2.21961 + H 2 -- H 4 -0.05 0.00 2.49740 + H 1 -- H 3 -0.05 0.00 2.49740 + H 4 -- H:mu 1 -0.00 -0.00 2.75721 + H 3 -- H:mu 1 -0.00 -0.00 2.75721 +================================================================================ + + +Writing analysis data to ./ethyleneMu_opt_displaced_0/ethyleneMu_opt_displaced_0.castep_bin + +Writing model to ./ethyleneMu_opt_displaced_0/ethyleneMu_opt_displaced_0.check + + A BibTeX formatted list of references used in this run has been written to + ./ethyleneMu_opt_displaced_0/ethyleneMu_opt_displaced_0.bib + +Initialisation time = 3.74 s +Calculation time = 10.92 s +Finalisation time = 0.62 s +Total time = 15.28 s +Peak Memory Use = 608744 kB + +Overall parallel efficiency rating: Mediocre (54%) + +Data was distributed by:- +G-vector (8-way); efficiency rating: Mediocre (55%) + +Parallel notes: +1) Calculation only took 14.7 s, so efficiency estimates may be inaccurate. diff --git a/pymuonsuite/test/test_data/ethyleneMu/ethyleneMu_no_gamma.phonon b/pymuonsuite/test/test_data/ethyleneMu/ethyleneMu_no_gamma.phonon new file mode 100644 index 0000000..908f2f1 --- /dev/null +++ b/pymuonsuite/test/test_data/ethyleneMu/ethyleneMu_no_gamma.phonon @@ -0,0 +1,191 @@ + BEGIN header + Number of ions 7 + Number of branches 21 + Number of wavevectors 1 + Frequencies in cm-1 + IR intensities in (D/A)**2/amu + Raman activities in A**4 amu**(-1) + Unit cell vectors (A) + 10.000000 0.000000 0.000000 + 0.000000 10.000000 0.000000 + 0.000000 0.000000 10.000000 + Fractional Co-ordinates + 1 0.000000 0.092283 0.123769 H 1.007940 + 2 0.000000 0.907717 0.123769 H 1.007940 + 3 0.000000 0.092283 0.876231 H 1.007940 + 4 0.000000 0.907717 0.876231 H 1.007940 + 5 0.000000 0.000000 0.066748 C 12.010700 + 6 0.000000 0.000000 0.933252 C 12.010700 + 7 0.100000 0.000000 0.066748 H:mu 0.113429 + END header + q-pt= 1 1.000000 1.000000 1.000000 1.0000000000 + 1 -3507.690333 + 2 -3406.857599 + 3 -295.722830 + 4 -205.564269 + 5 -121.437351 + 6 -0.086534 + 7 -0.072430 + 8 -0.049911 + 9 755.747481 + 10 1028.436033 + 11 1124.714362 + 12 1158.505679 + 13 1183.616729 + 14 1332.986682 + 15 1384.441992 + 16 1621.345550 + 17 3167.663872 + 18 3189.746402 + 19 3281.043303 + 20 3296.377333 + 21 11659.410304 + Phonon Eigenvectors +Mode Ion X Y Z + 1 1 -0.084194815067 0.000000000000 0.032837947561 0.000000000000 0.021641327845 0.000000000000 + 1 2 0.084341296904 0.000000000000 0.032899218471 0.000000000000 -0.021620253883 0.000000000000 + 1 3 0.038899814154 0.000000000000 0.003604860552 0.000000000000 0.001794348361 0.000000000000 + 1 4 -0.038843075123 0.000000000000 0.003571069849 0.000000000000 -0.001772729583 0.000000000000 + 1 5 -0.000035460709 0.000000000000 -0.122139950234 0.000000000000 0.000080666565 0.000000000000 + 1 6 -0.000026236341 0.000000000000 0.004169405257 0.000000000000 0.000004100042 0.000000000000 + 1 7 0.000030522891 0.000000000000 0.982196868025 0.000000000000 -0.000984247645 0.000000000000 + 2 1 -0.078349538456 0.000000000000 0.034196860094 0.000000000000 -0.008674309482 0.000000000000 + 2 2 -0.078174496024 0.000000000000 -0.034109963690 0.000000000000 -0.008711546442 0.000000000000 + 2 3 -0.028934225335 0.000000000000 -0.005989114128 0.000000000000 -0.006100260043 0.000000000000 + 2 4 -0.029016873091 0.000000000000 0.005975927388 0.000000000000 -0.006096572764 0.000000000000 + 2 5 0.037162387091 0.000000000000 -0.000125044545 0.000000000000 -0.083341335118 0.000000000000 + 2 6 0.028023676499 0.000000000000 0.000005009691 0.000000000000 -0.004805570810 0.000000000000 + 2 7 -0.030674615144 0.000000000000 0.000977030057 0.000000000000 0.986591999859 0.000000000000 + 3 1 0.361250871974 0.000000000000 0.046826389370 0.000000000000 -0.046657189626 0.000000000000 + 3 2 -0.361258050371 0.000000000000 0.046809603198 0.000000000000 0.046748640867 0.000000000000 + 3 3 0.602724652237 0.000000000000 0.011429551620 0.000000000000 0.018105913642 0.000000000000 + 3 4 -0.602722335520 0.000000000000 0.011435736783 0.000000000000 -0.018047600982 0.000000000000 + 3 5 -0.000018050586 0.000000000000 -0.050896489891 0.000000000000 0.000134681002 0.000000000000 + 3 6 -0.000009566794 0.000000000000 0.011959445047 0.000000000000 0.000121483659 0.000000000000 + 3 7 -0.000001640076 0.000000000000 0.006675682906 0.000000000000 0.000011256128 0.000000000000 + 4 1 -0.008287003779 0.000000000000 0.278307463078 0.000000000000 -0.220149244423 0.000000000000 + 4 2 0.008066637129 0.000000000000 0.278317894996 0.000000000000 0.221226394083 0.000000000000 + 4 3 0.003243435788 0.000000000000 -0.273225685724 0.000000000000 -0.202787714621 0.000000000000 + 4 4 -0.003195417525 0.000000000000 -0.273274947201 0.000000000000 0.203978921696 0.000000000000 + 4 5 -0.000346470775 0.000000000000 0.496106372895 0.000000000000 0.001733284379 0.000000000000 + 4 6 -0.000051705636 0.000000000000 -0.515937408254 0.000000000000 0.001741887682 0.000000000000 + 4 7 -0.000031920886 0.000000000000 0.056053217177 0.000000000000 0.000157544120 0.000000000000 + 5 1 -0.251218110712 0.000000000000 -0.002970809834 0.000000000000 -0.003785363179 0.000000000000 + 5 2 -0.251220599373 0.000000000000 0.003413158758 0.000000000000 -0.003916677384 0.000000000000 + 5 3 0.258764090152 0.000000000000 0.005588634053 0.000000000000 0.009213070984 0.000000000000 + 5 4 0.258778679635 0.000000000000 -0.004815198654 0.000000000000 0.009067557380 0.000000000000 + 5 5 -0.780645603890 0.000000000000 0.000883088772 0.000000000000 -0.004636828967 0.000000000000 + 5 6 0.353566540921 0.000000000000 0.001180158634 0.000000000000 -0.004046412958 0.000000000000 + 5 7 -0.071177489568 0.000000000000 0.000083097757 0.000000000000 -0.007589535781 0.000000000000 + 6 1 0.011613920435 0.000000000000 0.188583475857 0.000000000000 0.022443046303 0.000000000000 + 6 2 0.011020636757 0.000000000000 0.188714607943 0.000000000000 0.024805037156 0.000000000000 + 6 3 0.026836018251 0.000000000000 0.184680594503 0.000000000000 0.021925036496 0.000000000000 + 6 4 0.022280678412 0.000000000000 0.184516888694 0.000000000000 0.025815577547 0.000000000000 + 6 5 0.042210904130 0.000000000000 0.648567428117 0.000000000000 0.081959498167 0.000000000000 + 6 6 0.071227505462 0.000000000000 0.641754611688 0.000000000000 0.081912568081 0.000000000000 + 6 7 0.004240899722 0.000000000000 0.063882490230 0.000000000000 0.007797518422 0.000000000000 + 7 1 0.119350717316 0.000000000000 -0.022294906390 0.000000000000 0.030638534348 0.000000000000 + 7 2 0.119423194754 0.000000000000 -0.020514858869 0.000000000000 0.030260526088 0.000000000000 + 7 3 0.266477418620 0.000000000000 -0.019289187269 0.000000000000 0.034576986773 0.000000000000 + 7 4 0.267022456662 0.000000000000 -0.022296668208 0.000000000000 0.034015639915 0.000000000000 + 7 5 0.443041935401 0.000000000000 -0.073468317737 0.000000000000 0.108428326215 0.000000000000 + 7 6 0.768540578429 0.000000000000 -0.072412333824 0.000000000000 0.108349857790 0.000000000000 + 7 7 0.044610193552 0.000000000000 -0.007238882566 0.000000000000 0.008205545434 0.000000000000 + 8 1 -0.023518945271 0.000000000000 -0.020866687628 0.000000000000 0.185325528484 0.000000000000 + 8 2 -0.023384832792 0.000000000000 -0.021795700426 0.000000000000 0.183845846489 0.000000000000 + 8 3 -0.048063633082 0.000000000000 -0.019822510344 0.000000000000 0.184879297413 0.000000000000 + 8 4 -0.047293606452 0.000000000000 -0.018975893340 0.000000000000 0.183387341855 0.000000000000 + 8 5 -0.083880431496 0.000000000000 -0.072068968797 0.000000000000 0.639000418114 0.000000000000 + 8 6 -0.138388948502 0.000000000000 -0.068551133981 0.000000000000 0.638948098738 0.000000000000 + 8 7 -0.008421745120 0.000000000000 -0.007118289863 0.000000000000 0.062890217152 0.000000000000 + 9 1 0.033314450005 0.000000000000 -0.220470894264 0.000000000000 0.431384975534 0.000000000000 + 9 2 -0.033342021034 0.000000000000 -0.220434626324 0.000000000000 -0.431450092341 0.000000000000 + 9 3 0.052662725162 0.000000000000 -0.236113569939 0.000000000000 -0.434076738060 0.000000000000 + 9 4 -0.052678904386 0.000000000000 -0.236010128358 0.000000000000 0.434103837350 0.000000000000 + 9 5 -0.000006199438 0.000000000000 0.139620232300 0.000000000000 -0.000050788840 0.000000000000 + 9 6 0.000033298730 0.000000000000 0.121125883305 0.000000000000 0.000035806572 0.000000000000 + 9 7 -0.000000334006 0.000000000000 0.017451641837 0.000000000000 -0.000007623217 0.000000000000 + 10 1 0.614832803082 0.000000000000 0.002870123623 0.000000000000 0.056207288916 0.000000000000 + 10 2 0.614838663804 0.000000000000 -0.002845670521 0.000000000000 0.056313337008 0.000000000000 + 10 3 -0.119286121574 0.000000000000 0.009135610661 0.000000000000 0.032628379156 0.000000000000 + 10 4 -0.119276452579 0.000000000000 -0.009155271958 0.000000000000 0.032735771203 0.000000000000 + 10 5 -0.412180401402 0.000000000000 -0.000031349886 0.000000000000 -0.091238168319 0.000000000000 + 10 6 0.131477032755 0.000000000000 0.000097185254 0.000000000000 0.031791341443 0.000000000000 + 10 7 -0.036288228821 0.000000000000 0.000002760345 0.000000000000 0.094957104509 0.000000000000 + 11 1 0.498896953023 0.000000000000 0.088080637294 0.000000000000 -0.182666190859 0.000000000000 + 11 2 -0.498952598479 0.000000000000 0.088024419336 0.000000000000 0.182658244492 0.000000000000 + 11 3 -0.325914806583 0.000000000000 -0.056226898793 0.000000000000 -0.204106964752 0.000000000000 + 11 4 0.326035574317 0.000000000000 -0.056141305484 0.000000000000 0.204018226930 0.000000000000 + 11 5 0.000031732484 0.000000000000 -0.247716729171 0.000000000000 0.000006262641 0.000000000000 + 11 6 -0.000049979231 0.000000000000 0.222592687467 0.000000000000 -0.000033751455 0.000000000000 + 11 7 0.000002390178 0.000000000000 0.082966992184 0.000000000000 -0.000004525067 0.000000000000 + 12 1 -0.169984191886 0.000000000000 0.043192140540 0.000000000000 -0.103270284694 0.000000000000 + 12 2 -0.170261932341 0.000000000000 -0.043190701306 0.000000000000 -0.103389386197 0.000000000000 + 12 3 -0.577525270857 0.000000000000 0.028724059257 0.000000000000 0.052301838003 0.000000000000 + 12 4 -0.577379742687 0.000000000000 -0.028659256428 0.000000000000 0.052120216273 0.000000000000 + 12 5 -0.051989926606 0.000000000000 0.000088503379 0.000000000000 -0.001054100082 0.000000000000 + 12 6 0.482811896323 0.000000000000 -0.000061683634 0.000000000000 0.037258344905 0.000000000000 + 12 7 0.001664951365 0.000000000000 0.000033524304 0.000000000000 -0.076338358117 0.000000000000 + 13 1 -0.331507869116 0.000000000000 0.061321109772 0.000000000000 -0.334080508450 0.000000000000 + 13 2 0.331282513311 0.000000000000 0.061202661980 0.000000000000 0.333891110604 0.000000000000 + 13 3 0.161553658827 0.000000000000 -0.091673180143 0.000000000000 -0.324934934093 0.000000000000 + 13 4 -0.161841543033 0.000000000000 -0.091432418967 0.000000000000 0.324707420677 0.000000000000 + 13 5 0.000015115609 0.000000000000 -0.346608076221 0.000000000000 0.000049084585 0.000000000000 + 13 6 0.000128262043 0.000000000000 0.373045408779 0.000000000000 0.000056979546 0.000000000000 + 13 7 0.000003766053 0.000000000000 -0.101889721938 0.000000000000 -0.000047130917 0.000000000000 + 14 1 0.033470873733 0.000000000000 0.230855549740 0.000000000000 -0.463615576702 0.000000000000 + 14 2 0.033465410744 0.000000000000 -0.230841676014 0.000000000000 -0.463542401022 0.000000000000 + 14 3 0.101196465098 0.000000000000 0.152586036080 0.000000000000 0.361894862230 0.000000000000 + 14 4 0.101184373685 0.000000000000 -0.152567758236 0.000000000000 0.361860594998 0.000000000000 + 14 5 0.016240846172 0.000000000000 0.000043849511 0.000000000000 -0.215688001698 0.000000000000 + 14 6 -0.093921256077 0.000000000000 0.000130648840 0.000000000000 0.276321391558 0.000000000000 + 14 7 0.000181880935 0.000000000000 -0.000000596078 0.000000000000 -0.021386779580 0.000000000000 + 15 1 0.058952596497 0.000000000000 0.246270351726 0.000000000000 -0.322958288604 0.000000000000 + 15 2 0.058857038505 0.000000000000 -0.246291685296 0.000000000000 -0.323069870806 0.000000000000 + 15 3 0.012628489816 0.000000000000 -0.292463364763 0.000000000000 -0.440384154504 0.000000000000 + 15 4 0.012677020627 0.000000000000 0.292526739542 0.000000000000 -0.440509003207 0.000000000000 + 15 5 -0.043577803906 0.000000000000 0.000152362346 0.000000000000 0.268953222727 0.000000000000 + 15 6 0.002683129786 0.000000000000 -0.000228561594 0.000000000000 0.171460442109 0.000000000000 + 15 7 -0.003173995079 0.000000000000 0.000039543423 0.000000000000 0.003373960066 0.000000000000 + 16 1 -0.050681896550 0.000000000000 -0.189215150483 0.000000000000 0.085988376429 0.000000000000 + 16 2 -0.050726029227 0.000000000000 0.189249777365 0.000000000000 0.086019304697 0.000000000000 + 16 3 -0.008212575136 0.000000000000 -0.205589848671 0.000000000000 -0.106529270411 0.000000000000 + 16 4 -0.008190214081 0.000000000000 0.205649215977 0.000000000000 -0.106605300185 0.000000000000 + 16 5 0.026563547463 0.000000000000 -0.000006446266 0.000000000000 -0.623238397863 0.000000000000 + 16 6 0.007264752827 0.000000000000 -0.000063812084 0.000000000000 0.639928815250 0.000000000000 + 16 7 0.002651817731 0.000000000000 0.000008222591 0.000000000000 -0.048374897445 0.000000000000 + 17 1 0.041083034810 0.000000000000 -0.583176991499 0.000000000000 -0.348784574879 0.000000000000 + 17 2 0.041036952119 0.000000000000 0.583060218589 0.000000000000 -0.348638455697 0.000000000000 + 17 3 0.001681006550 0.000000000000 0.090004262482 0.000000000000 -0.054992914159 0.000000000000 + 17 4 0.001683465585 0.000000000000 -0.090020786417 0.000000000000 -0.054982866794 0.000000000000 + 17 5 -0.020624881901 0.000000000000 0.000043749481 0.000000000000 0.216547377938 0.000000000000 + 17 6 -0.003838742089 0.000000000000 0.000002466788 0.000000000000 0.011321162425 0.000000000000 + 17 7 -0.002595124868 0.000000000000 0.000021616939 0.000000000000 0.060405121697 0.000000000000 + 18 1 0.003583902189 0.000000000000 -0.084589928071 0.000000000000 -0.047605824777 0.000000000000 + 18 2 0.003587273641 0.000000000000 0.084720608742 0.000000000000 -0.047680008903 0.000000000000 + 18 3 -0.003672254221 0.000000000000 -0.583045238009 0.000000000000 0.348142900945 0.000000000000 + 18 4 -0.003664874358 0.000000000000 0.582823566238 0.000000000000 0.347859092183 0.000000000000 + 18 5 -0.001720282854 0.000000000000 -0.000034872862 0.000000000000 0.061022855713 0.000000000000 + 18 6 0.001694845183 0.000000000000 0.000071798239 0.000000000000 -0.235510729538 0.000000000000 + 18 7 0.000924407431 0.000000000000 0.000000062826 0.000000000000 0.006660573467 0.000000000000 + 19 1 -0.032986775751 0.000000000000 0.387932546023 0.000000000000 0.231004679859 0.000000000000 + 19 2 0.033007756491 0.000000000000 0.387966692818 0.000000000000 -0.231078095571 0.000000000000 + 19 3 -0.003515104722 0.000000000000 -0.417154671047 0.000000000000 0.253644283501 0.000000000000 + 19 4 0.003517650912 0.000000000000 -0.417418721672 0.000000000000 -0.253913521444 0.000000000000 + 19 5 -0.000002150319 0.000000000000 -0.220700694193 0.000000000000 0.000007626778 0.000000000000 + 19 6 0.000000256739 0.000000000000 0.244227755885 0.000000000000 0.000071985313 0.000000000000 + 19 7 0.000000203551 0.000000000000 -0.067879755377 0.000000000000 -0.000011783172 0.000000000000 + 20 1 0.037118396179 0.000000000000 -0.414862630036 0.000000000000 -0.253381370340 0.000000000000 + 20 2 -0.037146779695 0.000000000000 -0.414974660241 0.000000000000 0.253501711299 0.000000000000 + 20 3 -0.002256159577 0.000000000000 -0.385870257068 0.000000000000 0.241421981219 0.000000000000 + 20 4 0.002260169183 0.000000000000 -0.385915201064 0.000000000000 -0.241537083909 0.000000000000 + 20 5 0.000002170764 0.000000000000 0.235445180783 0.000000000000 -0.000025221260 0.000000000000 + 20 6 0.000000363059 0.000000000000 0.220965722111 0.000000000000 0.000023086215 0.000000000000 + 20 7 -0.000000049121 0.000000000000 0.075766203349 0.000000000000 -0.000005182419 0.000000000000 + 21 1 0.002853574523 0.000000000000 -0.000705736843 0.000000000000 0.000262243633 0.000000000000 + 21 2 0.002853560399 0.000000000000 0.000706225736 0.000000000000 0.000262298585 0.000000000000 + 21 3 -0.001817198463 0.000000000000 -0.000765075092 0.000000000000 0.000164265300 0.000000000000 + 21 4 -0.001817209929 0.000000000000 0.000765067886 0.000000000000 0.000164251000 0.000000000000 + 21 5 0.090636849230 0.000000000000 0.000000165670 0.000000000000 0.002961496215 0.000000000000 + 21 6 0.005792056202 0.000000000000 -0.000000022842 0.000000000000 0.000099984393 0.000000000000 + 21 7 -0.995273587674 0.000000000000 -0.000000179573 0.000000000000 -0.033880225636 0.000000000000 diff --git a/pymuonsuite/test/test_dftb.py b/pymuonsuite/test/test_dftb.py index fb4af8d..3e4f0ce 100644 --- a/pymuonsuite/test/test_dftb.py +++ b/pymuonsuite/test/test_dftb.py @@ -1,8 +1,7 @@ """Tests for ReadWriteDFTB methods""" - -import unittest - +from io import StringIO import os +import unittest import shutil from ase import Atoms, io @@ -231,6 +230,34 @@ def test_write_uses_correct_particle_mass_and_element(self): finally: shutil.rmtree(output_folder) + @unittest.mock.patch('sys.stdout', new_callable=StringIO) + def test_set_optional(self, mock_stdout): + # Check info and errors of set_optional + dftb_args = DFTBArgs("3ob-3-1") + dftb_args.set_optional() + self.assertIn("Optional files available:", mock_stdout.getvalue()) + + with self.assertRaises(KeyError) as e: + dftb_args.set_optional("bad_key", True) + self.assertEqual("'Optional file bad_key not available'", str(e.exception)) + + self.assertEqual("3ob-3-1", dftb_args.name) + self.assertIn("pymuonsuite/data/dftb_pars/3ob-3-1", dftb_args.path) + + @unittest.mock.patch('sys.stdout', new_callable=StringIO) + def test_static(self, mock_stdout): + # Check static functions + DFTBArgs.list() + printed_list = mock_stdout.getvalue() + self.assertIn("3ob-3-1", printed_list) + self.assertIn("pbc-0-3", printed_list) + + DFTBArgs.print_refmsg() + self.assertIn( + "This calculation makes use of the DFTB parametrisations found at", + mock_stdout.getvalue() + ) + if __name__ == "__main__":