diff --git a/calphy/input.py b/calphy/input.py index bfef0aa..a50952c 100644 --- a/calphy/input.py +++ b/calphy/input.py @@ -292,6 +292,7 @@ def _validate_pair_style(self) -> 'Input': def _validate_time(self) -> 'Input': if np.isscalar(self.n_switching_steps): self._n_sweep_steps = self.n_switching_steps + self._n_switching_steps = self.n_switching_steps else: self._n_sweep_steps = self.n_switching_steps[1] self._n_switching_steps = self.n_switching_steps[0] diff --git a/calphy/routines.py b/calphy/routines.py index 2229c4a..b747ab2 100644 --- a/calphy/routines.py +++ b/calphy/routines.py @@ -513,8 +513,12 @@ def routine_composition_scaling(job): flambda_arr, w_arr, q_arr, qerr_arr = job.thermodynamic_integration() + job.logger.info('performing mass rescaling') + job.logger.info(f'Ref. mass is {ref_mass}') + job.logger.info(f'Target masses are {target_masses}') + #read the file - mcorrarr, mcorsum = job.mass_integration(flambda_arr, ref_mass, target_masses, target_counts) + mcorrarr, mcorsum = job.mass_integration(flambda_arr, target_masses, ref_mass, target_counts) netfe = w_arr - mcorrarr job.fe = job.fe - mcorsum diff --git a/examples/example_10/analysis.ipynb b/examples/example_10/analysis.ipynb index 2fbbea7..6b9f791 100644 --- a/examples/example_10/analysis.ipynb +++ b/examples/example_10/analysis.ipynb @@ -36,7 +36,7 @@ "id": "0072d247-40eb-467b-9b26-4efe2be4e66b", "metadata": {}, "source": [ - "In the file [`ZrCu.dump`](ZrCu.dump), CuZr in B2 structure is provided. The file [`ZrCu_substitution.dump`](ZrCu_substitution.dump) contains the same structure, but a single atom of Zr is replaced with Cu. If the free energy of both structures are calculated, the difference between the two provides the free energy change when a substitutional Cu atom is introduced.\n", + "In the file [`ZrCu.data`](ZrCu.data), CuZr in B2 structure is provided. The file [`ZrCu_substitution.data`](ZrCu_substitution.data) contains the same structure, but a single atom of Zr is replaced with Cu. If the free energy of both structures are calculated, the difference between the two provides the free energy change when a substitutional Cu atom is introduced.\n", "\n", "The input files for the direct calculations are [`input-direct-1.yaml`](input-direct-1.yaml) and [`input-direct-2.yaml`](input-direct-2.yaml). The calculations can be run by `calphy -i inputfilename`. Once the calculations are over, we can read in the results and analyse them." ] @@ -69,8 +69,8 @@ "metadata": {}, "outputs": [], "source": [ - "fe_ref_direct = read_report(\"fe-ZrCu.dump-800-0\")\n", - "fe_sub_direct = read_report(\"fe-ZrCu_substitution.dump-800-0\")" + "fe_ref_direct = read_report(\"fe-zrcu.data-solid-800-0\")\n", + "fe_sub_direct = read_report(\"fe-zrcu_substitution.data-solid-800-0\")" ] }, { @@ -83,7 +83,7 @@ }, { "cell_type": "code", - "execution_count": 4, + "execution_count": 3, "id": "9255fe4d-a45d-46cb-b462-92dfe8586974", "metadata": {}, "outputs": [], @@ -102,17 +102,17 @@ }, { "cell_type": "code", - "execution_count": 5, + "execution_count": 4, "id": "476a6026-b44c-4ce8-b055-97bb07a2c465", "metadata": {}, "outputs": [ { "data": { "text/plain": [ - "0.0036244140356958+/-0.0005247047613173691" + "0.003912274087720213+/-9.587447227178194e-05" ] }, - "execution_count": 5, + "execution_count": 4, "metadata": {}, "output_type": "execute_result" } @@ -131,9 +131,6 @@ "\n", "```\n", "composition_scaling:\n", - " input_chemical_composition:\n", - " - Cu: 512\n", - " - Zr: 512\n", " output_chemical_composition:\n", " - Cu: 513\n", " - Zr: 511\n", @@ -152,27 +149,27 @@ }, { "cell_type": "code", - "execution_count": 8, + "execution_count": 5, "id": "6633d120-1d07-4ae6-91bd-27c2ea16804a", "metadata": {}, "outputs": [], "source": [ - "fe_sub_comp = read_report(\"sub-composition_scaling-ZrCu.dump-800-0\")" + "fe_sub_comp = read_report(\"sub-composition_scaling-zrcu.data-solid-800-0\")" ] }, { "cell_type": "code", - "execution_count": 9, + "execution_count": 6, "id": "a138085b-a32f-408a-a0e6-c71006fd3a30", "metadata": {}, "outputs": [ { "data": { "text/plain": [ - "0.0037993834787761636+/-1.1368085265609911e-05" + "0.0037949501379965674+/-6.960984850256015e-06" ] }, - "execution_count": 9, + "execution_count": 6, "metadata": {}, "output_type": "execute_result" } @@ -182,6 +179,27 @@ "fe_sub_comp" ] }, + { + "cell_type": "code", + "execution_count": 7, + "id": "2b51f5a7-d635-4cdc-83ef-a926ecfd0568", + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "0.0038679727402182425" + ] + }, + "execution_count": 7, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "0.003831461439107405+3.6511301110837446e-05" + ] + }, { "cell_type": "markdown", "id": "91e5c163-9f5e-4644-8994-e2e814cc35aa", @@ -356,7 +374,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.10.6" + "version": "3.11.5" } }, "nbformat": 4, diff --git a/examples/example_10/input-composition.yaml b/examples/example_10/input-composition.yaml index d084582..db64a9f 100644 --- a/examples/example_10/input-composition.yaml +++ b/examples/example_10/input-composition.yaml @@ -1,15 +1,13 @@ calculations: - composition_scaling: - input_chemical_composition: - - Cu: 512 - - Zr: 512 output_chemical_composition: - - Cu: 532 - - Zr: 492 + Cu: 532 + Zr: 492 element: - Zr - Cu - lattice: ZrCu.dump + lattice: ZrCu.data + equilibration_control: berendsen lattice_constant: 0.0 mass: - 91.224 diff --git a/examples/example_10/input-direct-1.yaml b/examples/example_10/input-direct-1.yaml index 9f9ed8b..d67335e 100644 --- a/examples/example_10/input-direct-1.yaml +++ b/examples/example_10/input-direct-1.yaml @@ -2,7 +2,8 @@ calculations: - element: - Zr - Cu - lattice: ZrCu.dump + lattice: ZrCu.data + equilibration_control: berendsen lattice_constant: 0.0 mass: - 91.224 diff --git a/examples/example_10/input-direct-2.yaml b/examples/example_10/input-direct-2.yaml index 64c46c0..6b7c52f 100644 --- a/examples/example_10/input-direct-2.yaml +++ b/examples/example_10/input-direct-2.yaml @@ -2,7 +2,8 @@ calculations: - element: - Zr - Cu - lattice: ZrCu_substitution.dump + lattice: ZrCu_substitution.data + equilibration_control: berendsen lattice_constant: 0.0 mass: - 91.224 diff --git a/examples/example_10/input-substitution.yaml b/examples/example_10/input-substitution.yaml index cc47d1f..d6f5aa4 100644 --- a/examples/example_10/input-substitution.yaml +++ b/examples/example_10/input-substitution.yaml @@ -1,23 +1,21 @@ calculations: - composition_scaling: - input_chemical_composition: - - Cu: 512 - - Zr: 512 output_chemical_composition: - - Cu: 513 - - Zr: 511 + Cu: 513 + Zr: 511 element: - Zr - Cu folder_prefix: sub - lattice: ZrCu.dump + lattice: ZrCu.data + equilibration_control: berendsen lattice_constant: 0.0 mass: - 91.224 - 63.546 mode: composition_scaling n_equilibration_steps: 5000 - n_iterations: 3 + n_iterations: 1 n_switching_steps: 5000 pair_coeff: '* * ../potentials/ZrCu.eam.fs Zr Cu' pair_style: eam/fs