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.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MzkzNzA0NTYsIm5iZiI6MTczOTM3MDE1NiwicGF0aCI6Ii82Mzc4NDcwNS8zNzEyNDE5ODUtZmJmNjlmOGYtZmNlZC00YmJjLWE4YjMtYjc3ZjAwYmNhY2IwLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNTAyMTIlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjUwMjEyVDE0MjIzNlomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTZlMWFjMDgwYTNkYjNmNGNmN2YyNTVhZmJkYjk0MDY5ZDU4NDBiOTYyN2E1MzA2MWFhODRiZTNmYjI0MmNkY2MmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0In0.mdDzq2TxPtJn02JP1QTOfMtZOvkRHiq5YwtI31iAXNc)
![{4BE4D7FD-0727-489B-8410-6A9A4E525A14}](https://private-user-images.githubusercontent.com/63784705/371242112-dfd06520-042f-41b0-92b7-419aa6e76f92.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MzkzNzA0NTYsIm5iZiI6MTczOTM3MDE1NiwicGF0aCI6Ii82Mzc4NDcwNS8zNzEyNDIxMTItZGZkMDY1MjAtMDQyZi00MWIwLTkyYjctNDE5YWE2ZTc2ZjkyLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNTAyMTIlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjUwMjEyVDE0MjIzNlomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPWU5MTZiMDgyMmEyYWZkZThlY2FmOGI2NjdjZDQzNWRkMWQ1ODA5OTRjZWI0NGVjYTg1NmE0ZmQ3MWNjYzZjOTQmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0In0.m0VaJFJh3-4aprXTquDhFwSRJliqB7KP-kCXjArIhlQ)
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.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MzkzNzA0NTYsIm5iZiI6MTczOTM3MDE1NiwicGF0aCI6Ii82Mzc4NDcwNS8zNzEyNDI2NDMtMDlhOTFhZjMtZjc2ZC00OWYyLThmOTItN2Q3ZTIwYmU5ZjE5LnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNTAyMTIlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjUwMjEyVDE0MjIzNlomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPWFlZTJjNTI1ZmMwZThlMzk0NTdjZDY0NGY4YmNlNTM1MGM5MjU4YmIyY2YyZTYyM2RiMTc4ZTQ1N2RiNTEyNDkmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0In0.BYN-J0rP9lcmicJcqbWb5Uj4Ut7puSkmnDKYP9Xz9fw)
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