26
26
from pymatgen .symmetry .analyzer import SpacegroupAnalyzer
27
27
from pymatgen .analysis .ferroelectricity .polarization import Polarization , get_total_ionic_dipole , \
28
28
EnergyTrend
29
- from pymatgen .analysis .magnetism import CollinearMagneticStructureAnalyzer , Ordering
29
+ from pymatgen .analysis .magnetism import CollinearMagneticStructureAnalyzer , Ordering , magnetic_deformation
30
30
from pymatgen .command_line .bader_caller import bader_analysis_from_path
31
31
32
32
from atomate .common .firetasks .glue_tasks import get_calc_loc
@@ -950,23 +950,6 @@ class MagneticDeformationToDB(FiretaskBase):
950
950
required_params = ["db_file" , "wf_uuid" ]
951
951
optional_params = ["to_db" ]
952
952
953
- @staticmethod
954
- def magnetic_deformation (nm_struct , m_struct ):
955
- """ Calculates 'magnetic deformation proxy',
956
- a measure of deformation (norm of finite strain)
957
- between 'non-magnetic' (non-spin-polarized) and
958
- ferromagnetic structures.
959
- Adapted from Bocarsly et al. 2017,
960
- doi: 10.1021/acs.chemmater.6b04729"""
961
- lmn = nm_struct .lattice .matrix .T
962
- lm = m_struct .lattice .matrix .T
963
- lmn_i = np .linalg .inv (lmn )
964
- p = np .dot (lmn_i , lm )
965
- eta = 0.5 * (np .dot (p .T , p ) - np .identity (3 ))
966
- w , _ = np .linalg .eig (eta )
967
- deformation = 100 * (1. / 3. ) * np .sqrt (w [0 ] ** 2 + w [1 ] ** 2 + w [2 ] ** 2 )
968
- return deformation
969
-
970
953
def run_task (self , fw_spec ):
971
954
972
955
uuid = self ["wf_uuid" ]
@@ -995,7 +978,7 @@ def run_task(self, fw_spec):
995
978
success = False if msa .ordering == Ordering .NM else True
996
979
997
980
# calculate magnetic deformation
998
- magnetic_deformation = self . magnetic_deformation (nm_structure , m_structure )
981
+ mag_def = magnetic_deformation (nm_structure , m_structure ). deformation
999
982
1000
983
# get run stats (mostly used for benchmarking)
1001
984
# using same approach as VaspDrone
@@ -1012,7 +995,7 @@ def run_task(self, fw_spec):
1012
995
summary = {
1013
996
"formula" : nm_structure .composition .reduced_formula ,
1014
997
"success" : success ,
1015
- "magnetic_deformation" : magnetic_deformation ,
998
+ "magnetic_deformation" : mag_def ,
1016
999
"non_magnetic_task_id" : d_nm ["task_id" ],
1017
1000
"non_magnetic_structure" : nm_structure .as_dict (),
1018
1001
"magnetic_task_id" : d_m ["task_id" ],
@@ -1021,7 +1004,6 @@ def run_task(self, fw_spec):
1021
1004
"created_at" : datetime .utcnow ()
1022
1005
}
1023
1006
1024
- # TODO: find a better way for passing tags of the entire workflow to db - albalu
1025
1007
if fw_spec .get ("tags" , None ):
1026
1008
summary ["tags" ] = fw_spec ["tags" ]
1027
1009
0 commit comments