-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #24 from yuzie007/fetch-transformations-k
Fetch transformations to k-subgroups etc.
- Loading branch information
Showing
12 changed files
with
704 additions
and
142 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
"""Fetch Wycksplit from the Bilbao Crystallographic Server.""" | ||
|
||
import time | ||
import urllib | ||
|
||
import pandas as pd | ||
|
||
|
||
def fetch_transformation(spg_sup: int, spg_sub: int, index: int) -> None: | ||
"""Get transformation.""" | ||
url = "https://www.cryst.ehu.es/cgi-bin/cryst/programs/nph-tranmax?" | ||
query = {"super": spg_sup, "sub": spg_sub, "index": index} | ||
url += urllib.parse.urlencode(query) | ||
transformations = pd.read_html(url)[1] | ||
s = transformations.loc[0]["Transformation Matrix"] | ||
ts = s.split() | ||
d = {} | ||
d["supergroup"] = spg_sup | ||
d["subgroup"] = spg_sub | ||
d["Pxx"] = ts[0] | ||
d["Pxy"] = ts[1] | ||
d["Pxz"] = ts[2] | ||
d["Pyx"] = ts[4] | ||
d["Pyy"] = ts[5] | ||
d["Pyz"] = ts[6] | ||
d["Pzx"] = ts[8] | ||
d["Pzy"] = ts[9] | ||
d["Pzz"] = ts[10] | ||
d["px"] = ts[3] | ||
d["py"] = ts[7] | ||
d["pz"] = ts[11] | ||
return d | ||
|
||
|
||
def run() -> None: | ||
"""Run.""" | ||
ds = [] | ||
df = pd.read_csv("loss_of_centrings.csv") | ||
for supergroup, groups in df.groupby("supergroup"): | ||
print(f"{supergroup:03d}") | ||
url = "https://www.cryst.ehu.es/cgi-bin/cryst/programs/nph-lxi?" | ||
query = {"gnum": supergroup} | ||
url += urllib.parse.urlencode(query) | ||
subgroups = pd.read_html(url)[1] | ||
isin = groups["subgroup"].to_numpy() | ||
subgroups = subgroups[subgroups["IT number"].isin(isin)] | ||
for d in subgroups.to_dict(orient="records"): | ||
subgroup = d["IT number"] | ||
index = d["Index"] | ||
print(f"-> {subgroup:03d}") | ||
ds.append(fetch_transformation(supergroup, subgroup, index)) | ||
time.sleep(5) | ||
pd.DataFrame(ds).to_csv("transformations_k.csv", index=False) | ||
|
||
|
||
if __name__ == "__main__": | ||
run() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,212 @@ | ||
supergroup,subgroup | ||
005,003 | ||
005,004 | ||
008,006 | ||
008,007 | ||
009,007 | ||
012,010 | ||
012,011 | ||
012,013 | ||
012,014 | ||
015,013 | ||
015,014 | ||
020,017 | ||
020,018 | ||
020,019 | ||
021,016 | ||
021,017 | ||
021,018 | ||
022,020 | ||
022,021 | ||
023,016 | ||
023,018 | ||
024,017 | ||
024,019 | ||
035,025 | ||
035,028 | ||
035,032 | ||
036,026 | ||
036,029 | ||
036,031 | ||
036,033 | ||
037,027 | ||
037,030 | ||
037,034 | ||
038,025 | ||
038,026 | ||
038,030 | ||
038,031 | ||
039,026 | ||
039,027 | ||
039,028 | ||
039,029 | ||
040,028 | ||
040,031 | ||
040,033 | ||
040,034 | ||
041,029 | ||
041,030 | ||
041,032 | ||
041,033 | ||
042,035 | ||
042,036 | ||
042,037 | ||
042,038 | ||
042,039 | ||
042,040 | ||
042,041 | ||
044,025 | ||
044,031 | ||
044,034 | ||
045,027 | ||
045,029 | ||
045,032 | ||
046,026 | ||
046,028 | ||
046,030 | ||
046,033 | ||
063,051 | ||
063,052 | ||
063,057 | ||
063,058 | ||
063,059 | ||
063,060 | ||
063,062 | ||
064,053 | ||
064,054 | ||
064,055 | ||
064,056 | ||
064,057 | ||
064,060 | ||
064,061 | ||
064,062 | ||
065,047 | ||
065,050 | ||
065,051 | ||
065,053 | ||
065,055 | ||
065,059 | ||
066,048 | ||
066,049 | ||
066,052 | ||
066,053 | ||
066,056 | ||
066,058 | ||
067,049 | ||
067,051 | ||
067,054 | ||
067,057 | ||
068,050 | ||
068,052 | ||
068,054 | ||
068,060 | ||
069,063 | ||
069,064 | ||
069,065 | ||
069,066 | ||
069,067 | ||
069,068 | ||
071,047 | ||
071,048 | ||
071,058 | ||
071,059 | ||
072,049 | ||
072,050 | ||
072,055 | ||
072,056 | ||
072,057 | ||
072,060 | ||
073,054 | ||
073,061 | ||
074,051 | ||
074,052 | ||
074,053 | ||
074,062 | ||
079,075 | ||
079,077 | ||
080,076 | ||
080,078 | ||
082,081 | ||
087,083 | ||
087,084 | ||
087,085 | ||
087,086 | ||
097,089 | ||
097,090 | ||
097,093 | ||
097,094 | ||
098,091 | ||
098,092 | ||
098,095 | ||
098,096 | ||
107,099 | ||
107,102 | ||
107,104 | ||
107,105 | ||
108,100 | ||
108,101 | ||
108,103 | ||
108,106 | ||
119,115 | ||
119,118 | ||
120,116 | ||
120,117 | ||
121,111 | ||
121,112 | ||
121,113 | ||
121,114 | ||
139,123 | ||
139,126 | ||
139,128 | ||
139,129 | ||
139,131 | ||
139,134 | ||
139,136 | ||
139,137 | ||
140,124 | ||
140,125 | ||
140,127 | ||
140,130 | ||
140,132 | ||
140,133 | ||
140,135 | ||
140,138 | ||
140,143 | ||
140,144 | ||
140,145 | ||
148,147 | ||
155,150 | ||
155,152 | ||
155,154 | ||
160,156 | ||
161,158 | ||
166,164 | ||
167,165 | ||
196,195 | ||
196,198 | ||
197,195 | ||
199,198 | ||
202,205 | ||
204,200 | ||
204,201 | ||
206,205 | ||
209,207 | ||
209,208 | ||
210,212 | ||
210,213 | ||
211,207 | ||
211,208 | ||
214,212 | ||
214,213 | ||
216,215 | ||
217,215 | ||
217,218 | ||
219,218 | ||
225,221 | ||
225,224 | ||
226,222 | ||
226,223 | ||
229,221 | ||
229,222 | ||
229,223 | ||
229,224 |
Oops, something went wrong.