~/bend-docscommunity

bonded.bend checks

raw source on the hub · import 0xdf198d67659100c90a58ecd6b01d034d/bonded.bend as Bonded

5 imports
import Base
import ./geom.bend as G
import ./protein.bend as P
import ./topology.bend as T
import ./force.bend as F

Definitions

def pos_of_serial_go source · line 18 · raw

@xs:List<&2, 0xdf198d67659100c90a58ecd6b01d034d/protein.Atom> -> @+s:U32 -> @best:Maybe<&2, 0xdf198d67659100c90a58ecd6b01d034d/geom.Vec3> -> Maybe<&2, 0xdf198d67659100c90a58ecd6b01d034d/geom.Vec3>

def pos_of_serial source · line 27 · raw

@xs:List<&2, 0xdf198d67659100c90a58ecd6b01d034d/protein.Atom> -> @s:U32 -> Maybe<&2, 0xdf198d67659100c90a58ecd6b01d034d/geom.Vec3>

def cov_rad source · line 33 · raw

@e:U32 -> F32

Harmonic bond energy k*(d - (ri+rj))^2 with covalent equilibrium; missing atoms answer 0.0. Lookups return (position & element) together so the equilibrium needs no extra pass.

def atom_of_serial_go source · line 50 · raw

@xs:List<&2, 0xdf198d67659100c90a58ecd6b01d034d/protein.Atom> -> @+s:U32 -> @best:Maybe<&1, Pair(0xdf198d67659100c90a58ecd6b01d034d/geom.Vec3, U32)> -> Maybe<&1, Pair(0xdf198d67659100c90a58ecd6b01d034d/geom.Vec3, U32)>

def atom_of_serial source · line 59 · raw

@xs:List<&2, 0xdf198d67659100c90a58ecd6b01d034d/protein.Atom> -> @s:U32 -> Maybe<&1, Pair(0xdf198d67659100c90a58ecd6b01d034d/geom.Vec3, U32)>

def bond_e source · line 62 · raw

@+pa:0xdf198d67659100c90a58ecd6b01d034d/geom.Vec3 -> @+pb:0xdf198d67659100c90a58ecd6b01d034d/geom.Vec3 -> @+k:F32 -> @+r0:F32 -> F32

def bond_cov_look1 source · line 65 · raw

@pa:0xdf198d67659100c90a58ecd6b01d034d/geom.Vec3 -> @ea:U32 -> @mb:Maybe<&1, Pair(0xdf198d67659100c90a58ecd6b01d034d/geom.Vec3, U32)> -> @+k:F32 -> F32

def bond_cov_look source · line 72 · raw

@ma:Maybe<&1, Pair(0xdf198d67659100c90a58ecd6b01d034d/geom.Vec3, U32)> -> @mb:Maybe<&1, Pair(0xdf198d67659100c90a58ecd6b01d034d/geom.Vec3, U32)> -> @+k:F32 -> F32

def bond_cov_pair source · line 79 · raw

@+xs:List<&2, 0xdf198d67659100c90a58ecd6b01d034d/protein.Atom> -> @s1:U32 -> @s2:U32 -> @+k:F32 -> F32

def bond_total source · line 82 · raw

@+xs:List<&2, 0xdf198d67659100c90a58ecd6b01d034d/protein.Atom> -> @bonds:List<&1, Pair(U32, U32)> -> @+k:F32 -> F32

def angle_e source · line 90 · raw

@+pa:0xdf198d67659100c90a58ecd6b01d034d/geom.Vec3 -> @+pb:0xdf198d67659100c90a58ecd6b01d034d/geom.Vec3 -> @+pc:0xdf198d67659100c90a58ecd6b01d034d/geom.Vec3 -> @+k:F32 -> @+eq:F32 -> F32

Harmonic angle energy k*(theta - eq)^2 about the middle serial.

def angle_e0 source · line 93 · raw

@pa:0xdf198d67659100c90a58ecd6b01d034d/geom.Vec3 -> @pb:0xdf198d67659100c90a58ecd6b01d034d/geom.Vec3 -> @mc:Maybe<&2, 0xdf198d67659100c90a58ecd6b01d034d/geom.Vec3> -> @+k:F32 -> @+eq:F32 -> F32

