Skip to content

Commit

Permalink
Change the creation of frameworks (#40)
Browse files Browse the repository at this point in the history
* Change the way that the framework is built

* Update sql, sql_a, kgd, and hxl_a nets

* Small fixes

* Add FXT and FXT_A nets

* Fix FXT_A net

* Add FXT Framework creation

* Remove FTX net

* Update

* Update

* Update

* Fix CONHNH2 connector

* FIx PYTO core

* FIX STAR1

* Fix save_cif function

* Fix save_cif

* Add an option to save the cif file on specific path

* Correct the get_bond_atom function

* Fix CHCN connector group

* Fix NHNH2 to CHNNH2

* FIx CHNNH2

* Fix CHCN

* Fix H6 and S4 Building block names

* Fix the creation of CellBox

* Change the Create_COF_json info text

* Fix Create_COF_json

* Update python version

* Update README

---------

Co-authored-by: Felipe Lopes de Oliveira <felipe.lopes.oliveira@ibm.com>
Co-authored-by: lipelopesoliveira <lipelopesoliveira@github.com>
  • Loading branch information
3 people authored Oct 6, 2023
1 parent f0a31c6 commit 0e8d57b
Show file tree
Hide file tree
Showing 25 changed files with 1,978 additions and 823 deletions.
3 changes: 3 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"python.analysis.typeCheckingMode": "off"
}
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License

Copyright (c) 2021, Felipe Lopes de Oliveira
Copyright (c) 2023, Felipe Lopes de Oliveira

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
21 changes: 8 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,29 +37,29 @@ conda env create --file environment.yml
To create a specific COF, like `T3_BENZ_NH2_OH-L2_BENZ_CHO_H-HCB_A-AA`:

```python
>>> import pycofbuilder as COF
>>> import pycofbuilder as cof

>>> structure = COF.Reticulum(name='T3_BENZ_NH2_OH-L2_BENZ_CHO_H-HCB_A-AA')
>>> cof.Framework('T3_BENZ_CHO_OH-L2_BENZ_NH2_H-HCB_A-AA')
T3_BENZ_NH2_OH-L2_BENZ_CHO_H_H-HCB_A-AA hexagonal P P6/m # 175 12 sym. op.
>>> structure.save(fmt='cif', supercell = [1, 1, 2])
>>> cof.save(fmt='cif', supercell = [1, 1, 2])
```

A `.cif` file (the default save format is CIF, but it can be easily changed by setting other value on the `fmt` option) will be created in the `out` folder. The code will print out some information about the structure created.

Besides, the variable `structure` now is a `Reticulum` object. This object has some attributes that can be accessed:

```python
>>> structure.name
>>> cof.name
'T3_BENZ_NH2_OH-L2_BENZ_CHO_H-HCB_A-AA'
>>> structure.smiles
>>> cof.smiles
'(N)C1=C(O)C((N))=C(O)C((N))=C1O.(C([H])=O)C1=C([H])C([H])=C((C([H])=O))C([H])=C1[H]'
>>> structure.lattice
>>> cof.lattice
array([[ 22.49540055, 0. , 0. ],
[-11.24770028, 19.48158835, 0. ],
[ 0. , 0. , 3.6 ]])
>>> Ret.n_atoms
>>> cof.n_atoms
72
>>> Ret.space_group
>>> cof.space_group
'P6/m'
```

