/
coordinates.jl
82 lines (67 loc) · 2.18 KB
/
coordinates.jl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
"""
prefer_coordgen(val::Int64)
Set to use CoordgenLibs for 2D coordinates generation.
# Examples
```julia
prefer_coordgen(1)
```
"""
function prefer_coordgen(val::Integer)
ccall((:prefer_coordgen, librdkitcffi), Cvoid, (Cshort,), Cshort(val))
end
"""
set_2d_coords(mol::Mol, details::Union{Dict{String,Any},Nothing}=nothing)::Int16
Generate 2D coordinates.
# Examples
```julia
mol = get_mol("CC(=O)Oc1ccccc1C(=O)O")
set_2d_coords(mol)
```
"""
function set_2d_coords(mol::Mol)::Int16
val::Cshort = ccall((:set_2d_coords, librdkitcffi), Cshort, (Ref{Cstring}, Ref{Csize_t}), mol.mol, mol.mol_size)
return val
end
"""
set_2d_coords_aligned(mol::Mol, template_mol::Mol, details::Union{Dict{String,Any},Nothing}=nothing)::Int16
Generate 2D coordinates aligned to a template mol.
# Examples
```julia
mol = get_mol("CC(=O)Oc1ccccc1C(=O)O")
template = get_mol("CC(=O)Nc1ccc(O)cc1")
set_2d_coords(template)
set_2d_coords_aligned(mol, template_mol)
```
"""
function set_2d_coords_aligned(mol::Mol, template_mol::Mol, details::Union{Dict{String,Any},Nothing}=nothing)::Int16
details_json::String = jsonify_details(details)
val::Cshort = ccall((:set_2d_coords_aligned, librdkitcffi), Cshort, (Ref{Cstring}, Ref{Csize_t}, Cstring, Csize_t, Cstring, Ref{Ref{Cstring}}), mol.mol, mol.mol_size, template_mol.mol[], template_mol.mol_size[], details_json, C_NULL)
return val
end
"""
set_3d_coords(mol::Mol, details::Union{Dict{String,Any},Nothing}=nothing)::Int16
Generate 3D coordinates.
# Examples
```julia
mol = get_mol("CC(=O)Oc1ccccc1C(=O)O")
set_3d_coords(mol)
```
"""
function set_3d_coords(mol::Mol, details::Union{Dict{String,Any},Nothing}=nothing)::Int16
details_json::String = jsonify_details(details)
val::Cshort = ccall((:set_3d_coords, librdkitcffi), Cshort, (Ref{Cstring}, Ref{Csize_t}, Cstring), mol.mol, mol.mol_size, details_json)
return val
end
"""
has_coords(mol::Mol)::Int16
Check if the molecule has coords.
# Examples
```julia
mol = get_mol("CC(=O)Oc1ccccc1C(=O)O")
has_coords(mol)
```
"""
function has_coords(mol::Mol)::Int16
val::Cshort = ccall((:has_coords, librdkitcffi), Cshort, (Cstring, Csize_t), mol.mol[], mol.mol_size[])
return val
end