Skip to content

Commit 64056ea

Browse files
committed
fix 1d rep string output
1 parent a406a9a commit 64056ea

File tree

1 file changed

+33
-31
lines changed

1 file changed

+33
-31
lines changed

pyxtal/representation.py

Lines changed: 33 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ def from_string(cls, inputs, smiles, composition=None):
7676
n_cell = 4
7777
else:
7878
n_cell = 3 #cubic
79-
cell = [hn] + inputs[1:n_cell]
79+
cell = [hn] + inputs[1:n_cell-1]
8080

8181
x = [cell]
8282
n_site = int(inputs[n_cell-1])
@@ -254,38 +254,40 @@ def to_string(self, time=None, eng=None, tag=None):
254254
print(rep2.to_string())
255255
string = "82 11.43 6.49 11.19 83.31 1 0.77 0.57 0.53 48.55 24.31 145.9 -77.85 -4.40 170.9 0"
256256
rep3 = representation.from_string(string, smiles)
257+
print(rep3.to_string())
257258
print(rep3.to_pyxtal())
258259
rep3.to_standard_setting()
259260
print(rep3.to_pyxtal())
260261
print(rep3.to_string())
261-
smiles = ['CC1=CC=C(C=C1)S(=O)(=O)C2=C(N=C(S2)C3=CC=C(C=C3)NC(=O)OCC4=CC=CC=C4)C']
262-
strings = [
263-
"83 14.08 6.36 25.31 83.9 1 0.72 0.40 0.27 131.6 -17.0 -120.0 -83.8 -134.1 -174.5 -175.7 -168.8 173.9 178.0 -157.4 0",
264-
"81 14.08 6.36 25.31 83.9 1 0.83 0.40 0.63 136.6 -21.6 -151.1 -101.1 -131.2 154.7 -176.4 -147.8 178.2 -179.1 -53.3 0",
265-
"81 14.08 6.36 25.31 83.9 1 0.59 0.81 0.39 -117.8 -50.1 -95.3 -25.8 -80.6 164.7 155.9 -124.9 -159.2 178.6 -154.7 0",
266-
"81 14.08 6.36 25.31 83.9 1 0.03 0.84 0.89 149.1 -8.0 -37.8 -39.9 -104.2 176.2 -179.6 137.8 -178.5 -173.3 -103.6 0",
267-
"81 14.08 6.36 25.31 83.9 1 0.75 0.09 0.01 133.8 -19.5 -55.1 -86.7 -91.7 -175.0 -170.4 -176.8 173.3 -164.8 -58.4 0",
268-
"81 14.08 6.36 25.31 83.9 1 0.72 0.44 0.01 135.2 27.5 97.2 -101.1 -105.1 -29.7 -169.7 -50.1 172.2 -173.1 131.6 0",
269-
"82 14.00 6.34 25.26 83.6 1 0.21 0.08 0.54 146.0 -12.0 50.2 108.0 112.3 -166.3 -158.7 -35.5 172.3 -168.7 133.0 0",
270-
#"83 14.08 6.36 25.31 83.9 1 0.25 0.91 0.06 136.4 20.0 52.2 -55.5 -79.7 -176.4 -160.9 109.2 168.9 -179.7 -25.7 0",
271-
#"82 14.08 6.36 25.31 83.9 1 0.55 0.04 0.64 -130.1 15.3 -10.7 74.9 64.0 177.4 180.0 8.7 177.8 174.6 -174.2 0",
272-
#"82 14.08 6.36 25.31 83.9 1 0.99 0.02 0.62 38.4 11.6 -16.2 -86.3 71.3 -19.5 164.9 -176.4 -168.2 174.4 88.1 0",
273-
#"83 14.08 6.36 25.31 83.9 1 0.67 0.40 0.87 136.6 -21.6 28.9 -101.1 -131.2 154.7 -176.4 -147.8 178.2 -179.1 -53.3 0",
274-
#"82 14.08 6.36 25.31 83.9 1 0.18 0.53 0.12 -84.9 36.3 89.1 15.6 54.8 140.6 -179.4 -138.3 178.5 169.7 4.7 0",
275-
#"82 14.08 6.36 25.31 83.9 1 0.47 0.75 0.11 -44.4 -26.0 -138.6 -50.5 -64.5 -174.1 161.8 20.8 -167.9 171.7 68.2 0",
276-
#"82 14.08 6.36 25.31 83.9 1 0.75 0.43 0.55 -44.9 16.9 58.5 -85.6 -87.7 -175.5 -170.6 -174.4 175.3 -170.0 -82.7 0",
277-
#"83 14.08 6.36 25.31 83.9 1 0.52 0.50 0.62 -39.5 -0.4 -32.5 -59.9 -76.0 11.3 169.5 166.5 -148.6 -87.3 82.6 0",
278-
#"83 14.08 6.36 25.31 83.9 1 0.42 0.98 0.67 141.3 -16.3 -123.8 62.9 -73.5 -39.4 178.8 -151.7 -175.1 -171.6 35.4 0",
279-
#"82 14.08 6.36 25.31 83.9 1 0.96 0.16 0.37 -41.7 45.2 -6.2 -93.1 -81.2 8.3 -146.8 147.2 147.2 -76.0 84.9 0",
280-
#"83 14.08 6.36 25.31 83.9 1 0.92 0.68 0.13 110.3 -46.9 -152.1 -80.7 -79.4 -172.6 -173.1 -140.8 169.0 165.6 155.7 0",
281-
]
262+
#smiles = ['CC1=CC=C(C=C1)S(=O)(=O)C2=C(N=C(S2)C3=CC=C(C=C3)NC(=O)OCC4=CC=CC=C4)C']
263+
#strings = [
264+
# "83 14.08 6.36 25.31 83.9 1 0.72 0.40 0.27 131.6 -17.0 -120.0 -83.8 -134.1 -174.5 -175.7 -168.8 173.9 178.0 -157.4 0",
265+
# "81 14.08 6.36 25.31 83.9 1 0.83 0.40 0.63 136.6 -21.6 -151.1 -101.1 -131.2 154.7 -176.4 -147.8 178.2 -179.1 -53.3 0",
266+
# "81 14.08 6.36 25.31 83.9 1 0.59 0.81 0.39 -117.8 -50.1 -95.3 -25.8 -80.6 164.7 155.9 -124.9 -159.2 178.6 -154.7 0",
267+
# "81 14.08 6.36 25.31 83.9 1 0.03 0.84 0.89 149.1 -8.0 -37.8 -39.9 -104.2 176.2 -179.6 137.8 -178.5 -173.3 -103.6 0",
268+
# "81 14.08 6.36 25.31 83.9 1 0.75 0.09 0.01 133.8 -19.5 -55.1 -86.7 -91.7 -175.0 -170.4 -176.8 173.3 -164.8 -58.4 0",
269+
# "81 14.08 6.36 25.31 83.9 1 0.72 0.44 0.01 135.2 27.5 97.2 -101.1 -105.1 -29.7 -169.7 -50.1 172.2 -173.1 131.6 0",
270+
# "82 14.00 6.34 25.26 83.6 1 0.21 0.08 0.54 146.0 -12.0 50.2 108.0 112.3 -166.3 -158.7 -35.5 172.3 -168.7 133.0 0",
271+
# "81 14.08 6.36 25.31 83.9 1 0.05 0.30 0.89 -68.2 41.2 148.8 -66.9 -85.0 -167.4 172.3 -166.2 -178.3 166.4 -45.9 0",
272+
# #"83 14.08 6.36 25.31 83.9 1 0.25 0.91 0.06 136.4 20.0 52.2 -55.5 -79.7 -176.4 -160.9 109.2 168.9 -179.7 -25.7 0",
273+
# #"82 14.08 6.36 25.31 83.9 1 0.55 0.04 0.64 -130.1 15.3 -10.7 74.9 64.0 177.4 180.0 8.7 177.8 174.6 -174.2 0",
274+
# #"82 14.08 6.36 25.31 83.9 1 0.99 0.02 0.62 38.4 11.6 -16.2 -86.3 71.3 -19.5 164.9 -176.4 -168.2 174.4 88.1 0",
275+
# #"83 14.08 6.36 25.31 83.9 1 0.67 0.40 0.87 136.6 -21.6 28.9 -101.1 -131.2 154.7 -176.4 -147.8 178.2 -179.1 -53.3 0",
276+
# #"82 14.08 6.36 25.31 83.9 1 0.18 0.53 0.12 -84.9 36.3 89.1 15.6 54.8 140.6 -179.4 -138.3 178.5 169.7 4.7 0",
277+
# #"82 14.08 6.36 25.31 83.9 1 0.47 0.75 0.11 -44.4 -26.0 -138.6 -50.5 -64.5 -174.1 161.8 20.8 -167.9 171.7 68.2 0",
278+
# #"82 14.08 6.36 25.31 83.9 1 0.75 0.43 0.55 -44.9 16.9 58.5 -85.6 -87.7 -175.5 -170.6 -174.4 175.3 -170.0 -82.7 0",
279+
# #"83 14.08 6.36 25.31 83.9 1 0.52 0.50 0.62 -39.5 -0.4 -32.5 -59.9 -76.0 11.3 169.5 166.5 -148.6 -87.3 82.6 0",
280+
# #"83 14.08 6.36 25.31 83.9 1 0.42 0.98 0.67 141.3 -16.3 -123.8 62.9 -73.5 -39.4 178.8 -151.7 -175.1 -171.6 35.4 0",
281+
# #"82 14.08 6.36 25.31 83.9 1 0.96 0.16 0.37 -41.7 45.2 -6.2 -93.1 -81.2 8.3 -146.8 147.2 147.2 -76.0 84.9 0",
282+
# #"83 14.08 6.36 25.31 83.9 1 0.92 0.68 0.13 110.3 -46.9 -152.1 -80.7 -79.4 -172.6 -173.1 -140.8 169.0 165.6 155.7 0",
283+
# ]
282284