Expand Down Expand Up @@ -178,8 +178,3 @@ If you find **pyCOFBuilder** useful in your research please consider citing the
> _pyCOFBuilder: A Python Module for Automated Assembly of Covalent Organic Frameworks_
>
> _Manuscript in preparation._ [DOI](https://doi.org/)
>
> F. L. Oliveira, J.M.C. Souza and P. M. Esteves,
> _Exploring Machine Learning Strategies for Partial Atomic Charges Prediction on Covalent Organic Framework_
>
> _Manuscript in preparation._ [DOI](https://doi.org/)
2 changes: 1 addition & 1 deletion environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ dependencies:
- pandas
- panel
- pip
- python
- python >= 3.10
- pymatgen
- scipy
- simplejson
Expand Down
6 changes: 1 addition & 5 deletions exemple.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
'C3_BENZ_CHO_OH-C2_BENZ_NH2_H-HCB_A-AA',
'C3_BENZ_CHO_OH-C2_ANTR_NH2_O-HCB_A-AA']

COF.build_COFs_list(COF_list, supercell=[1,1,1], save_format=['cif'])
COF.build_COFs_list(COF_list, supercell=[1, 1, 1], save_format=['cif'])

#COF.build('C3_BENZ_CHO_OH-C2_HDZ_NH2-HCB_A-AA', supercell=[1,1,1])
#COF.build('C3_BENZ_CHO_H-C2_HDZ_NH2-HCB_A-AA', supercell=[1,1,1])
Expand All @@ -54,7 +54,3 @@
#COF.create_all_C3(nucleos=['BENZ', 'TPBZ'], conectores=['CHO'], radicais=['H'])

#COF.build_all_available_COFs()




4 changes: 4 additions & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,7 @@ numpy >= 1.6.3
scipy >= 1.2
pymatgen >=2022.0.8
simplejson
jupyter
jupyterlab
pandas
tqdm
8 changes: 4 additions & 4 deletions src/pycofbuilder/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,20 +15,20 @@
from pycofbuilder.building_block import Building_Block

# Import BuildingBlocks class
from pycofbuilder.reticulum import Reticulum
from pycofbuilder.framework import Framework

# Import Core class
from pycofbuilder.core import *
#from pycofbuilder.core import *

__all__ = ['Tools',
'Building_Block',
'Reticulum'
'Framework'
]

_ROOT = os.path.abspath(os.path.dirname(__file__))

__author__ = "Felipe Lopes de Oliveira"
__license__ = "MIT"
__version__ = '0.0.3'
__version__ = '0.0.4'
__email__ = "felipe.lopes@nano.ufrj.br"
__status__ = "Development"
14 changes: 7 additions & 7 deletions src/pycofbuilder/building_block.py
Original file line number Diff line number Diff line change
Expand Up @@ -269,7 +269,7 @@ def _add_connection_group(self, conector_name):
close_Q_struct = Tools.closest_atom('Q',
location_Q_struct[1][i],
self.atom_labels,
self.atom_pos)[1]
self.atom_pos)[1]

# Get the position of Q in the conection group
location_Q_connector = self._get_Q_points(n_conector_label, n_conector_pos)
Expand Down Expand Up @@ -443,30 +443,30 @@ def save(self, extension='xyz'):
def get_available_core(self):
'''Get the list of available cores'''
L2_PATH = os.path.join(self.main_path, 'core', 'L2')
L2_list = [i.rstrip('.gjf') for i in os.listdir(L2_PATH) if '.gjf' in i]
L2_list = [i.rstrip('.json') for i in os.listdir(L2_PATH) if '.json' in i]

T3_PATH = os.path.join(self.main_path, 'core', 'T3')
T3_list = [i.rstrip('.gjf') for i in os.listdir(T3_PATH) if '.gjf' in i]
T3_list = [i.rstrip('.json') for i in os.listdir(T3_PATH) if '.json' in i]

S4_PATH = os.path.join(self.main_path, 'core', 'S4')
S4_list = [i.rstrip('.gjf') for i in os.listdir(S4_PATH) if '.gjf' in i]
S4_list = [i.rstrip('.json') for i in os.listdir(S4_PATH) if '.json' in i]

H6_PATH = os.path.join(self.main_path, 'core', 'H6')
H6_list = [i.rstrip('.gjf') for i in os.listdir(H6_PATH) if '.gjf' in i]
H6_list = [i.rstrip('.json') for i in os.listdir(H6_PATH) if '.json' in i]

return L2_list, T3_list, S4_list, H6_list

def get_available_R(self):
'''Get the list of available radicals'''
R_PATH = os.path.join(self.main_path, 'radical')
R_list = [i.rstrip('.gjf') for i in os.listdir(R_PATH) if '.gjf' in i]
R_list = [i.rstrip('.json') for i in os.listdir(R_PATH) if '.json' in i]

return R_list

def get_available_conector(self):
'''Get the list of available conectores'''
C_PATH = os.path.join(self.main_path, 'conector')
C_list = [i.rstrip('.gjf') for i in os.listdir(C_PATH) if '.gjf' in i]
C_list = [i.rstrip('.json') for i in os.listdir(C_PATH) if '.json' in i]