def angle_e1 source · line 100 · raw

@pa:0xdf198d67659100c90a58ecd6b01d034d/geom.Vec3 -> @mb:Maybe<&2, 0xdf198d67659100c90a58ecd6b01d034d/geom.Vec3> -> @mc:Maybe<&2, 0xdf198d67659100c90a58ecd6b01d034d/geom.Vec3> -> @+k:F32 -> @+eq:F32 -> F32

def angle_e2 source · line 107 · raw

@ma:Maybe<&2, 0xdf198d67659100c90a58ecd6b01d034d/geom.Vec3> -> @mb:Maybe<&2, 0xdf198d67659100c90a58ecd6b01d034d/geom.Vec3> -> @mc:Maybe<&2, 0xdf198d67659100c90a58ecd6b01d034d/geom.Vec3> -> @+k:F32 -> @+eq:F32 -> F32

def angle_triple source · line 114 · raw

@+xs:List<&2, 0xdf198d67659100c90a58ecd6b01d034d/protein.Atom> -> @sa:U32 -> @sb:U32 -> @sc:U32 -> @+k:F32 -> @+eq:F32 -> F32

def angle_total source · line 117 · raw

@+xs:List<&2, 0xdf198d67659100c90a58ecd6b01d034d/protein.Atom> -> @triples:List<&1, Pair(U32, Pair(U32, U32))> -> @+k:F32 -> @+eq:F32 -> F32

def flatten_bonds source · line 125 · raw

@bs:List<&1, Pair(U32, U32)> -> List<&2, U32>

Pair bonds -> flat [a, b, ..] so tests can re-scan (Data reuses).

def bond_match source · line 132 · raw

@+a:U32 -> @+b:U32 -> @+x:U32 -> @+y:U32 -> Bool

def bonded12_flat source · line 135 · raw

@bs:List<&2, U32> -> @+a:U32 -> @+b:U32 -> Bool

def bond_neighbors_go source · line 144 · raw

@bs:List<&2, U32> -> @+s:U32 -> @+acc:List<&2, U32> -> List<&2, U32>

def bond_neighbors source · line 155 · raw

@s:U32 -> @bs:List<&2, U32> -> List<&2, U32>

def list_member source · line 158 · raw

@+x:U32 -> @ys:List<&2, U32> -> Bool

def share_one source · line 165 · raw

@xs:List<&2, U32> -> @+ys:List<&2, U32> -> Bool

def excluded12 source · line 172 · raw

@a:U32 -> @b:U32 -> @+bonds:List<&2, U32> -> Bool

def excluded13 source · line 175 · raw

@a:U32 -> @b:U32 -> @+bonds:List<&2, U32> -> Bool

def excluded source · line 178 · raw

@+a:U32 -> @+b:U32 -> @+bonds:List<&2, U32> -> Bool

def lj_row_excl source · line 182 · raw

@+si:U32 -> @+pi:0xdf198d67659100c90a58ecd6b01d034d/geom.Vec3 -> @+eps:F32 -> @+sig2:F32 -> @+c2:F32 -> @ys:List<&2, 0xdf198d67659100c90a58ecd6b01d034d/protein.Atom> -> @+bonds:List<&2, U32> -> F32

Nonbonded rows/totals that skip 1-2 and 1-3 pairs by serial.

def lj_total_excl source · line 191 · raw

@xs:List<&2, 0xdf198d67659100c90a58ecd6b01d034d/protein.Atom> -> @+ys:List<&2, 0xdf198d67659100c90a58ecd6b01d034d/protein.Atom> -> @+eps:F32 -> @+sig2:F32 -> @+c2:F32 -> @+bonds:List<&2, U32> -> F32

def coul_row_excl source · line 200 · raw

@+si:U32 -> @+pi:0xdf198d67659100c90a58ecd6b01d034d/geom.Vec3 -> @+qi:F32 -> @+ke:F32 -> @+c2:F32 -> @ys:List<&2, 0xdf198d67659100c90a58ecd6b01d034d/protein.Atom> -> @qs:List<&2, F32> -> @+bonds:List<&2, U32> -> F32

def coul_total_excl source · line 212 · raw

