Replies: 1 comment
-
Hi @aahil1412 I believe you are just one step from there! You would need to check the distance between two sites ( # Only add edges if the bond length is within the atom-specific cutoff
- if neighbor.nn_distance < bond_cutoff:
+ if structure.get_distance(i, j, jimage=0) < bond_cutoff: # use jimage=0 to ignore PBC
G.add_edge(i, j, distance=neighbor.nn_distance) Then the plot becomes: |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi, I am trying to get a graph representation of covalent organic frameworks (COF). However, I faced a problem while creating the plot. So, COFs have periodic structures like crystals, and I want to incorporate them into the graph structure.
I am attaching the code I used below:
This is the output I got:
![{3E35AED3-98A2-478F-A7D0-6140CD5A79A7}](https://private-user-images.githubusercontent.com/63784705/371241985-fbf69f8f-fced-4bbc-a8b3-b77f00bcacb0.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MzkwMTU3MTYsIm5iZiI6MTczOTAxNTQxNiwicGF0aCI6Ii82Mzc4NDcwNS8zNzEyNDE5ODUtZmJmNjlmOGYtZmNlZC00YmJjLWE4YjMtYjc3ZjAwYmNhY2IwLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNTAyMDglMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjUwMjA4VDExNTAxNlomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTc5N2YyM2IyYmY1MjY0MmM1MDkwZmIxMDE2YmIzZDgzODc5NzllZjdkNTQzMTA0MTc4MTU4MzQ5N2Q1MjMzMWYmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0In0.Ex4h1le_45344dsCsslFblzjluREmVuh3cPhnzzjvls)
![{4BE4D7FD-0727-489B-8410-6A9A4E525A14}](https://private-user-images.githubusercontent.com/63784705/371242112-dfd06520-042f-41b0-92b7-419aa6e76f92.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MzkwMTU3MTYsIm5iZiI6MTczOTAxNTQxNiwicGF0aCI6Ii82Mzc4NDcwNS8zNzEyNDIxMTItZGZkMDY1MjAtMDQyZi00MWIwLTkyYjctNDE5YWE2ZTc2ZjkyLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNTAyMDglMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjUwMjA4VDExNTAxNlomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPWIwYjcyNzMwMTMyZTJlOTM2YmU4ZTQxNjU2M2M3MmYzZWMwMDA5MDc0NGUwNjFjZDg0ZmU3ZGFhYWI4ZTc5ODEmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0In0.wzhabkDwH5PqG93ZVSy15eJeZH3geM9ToFs2keqRDoI)
However, the actual structure should look like this:
I tried using this code for a Metal-organic framework (which has a more defined crystal system than COFs), and it worked perfectly, but in this case, the periodic conditions mismatched.
I also tried doing it for another COf structure, but that led to the same result, too.
![{1DBE8E97-F948-43C2-A149-43BFD7DF0E1E}](https://private-user-images.githubusercontent.com/63784705/371242643-09a91af3-f76d-49f2-8f92-7d7e20be9f19.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MzkwMTU3MTYsIm5iZiI6MTczOTAxNTQxNiwicGF0aCI6Ii82Mzc4NDcwNS8zNzEyNDI2NDMtMDlhOTFhZjMtZjc2ZC00OWYyLThmOTItN2Q3ZTIwYmU5ZjE5LnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNTAyMDglMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjUwMjA4VDExNTAxNlomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTg1NTVmNzllYzFmZjczYjNiMGMwOWRlMTI4NzBiYmE2MTEwZDEwMGNmZjM5MTdlMWEzZDg4ZGJiN2Y5ODNjYmQmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0In0.2ExCieSEEy6srVM8DaBCkYhYn4f-VAQJDV8hdKpKCcE)
I am not sure what I need to change in the code. I am also attaching the cif file below.
Thank you
COF-5.zip
Beta Was this translation helpful? Give feedback.
All reactions