return C_list

Expand Down
10 changes: 4 additions & 6 deletions src/pycofbuilder/data/conector/CHCN.gjf
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,8 @@
Title Card Required

0 1
Q 0.00000000 0.00000000 0.00000000
C 0.38100000 0.00000000 0.00000000
H 0.40924527 -1.05919702 0.00000000
X 1.17860072 1.07502700 0.00000000
C 0.14695582 2.51329290 0.00000000
N -0.52134025 3.44499668 -0.00000001
F 0.00000000 0.00000000 0.00000000
X 0.38000000 0.00000000 0.00000000
C 1.09802718 1.24936702 0.00000000
N 1.66935957 2.24348516 -0.00000000

32 changes: 10 additions & 22 deletions src/pycofbuilder/data/conector/CHCN.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,14 @@
"smiles": "[Q]CC#N",
"xsmiles": "[*]CC#N",
"xsmiles_label": "|$Q;;;$|",
"formula": "X1Q1H1N1C2",
"formula": "X1Q1N1C2",
"atoms": {
"elements": {
"elementType": [
"Q",
"C",
"H",
"X",
"C",
"N"
"N",
"X"
]
},
"coords": {
Expand All @@ -24,31 +22,21 @@
0.0
],
[
0.381,
0.0,
0.0
],
[
0.40924527,
-1.05919702,
1.09802718,
1.24936702,
0.0
],
[
1.17860072,
1.075027,
1.66935957,
2.24348516,
0.0
],
[
0.14695582,
2.5132929,
0.38100000,
0.0,
0.0
],
[
-0.52134025,
3.44499668,
-1e-08
]
]
}
}
}
}
11 changes: 11 additions & 0 deletions src/pycofbuilder/data/conector/CHNNH2.gjf
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# opt pbepbe/6-311g/auto

Title Card Required

0 2
F 0.00000000 0.00000000 0.00000000
H 1.24945514 0.32205908 0.00000000
C 0.39767850 -0.20913489 0.00000000
N 0.44482913 -1.67837851 0.00000000
X 1.56800973 -2.27966158 0.00000000

48 changes: 48 additions & 0 deletions src/pycofbuilder/data/conector/CHNNH2.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
{
"name": "methylhydrazine",
"code": "NHNH2",
"smiles": "[Q]CNN",
"xsmiles": "[*]CNN",
"xsmiles_label": "|$Q;;;$|",
"formula": "Q1C1H1N1X1",
"atoms": {
"elements": {
"elementType": [
"Q",
"H",
"C",
"N",
"X"
]
},
"coords": {
"3d": [
[
0.0,
0.0,
0.0
],
[
1.24945514,
0.32205908,
0.0
],
[
0.39767850,
-0.20913489,
0.0
],
[
0.44482913,
-1.67837851,
0.0
],
[
1.56800973,
-2.27966158,
0.0
]
]
}
}
}
4 changes: 2 additions & 2 deletions src/pycofbuilder/data/conector/CONHNH2.gjf
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,5 @@ Title Card Required
C 0.45000000 0.00000000 0.00000000
O 0.93949639 1.12317482 0.00000000
N 1.28911694 -1.16938849 0.00000000
X 1.60099962 -1.11891794 0.00000000
H 0.93504819 -2.15789004 0.00000000
X 2.58815584 -0.95917095 0.00000000
H 1.19718229 -2.18185415 0.00000000
16 changes: 8 additions & 8 deletions src/pycofbuilder/data/conector/CONHNH2.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,22 +31,22 @@
[
0.93949639,
1.12317482,
0.0001013
0.00000000
],
[
1.28911694,
-1.16938849,
8.669e-05
0.00000000
],
[
1.60099962,
-1.11891794,
0.00010582
2.58815584,
-0.95917095,
0.00000000
],
[
0.93504819,
-2.15789004,
3.761e-05
1.19718229,
-2.18185415,
0.00000000
]
]
}
Expand Down
10 changes: 0 additions & 10 deletions src/pycofbuilder/data/conector/NHNH2.gjf

This file was deleted.

42 changes: 0 additions & 42 deletions src/pycofbuilder/data/conector/NHNH2.json

This file was deleted.

Loading

0 comments on commit 0e8d57b

Please sign in to comment.