From 36e4339d2002263b40396c63b36a53c30af9f618 Mon Sep 17 00:00:00 2001 From: Sam Holt Date: Mon, 8 Aug 2022 10:41:27 +0100 Subject: [PATCH 1/4] Test new exchange --- oommfc/scripts/energy.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/oommfc/scripts/energy.py b/oommfc/scripts/energy.py index d25ebd28..63b241dd 100644 --- a/oommfc/scripts/energy.py +++ b/oommfc/scripts/energy.py @@ -15,10 +15,15 @@ def energy_script(system): def exchange_script(term, system): + if isinstance(term.A, numbers.Real): mif = "# UniformExchange\n" - mif += f"Specify Oxs_UniformExchange:{term.name} {{\n" - mif += f" A {term.A}\n" + mif += f"Specify Oxs_isoexch:{term.name} {{\n" + mif += f" default_A {term.A}\n" + mif += " atlas :main_atlas\n" + mif += " A {\n" + mif += f" main main {term.A}\n" + mif += " }\n" mif += "}\n\n" elif isinstance(term.A, dict): From 46032d5842a3758705393b3baa7a5042f1ebf8f4 Mon Sep 17 00:00:00 2001 From: Sam Holt Date: Tue, 9 Aug 2022 18:26:56 +0100 Subject: [PATCH 2/4] add nn --- oommfc/scripts/energy.py | 46 +++++++++++++++------------------------- 1 file changed, 17 insertions(+), 29 deletions(-) diff --git a/oommfc/scripts/energy.py b/oommfc/scripts/energy.py index 63b241dd..402ba12d 100644 --- a/oommfc/scripts/energy.py +++ b/oommfc/scripts/energy.py @@ -15,9 +15,20 @@ def energy_script(system): def exchange_script(term, system): + if not isinstance(term.A, numbers.Real): + raise RuntimeError('Sam needs to actually sort this.') - if isinstance(term.A, numbers.Real): - mif = "# UniformExchange\n" + if not hasattr(term, 'nn'): + term.nn = None + + if term.nn == '12nn': + mif = "# UniformExchange 12nn\n" + mif += f"Specify Oxs_UniformExchange:{term.name} {{\n" + mif += f" A {term.A}\n" + mif += f" kernel 12ngbrmirror\n" + mif += "}\n\n" + elif term.nn == 'iso': + mif = "# UniformExchange iso\n" mif += f"Specify Oxs_isoexch:{term.name} {{\n" mif += f" default_A {term.A}\n" mif += " atlas :main_atlas\n" @@ -25,33 +36,10 @@ def exchange_script(term, system): mif += f" main main {term.A}\n" mif += " }\n" mif += "}\n\n" - - elif isinstance(term.A, dict): - if "default" in term.A.keys(): - default_value = term.A["default"] - else: - default_value = 0 - mif = "# Exchange6Ngbr\n" - mif += f"Specify Oxs_Exchange6Ngbr:{term.name} {{\n" - mif += f" default_A {default_value}\n" - mif += " atlas :main_atlas\n" - mif += " A {\n" - for key, value in term.A.items(): - if key != "default": - if ":" in key: - region1, region2 = key.split(":") - else: - region1, region2 = key, key - mif += f" {region1} {region2} {value}\n" - mif += " }\n" - mif += "}\n\n" - - elif isinstance(term.A, df.Field): - Amif, Aname = oc.scripts.setup_scalar_parameter(term.A, f"{term.name}_A") - mif = Amif - mif += "# ExchangePtwise\n" - mif += f"Specify Oxs_ExchangePtwise:{term.name} {{\n" - mif += f" A {Aname}\n" + else: + mif = "# UniformExchange 6nn\n" + mif += f"Specify Oxs_UniformExchange:{term.name} {{\n" + mif += f" A {term.A}\n" mif += "}\n\n" return mif From 9e2aa0e7f4b9c4db5aeeefee2c55ececbbeba03b Mon Sep 17 00:00:00 2001 From: Sam Holt Date: Wed, 17 Aug 2022 16:22:46 +0100 Subject: [PATCH 3/4] 12nn DMI T --- oommfc/scripts/energy.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/oommfc/scripts/energy.py b/oommfc/scripts/energy.py index 402ba12d..58599d83 100644 --- a/oommfc/scripts/energy.py +++ b/oommfc/scripts/energy.py @@ -267,6 +267,8 @@ def dmi_script(term, system): warnings.warn(msg, FutureWarning) tcc = "Cnv_z" oxs = f"Oxs_DMI_{tcc}" + elif (tcc := term.crystalclass) in ["T_12"]: + oxs = "Oxs_DMI_T_12" mif = f"# DMI of crystallographic class {term.crystalclass}\n" mif += f"Specify {oxs}:{term.name} {{\n" From a5b7ff532262f62a9e51750c0af295d8e52de486 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Thu, 19 Jan 2023 10:48:16 +0000 Subject: [PATCH 4/4] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- oommfc/scripts/energy.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/oommfc/scripts/energy.py b/oommfc/scripts/energy.py index 58599d83..04b4397d 100644 --- a/oommfc/scripts/energy.py +++ b/oommfc/scripts/energy.py @@ -16,18 +16,18 @@ def energy_script(system): def exchange_script(term, system): if not isinstance(term.A, numbers.Real): - raise RuntimeError('Sam needs to actually sort this.') + raise RuntimeError("Sam needs to actually sort this.") - if not hasattr(term, 'nn'): + if not hasattr(term, "nn"): term.nn = None - if term.nn == '12nn': + if term.nn == "12nn": mif = "# UniformExchange 12nn\n" mif += f"Specify Oxs_UniformExchange:{term.name} {{\n" mif += f" A {term.A}\n" mif += f" kernel 12ngbrmirror\n" mif += "}\n\n" - elif term.nn == 'iso': + elif term.nn == "iso": mif = "# UniformExchange iso\n" mif += f"Specify Oxs_isoexch:{term.name} {{\n" mif += f" default_A {term.A}\n"