283-
import pymatgen.analysis.structure_matcher as sm
284-
matcher = sm.StructureMatcher(ltol=0.3, stol=0.3, angle_tol=10)
285-
for i, string in enumerate(strings):
286-
print(str(i) + ' ' +string)
287-
rep4 = representation.from_string(string, smiles)
288-
pmg1 = rep4.to_pyxtal().to_pymatgen(); pmg1.remove_species('H')
289-
rep4.to_standard_setting()
290-
pmg2 = rep4.to_pyxtal().to_pymatgen(); pmg2.remove_species('H')
291-
print(i, rep4.to_string(), matcher.fit(pmg1, pmg2))
285+
#import pymatgen.analysis.structure_matcher as sm
286+
#matcher = sm.StructureMatcher(ltol=0.3, stol=0.3, angle_tol=10)
287+
#for i, string in enumerate(strings):
288+
# print(str(i) + ' ' +string)
289+
# rep4 = representation.from_string(string, smiles)
290+
# pmg1 = rep4.to_pyxtal().to_pymatgen(); pmg1.remove_species('H')
291+
# rep4.to_standard_setting()
292+
# pmg2 = rep4.to_pyxtal().to_pymatgen(); pmg2.remove_species('H')
293+
# print(i, rep4.to_string(), matcher.fit(pmg1, pmg2))

0 commit comments

Comments
 (0)