@xs:List<&2, 0xdf198d67659100c90a58ecd6b01d034d/protein.Atom> -> @+qs_o:List<&2, F32> -> @+ys:List<&2, 0xdf198d67659100c90a58ecd6b01d034d/protein.Atom> -> @+qs_e:List<&2, F32> -> @+ke:F32 -> @+c2:F32 -> @+bonds:List<&2, U32> -> F32

def lj_row_elem_excl source · line 226 · raw

@+si:U32 -> @+se:U32 -> @+pi:0xdf198d67659100c90a58ecd6b01d034d/geom.Vec3 -> @+ys:List<&2, 0xdf198d67659100c90a58ecd6b01d034d/protein.Atom> -> @+c2:F32 -> @+bonds:List<&2, U32> -> F32

Per-element rows/totals that also skip 1-2 and 1-3 pairs: the physically meaningful combination (uniform rows blow up on bonded neighbors).

def lj_total_elem_excl source · line 235 · raw

@xs:List<&2, 0xdf198d67659100c90a58ecd6b01d034d/protein.Atom> -> @+ys:List<&2, 0xdf198d67659100c90a58ecd6b01d034d/protein.Atom> -> @+c2:F32 -> @+bonds:List<&2, U32> -> F32

def lj_frow_excl source · line 245 · raw

@+si:U32 -> @+pi:0xdf198d67659100c90a58ecd6b01d034d/geom.Vec3 -> @+eps:F32 -> @+sig2:F32 -> @+c2:F32 -> @ys:List<&2, 0xdf198d67659100c90a58ecd6b01d034d/protein.Atom> -> @+bonds:List<&2, U32> -> 0xdf198d67659100c90a58ecd6b01d034d/geom.Vec3

Excluded LJ forces mirror lj_forces, skipping 1-2/1-3 pairs by serial.

def lj_fself_atom_excl source · line 254 · raw

@h:0xdf198d67659100c90a58ecd6b01d034d/protein.Atom -> @si:U32 -> @+ys:List<&2, 0xdf198d67659100c90a58ecd6b01d034d/protein.Atom> -> @+eps:F32 -> @+sig2:F32 -> @+c2:F32 -> @+bonds:List<&2, U32> -> 0xdf198d67659100c90a58ecd6b01d034d/geom.Vec3

def lj_forces_excl source · line 259 · raw

@xs:List<&2, 0xdf198d67659100c90a58ecd6b01d034d/protein.Atom> -> @+ys:List<&2, 0xdf198d67659100c90a58ecd6b01d034d/protein.Atom> -> @+eps:F32 -> @+sig2:F32 -> @+c2:F32 -> @+bonds:List<&2, U32> -> List<&2, 0xdf198d67659100c90a58ecd6b01d034d/geom.Vec3>

def bond_fpair source · line 268 · raw

@+d:0xdf198d67659100c90a58ecd6b01d034d/geom.Vec3 -> @+d2:F32 -> @+k:F32 -> @+r0:F32 -> Pair(0xdf198d67659100c90a58ecd6b01d034d/geom.Vec3, 0xdf198d67659100c90a58ecd6b01d034d/geom.Vec3)

Bond forces: F = -2k(d-r0) * unit(pa-pb) on a, opposite on b; zero for coincident or missing atoms. Per-atom loop over flat bonds.

def bond_fpick source · line 274 · raw

@eqa:Bool -> @eqb:Bool -> @fab:Pair(0xdf198d67659100c90a58ecd6b01d034d/geom.Vec3, 0xdf198d67659100c90a58ecd6b01d034d/geom.Vec3) -> 0xdf198d67659100c90a58ecd6b01d034d/geom.Vec3

def bond_fsas source · line 279 · raw

@+s:U32 -> @sa:U32 -> @sb:U32 -> @+pa:0xdf198d67659100c90a58ecd6b01d034d/geom.Vec3 -> @+pb:0xdf198d67659100c90a58ecd6b01d034d/geom.Vec3 -> @+k:F32 -> @+r0:F32 -> 0xdf198d67659100c90a58ecd6b01d034d/geom.Vec3

def bond_force_look1 source · line 282 · raw

@s:U32 -> @pa:0xdf198d67659100c90a58ecd6b01d034d/geom.Vec3 -> @ea:U32 -> @mb:Maybe<&1, Pair(0xdf198d67659100c90a58ecd6b01d034d/geom.Vec3, U32)> -> @a:U32 -> @b:U32 -> @+k:F32 -> 0xdf198d67659100c90a58ecd6b01d034d/geom.Vec3

