diff --git a/docs/source/notebooks/Masking.ipynb b/docs/source/notebooks/Masking.ipynb index ac9b618..10f1948 100644 --- a/docs/source/notebooks/Masking.ipynb +++ b/docs/source/notebooks/Masking.ipynb @@ -68,7 +68,7 @@ "from ramannoodle.polarizability.art import ARTModel\n", "\n", "data_dir = \"../../../test/data/TiO2\"\n", - "# phonon_OUTCAR contains phonons (duh) as well as the equilibrium TiO2 structure.\n", + "# phonon_OUTCAR contains phonons (duh) as well as the reference TiO2 structure.\n", "phonon_outcar = f\"{data_dir}/phonons_OUTCAR\"\n", "\n", "# Read the phonons\n", @@ -76,11 +76,11 @@ "# Read the reference structure. This might take a few moments...\n", "ref_structure = vasp_io.outcar.read_ref_structure(f\"{data_dir}/ref_eps_OUTCAR\")\n", "\n", - "# We'll need the polarizability of the equilibrium structure. \n", - "_, equilibrium_polarizability = vasp_io.outcar.read_positions_and_polarizability(\n", + "# We'll need the polarizability of the reference structure. \n", + "_, ref_polarizability = vasp_io.outcar.read_positions_and_polarizability(\n", " f\"{data_dir}/ref_eps_OUTCAR\"\n", ")\n", - "model = ARTModel(ref_structure, equilibrium_polarizability)" + "model = ARTModel(ref_structure, ref_polarizability)" ] }, { diff --git a/docs/source/notebooks/basics.ipynb b/docs/source/notebooks/basics.ipynb index 52e6cfc..e43ea02 100644 --- a/docs/source/notebooks/basics.ipynb +++ b/docs/source/notebooks/basics.ipynb @@ -84,14 +84,14 @@ "source": [ "from ramannoodle.polarizability.interpolation import InterpolationModel\n", "\n", - "# Read a reference (equilibrium) structure.\n", + "# Read a reference (minimum) structure.\n", "ref_structure = vasp_io.outcar.read_ref_structure(f\"{data_dir}/ref_eps_OUTCAR\")\n", "\n", - "# We'll need the polarizability of the equilibrium structure. \n", - "_, equilibrium_polarizability = vasp_io.outcar.read_positions_and_polarizability(\n", + "# We'll need the polarizability of the minimum structure. \n", + "_, ref_polarizability = vasp_io.outcar.read_positions_and_polarizability(\n", " f\"{data_dir}/ref_eps_OUTCAR\"\n", ")\n", - "model = InterpolationModel(ref_structure, equilibrium_polarizability)\n", + "model = InterpolationModel(ref_structure, ref_polarizability)\n", "\n", "# Using __repr__, we can check out model.\n", "model" diff --git a/docs/source/notebooks/full-workflow.ipynb b/docs/source/notebooks/full-workflow.ipynb index c150ff0..df81379 100644 --- a/docs/source/notebooks/full-workflow.ipynb +++ b/docs/source/notebooks/full-workflow.ipynb @@ -79,7 +79,7 @@ "id": "c6831e95", "metadata": {}, "source": [ - "Now that we have the reference structure, we can initialize the polarizability model. We do this the usual way, but we specify `is_dummy_model = True`. Because this is a dummy model, the value for `equilibrium_polarizability` is completely ignored. We simply set it to ``np.zeros((3,3))``. " + "Now that we have the reference structure, we can initialize the polarizability model. We do this the usual way, but we specify `is_dummy_model = True`. Because this is a dummy model, the value for `ref_polarizability` is completely ignored. We simply set it to ``np.zeros((3,3))``. " ] }, { @@ -92,7 +92,7 @@ "from ramannoodle.polarizability.art import ARTModel\n", "\n", "model = ARTModel(ref_structure=ref_structure, \n", - " equilibrium_polarizability = np.zeros((3,3)), \n", + " ref_polarizability = np.zeros((3,3)), \n", " is_dummy_model=True) \n", "model" ] @@ -251,11 +251,11 @@ "metadata": {}, "outputs": [], "source": [ - "_, equilibrium_polarizability = vasp_io.outcar.read_positions_and_polarizability(\n", + "_, ref_polarizability = vasp_io.outcar.read_positions_and_polarizability(\n", " f\"{data_dir}/ref_eps_OUTCAR\"\n", ")\n", "model = ARTModel(ref_structure=ref_structure, \n", - " equilibrium_polarizability = equilibrium_polarizability) \n", + " ref_polarizability = ref_polarizability) \n", "\n", "model.add_art_from_files(\n", " [f\"{data_dir}/Ti5_0.1x_eps_OUTCAR\"], file_format = 'outcar'\n", diff --git a/docs/source/notebooks/molecular-dynamics.ipynb b/docs/source/notebooks/molecular-dynamics.ipynb index 5213339..490fade 100644 --- a/docs/source/notebooks/molecular-dynamics.ipynb +++ b/docs/source/notebooks/molecular-dynamics.ipynb @@ -81,11 +81,11 @@ "data_dir = \"../../../test/data/TiO2\"\n", "ref_structure = vasp_io.poscar.read_ref_structure(f\"{data_dir}/POSCAR\")\n", "\n", - "# We'll need the polarizability of the equilibrium structure. \n", - "_, equilibrium_polarizability = vasp_io.outcar.read_positions_and_polarizability(\n", + "# We'll need the polarizability of the reference structure. \n", + "_, ref_polarizability = vasp_io.outcar.read_positions_and_polarizability(\n", " f\"{data_dir}/ref_eps_OUTCAR\"\n", ")\n", - "model = InterpolationModel(ref_structure, equilibrium_polarizability)\n", + "model = InterpolationModel(ref_structure, ref_polarizability)\n", "\n", "# OUTCARS are polarizability calculation where atom 5 (Ti) \n", "# was displaced +0.1 and +0.2 angstrom in the x direction\n", diff --git a/ramannoodle/polarizability/art.py b/ramannoodle/polarizability/art.py index cb75184..c03a462 100644 --- a/ramannoodle/polarizability/art.py +++ b/ramannoodle/polarizability/art.py @@ -58,7 +58,7 @@ class ARTModel(InterpolationModel): :meth:`add_art_from_files`. .. warning:: - Due to the way ARTModel is implemented, the predicted tensor of the equilibrium + Due to the way ARTModel is implemented, the predicted tensor of the reference structure may be offset slightly. This is a fixed offset and therefore has no influence on Raman spectra calculations. @@ -66,7 +66,7 @@ class ARTModel(InterpolationModel): ---------- ref_structure | Reference structure on which to base the model. - equilibrium_polarizability + ref_polarizability | 2D array with shape (3,3) giving polarizability of the reference structure. is_dummy_model @@ -78,7 +78,7 @@ def add_dof( # pylint: disable=too-many-arguments amplitudes: NDArray[np.float64], polarizabilities: NDArray[np.float64], interpolation_order: int, - include_equilibrium_polarizability: bool = True, + include_ref_polarizability: bool = True, ) -> None: """Disable add_dof. @@ -171,7 +171,7 @@ def add_art( amplitudes, polarizabilities, 1, - include_equilibrium_polarizability=False, + include_ref_polarizability=False, ) def add_art_from_files( diff --git a/ramannoodle/polarizability/interpolation.py b/ramannoodle/polarizability/interpolation.py index b255d7d..7fee0a1 100644 --- a/ramannoodle/polarizability/interpolation.py +++ b/ramannoodle/polarizability/interpolation.py @@ -82,7 +82,7 @@ class InterpolationModel(PolarizabilityModel): ---------- ref_structure | Reference structure on which to base the model. - equilibrium_polarizability + ref_polarizability | 2D array with shape (3,3) with polarizability of the reference structure. is_dummy_model @@ -91,17 +91,15 @@ class InterpolationModel(PolarizabilityModel): def __init__( self, ref_structure: ReferenceStructure, - equilibrium_polarizability: NDArray[np.float64], + ref_polarizability: NDArray[np.float64], is_dummy_model: bool = False, ) -> None: if is_dummy_model: - equilibrium_polarizability = np.zeros((3, 3)) - verify_ndarray_shape( - "equilibrium_polarizability", equilibrium_polarizability, (3, 3) - ) + ref_polarizability = np.zeros((3, 3)) + verify_ndarray_shape("ref_polarizability", ref_polarizability, (3, 3)) self._ref_structure = ref_structure - self._equilibrium_polarizability = equilibrium_polarizability + self._ref_polarizability = ref_polarizability self._is_dummy_model = is_dummy_model self._cart_basis_vectors: list[NDArray[np.float64]] = [] self._interpolations: list[BSpline] = [] @@ -113,15 +111,15 @@ def ref_structure(self) -> ReferenceStructure: return copy.deepcopy(self._ref_structure) @property - def equilibrium_polarizability(self) -> NDArray[np.float64]: - """Get (a copy of) equilibrium polarizability. + def ref_polarizability(self) -> NDArray[np.float64]: + """Get (a copy of) reference polarizability. Returns ------- : 2D array with shape (3,3). """ - return self._equilibrium_polarizability.copy() + return self._ref_polarizability.copy() @property def is_dummy_model(self) -> bool: @@ -244,14 +242,14 @@ def calc_polarizabilities( ) from err raise err - return delta_polarizabilities + self._equilibrium_polarizability + return delta_polarizabilities + self._ref_polarizability def _get_dof( # pylint: disable=too-many-locals self, parent_displacement: NDArray[np.float64], amplitudes: NDArray[np.float64], polarizabilities: NDArray[np.float64], - include_equilibrium_polarizability: bool, + include_ref_polarizability: bool, ) -> tuple[ list[NDArray[np.float64]], list[list[float]], list[list[NDArray[np.float64]]] ]: @@ -300,7 +298,7 @@ def _get_dof( # pylint: disable=too-many-locals interpolation_x: list[float] = [] interpolation_y: list[NDArray[np.float64]] = [] - if include_equilibrium_polarizability: + if include_ref_polarizability: interpolation_x.append(0.0) interpolation_y.append(np.zeros((3, 3))) @@ -315,9 +313,7 @@ def _get_dof( # pylint: disable=too-many-locals for amplitude, polarizability in zip(amplitudes, polarizabilities): interpolation_x.append(multiplier * amplitude) rotation = transformation[0] - delta_polarizability = ( - polarizability - self._equilibrium_polarizability - ) + delta_polarizability = polarizability - self._ref_polarizability interpolation_y.append( (np.linalg.inv(rotation) @ delta_polarizability @ rotation) @@ -405,7 +401,7 @@ def add_dof( # pylint: disable=too-many-arguments amplitudes: NDArray[np.float64], polarizabilities: NDArray[np.float64], interpolation_order: int, - include_equilibrium_polarizability: bool = True, + include_ref_polarizability: bool = True, ) -> None: """Add a degree of freedom (DOF). @@ -434,8 +430,8 @@ def add_dof( # pylint: disable=too-many-arguments interpolation_order | Must be less than the number of total number of amplitudes after | symmetry considerations. - include_equilibrium_polarizability - | Whether to include the equilibrium polarizability at 0.0 amplitude in the + include_ref_polarizability + | Whether to include the references polarizability at 0.0 amplitude in the | interpolation. Raises @@ -462,7 +458,7 @@ def add_dof( # pylint: disable=too-many-arguments parent_displacement, amplitudes, polarizabilities, - include_equilibrium_polarizability, + include_ref_polarizability, ) # Then append the DOF - checks amplitudes (in form of interpolation_xs)