Skip to content

Commit

Permalink
Fixed group-group min bond distance in RGBI
Browse files Browse the repository at this point in the history
  • Loading branch information
dylan-jayatilaka committed Nov 5, 2024
1 parent a9fc7cd commit 33d2731
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 22 deletions.
18 changes: 6 additions & 12 deletions foofiles/atom.foo
Original file line number Diff line number Diff line change
Expand Up @@ -6040,22 +6040,16 @@ contains

! Bond distances and bonding

bond_distance_to(b,angstrom) result (res) ::: PURE
! Return the bond distance between atoms "a" and "b"
bond_distance_to(that) result (res) ::: PURE
! Return the distance between "self" and "that" other atom.
self :: IN
b :: ATOM, IN
angstrom :: BIN, optional, IN
res :: REAL
that :: ATOM, IN
res :: REAL

r :: VEC{REAL}(3)
change :: BIN

r = b.position - .position
res = sqrt(r(1)*r(1) + r(2)*r(2) + r(3)*r(3))

change = FALSE
if (present (angstrom)) change = angstrom
if (change) res = res * STR:conversion_factor("angstrom")
r = that.position - .position
res = sqrt(dot_product(r,r))

end

Expand Down
23 changes: 15 additions & 8 deletions foofiles/roby.foo
Original file line number Diff line number Diff line change
Expand Up @@ -3889,6 +3889,7 @@ contains
ENSURE(.atom.allocated,"no atom data")

table :: VEC{TABLE_COLUMN}@
group :: VEC{INT}@
symbols :: VEC{STR}@
vals :: VEC{REAL}@
n_e, i :: INT
Expand All @@ -3915,7 +3916,10 @@ contains
if (.is_homoleptic) then
! Group atom indices
do i = 1,.n_group
symbols(i) = .atom(.atom_group(i).element).chemical_formula
group = .atom_group(i).element
if (group.dim==1) then; symbols(i) = .atom(group(1)).tag
else; symbols(i) = .atom(group).chemical_formula
end
end
table.create(3)
table(1).set_heading("Group")
Expand Down Expand Up @@ -3995,6 +3999,7 @@ contains
table :: VEC{TABLE_COLUMN}@
symbol :: VEC{STR}@
g_A,g_B :: VEC{INT}@
grA,grB :: VEC{INT}@
n_A,n_B :: VEC{REAL}@
rAB,nAB,sAB,cAB,iAB :: VEC{REAL}@
tAB,pAB,aAB :: VEC{REAL}@
Expand Down Expand Up @@ -4034,7 +4039,7 @@ contains
table( 1).set_subhead(" A")
table( 2).set_heading("Grp")
table( 2).set_subhead(" B")
table( 3).set_heading("min R(AB)")
table( 3).set_heading("min r(AB)")
table( 3).set_subheading("/Angs.")
table( 3).set_width_from(ONE)
table( 4).set_heading("n_A")
Expand Down Expand Up @@ -4069,9 +4074,9 @@ contains
n_pair = n_pair.triangle_number
g_A.create(n_pair)
g_B.create(n_pair)
rAB.create(n_pair)
n_A.create(n_pair)
n_B.create(n_pair)
rAB.create(n_pair)
nAB.create(n_pair)
sAB.create(n_pair)
cAB.create(n_pair)
Expand All @@ -4086,10 +4091,12 @@ contains
i = i + 1
g_A(i) = a
g_B(i) = b
grA = .atom_group(a)[:]
grB = .atom_group(b)[:]
distAB = .atom.min_distance_between(grA,grB)
rAB(i) = distAB*ANGSTROM_PER_BOHR
n_A(i) = .n1(a)
n_B(i) = .n1(b)
distAB = .atom.min_bond_distance(.atom_group(a).element,.atom_group(b).element)
rAB(i) = distAB*ANGSTROM_PER_BOHR
nAB(i) = .n2(a,b)
sAB(i) = .n1(a) + .n1(b) - .n2(a,b)
cAB(i) = .cov_index(a,b)
Expand All @@ -4103,9 +4110,9 @@ contains
! Set table data
table( 1).set_values(g_A)
table( 2).set_values(g_B)
table( 3).set_values(n_A)
table( 4).set_values(n_B)
table( 5).set_values(rAB)
table( 3).set_values(rAB)
table( 4).set_values(n_A)
table( 5).set_values(n_B)
table( 6).set_values(nAB)
table( 7).set_values(sAB)
table( 8).set_values(cAB)
Expand Down
4 changes: 2 additions & 2 deletions foofiles/vec{atom}.foo
Original file line number Diff line number Diff line change
Expand Up @@ -8859,8 +8859,8 @@ contains
end


min_bond_distance(group_a,group_b) result (res) ::: PURE
! Return the minimum bond distance between the atoms whose
min_distance_between(group_a,group_b) result (res) ::: PURE
! Return the minimum distance between the atoms whose
! indices are listed in "group_a" and "group_b".
self :: IN
group_a :: VEC{INT}, IN
Expand Down

0 comments on commit 33d2731

Please sign in to comment.