Analyzer
StateAnalyzer
Provides basic functionality for analyzing a SimulationState object.
Source code in pylattica/core/analyzer.py
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 |
|
__init__(structure=None)
Ininitializes the StateAnalyzer with the structure provided. The structure is used to filter sites down by site class, if desired.
Parameters
PeriodicStructure
The structure to use as the source for site class information.
Source code in pylattica/core/analyzer.py
11 12 13 14 15 16 17 18 19 20 |
|
get_site_count(state, site_class=None, state_criteria=None)
Counts the sites in the state matching the specified criteria. See documentation for get_sites for more details.
Parameters
SimulationState
The simulation state to search
str, optional
The class of sites to consider, by default None
List[Callable[[Dict], bool]], optional
The criteria by which a site should be assessed for filtering, by default None
Returns
int The number of sites matching the specified criteria
Source code in pylattica/core/analyzer.py
106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 |
|
get_site_count_where_equal(state, search_pairs, site_class=None)
Counts the sites which have state values equal to those specified by search_pairs. See get_sites_equal for a specification of the search_pairs parameter.
Parameters
SimulationState
The state to search for sites.
Dict
The state values that must be matched
str, optional
The class of sites to consider, by default None
Returns
int The number of sites matching the criteria
Source code in pylattica/core/analyzer.py
133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 |
|
get_sites(state, site_class=None, state_criteria=None)
Retrieves a list of site states matching the specified criteria. Criteria are expressed as functions or lambdas that take a site state dictionary and return a boolean indicating whether or not the site satisfies the criteria.
Parameters
SimulationState
The simulation state to analyze
str, optional
If desired, a site class to filter down on, by default None
List[Callable[[Dict], bool]], optional
A list of functions which must return true for a site to be included in the returned sites, by default None
Returns
List[Dict] A list of site IDs satisfying the specified criteria and belonging to the specified site class.
Source code in pylattica/core/analyzer.py
22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 |
|
get_sites_where_equal(state, search_pairs, site_class=None)
Returns sites whose state dictionaries contain values matching the search_pairs parameters passed here. For instance, if you wanted every site with had a state value for property "B" equal to 2, search_pairs would be:
{ "B": 2 }
Also supports filtering sites based on site class.
Parameters
SimulationState
The state to filter sites from.
Dict
The dictionary containing key value pairs that must match the site state.
str, optional
The class of sites to consider, by default None
Returns
List[int] A list of site IDs corresponding to the matching sites
Source code in pylattica/core/analyzer.py
70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 |
|