def bond_force_look source · line 289 · raw

@s:U32 -> @ma:Maybe<&1, Pair(0xdf198d67659100c90a58ecd6b01d034d/geom.Vec3, U32)> -> @mb:Maybe<&1, Pair(0xdf198d67659100c90a58ecd6b01d034d/geom.Vec3, U32)> -> @a:U32 -> @b:U32 -> @+k:F32 -> 0xdf198d67659100c90a58ecd6b01d034d/geom.Vec3

def bond_force_bond source · line 296 · raw

@+xs:List<&2, 0xdf198d67659100c90a58ecd6b01d034d/protein.Atom> -> @s:U32 -> @+a:U32 -> @+b:U32 -> @+k:F32 -> 0xdf198d67659100c90a58ecd6b01d034d/geom.Vec3

def bond_force_list source · line 299 · raw

@+s:U32 -> @bs:List<&2, U32> -> @+xs:List<&2, 0xdf198d67659100c90a58ecd6b01d034d/protein.Atom> -> @+k:F32 -> 0xdf198d67659100c90a58ecd6b01d034d/geom.Vec3

def bond_forces source · line 308 · raw

@+xs:List<&2, 0xdf198d67659100c90a58ecd6b01d034d/protein.Atom> -> @+bonds:List<&2, U32> -> @+k:F32 -> List<&2, 0xdf198d67659100c90a58ecd6b01d034d/geom.Vec3>

def bond_cut2 source · line 315 · raw

@ei:U32 -> @ej:U32 -> F32

def infer_one source · line 320 · raw

@si:U32 -> @pi:0xdf198d67659100c90a58ecd6b01d034d/geom.Vec3 -> @ei:U32 -> @sj:U32 -> @ej:U32 -> @pj:0xdf198d67659100c90a58ecd6b01d034d/geom.Vec3 -> List<&1, Pair(U32, U32)>

def append_infer source · line 323 · raw

@a:List<&1, Pair(U32, U32)> -> @b:List<&1, Pair(U32, U32)> -> List<&1, Pair(U32, U32)>

def infer_row source · line 330 · raw

@+si:U32 -> @+pi:0xdf198d67659100c90a58ecd6b01d034d/geom.Vec3 -> @+ei:U32 -> @ys:List<&2, 0xdf198d67659100c90a58ecd6b01d034d/protein.Atom> -> List<&1, Pair(U32, U32)>

def infer_total source · line 337 · raw

@+xs:List<&2, 0xdf198d67659100c90a58ecd6b01d034d/protein.Atom> -> List<&1, Pair(U32, U32)>

def bond_neighbors_except_go source · line 347 · raw

@bs:List<&2, U32> -> @+s:U32 -> @+excl:U32 -> @+acc:List<&2, U32> -> List<&2, U32>

Angle auto-derivation from flat bonds: for each bond, fan over the other neighbors of each end. Needs no templates; duplicates across overlapping fans are possible in rings (documented, harmless for boolean use).

def bond_neighbors_except source · line 358 · raw

@s:U32 -> @excl:U32 -> @bs:List<&2, U32> -> List<&2, U32>

def fan_triples source · line 361 · raw

@+x:U32 -> @+y:U32 -> @ns:List<&2, U32> -> List<&1, Pair(U32, Pair(U32, U32))>

def append_triples source · line 368 · raw

@a:List<&1, Pair(U32, Pair(U32, U32))> -> @b:List<&1, Pair(U32, Pair(U32, U32))> -> List<&1, Pair(U32, Pair(U32, U32))>

def angle_fan_both source · line 375 · raw

@+a:U32 -> @+b:U32 -> @+flat:List<&2, U32> -> List<&1, Pair(U32, Pair(U32, U32))>

def angle_triples_flat_go source · line 378 · raw

@bs:List<&2, U32> -> @+flat:List<&2, U32> -> List<&1, Pair(U32, Pair(U32, U32))>

def angle_triples_auto source · line 387 · raw

@+flat:List<&2, U32> -> List<&1, Pair(U32, Pair(U32, U32))>