Subversion Repositories wimsdev

Rev

Rev 6785 | Rev 6787 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 6785 Rev 6786
Line 3735... Line 3735...
3735
static void
3735
static void
3736
get_neighbors (Result, id)
3736
get_neighbors (Result, id)
3737
     int *Result;
3737
     int *Result;
3738
     int id;
3738
     int id;
3739
{
3739
{
3740
  int i = 0;
3740
  int i;
3741
  //neighbor_rec nb_tmp;
3741
  //neighbor_rec nb_tmp;
3742
  int nb_count = 0;
3742
  int nb_count = 0;
3743
  //int FORLIM = n_bonds;
3743
  //int FORLIM = n_bonds;
3744
 
3744
 
3745
  //memset (Result, 0, sizeof (neighbor_rec));
3745
  //memset (Result, 0, sizeof (neighbor_rec));
3746
 
3746
 
3747
  for (i; i < n_bonds; i++)
3747
  for (i = 0; i < n_bonds; i++)
3748
    {
3748
    {
3749
      if (bond[i].a1 == id && atom[bond[i].a2 - 1].heavy
3749
      if (bond[i].a1 == id && atom[bond[i].a2 - 1].heavy
3750
          && nb_count < max_neighbors)
3750
          && nb_count < max_neighbors)
3751
        {
3751
        {
3752
          Result[nb_count++] = bond[i].a2;
3752
          Result[nb_count++] = bond[i].a2;
Line 4023... Line 4023...
4023
  boolean same_ring;
4023
  boolean same_ring;
4024
  ringpath_type tmp_path;
4024
  ringpath_type tmp_path;
4025
  int rc_result;
4025
  int rc_result;
4026
  boolean found_ring;
4026
  boolean found_ring;
4027
  int pl;                       /* new in v0.3 */
4027
  int pl;                       /* new in v0.3 */
4028
  int FORLIM;
4028
  int FORLIM;
4029
 
4029
 
4030
  pl = path_length (n_path);    /* new in v0.3 */
4030
  pl = path_length (n_path);    /* new in v0.3 */
4031
  if (n_rings <= 0)
4031
  if (n_rings <= 0)
4032
    return true;
4032
    return true;
4033
  switch (ringsearch_mode)
4033
  switch (ringsearch_mode)
Line 4454... Line 4454...
4454
      strcpy (nb_el, atom[nb[i] - 1].element);
4454
      strcpy (nb_el, atom[nb[i] - 1].element);
4455
      if (strcmp (nb_el, "C ") && strcmp (nb_el, "A ") && strcmp (nb_el, "H ")  /* &&  strcmp (nb_el, "D ") */
4455
      if (strcmp (nb_el, "C ") && strcmp (nb_el, "A ") && strcmp (nb_el, "H ")  /* &&  strcmp (nb_el, "D ") */
4456
          && strcmp (nb_el, "LP") && strcmp (nb_el, "DU"))
4456
          && strcmp (nb_el, "LP") && strcmp (nb_el, "DU"))
4457
        /* added 'D ' in v0.3n */
4457
        /* added 'D ' in v0.3n */
4458
        hbc++;
4458
        hbc++;
4459
    }
4459
    }
4460
  return hbc;
4460
  return hbc;
4461
}
4461
}
4462
 
4462
 
4463
 
4463
 
4464
static int
4464
static int
4465
hetbond_count (int a)
4465
hetbond_count (int a)
4466
{
4466
{
4467
  int i;
4467
  int i;
4468
  neighbor_rec nb;
4468
  neighbor_rec nb;
4469
  str2 nb_el;
4469
  str2 nb_el;
4470
  float hbc = 0.0;
4470
  float hbc = 0.0;
4471
  int FORLIM;
4471
  int FORLIM;
4472
 
4472
 
4473
  if (a <= 0 || a > n_atoms)
4473
  if (a <= 0 || a > n_atoms)
4474
    return ((int) floor (hbc + 0.5));
4474
    return ((int) floor (hbc + 0.5));
4475
  memset (nb, 0, sizeof (neighbor_rec));
4475
  memset (nb, 0, sizeof (neighbor_rec));
4476
  get_neighbors (nb, a);
4476
  get_neighbors (nb, a);
4477
  if (atom[a - 1].neighbor_count <= 0)
4477
  if (atom[a - 1].neighbor_count <= 0)
4478
    return ((int) floor (hbc + 0.5));
4478
    return ((int) floor (hbc + 0.5));
4479
  FORLIM = atom[a - 1].neighbor_count;
4479
  FORLIM = atom[a - 1].neighbor_count;
4480
  for (i = 0; i < FORLIM; i++)
4480
  for (i = 0; i < FORLIM; i++)
4481
    {
4481
    {
Line 4488... Line 4488...
4488
          if (bond[get_bond (a, nb[i]) - 1].btype == 'A')
4488
          if (bond[get_bond (a, nb[i]) - 1].btype == 'A')
4489
            hbc += 1.5;
4489
            hbc += 1.5;
4490
          if (bond[get_bond (a, nb[i]) - 1].btype == 'D')
4490
          if (bond[get_bond (a, nb[i]) - 1].btype == 'D')
4491
            hbc += 2.0;
4491
            hbc += 2.0;
4492
          if (bond[get_bond (a, nb[i]) - 1].btype == 'T')
4492
          if (bond[get_bond (a, nb[i]) - 1].btype == 'T')
4493
            hbc += 3.0;
4493
            hbc += 3.0;
4494
        }
4494
        }
4495
    }
4495
    }
4496
  return ((int) floor (hbc + 0.5));
4496
  return ((int) floor (hbc + 0.5));
4497
}
4497
}
4498
 
4498
 
4499
 
4499
 
4500
static int
4500
static int
4501
hetatom_count (int a)
4501
hetatom_count (int a)
4502
{
4502
{
4503
  int i;
4503
  int i;
4504
  neighbor_rec nb;
4504
  neighbor_rec nb;
4505
  str2 nb_el;
4505
  str2 nb_el;
4506
  int hac = 0;
4506
  int hac = 0;
4507
  int FORLIM;
4507
  int FORLIM;
4508
 
4508
 
4509
  if (a <= 0 || a > n_atoms)
4509
  if (a <= 0 || a > n_atoms)
4510
    return hac;
4510
    return hac;
4511
  memset (nb, 0, sizeof (neighbor_rec));
4511
  memset (nb, 0, sizeof (neighbor_rec));
4512
  get_neighbors (nb, a);
4512
  get_neighbors (nb, a);
4513
  if (atom[a - 1].neighbor_count <= 0)
4513
  if (atom[a - 1].neighbor_count <= 0)
4514
    return hac;
4514
    return hac;
4515
  FORLIM = atom[a - 1].neighbor_count;
4515
  FORLIM = atom[a - 1].neighbor_count;
4516
  for (i = 0; i < FORLIM; i++)
4516
  for (i = 0; i < FORLIM; i++)
4517
    {
4517
    {
4518
      strcpy (nb_el, atom[nb[i] - 1].element);
4518
      strcpy (nb_el, atom[nb[i] - 1].element);
4519
      if (strcmp (nb_el, "C ") && strcmp (nb_el, "H ")
4519
      if (strcmp (nb_el, "C ") && strcmp (nb_el, "H ")
4520
          /*&&  strcmp (nb_el, "D ") */  && strcmp (nb_el, "LP")
4520
          /*&&  strcmp (nb_el, "D ") */  && strcmp (nb_el, "LP")
4521
          && strcmp (nb_el, "DU"))
4521
          && strcmp (nb_el, "DU"))
4522
        /* added 'D ' in v0.3n */
4522
        /* added 'D ' in v0.3n */
4523
        hac++;
4523
        hac++;
4524
    }
4524
    }
4525
  return hac;
4525
  return hac;
4526
}
4526
}
4527
 
4527
 
4528
#if 0
4528
#if 0
4529
static int
4529
static int
4530
ndl_hetbond_count (int a)
4530
ndl_hetbond_count (int a)
4531
{
4531
{
4532
  int i;
4532
  int i;
Line 4535... Line 4535...
4535
  float hbc = 0.0;
4535
  float hbc = 0.0;
4536
  int FORLIM;
4536
  int FORLIM;
4537
 
4537
 
4538
  if (a <= 0 || a > n_atoms)
4538
  if (a <= 0 || a > n_atoms)
4539
    return ((int) floor (hbc + 0.5));
4539
    return ((int) floor (hbc + 0.5));
4540
  memset (nb, 0, sizeof (neighbor_rec));
4540
  memset (nb, 0, sizeof (neighbor_rec));
4541
  get_ndl_neighbors (nb, a);
4541
  get_ndl_neighbors (nb, a);
4542
  if (ndl_atom[a - 1].neighbor_count <= 0)
4542
  if (ndl_atom[a - 1].neighbor_count <= 0)
4543
    return ((int) floor (hbc + 0.5));
4543
    return ((int) floor (hbc + 0.5));
4544
  FORLIM = ndl_atom[a - 1].neighbor_count;
4544
  FORLIM = ndl_atom[a - 1].neighbor_count;
4545
  for (i = 0; i < FORLIM; i++)
4545
  for (i = 0; i < FORLIM; i++)
4546
    {
4546
    {
4547
      strcpy (nb_el, ndl_atom[nb[i] - 1].element);
4547
      strcpy (nb_el, ndl_atom[nb[i] - 1].element);
4548
      if (strcmp (nb_el, "C ") && strcmp (nb_el, "H ")
4548
      if (strcmp (nb_el, "C ") && strcmp (nb_el, "H ")
4549
          /*&&  strcmp (nb_el, "D ") */  && strcmp (nb_el, "LP")
4549
          /*&&  strcmp (nb_el, "D ") */  && strcmp (nb_el, "LP")
Line 4556... Line 4556...
4556
          if (ndl_bond[get_ndl_bond (a, nb[i]) - 1].btype == 'D')
4556
          if (ndl_bond[get_ndl_bond (a, nb[i]) - 1].btype == 'D')
4557
            hbc += 2.0;
4557
            hbc += 2.0;
4558
          if (ndl_bond[get_ndl_bond (a, nb[i]) - 1].btype == 'T')
4558
          if (ndl_bond[get_ndl_bond (a, nb[i]) - 1].btype == 'T')
4559
            hbc += 3.0;
4559
            hbc += 3.0;
4560
        }
4560
        }
4561
    }
4561
    }
4562
  return ((int) floor (hbc + 0.5));
4562
  return ((int) floor (hbc + 0.5));
4563
}
4563
}
4564
#endif
4564
#endif
4565
 
4565
 
4566
static int
4566
static int
Line 4591... Line 4591...
4591
}
4591
}
4592
 
4592
 
4593
 
4593
 
4594
static boolean
4594
static boolean
4595
is_oxo_C (int id)
4595
is_oxo_C (int id)
4596
{
4596
{
4597
  boolean Result;
-
 
4598
  int i;
4597
  int i;
4599
  boolean r = false;
4598
  boolean r = false;
4600
  neighbor_rec nb;
4599
  neighbor_rec nb;
4601
  int FORLIM;
4600
  int FORLIM;
4602
 
4601
 
4603
  memset (nb, 0, sizeof (neighbor_rec));
4602
  memset (nb, 0, sizeof (neighbor_rec));
4604
  if (id < 1 || id > n_atoms)
4603
  if (id < 1 || id > n_atoms)
4605
    return Result;
4604
    return false;
4606
  get_neighbors (nb, id);
4605
  get_neighbors (nb, id);
4607
  if (strcmp (atom[id - 1].element, "C ") || atom[id - 1].neighbor_count <= 0)
4606
  if (strcmp (atom[id - 1].element, "C ") || atom[id - 1].neighbor_count <= 0)
4608
    return false;
4607
    return false;
4609
  FORLIM = atom[id - 1].neighbor_count;
4608
  FORLIM = atom[id - 1].neighbor_count;
4610
  for (i = 0; i < FORLIM; i++)
4609
  for (i = 0; i < FORLIM; i++)
Line 4621... Line 4620...
4621
}
4620
}
4622
 
4621
 
4623
 
4622
 
4624
static boolean
4623
static boolean
4625
is_thioxo_C (int id)
4624
is_thioxo_C (int id)
4626
{
4625
{
4627
  boolean Result;
-
 
4628
  int i;
4626
  int i;
4629
  boolean r = false;
4627
  boolean r = false;
4630
  neighbor_rec nb;
4628
  neighbor_rec nb;
4631
  int FORLIM;
4629
  int FORLIM;
4632
 
4630
 
4633
  memset (nb, 0, sizeof (neighbor_rec));
4631
  memset (nb, 0, sizeof (neighbor_rec));
4634
  if (id < 1 || id > n_atoms)
4632
  if (id < 1 || id > n_atoms)
4635
    return Result;
4633
    return false;
4636
  get_neighbors (nb, id);
4634
  get_neighbors (nb, id);
4637
  if (strcmp (atom[id - 1].element, "C ") || atom[id - 1].neighbor_count <= 0)
4635
  if (strcmp (atom[id - 1].element, "C ") || atom[id - 1].neighbor_count <= 0)
4638
    return false;
4636
    return false;
4639
  FORLIM = atom[id - 1].neighbor_count;
4637
  FORLIM = atom[id - 1].neighbor_count;
4640
  for (i = 0; i < FORLIM; i++)
4638
  for (i = 0; i < FORLIM; i++)
4641
    {
4639
    {
4642
      if (bond[get_bond (id, nb[i]) - 1].btype == 'D' &&
4640
      if (bond[get_bond (id, nb[i]) - 1].btype == 'D' &&
4643
          (!strcmp (atom[nb[i] - 1].element, "S ") ||
4641
          (!strcmp (atom[nb[i] - 1].element, "S ") ||
4644
           !strcmp (atom[nb[i] - 1].element, "SE")))
4642
           !strcmp (atom[nb[i] - 1].element, "SE")))
4645
        /* no N, amidines are different... */
4643
        /* no N, amidines are different... */
4646
        r = true;
4644
        r = true;
4647
    }
4645
    }
4648
  return r;
4646
  return r;
4649
}
4647
}
4650
 
4648
 
4651
 
4649
 
4652
static boolean
4650
static boolean
4653
is_imino_C (int id)
4651
is_imino_C (int id)
4654
{
4652
{
4655
  boolean Result;
-
 
4656
  int i;
4653
  int i;
4657
  boolean r = false;
4654
  boolean r = false;
4658
  neighbor_rec nb;
4655
  neighbor_rec nb;
4659
  int FORLIM;
4656
  int FORLIM;
4660
 
4657
 
4661
  memset (nb, 0, sizeof (neighbor_rec));
4658
  memset (nb, 0, sizeof (neighbor_rec));
4662
  if (id < 1 || id > n_atoms)
4659
  if (id < 1 || id > n_atoms)
4663
    return Result;
4660
    return false;
4664
  get_neighbors (nb, id);
4661
  get_neighbors (nb, id);
4665
  if (strcmp (atom[id - 1].element, "C ") || atom[id - 1].neighbor_count <= 0)
4662
  if (strcmp (atom[id - 1].element, "C ") || atom[id - 1].neighbor_count <= 0)
4666
    return false;
4663
    return false;
4667
  FORLIM = atom[id - 1].neighbor_count;
4664
  FORLIM = atom[id - 1].neighbor_count;
4668
  for (i = 0; i < FORLIM; i++)
4665
  for (i = 0; i < FORLIM; i++)
4669
    {
4666
    {
4670
      if (bond[get_bond (id, nb[i]) - 1].btype == 'D' &&
4667
      if (bond[get_bond (id, nb[i]) - 1].btype == 'D' &&
Line 4672... Line 4669...
4672
        r = true;
4669
        r = true;
4673
    }
4670
    }
4674
  return r;
4671
  return r;
4675
}
4672
}
4676
 
4673
 
4677
 
4674
 
4678
static boolean
4675
static boolean
4679
is_true_imino_C (int id)
4676
is_true_imino_C (int id)
4680
{
4677
{
4681
  boolean Result;
-
 
4682
  int i;
4678
  int i;
4683
  boolean r = true;
4679
  boolean r = true;
4684
  neighbor_rec nb;
4680
  neighbor_rec nb;
4685
  str2 nb_el;
4681
  str2 nb_el;
4686
  int a_n = 0;
4682
  int a_n = 0;
4687
  int b;                        /* v0.3j */
4683
  int b;                        /* v0.3j */
4688
  int FORLIM;
4684
  int FORLIM;
4689
 
4685
 
4690
/* p2c: checkmol.pas: Note: Eliminated unused assignment statement [338] */
4686
/* p2c: checkmol.pas: Note: Eliminated unused assignment statement [338] */
4691
  memset (nb, 0, sizeof (neighbor_rec));
4687
  memset (nb, 0, sizeof (neighbor_rec));
4692
  if (id < 1 || id > n_atoms)
4688
  if (id < 1 || id > n_atoms)
4693
    return Result;
4689
    return false;
4694
  get_neighbors (nb, id);
4690
  get_neighbors (nb, id);
4695
  if (strcmp (atom[id - 1].element, "C ") || atom[id - 1].neighbor_count <= 0)
4691
  if (strcmp (atom[id - 1].element, "C ") || atom[id - 1].neighbor_count <= 0)
4696
    return false;
4692
    return false;
4697
  FORLIM = atom[id - 1].neighbor_count;
4693
  FORLIM = atom[id - 1].neighbor_count;
4698
  for (i = 0; i < FORLIM; i++)
4694
  for (i = 0; i < FORLIM; i++)
4699
    {
4695
    {
4700
      b = get_bond (id, nb[i]); /* v0.3j */
4696
      b = get_bond (id, nb[i]); /* v0.3j */
4701
      if (bond[b - 1].btype == 'D' && bond[b - 1].arom == false &&
4697
      if (bond[b - 1].btype == 'D' && bond[b - 1].arom == false &&
4702
          !strcmp (atom[nb[i] - 1].element, "N "))
4698
          !strcmp (atom[nb[i] - 1].element, "N "))
4703
        /* v0.3j */
4699
        /* v0.3j */
4704
        a_n = nb[i];
4700
        a_n = nb[i];
Line 4728... Line 4724...
4728
  int i, j;
4724
  int i, j;
4729
  boolean r = false;
4725
  boolean r = false;
4730
  neighbor_rec nb;
4726
  neighbor_rec nb;
4731
  ringpath_type testring;
4727
  ringpath_type testring;
4732
  int ring_size, b, FORLIM;
4728
  int ring_size, b, FORLIM;
4733
 
4729
 
4734
  memset (nb, 0, sizeof (neighbor_rec));
4730
  memset (nb, 0, sizeof (neighbor_rec));
4735
  if (id < 1 || id > n_atoms)
4731
  if (id < 1 || id > n_atoms)
4736
    return Result;
4732
    return Result;
4737
  get_neighbors (nb, id);
4733
  get_neighbors (nb, id);
4738
  memset (testring, 0, sizeof (ringpath_type));
4734
  memset (testring, 0, sizeof (ringpath_type));
4739
  ring_size = ringprop[r_id - 1].size;  /* v0.3j */
4735
  ring_size = ringprop[r_id - 1].size;  /* v0.3j */
4740
  for (j = 0; j < ring_size; j++)       /* v0.3j */
4736
  for (j = 0; j < ring_size; j++)       /* v0.3j */
4741
    testring[j] = ring[r_id - 1][j];
4737
    testring[j] = ring[r_id - 1][j];
4742
  if (strcmp (atom[id - 1].element, "C ") || atom[id - 1].neighbor_count <= 0)
4738
  if (strcmp (atom[id - 1].element, "C ") || atom[id - 1].neighbor_count <= 0)
4743
    return false;
4739
    return false;
4744
  FORLIM = atom[id - 1].neighbor_count;
4740
  FORLIM = atom[id - 1].neighbor_count;
4745
  for (i = 0; i < FORLIM; i++)
4741
  for (i = 0; i < FORLIM; i++)
4746
    {
4742
    {
4747
      b = get_bond (id, nb[i]);
4743
      b = get_bond (id, nb[i]);
4748
      if (bond[b - 1].btype == 'D' && bond[b - 1].arom == false &&
4744
      if (bond[b - 1].btype == 'D' && bond[b - 1].arom == false &&
4749
          !strcmp (atom[nb[i] - 1].element, "N "))
4745
          !strcmp (atom[nb[i] - 1].element, "N "))
4750
        {
4746
        {
4751
          r = true;
4747
          r = true;
Line 4771... Line 4767...
4771
  int ring_size, FORLIM;
4767
  int ring_size, FORLIM;
4772
 
4768
 
4773
  memset (nb, 0, sizeof (neighbor_rec));
4769
  memset (nb, 0, sizeof (neighbor_rec));
4774
  if (id < 1 || id > n_atoms)
4770
  if (id < 1 || id > n_atoms)
4775
    return Result;
4771
    return Result;
4776
  get_neighbors (nb, id);
4772
  get_neighbors (nb, id);
4777
  memset (testring, 0, sizeof (ringpath_type));
4773
  memset (testring, 0, sizeof (ringpath_type));
4778
  ring_size = ringprop[r_id - 1].size;  /* v0.3j */
4774
  ring_size = ringprop[r_id - 1].size;  /* v0.3j */
4779
  for (j = 0; j < ring_size; j++)       /* v0.3j */
4775
  for (j = 0; j < ring_size; j++)       /* v0.3j */
4780
    testring[j] = ring[r_id - 1][j];
4776
    testring[j] = ring[r_id - 1][j];
4781
  if (strcmp (atom[id - 1].element, "C ") || atom[id - 1].neighbor_count <= 0)
4777
  if (strcmp (atom[id - 1].element, "C ") || atom[id - 1].neighbor_count <= 0)
4782
    return false;
4778
    return false;
4783
  FORLIM = atom[id - 1].neighbor_count;
4779
  FORLIM = atom[id - 1].neighbor_count;
4784
  for (i = 0; i < FORLIM; i++)
4780
  for (i = 0; i < FORLIM; i++)
4785
    {
4781
    {
4786
      if (bond[get_bond (id, nb[i]) - 1].btype == 'D' &&
4782
      if (bond[get_bond (id, nb[i]) - 1].btype == 'D' &&
4787
          !strcmp (atom[nb[i] - 1].element, "N "))
4783
          !strcmp (atom[nb[i] - 1].element, "N "))
Line 4789... Line 4785...
4789
          r = true;
4785
          r = true;
4790
          for (j = 0; j < ring_size; j++)
4786
          for (j = 0; j < ring_size; j++)
4791
            {
4787
            {
4792
              if (nb[i] == ring[r_id - 1][j])
4788
              if (nb[i] == ring[r_id - 1][j])
4793
                r = false;
4789
                r = false;
4794
            }
4790
            }
4795
        }
4791
        }
4796
    }
4792
    }
4797
  return r;
4793
  return r;
4798
}
4794
}
4799
 
4795
 
4800
 
4796
 
4801
static int
4797
static int
4802
find_exocyclic_methylene_C (int id, int r_id)
4798
find_exocyclic_methylene_C (int id, int r_id)
4803
{
4799
{
4804
  /* renamed and rewritten in v0.3j */
4800
  /* renamed and rewritten in v0.3j */
4805
  int i, j;
4801
  int i, j;
Line 4829... Line 4825...
4829
            {
4825
            {
4830
              if (nb[i] == ring[r_id - 1][j])
4826
              if (nb[i] == ring[r_id - 1][j])
4831
                r = 0;
4827
                r = 0;
4832
            }
4828
            }
4833
        }
4829
        }
4834
    }
4830
    }
4835
  return r;
4831
  return r;
4836
}
4832
}
4837
 
4833
 
4838
 
4834
 
4839
static boolean
4835
static boolean
4840
is_hydroxy (int a_view, int a_ref)
4836
is_hydroxy (int a_view, int a_ref)
4841
{
4837
{
4842
  boolean r = false;
4838
  boolean r = false;
4843
 
4839
 
4844
  if (atom[a_view - 1].
4840
  if (atom[a_view - 1].
4845
      heavy && (bond[get_bond (a_view, a_ref) - 1].btype == 'S'))
4841
      heavy && (bond[get_bond (a_view, a_ref) - 1].btype == 'S'))
4846
    {
4842
    {
4847
      if (!strcmp (atom[a_ref - 1].atype, "O3 ") &&
4843
      if (!strcmp (atom[a_ref - 1].atype, "O3 ") &&
4848
          atom[a_ref - 1].neighbor_count == 1)
4844
          atom[a_ref - 1].neighbor_count == 1)
4849
        r = true;
4845
        r = true;
4850
    }
4846
    }
4851
  return r;
4847
  return r;
4852
}
4848
}
4853
 
4849
 
4854
 
4850
 
4855
static boolean
4851
static boolean
4856
is_sulfanyl (int a_view, int a_ref)
4852
is_sulfanyl (int a_view, int a_ref)
4857
{
4853
{
4858
  boolean r = false;
4854
  boolean r = false;
4859
 
4855
 
Line 4885... Line 4881...
4885
}
4881
}
4886
 
4882
 
4887
 
4883
 
4888
static boolean
4884
static boolean
4889
is_alkyl (int a_view, int a_ref)
4885
is_alkyl (int a_view, int a_ref)
4890
{
4886
{
4891
  int i;
4887
  int i;
4892
  boolean r = false;
4888
  boolean r = false;
4893
  neighbor_rec nb;
4889
  neighbor_rec nb;
4894
  str2 nb_el;
4890
  str2 nb_el;
4895
  int het_count = 0;
4891
  int het_count = 0;
4896
  int FORLIM;
4892
  int FORLIM;
4897
 
4893
 
4898
  memset (nb, 0, sizeof (neighbor_rec));
4894
  memset (nb, 0, sizeof (neighbor_rec));
4899
  if (!
4895
  if (!
4900
      (atom[a_view - 1].
4896
      (atom[a_view - 1].
4901
       heavy && (bond[get_bond (a_view, a_ref) - 1].btype == 'S'))
4897
       heavy && (bond[get_bond (a_view, a_ref) - 1].btype == 'S'))
4902
      || strcmp (atom[a_ref - 1].atype, "C3 ")
4898
      || strcmp (atom[a_ref - 1].atype, "C3 ")
4903
      || atom[a_ref - 1].arom != false)
4899
      || atom[a_ref - 1].arom != false)
4904
    return false;
4900
    return false;
4905
  get_nextneighbors (nb, a_ref, a_view);
4901
  get_nextneighbors (nb, a_ref, a_view);
4906
  FORLIM = atom[a_ref - 1].neighbor_count - 2;
4902
  FORLIM = atom[a_ref - 1].neighbor_count - 2;
4907
  for (i = 0; i <= FORLIM; i++)
4903
  for (i = 0; i <= FORLIM; i++)
4908
    {
4904
    {
4909
      strcpy (nb_el, atom[nb[i] - 1].element);
4905
      strcpy (nb_el, atom[nb[i] - 1].element);
4910
      if (strcmp (nb_el, "C ") && strcmp (nb_el, "H ")
4906
      if (strcmp (nb_el, "C ") && strcmp (nb_el, "H ")
4911
          /*&&  strcmp (nb_el, "D ") */  && strcmp (nb_el, "DU")
4907
          /*&&  strcmp (nb_el, "D ") */  && strcmp (nb_el, "DU")
4912
          && strcmp (nb_el, "LP"))
4908
          && strcmp (nb_el, "LP"))
Line 4919... Line 4915...
4919
}
4915
}
4920
 
4916
 
4921
 
4917
 
4922
static boolean
4918
static boolean
4923
is_true_alkyl (int a_view, int a_ref)
4919
is_true_alkyl (int a_view, int a_ref)
4924
{
4920
{
4925
  int i;
4921
  int i;
4926
  boolean r = false;
4922
  boolean r = false;
4927
  neighbor_rec nb;
4923
  neighbor_rec nb;
4928
  str2 nb_el;
4924
  str2 nb_el;
4929
  int het_count = 0;
4925
  int het_count = 0;
4930
  int FORLIM;
4926
  int FORLIM;
4931
 
4927
 
4932
  memset (nb, 0, sizeof (neighbor_rec));
4928
  memset (nb, 0, sizeof (neighbor_rec));
4933
  if (!
4929
  if (!
4934
      (atom[a_view - 1].
4930
      (atom[a_view - 1].
4935
       heavy && (bond[get_bond (a_view, a_ref) - 1].btype == 'S'))
4931
       heavy && (bond[get_bond (a_view, a_ref) - 1].btype == 'S'))
4936
      || strcmp (atom[a_ref - 1].atype, "C3 ")
4932
      || strcmp (atom[a_ref - 1].atype, "C3 ")
4937
      || atom[a_ref - 1].arom != false)
4933
      || atom[a_ref - 1].arom != false)
4938
    return false;
4934
    return false;
4939
  get_nextneighbors (nb, a_ref, a_view);
4935
  get_nextneighbors (nb, a_ref, a_view);
4940
  FORLIM = atom[a_ref - 1].neighbor_count - 2;
4936
  FORLIM = atom[a_ref - 1].neighbor_count - 2;
4941
  for (i = 0; i <= FORLIM; i++)
4937
  for (i = 0; i <= FORLIM; i++)
4942
    {
4938
    {
4943
      strcpy (nb_el, atom[nb[i] - 1].element);
4939
      strcpy (nb_el, atom[nb[i] - 1].element);
4944
      if (strcmp (nb_el, "C ") && strcmp (nb_el, "H ")
4940
      if (strcmp (nb_el, "C ") && strcmp (nb_el, "H ")
4945
          /*&&  strcmp (nb_el, "D ") */  && strcmp (nb_el, "DU"))
4941
          /*&&  strcmp (nb_el, "D ") */  && strcmp (nb_el, "DU"))
4946
        /* added 'D ' in v0.3n */
4942
        /* added 'D ' in v0.3n */
4947
        het_count++;
4943
        het_count++;
4948
    }
4944
    }
4949
  if (het_count == 0)           /* */
4945
  if (het_count == 0)           /* */
Line 4994... Line 4990...
4994
}
4990
}
4995
 
4991
 
4996
 
4992
 
4997
static boolean
4993
static boolean
4998
is_alkynyl (int a_view, int a_ref)
4994
is_alkynyl (int a_view, int a_ref)
4999
{
4995
{
5000
  /* new in v0.3j */
4996
  /* new in v0.3j */
5001
  int i;
4997
  int i;
5002
  boolean r = false;
4998
  boolean r = false;
5003
  neighbor_rec nb;
4999
  neighbor_rec nb;
5004
  str3 nb_at;
5000
  str3 nb_at;
Line 5040... Line 5036...
5040
}
5036
}
5041
 
5037
 
5042
 
5038
 
5043
static boolean
5039
static boolean
5044
is_alkoxy (int a_view, int a_ref)
5040
is_alkoxy (int a_view, int a_ref)
5045
{
5041
{
5046
  boolean r = false;
5042
  boolean r = false;
5047
  neighbor_rec nb;
5043
  neighbor_rec nb;
5048
 
5044
 
5049
  memset (nb, 0, sizeof (neighbor_rec));
5045
  memset (nb, 0, sizeof (neighbor_rec));
5050
  if (!
5046
  if (!
5051
      (atom[a_view - 1].
5047
      (atom[a_view - 1].
5052
       heavy && (bond[get_bond (a_view, a_ref) - 1].btype == 'S')))
5048
       heavy && (bond[get_bond (a_view, a_ref) - 1].btype == 'S')))
5053
    return false;
5049
    return false;
5054
  if (strcmp (atom[a_ref - 1].atype, "O3 ")
5050
  if (strcmp (atom[a_ref - 1].atype, "O3 ")
5055
      || atom[a_ref - 1].neighbor_count != 2)
5051
      || atom[a_ref - 1].neighbor_count != 2)
5056
    return false;
5052
    return false;
5057
  get_nextneighbors (nb, a_ref, a_view);
5053
  get_nextneighbors (nb, a_ref, a_view);
5058
  if (is_alkyl (a_ref, nb[0]))
5054
  if (is_alkyl (a_ref, nb[0]))
5059
    r = true;
5055
    r = true;
5060
  return r;
5056
  return r;
5061
}
5057
}
5062
 
5058
 
5063
 
5059
 
5064
static boolean
5060
static boolean
5065
is_siloxy (int a_view, int a_ref)
5061
is_siloxy (int a_view, int a_ref)
5066
{
5062
{
5067
  boolean r = false;
5063
  boolean r = false;
5068
  neighbor_rec nb;
5064
  neighbor_rec nb;
5069
 
5065
 
5070
  memset (nb, 0, sizeof (neighbor_rec));
5066
  memset (nb, 0, sizeof (neighbor_rec));
5071
  if (!
5067
  if (!
5072
      (atom[a_view - 1].
5068
      (atom[a_view - 1].
5073
       heavy && (bond[get_bond (a_view, a_ref) - 1].btype == 'S')))
5069
       heavy && (bond[get_bond (a_view, a_ref) - 1].btype == 'S')))
5074
    return false;
5070
    return false;
5075
  if (strcmp (atom[a_ref - 1].atype, "O3 ")
5071
  if (strcmp (atom[a_ref - 1].atype, "O3 ")
5076
      || atom[a_ref - 1].neighbor_count != 2)
5072
      || atom[a_ref - 1].neighbor_count != 2)
5077
    return false;
5073
    return false;
Line 5079... Line 5075...
5079
  if (!strcmp (atom[nb[0] - 1].element, "SI"))
5075
  if (!strcmp (atom[nb[0] - 1].element, "SI"))
5080
    r = true;
5076
    r = true;
5081
  return r;
5077
  return r;
5082
}
5078
}
5083
 
5079
 
5084
 
5080
 
5085
static boolean
5081
static boolean
5086
is_true_alkoxy (int a_view, int a_ref)
5082
is_true_alkoxy (int a_view, int a_ref)
5087
{
5083
{
5088
  boolean r = false;
5084
  boolean r = false;
5089
  neighbor_rec nb;
5085
  neighbor_rec nb;
5090
 
5086
 
5091
  memset (nb, 0, sizeof (neighbor_rec));
5087
  memset (nb, 0, sizeof (neighbor_rec));
5092
  if (!
5088
  if (!
5093
      (atom[a_view - 1].
5089
      (atom[a_view - 1].
5094
       heavy && (bond[get_bond (a_view, a_ref) - 1].btype == 'S')))
5090
       heavy && (bond[get_bond (a_view, a_ref) - 1].btype == 'S')))
5095
    return false;
5091
    return false;
5096
  if (strcmp (atom[a_ref - 1].atype, "O3 ")
5092
  if (strcmp (atom[a_ref - 1].atype, "O3 ")
5097
      || atom[a_ref - 1].neighbor_count != 2)
5093
      || atom[a_ref - 1].neighbor_count != 2)
5098
    return false;
5094
    return false;
5099
  get_nextneighbors (nb, a_ref, a_view);
5095
  get_nextneighbors (nb, a_ref, a_view);
5100
  if (is_true_alkyl (a_ref, nb[0]))
5096
  if (is_true_alkyl (a_ref, nb[0]))
5101
    r = true;
5097
    r = true;
5102
  return r;
5098
  return r;
5103
}
5099
}
5104
 
5100
 
5105
 
5101
 
5106
static boolean
5102
static boolean
5107
is_aryloxy (int a_view, int a_ref)
5103
is_aryloxy (int a_view, int a_ref)
5108
{
5104
{
5109
  boolean r = false;
5105
  boolean r = false;
5110
  neighbor_rec nb;
5106
  neighbor_rec nb;
5111
 
5107
 
5112
  memset (nb, 0, sizeof (neighbor_rec));
5108
  memset (nb, 0, sizeof (neighbor_rec));
5113
  if (!
5109
  if (!
5114
      (atom[a_view - 1].
5110
      (atom[a_view - 1].
5115
       heavy && (bond[get_bond (a_view, a_ref) - 1].btype == 'S')))
5111
       heavy && (bond[get_bond (a_view, a_ref) - 1].btype == 'S')))
5116
    return false;
5112
    return false;
5117
  if (strcmp (atom[a_ref - 1].atype, "O3 ")
5113
  if (strcmp (atom[a_ref - 1].atype, "O3 ")
5118
      || atom[a_ref - 1].neighbor_count != 2)
5114
      || atom[a_ref - 1].neighbor_count != 2)
5119
    return false;
5115
    return false;
5120
  get_nextneighbors (nb, a_ref, a_view);
5116
  get_nextneighbors (nb, a_ref, a_view);
5121
  if (is_aryl (a_ref, nb[0]))
5117
  if (is_aryl (a_ref, nb[0]))
5122
    r = true;
5118
    r = true;
5123
  return r;
5119
  return r;
5124
}
5120
}
5125
 
5121
 
5126
 
5122
 
5127
static boolean
5123
static boolean
5128
is_alkenyloxy (int a_view, int a_ref)
5124
is_alkenyloxy (int a_view, int a_ref)
5129
{
5125
{
5130
  /* v0.3j */
5126
  /* v0.3j */
5131
  boolean r = false;
5127
  boolean r = false;
Line 5133... Line 5129...
5133
 
5129
 
5134
  memset (nb, 0, sizeof (neighbor_rec));
5130
  memset (nb, 0, sizeof (neighbor_rec));
5135
  if (!
5131
  if (!
5136
      (atom[a_view - 1].
5132
      (atom[a_view - 1].
5137
       heavy && (bond[get_bond (a_view, a_ref) - 1].btype == 'S')))
5133
       heavy && (bond[get_bond (a_view, a_ref) - 1].btype == 'S')))
5138
    return false;
5134
    return false;
5139
  if (strcmp (atom[a_ref - 1].atype, "O3 ")
5135
  if (strcmp (atom[a_ref - 1].atype, "O3 ")
5140
      || atom[a_ref - 1].neighbor_count != 2)
5136
      || atom[a_ref - 1].neighbor_count != 2)
5141
    return false;
5137
    return false;
5142
  get_nextneighbors (nb, a_ref, a_view);
5138
  get_nextneighbors (nb, a_ref, a_view);
5143
  if (is_alkenyl (a_ref, nb[0]))
5139
  if (is_alkenyl (a_ref, nb[0]))
5144
    r = true;
5140
    r = true;
5145
  return r;
5141
  return r;
5146
}
5142
}
5147
 
5143
 
5148
 
5144
 
5149
static boolean
5145
static boolean
Line 5157... Line 5153...
5157
  if (!
5153
  if (!
5158
      (atom[a_view - 1].
5154
      (atom[a_view - 1].
5159
       heavy && (bond[get_bond (a_view, a_ref) - 1].btype == 'S')))
5155
       heavy && (bond[get_bond (a_view, a_ref) - 1].btype == 'S')))
5160
    return false;
5156
    return false;
5161
  if (strcmp (atom[a_ref - 1].atype, "O3 ")
5157
  if (strcmp (atom[a_ref - 1].atype, "O3 ")
5162
      || atom[a_ref - 1].neighbor_count != 2)
5158
      || atom[a_ref - 1].neighbor_count != 2)
5163
    return false;
5159
    return false;
5164
  get_nextneighbors (nb, a_ref, a_view);
5160
  get_nextneighbors (nb, a_ref, a_view);
5165
  if (is_alkynyl (a_ref, nb[0]))
5161
  if (is_alkynyl (a_ref, nb[0]))
5166
    r = true;
5162
    r = true;
5167
  return r;
5163
  return r;
Line 5189... Line 5185...
5189
}
5185
}
5190
 
5186
 
5191
 
5187
 
5192
static boolean
5188
static boolean
5193
is_true_alkylsulfanyl (int a_view, int a_ref)
5189
is_true_alkylsulfanyl (int a_view, int a_ref)
5194
{
5190
{
5195
  boolean r = false;
5191
  boolean r = false;
5196
  neighbor_rec nb;
5192
  neighbor_rec nb;
5197
 
5193
 
5198
  memset (nb, 0, sizeof (neighbor_rec));
5194
  memset (nb, 0, sizeof (neighbor_rec));
5199
  if (!
5195
  if (!
5200
      (atom[a_view - 1].
5196
      (atom[a_view - 1].
5201
       heavy && (bond[get_bond (a_view, a_ref) - 1].btype == 'S')))
5197
       heavy && (bond[get_bond (a_view, a_ref) - 1].btype == 'S')))
5202
    return false;
5198
    return false;
5203
  if (strcmp (atom[a_ref - 1].atype, "S3 ")
5199
  if (strcmp (atom[a_ref - 1].atype, "S3 ")
5204
      || atom[a_ref - 1].neighbor_count != 2)
5200
      || atom[a_ref - 1].neighbor_count != 2)
5205
    return false;
5201
    return false;
5206
  get_nextneighbors (nb, a_ref, a_view);
5202
  get_nextneighbors (nb, a_ref, a_view);
5207
  if (is_true_alkyl (a_ref, nb[0]))
5203
  if (is_true_alkyl (a_ref, nb[0]))
5208
    r = true;
5204
    r = true;
5209
  return r;
5205
  return r;
5210
}
5206
}
5211
 
5207
 
5212
 
5208
 
5213
static boolean
5209
static boolean
5214
is_arylsulfanyl (int a_view, int a_ref)
5210
is_arylsulfanyl (int a_view, int a_ref)
5215
{
5211
{
5216
  boolean r = false;
5212
  boolean r = false;
Line 5218... Line 5214...
5218
 
5214
 
5219
  memset (nb, 0, sizeof (neighbor_rec));
5215
  memset (nb, 0, sizeof (neighbor_rec));
5220
  if (!
5216
  if (!
5221
      (atom[a_view - 1].
5217
      (atom[a_view - 1].
5222
       heavy && (bond[get_bond (a_view, a_ref) - 1].btype == 'S')))
5218
       heavy && (bond[get_bond (a_view, a_ref) - 1].btype == 'S')))
5223
    return false;
5219
    return false;
5224
  if (strcmp (atom[a_ref - 1].atype, "S3 ")
5220
  if (strcmp (atom[a_ref - 1].atype, "S3 ")
5225
      || atom[a_ref - 1].neighbor_count != 2)
5221
      || atom[a_ref - 1].neighbor_count != 2)
5226
    return false;
5222
    return false;
5227
  get_nextneighbors (nb, a_ref, a_view);
5223
  get_nextneighbors (nb, a_ref, a_view);
5228
  if (is_aryl (a_ref, nb[0]))
5224
  if (is_aryl (a_ref, nb[0]))
5229
    r = true;
5225
    r = true;
5230
  return r;
5226
  return r;
5231
}
5227
}
5232
 
5228
 
5233
 
5229
 
5234
static boolean
5230
static boolean
5235
is_alkenylsulfanyl (a_view, a_ref)
5231
is_alkenylsulfanyl (a_view, a_ref)
5236
     int a_view, a_ref;
5232
     int a_view, a_ref;
5237
{
5233
{
5238
  /* v0.3j */
5234
  /* v0.3j */
5239
  boolean r = false;
5235
  boolean r = false;
5240
  neighbor_rec nb;
5236
  neighbor_rec nb;
5241
 
5237
 
5242
  memset (nb, 0, sizeof (neighbor_rec));
5238
  memset (nb, 0, sizeof (neighbor_rec));
5243
  if (!
5239
  if (!
5244
      (atom[a_view - 1].
5240
      (atom[a_view - 1].
5245
       heavy && (bond[get_bond (a_view, a_ref) - 1].btype == 'S')))
5241
       heavy && (bond[get_bond (a_view, a_ref) - 1].btype == 'S')))
5246
    return false;
5242
    return false;
5247
  if (strcmp (atom[a_ref - 1].atype, "S3 ")
5243
  if (strcmp (atom[a_ref - 1].atype, "S3 ")
5248
      || atom[a_ref - 1].neighbor_count != 2)
5244
      || atom[a_ref - 1].neighbor_count != 2)
5249
    return false;
5245
    return false;
5250
  get_nextneighbors (nb, a_ref, a_view);
5246
  get_nextneighbors (nb, a_ref, a_view);
5251
  if (is_alkenyl (a_ref, nb[0]))
5247
  if (is_alkenyl (a_ref, nb[0]))
5252
    r = true;
5248
    r = true;
5253
  return r;
5249
  return r;
5254
}
5250
}
5255
 
5251
 
5256
 
5252
 
5257
static boolean
5253
static boolean
5258
is_alkynylsulfanyl (a_view, a_ref)
5254
is_alkynylsulfanyl (a_view, a_ref)
5259
     int a_view, a_ref;
5255
     int a_view, a_ref;
5260
{
5256
{
5261
  /* v0.3j */
5257
  /* v0.3j */
5262
  boolean r = false;
5258
  boolean r = false;
5263
  neighbor_rec nb;
5259
  neighbor_rec nb;
5264
 
5260
 
5265
  memset (nb, 0, sizeof (neighbor_rec));
5261
  memset (nb, 0, sizeof (neighbor_rec));
5266
  if (!
5262
  if (!
5267
      (atom[a_view - 1].
5263
      (atom[a_view - 1].
5268
       heavy && (bond[get_bond (a_view, a_ref) - 1].btype == 'S')))
5264
       heavy && (bond[get_bond (a_view, a_ref) - 1].btype == 'S')))
5269
    return false;
5265
    return false;
5270
  if (strcmp (atom[a_ref - 1].atype, "S3 ")
5266
  if (strcmp (atom[a_ref - 1].atype, "S3 ")
5271
      || atom[a_ref - 1].neighbor_count != 2)
5267
      || atom[a_ref - 1].neighbor_count != 2)
5272
    return false;
5268
    return false;
5273
  get_nextneighbors (nb, a_ref, a_view);
5269
  get_nextneighbors (nb, a_ref, a_view);
5274
  if (is_alkynyl (a_ref, nb[0]))
5270
  if (is_alkynyl (a_ref, nb[0]))
5275
    r = true;
5271
    r = true;
5276
  return r;
5272
  return r;
5277
}
5273
}
5278
 
5274
 
5279
 
5275
 
5280
static boolean
5276
static boolean
5281
is_alkylamino (a_view, a_ref)
5277
is_alkylamino (a_view, a_ref)
5282
     int a_view, a_ref;
5278
     int a_view, a_ref;
5283
{
5279
{
5284
  boolean r = false;
5280
  boolean r = false;
5285
  neighbor_rec nb;
5281
  neighbor_rec nb;
5286
  int alkyl_count = 0;
5282
  int alkyl_count = 0;
5287
 
5283
 
Line 5295... Line 5291...
5295
    return false;
5291
    return false;
5296
  get_nextneighbors (nb, a_ref, a_view);
5292
  get_nextneighbors (nb, a_ref, a_view);
5297
  if (is_alkyl (a_ref, nb[0]))
5293
  if (is_alkyl (a_ref, nb[0]))
5298
    alkyl_count++;
5294
    alkyl_count++;
5299
  if (alkyl_count == 1)
5295
  if (alkyl_count == 1)
5300
    r = true;
5296
    r = true;
5301
  return r;
5297
  return r;
5302
}
5298
}
5303
 
5299
 
5304
 
5300
 
5305
static boolean
5301
static boolean
5306
is_dialkylamino (a_view, a_ref)
5302
is_dialkylamino (a_view, a_ref)
5307
     int a_view, a_ref;
5303
     int a_view, a_ref;
5308
{
5304
{
5309
  int i;
5305
  int i;
Line 5313... Line 5309...
5313
 
5309
 
5314
  memset (nb, 0, sizeof (neighbor_rec));
5310
  memset (nb, 0, sizeof (neighbor_rec));
5315
  if (!
5311
  if (!
5316
      (atom[a_view - 1].
5312
      (atom[a_view - 1].
5317
       heavy && (bond[get_bond (a_view, a_ref) - 1].btype == 'S')))
5313
       heavy && (bond[get_bond (a_view, a_ref) - 1].btype == 'S')))
5318
    return false;
5314
    return false;
5319
  if (strcmp (atom[a_ref - 1].element, "N ")
5315
  if (strcmp (atom[a_ref - 1].element, "N ")
5320
      || atom[a_ref - 1].neighbor_count != 3)
5316
      || atom[a_ref - 1].neighbor_count != 3)
5321
    return false;
5317
    return false;
5322
  get_nextneighbors (nb, a_ref, a_view);
5318
  get_nextneighbors (nb, a_ref, a_view);
5323
  for (i = 0; i <= 1; i++)
5319
  for (i = 0; i <= 1; i++)
Line 5331... Line 5327...
5331
}
5327
}
5332
 
5328
 
5333
 
5329
 
5334
static boolean
5330
static boolean
5335
is_arylamino (a_view, a_ref)
5331
is_arylamino (a_view, a_ref)
5336
     int a_view, a_ref;
5332
     int a_view, a_ref;
5337
{
5333
{
5338
  boolean r = false;
5334
  boolean r = false;
5339
  neighbor_rec nb;
5335
  neighbor_rec nb;
5340
  int aryl_count = 0;
5336
  int aryl_count = 0;
5341
 
5337
 
5342
  memset (nb, 0, sizeof (neighbor_rec));
5338
  memset (nb, 0, sizeof (neighbor_rec));
5343
  if (!
5339
  if (!
5344
      (atom[a_view - 1].
5340
      (atom[a_view - 1].
5345
       heavy && (bond[get_bond (a_view, a_ref) - 1].btype == 'S')))
5341
       heavy && (bond[get_bond (a_view, a_ref) - 1].btype == 'S')))
5346
    return false;
5342
    return false;
5347
  if (strcmp (atom[a_ref - 1].element, "N ")
5343
  if (strcmp (atom[a_ref - 1].element, "N ")
5348
      || atom[a_ref - 1].neighbor_count != 2)
5344
      || atom[a_ref - 1].neighbor_count != 2)
5349
    return false;
5345
    return false;
Line 5356... Line 5352...
5356
}
5352
}
5357
 
5353
 
5358
 
5354
 
5359
static boolean
5355
static boolean
5360
is_diarylamino (a_view, a_ref)
5356
is_diarylamino (a_view, a_ref)
5361
     int a_view, a_ref;
5357
     int a_view, a_ref;
5362
{
5358
{
5363
  int i;
5359
  int i;
5364
  boolean r = false;
5360
  boolean r = false;
5365
  neighbor_rec nb;
5361
  neighbor_rec nb;
5366
  int aryl_count = 0;
5362
  int aryl_count = 0;
5367
 
5363
 
5368
  memset (nb, 0, sizeof (neighbor_rec));
5364
  memset (nb, 0, sizeof (neighbor_rec));
5369
  if (!
5365
  if (!
5370
      (atom[a_view - 1].
5366
      (atom[a_view - 1].
5371
       heavy && (bond[get_bond (a_view, a_ref) - 1].btype == 'S')))
5367
       heavy && (bond[get_bond (a_view, a_ref) - 1].btype == 'S')))
5372
    return false;
5368
    return false;
5373
  if (strcmp (atom[a_ref - 1].element, "N ")
5369
  if (strcmp (atom[a_ref - 1].element, "N ")
5374
      || atom[a_ref - 1].neighbor_count != 3)
5370
      || atom[a_ref - 1].neighbor_count != 3)
5375
    return false;
5371
    return false;
5376
  get_nextneighbors (nb, a_ref, a_view);
5372
  get_nextneighbors (nb, a_ref, a_view);
5377
  for (i = 0; i <= 1; i++)
5373
  for (i = 0; i <= 1; i++)
5378
    {
5374
    {
5379
      if (is_aryl (a_ref, nb[i]))
5375
      if (is_aryl (a_ref, nb[i]))
5380
        aryl_count++;
5376
        aryl_count++;
5381
    }
5377
    }
5382
  if (aryl_count == 2)
5378
  if (aryl_count == 2)
5383
    r = true;
5379
    r = true;
5384
  return r;
5380
  return r;
5385
}
5381
}
5386
 
5382
 
5387
 
5383
 
5388
static boolean
5384
static boolean
5389
is_alkylarylamino (a_view, a_ref)
5385
is_alkylarylamino (a_view, a_ref)
5390
     int a_view, a_ref;
5386
     int a_view, a_ref;
5391
{
5387
{
5392
  int i;
5388
  int i;
5393
  boolean r = false;
5389
  boolean r = false;
5394
  neighbor_rec nb;
5390
  neighbor_rec nb;
5395
  int alkyl_count = 0, aryl_count = 0;
5391
  int alkyl_count = 0, aryl_count = 0;
5396
 
5392
 
5397
  memset (nb, 0, sizeof (neighbor_rec));
5393
  memset (nb, 0, sizeof (neighbor_rec));
5398
  if (!
5394
  if (!
5399
      (atom[a_view - 1].
5395
      (atom[a_view - 1].
5400
       heavy && (bond[get_bond (a_view, a_ref) - 1].btype == 'S')))
5396
       heavy && (bond[get_bond (a_view, a_ref) - 1].btype == 'S')))
5401
    return false;
5397
    return false;
5402
  if (strcmp (atom[a_ref - 1].element, "N ")
5398
  if (strcmp (atom[a_ref - 1].element, "N ")
5403
      || atom[a_ref - 1].neighbor_count != 3)
5399
      || atom[a_ref - 1].neighbor_count != 3)
5404
    return false;
5400
    return false;
Line 5409... Line 5405...
5409
        alkyl_count++;
5405
        alkyl_count++;
5410
      if (is_aryl (a_ref, nb[i]))
5406
      if (is_aryl (a_ref, nb[i]))
5411
        aryl_count++;
5407
        aryl_count++;
5412
    }
5408
    }
5413
  if (alkyl_count == 1 && aryl_count == 1)
5409
  if (alkyl_count == 1 && aryl_count == 1)
5414
    r = true;
5410
    r = true;
5415
  return r;
5411
  return r;
5416
}
5412
}
5417
 
5413
 
5418
 
5414
 
5419
static boolean
5415
static boolean
5420
is_C_monosubst_amino (a_view, a_ref)
5416
is_C_monosubst_amino (a_view, a_ref)
5421
     int a_view, a_ref;
5417
     int a_view, a_ref;
5422
{
5418
{
Line 5482... Line 5478...
5482
  boolean r = false;
5478
  boolean r = false;
5483
 
5479
 
5484
  if (is_amino (a_view, a_ref) || is_alkylamino (a_view, a_ref) |
5480
  if (is_amino (a_view, a_ref) || is_alkylamino (a_view, a_ref) |
5485
      is_arylamino (a_view, a_ref) || is_dialkylamino (a_view, a_ref) |
5481
      is_arylamino (a_view, a_ref) || is_dialkylamino (a_view, a_ref) |
5486
      is_alkylarylamino (a_view, a_ref) || is_diarylamino (a_view, a_ref))
5482
      is_alkylarylamino (a_view, a_ref) || is_diarylamino (a_view, a_ref))
5487
    r = true;
5483
    r = true;
5488
  return r;
5484
  return r;
5489
}
5485
}
5490
 
5486
 
5491
 
5487
 
5492
static boolean
5488
static boolean
5493
is_true_alkylamino (a_view, a_ref)
5489
is_true_alkylamino (a_view, a_ref)
5494
     int a_view, a_ref;
5490
     int a_view, a_ref;
5495
{
5491
{
5496
  boolean r = false;
5492
  boolean r = false;
5497
  neighbor_rec nb;
5493
  neighbor_rec nb;
5498
  int alkyl_count = 0;
5494
  int alkyl_count = 0;
5499
 
5495
 
5500
  memset (nb, 0, sizeof (neighbor_rec));
5496
  memset (nb, 0, sizeof (neighbor_rec));
5501
  if (!
5497
  if (!
5502
      (atom[a_view - 1].
5498
      (atom[a_view - 1].
5503
       heavy && (bond[get_bond (a_view, a_ref) - 1].btype == 'S')))
5499
       heavy && (bond[get_bond (a_view, a_ref) - 1].btype == 'S')))
5504
    return false;
5500
    return false;
5505
  if ((strcmp (atom[a_ref - 1].atype, "N3 ")
5501
  if ((strcmp (atom[a_ref - 1].atype, "N3 ")
5506
      && strcmp (atom[a_ref - 1].atype, "N3+"))
5502
      && strcmp (atom[a_ref - 1].atype, "N3+"))
5507
      || atom[a_ref - 1].neighbor_count != 2)
5503
      || atom[a_ref - 1].neighbor_count != 2)
5508
    return false;
5504
    return false;
5509
  get_nextneighbors (nb, a_ref, a_view);
5505
  get_nextneighbors (nb, a_ref, a_view);
Line 5512... Line 5508...
5512
  if (alkyl_count == 1)
5508
  if (alkyl_count == 1)
5513
    r = true;
5509
    r = true;
5514
  return r;
5510
  return r;
5515
}
5511
}
5516
 
5512
 
5517
 
5513
 
5518
static boolean
5514
static boolean
5519
is_true_dialkylamino (a_view, a_ref)
5515
is_true_dialkylamino (a_view, a_ref)
5520
     int a_view, a_ref;
5516
     int a_view, a_ref;
5521
{
5517
{
5522
  int i;
5518
  int i;
5523
  boolean r = false;
5519
  boolean r = false;
5524
  neighbor_rec nb;
5520
  neighbor_rec nb;
5525
  int alkyl_count = 0;
5521
  int alkyl_count = 0;
5526
 
5522
 
5527
  memset (nb, 0, sizeof (neighbor_rec));
5523
  memset (nb, 0, sizeof (neighbor_rec));
5528
  if (!
5524
  if (!
5529
      (atom[a_view - 1].
5525
      (atom[a_view - 1].
5530
       heavy && (bond[get_bond (a_view, a_ref) - 1].btype == 'S')))
5526
       heavy && (bond[get_bond (a_view, a_ref) - 1].btype == 'S')))
5531
    return false;
5527
    return false;
5532
  if ((strcmp (atom[a_ref - 1].atype, "N3 ")
5528
  if ((strcmp (atom[a_ref - 1].atype, "N3 ")
5533
      && strcmp (atom[a_ref - 1].atype, "N3+"))
5529
      && strcmp (atom[a_ref - 1].atype, "N3+"))
5534
      || atom[a_ref - 1].neighbor_count != 3)
5530
      || atom[a_ref - 1].neighbor_count != 3)
5535
    return false;
5531
    return false;
5536
  get_nextneighbors (nb, a_ref, a_view);
5532
  get_nextneighbors (nb, a_ref, a_view);
5537
  for (i = 0; i <= 1; i++)
5533
  for (i = 0; i <= 1; i++)
5538
    {
5534
    {
5539
      if (is_true_alkyl (a_ref, nb[i]))
5535
      if (is_true_alkyl (a_ref, nb[i]))
5540
        alkyl_count++;
5536
        alkyl_count++;
5541
    }
5537
    }
5542
  if (alkyl_count == 2)
5538
  if (alkyl_count == 2)
5543
    r = true;
5539
    r = true;
5544
  return r;
5540
  return r;
Line 5551... Line 5547...
5551
{
5547
{
5552
  int i;
5548
  int i;
5553
  boolean r = false;
5549
  boolean r = false;
5554
  neighbor_rec nb;
5550
  neighbor_rec nb;
5555
  int alkyl_count = 0, aryl_count = 0;
5551
  int alkyl_count = 0, aryl_count = 0;
5556
 
5552
 
5557
  memset (nb, 0, sizeof (neighbor_rec));
5553
  memset (nb, 0, sizeof (neighbor_rec));
5558
  if (!
5554
  if (!
5559
      (atom[a_view - 1].
5555
      (atom[a_view - 1].
5560
       heavy && (bond[get_bond (a_view, a_ref) - 1].btype == 'S')))
5556
       heavy && (bond[get_bond (a_view, a_ref) - 1].btype == 'S')))
5561
    return false;
5557
    return false;
5562
  if ((strcmp (atom[a_ref - 1].atype, "N3 ")
5558
  if ((strcmp (atom[a_ref - 1].atype, "N3 ")
Line 5570... Line 5566...
5570
        alkyl_count++;
5566
        alkyl_count++;
5571
      if (is_aryl (a_ref, nb[i]))
5567
      if (is_aryl (a_ref, nb[i]))
5572
        aryl_count++;
5568
        aryl_count++;
5573
    }
5569
    }
5574
  if (alkyl_count == 1 && aryl_count == 1)
5570
  if (alkyl_count == 1 && aryl_count == 1)
5575
    r = true;
5571
    r = true;
5576
  return r;
5572
  return r;
5577
}
5573
}
5578
#endif
5574
#endif
5579
 
5575
 
5580
static boolean
5576
static boolean
Line 5585... Line 5581...
5585
  boolean r = false;
5581
  boolean r = false;
5586
  neighbor_rec nb;
5582
  neighbor_rec nb;
5587
  int oh_count = 0, het_count = 0;      /* v0.3k */
5583
  int oh_count = 0, het_count = 0;      /* v0.3k */
5588
  str2 nb_el;                   /* v0.3k */
5584
  str2 nb_el;                   /* v0.3k */
5589
  int FORLIM;
5585
  int FORLIM;
5590
 
5586
 
5591
  memset (nb, 0, sizeof (neighbor_rec));
5587
  memset (nb, 0, sizeof (neighbor_rec));
5592
  if (!
5588
  if (!
5593
      (atom[a_view - 1].
5589
      (atom[a_view - 1].
5594
       heavy && (bond[get_bond (a_view, a_ref) - 1].btype == 'S')))
5590
       heavy && (bond[get_bond (a_view, a_ref) - 1].btype == 'S')))
5595
    return false;
5591
    return false;
5596
  if (strcmp (atom[a_ref - 1].element, "N ")
5592
  if (strcmp (atom[a_ref - 1].element, "N ")
5597
      || atom[a_ref - 1].neighbor_count < 2)
5593
      || atom[a_ref - 1].neighbor_count < 2)
Line 5623... Line 5619...
5623
{
5619
{
5624
  int i;
5620
  int i;
5625
  boolean r = false;
5621
  boolean r = false;
5626
  neighbor_rec nb;
5622
  neighbor_rec nb;
5627
  int o_count = 0, bond_count = 0;
5623
  int o_count = 0, bond_count = 0;
5628
 
5624
 
5629
  memset (nb, 0, sizeof (neighbor_rec));
5625
  memset (nb, 0, sizeof (neighbor_rec));
5630
  if (!
5626
  if (!
5631
      (atom[a_view - 1].
5627
      (atom[a_view - 1].
5632
       heavy && (bond[get_bond (a_view, a_ref) - 1].btype == 'S')))
5628
       heavy && (bond[get_bond (a_view, a_ref) - 1].btype == 'S')))
5633
    return false;
5629
    return false;
5634
  if (strcmp (atom[a_ref - 1].element, "N ")
5630
  if (strcmp (atom[a_ref - 1].element, "N ")
5635
      || atom[a_ref - 1].neighbor_count != 3)
5631
      || atom[a_ref - 1].neighbor_count != 3)
5636
    return false;
5632
    return false;
5637
  get_nextneighbors (nb, a_ref, a_view);
5633
  get_nextneighbors (nb, a_ref, a_view);
5638
  for (i = 0; i <= 1; i++)
5634
  for (i = 0; i <= 1; i++)
5639
    {
5635
    {
5640
      if (!strcmp (atom[nb[i] - 1].element, "O "))
5636
      if (!strcmp (atom[nb[i] - 1].element, "O "))
Line 5655... Line 5651...
5655
     int a_view, a_ref;
5651
     int a_view, a_ref;
5656
{
5652
{
5657
  boolean r = false;
5653
  boolean r = false;
5658
  neighbor_rec nb;
5654
  neighbor_rec nb;
5659
  int bond_count = 0, n1 = 0, n2 = 0, n3 = 0;
5655
  int bond_count = 0, n1 = 0, n2 = 0, n3 = 0;
5660
 
5656
 
5661
  if (!
5657
  if (!
5662
      (atom[a_view - 1].
5658
      (atom[a_view - 1].
5663
       heavy && (bond[get_bond (a_view, a_ref) - 1].btype == 'S')))
5659
       heavy && (bond[get_bond (a_view, a_ref) - 1].btype == 'S')))
5664
    return false;
5660
    return false;
5665
  if (strcmp (atom[a_ref - 1].element, "N ")
5661
  if (strcmp (atom[a_ref - 1].element, "N ")
5666
      || atom[a_ref - 1].neighbor_count != 2)
5662
      || atom[a_ref - 1].neighbor_count != 2)
5667
    return false;
5663
    return false;
5668
  n1 = a_ref;
5664
  n1 = a_ref;
5669
  memset (nb, 0, sizeof (neighbor_rec));
5665
  memset (nb, 0, sizeof (neighbor_rec));
5670
  get_nextneighbors (nb, n1, a_view);
5666
  get_nextneighbors (nb, n1, a_view);
5671
  if (!strcmp (atom[nb[0] - 1].element, "N "))
5667
  if (!strcmp (atom[nb[0] - 1].element, "N "))
5672
    {
5668
    {
5673
      n2 = nb[0];
5669
      n2 = nb[0];
5674
      if (bond[get_bond (n1, n2) - 1].btype == 'S')
5670
      if (bond[get_bond (n1, n2) - 1].btype == 'S')
5675
        bond_count++;
5671
        bond_count++;
5676
      if (bond[get_bond (n1, n2) - 1].btype == 'D')
5672
      if (bond[get_bond (n1, n2) - 1].btype == 'D')
5677
        bond_count += 2;
5673
        bond_count += 2;
Line 5701... Line 5697...
5701
 
5697
 
5702
 
5698
 
5703
static boolean
5699
static boolean
5704
is_diazonium (a_view, a_ref)
5700
is_diazonium (a_view, a_ref)
5705
     int a_view, a_ref;
5701
     int a_view, a_ref;
5706
{
5702
{
5707
  boolean r = false;
5703
  boolean r = false;
5708
  neighbor_rec nb;
5704
  neighbor_rec nb;
5709
  int bond_count = 0, chg_count = 0, n1 = 0, n2 = 0;
5705
  int bond_count = 0, chg_count = 0, n1 = 0, n2 = 0;
5710
 
5706
 
5711
  if (!
5707
  if (!
5712
      (atom[a_view - 1].
5708
      (atom[a_view - 1].
5713
       heavy && (bond[get_bond (a_view, a_ref) - 1].btype == 'S')))
5709
       heavy && (bond[get_bond (a_view, a_ref) - 1].btype == 'S')))
Line 5771... Line 5767...
5771
    return false;
5767
    return false;
5772
  FORLIM = atom[a_het - 1].neighbor_count;
5768
  FORLIM = atom[a_het - 1].neighbor_count;
5773
  for (i = 0; i < FORLIM; i++)
5769
  for (i = 0; i < FORLIM; i++)
5774
    {
5770
    {
5775
      if (is_hydroxy (a_het, nb[i]))
5771
      if (is_hydroxy (a_het, nb[i]))
5776
        r = true;
5772
        r = true;
5777
    }
5773
    }
5778
  return r;
5774
  return r;
5779
}
5775
}
5780
 
5776
 
5781
 
5777
 
5782
static boolean
5778
static boolean
5783
is_hydrazono_C (id)
5779
is_hydrazono_C (id)
5784
     int id;
5780
     int id;
5785
{
5781
{
Line 5787... Line 5783...
5787
  int i;
5783
  int i;
5788
  boolean r = false;
5784
  boolean r = false;
5789
  neighbor_rec nb;
5785
  neighbor_rec nb;
5790
  int a_het = 0;
5786
  int a_het = 0;
5791
  int FORLIM;
5787
  int FORLIM;
5792
 
5788
 
5793
  memset (nb, 0, sizeof (neighbor_rec));
5789
  memset (nb, 0, sizeof (neighbor_rec));
5794
  if (id < 1 || id > n_atoms)
5790
  if (id < 1 || id > n_atoms)
5795
    return Result;
5791
    return Result;
5796
  get_neighbors (nb, id);
5792
  get_neighbors (nb, id);
5797
  if (strcmp (atom[id - 1].element, "C ") || atom[id - 1].neighbor_count <= 0)
5793
  if (strcmp (atom[id - 1].element, "C ") || atom[id - 1].neighbor_count <= 0)
Line 5818... Line 5814...
5818
  for (i = 0; i < FORLIM; i++)
5814
  for (i = 0; i < FORLIM; i++)
5819
    {
5815
    {
5820
      if (is_amino (a_het, nb[i]) || is_alkylamino (a_het, nb[i]) |
5816
      if (is_amino (a_het, nb[i]) || is_alkylamino (a_het, nb[i]) |
5821
          is_alkylarylamino (a_het, nb[i]) || is_arylamino (a_het, nb[i]) |
5817
          is_alkylarylamino (a_het, nb[i]) || is_arylamino (a_het, nb[i]) |
5822
          is_dialkylamino (a_het, nb[i]) || is_diarylamino (a_het, nb[i]))
5818
          is_dialkylamino (a_het, nb[i]) || is_diarylamino (a_het, nb[i]))
5823
        r = true;
5819
        r = true;
5824
    }
5820
    }
5825
  return r;
5821
  return r;
5826
}
5822
}
5827
 
5823
 
5828
 
5824
 
5829
static boolean
5825
static boolean
5830
is_alkoxycarbonyl (a_view, a_ref)
5826
is_alkoxycarbonyl (a_view, a_ref)
5831
     int a_view, a_ref;
5827
     int a_view, a_ref;
5832
{
5828
{
5833
  int i;
5829
  int i;
5834
  boolean r = false;
5830
  boolean r = false;
5835
  neighbor_rec nb;
5831
  neighbor_rec nb;
5836
 
5832
 
5837
  memset (nb, 0, sizeof (neighbor_rec));
5833
  memset (nb, 0, sizeof (neighbor_rec));
5838
  if (!
5834
  if (!
5839
      (atom[a_view - 1].
5835
      (atom[a_view - 1].
5840
       heavy && (bond[get_bond (a_view, a_ref) - 1].btype == 'S')))
5836
       heavy && (bond[get_bond (a_view, a_ref) - 1].btype == 'S')))
5841
    return false;
5837
    return false;
5842
  if (!(is_oxo_C (a_ref) && atom[a_ref - 1].neighbor_count == 3))
5838
  if (!(is_oxo_C (a_ref) && atom[a_ref - 1].neighbor_count == 3))
5843
    return false;
5839
    return false;
5844
  get_nextneighbors (nb, a_ref, a_view);
5840
  get_nextneighbors (nb, a_ref, a_view);
5845
  for (i = 0; i <= 1; i++)
5841
  for (i = 0; i <= 1; i++)
5846
    {
5842
    {
5847
      if (is_alkoxy (a_ref, nb[i]))
5843
      if (is_alkoxy (a_ref, nb[i]))
5848
        r = true;
5844
        r = true;
5849
    }
5845
    }
5850
  return r;
5846
  return r;
5851
}
5847
}
5852
 
5848
 
5853
 
5849
 
5854
static boolean
5850
static boolean
5855
is_aryloxycarbonyl (a_view, a_ref)
5851
is_aryloxycarbonyl (a_view, a_ref)
-
 
5852
     int a_view, a_ref;
-
 
5853
{
-
 
5854
  int i;
-
 
5855
  boolean r = false;
-
 
5856
  neighbor_rec nb;
-
 
5857
 
-
 
5858
  memset (nb, 0, sizeof (neighbor_rec));
-
 
5859
  if (!
-
 
5860
      (atom[a_view - 1].
-
 
5861
       heavy && (bond[get_bond (a_view, a_ref) - 1].btype == 'S')))
-
 
5862
    return false;
-
 
5863
  if (!(is_oxo_C (a_ref) && atom[a_ref - 1].neighbor_count == 3))
-
 
5864
    return false;
-
 
5865
  get_nextneighbors (nb, a_ref, a_view);
-
 
5866
  for (i = 0; i <= 1; i++)
-
 
5867
    {
-
 
5868
      if (is_aryloxy (a_ref, nb[i]))
-
 
5869
        r = true;
-
 
5870
    }
-
 
5871
  return r;
-
 
5872
}
-
 
5873
 
-
 
5874
 
-
 
5875
static boolean
-
 
5876
is_carbamoyl (a_view, a_ref)
5856
     int a_view, a_ref;
5877
     int a_view, a_ref;
5857
{
5878
{
5858
  int i;
5879
  int i;
5859
  boolean r = false;
5880
  boolean r = false;
5860
  neighbor_rec nb;
5881
  neighbor_rec nb;
5861
 
5882
 
5862
  memset (nb, 0, sizeof (neighbor_rec));
5883
  memset (nb, 0, sizeof (neighbor_rec));
5863
  if (!
5884
  if (!
5864
      (atom[a_view - 1].
5885
      (atom[a_view - 1].
5865
       heavy && (bond[get_bond (a_view, a_ref) - 1].btype == 'S')))
5886
       heavy && (bond[get_bond (a_view, a_ref) - 1].btype == 'S')))
5866
    return false;
5887
    return false;
5867
  if (!(is_oxo_C (a_ref) && atom[a_ref - 1].neighbor_count == 3))
5888
  if (!(is_oxo_C (a_ref) && atom[a_ref - 1].neighbor_count == 3))
5868
    return false;
5889
    return false;
5869
  get_nextneighbors (nb, a_ref, a_view);
5890
  get_nextneighbors (nb, a_ref, a_view);
5870
  for (i = 0; i <= 1; i++)
5891
  for (i = 0; i <= 1; i++)
5871
    {
5892
    {
5872
      if (is_aryloxy (a_ref, nb[i]))
5893
      if (!strcmp (atom[nb[i] - 1].atype, "N3 ") ||
-
 
5894
          !strcmp (atom[nb[i] - 1].atype, "NAM"))
5873
        r = true;
5895
        r = true;
5874
    }
5896
    }
5875
  return r;
5897
  return r;
5876
}
5898
}
5877
 
5899
 
5878
 
5900
 
5879
static boolean
5901
static boolean
5880
is_carbamoyl (a_view, a_ref)
5902
is_alkoxythiocarbonyl (a_view, a_ref)
5881
     int a_view, a_ref;
5903
     int a_view, a_ref;
5882
{
5904
{
5883
  int i;
5905
  int i;
5884
  boolean r = false;
5906
  boolean r = false;
5885
  neighbor_rec nb;
5907
  neighbor_rec nb;
Line 5887... Line 5909...
5887
  memset (nb, 0, sizeof (neighbor_rec));
5909
  memset (nb, 0, sizeof (neighbor_rec));
5888
  if (!
5910
  if (!
5889
      (atom[a_view - 1].
5911
      (atom[a_view - 1].
5890
       heavy && (bond[get_bond (a_view, a_ref) - 1].btype == 'S')))
5912
       heavy && (bond[get_bond (a_view, a_ref) - 1].btype == 'S')))
5891
    return false;
5913
    return false;
5892
  if (!(is_oxo_C (a_ref) && atom[a_ref - 1].neighbor_count == 3))
5914
  if (!(is_thioxo_C (a_ref) && atom[a_ref - 1].neighbor_count == 3))
5893
    return false;
5915
    return false;
5894
  get_nextneighbors (nb, a_ref, a_view);
5916
  get_nextneighbors (nb, a_ref, a_view);
5895
  for (i = 0; i <= 1; i++)
5917
  for (i = 0; i <= 1; i++)
5896
    {
5918
    {
5897
      if (!strcmp (atom[nb[i] - 1].atype, "N3 ") ||
5919
      if (is_alkoxy (a_ref, nb[i]))
5898
          !strcmp (atom[nb[i] - 1].atype, "NAM"))
-
 
5899
        r = true;
5920
        r = true;
5900
    }
5921
    }
5901
  return r;
5922
  return r;
5902
}
5923
}
5903
 
-
 
5904
 
-
 
5905
static boolean
-
 
5906
is_alkoxythiocarbonyl (a_view, a_ref)
-
 
5907
     int a_view, a_ref;
-
 
5908
{
-
 
5909
  int i;
-
 
5910
  boolean r = false;
-
 
5911
  neighbor_rec nb;
-
 
5912
 
-
 
5913
  memset (nb, 0, sizeof (neighbor_rec));
-
 
5914
  if (!
-
 
5915
      (atom[a_view - 1].
-
 
5916
       heavy && (bond[get_bond (a_view, a_ref) - 1].btype == 'S')))
-
 
5917
    return false;
-
 
5918
  if (!(is_thioxo_C (a_ref) && atom[a_ref - 1].neighbor_count == 3))
-
 
5919
    return false;
-
 
5920
  get_nextneighbors (nb, a_ref, a_view);
-
 
5921
  for (i = 0; i <= 1; i++)
-
 
5922
    {
-
 
5923
      if (is_alkoxy (a_ref, nb[i]))
-
 
5924
        r = true;
-
 
5925
    }
-
 
5926
  return r;
-
 
5927
}
-
 
5928
 
5924
 
5929
 
5925
 
5930
static boolean
5926
static boolean
5931
is_aryloxythiocarbonyl (a_view, a_ref)
5927
is_aryloxythiocarbonyl (a_view, a_ref)
5932
     int a_view, a_ref;
5928
     int a_view, a_ref;
5933
{
5929
{
5934
  int i;
5930
  int i;
5935
  boolean r = false;
5931
  boolean r = false;
5936
  neighbor_rec nb;
5932
  neighbor_rec nb;
Line 5949... Line 5945...
5949
        r = true;
5945
        r = true;
5950
    }
5946
    }
5951
  return r;
5947
  return r;
5952
}
5948
}
5953
 
5949
 
5954
 
5950
 
5955
static boolean
5951
static boolean
5956
is_thiocarbamoyl (a_view, a_ref)
5952
is_thiocarbamoyl (a_view, a_ref)
5957
     int a_view, a_ref;
5953
     int a_view, a_ref;
5958
{
5954
{
5959
  int i;
5955
  int i;
5960
  boolean r = false;
5956
  boolean r = false;
5961
  neighbor_rec nb;
5957
  neighbor_rec nb;
5962
 
5958
 
5963
  memset (nb, 0, sizeof (neighbor_rec));
5959
  memset (nb, 0, sizeof (neighbor_rec));
5964
  if (!
5960
  if (!
5965
      (atom[a_view - 1].
5961
      (atom[a_view - 1].
5966
       heavy && (bond[get_bond (a_view, a_ref) - 1].btype == 'S')))
5962
       heavy && (bond[get_bond (a_view, a_ref) - 1].btype == 'S')))
5967
    return false;
5963
    return false;
5968
  if (!(is_thioxo_C (a_ref) && atom[a_ref - 1].neighbor_count == 3))
5964
  if (!(is_thioxo_C (a_ref) && atom[a_ref - 1].neighbor_count == 3))
Line 5970... Line 5966...
5970
  get_nextneighbors (nb, a_ref, a_view);
5966
  get_nextneighbors (nb, a_ref, a_view);
5971
  for (i = 0; i <= 1; i++)
5967
  for (i = 0; i <= 1; i++)
5972
    {
5968
    {
5973
      if (!strcmp (atom[nb[i] - 1].atype, "N3 ") ||
5969
      if (!strcmp (atom[nb[i] - 1].atype, "N3 ") ||
5974
          !strcmp (atom[nb[i] - 1].atype, "NAM"))
5970
          !strcmp (atom[nb[i] - 1].atype, "NAM"))
5975
        r = true;
5971
        r = true;
5976
    }
5972
    }
5977
  return r;
5973
  return r;
5978
}
5974
}
5979
 
5975
 
5980
 
5976
 
5981
static boolean
5977
static boolean
5982
is_alkanoyl (a_view, a_ref)
5978
is_alkanoyl (a_view, a_ref)
5983
     int a_view, a_ref;
5979
     int a_view, a_ref;
5984
{
5980
{
5985
  int i;
5981
  int i;
5986
  boolean r = false;
5982
  boolean r = false;
Line 6028... Line 6024...
6028
}
6024
}
6029
 
6025
 
6030
 
6026
 
6031
static boolean
6027
static boolean
6032
is_acyl (a_view, a_ref)
6028
is_acyl (a_view, a_ref)
6033
     int a_view, a_ref;
6029
     int a_view, a_ref;
6034
{
6030
{
6035
  boolean r = false;
6031
  boolean r = false;
6036
 
6032
 
6037
  if (is_alkanoyl (a_view, a_ref) || is_aroyl (a_view, a_ref))
6033
  if (is_alkanoyl (a_view, a_ref) || is_aroyl (a_view, a_ref))
6038
    r = true;
6034
    r = true;
6039
  return r;
6035
  return r;
6040
}
6036
}
Line 6053... Line 6049...
6053
}
6049
}
6054
 
6050
 
6055
 
6051
 
6056
static boolean
6052
static boolean
6057
is_acylamino (a_view, a_ref)
6053
is_acylamino (a_view, a_ref)
6058
     int a_view, a_ref;
6054
     int a_view, a_ref;
6059
{
6055
{
6060
  boolean r = false;
6056
  boolean r = false;
6061
  neighbor_rec nb;
6057
  neighbor_rec nb;
6062
  int acyl_count = 0;
6058
  int acyl_count = 0;
6063
 
6059
 
6064
  memset (nb, 0, sizeof (neighbor_rec));
6060
  memset (nb, 0, sizeof (neighbor_rec));
6065
  if (!
6061
  if (!
6066
      (atom[a_view - 1].
6062
      (atom[a_view - 1].
6067
       heavy && (bond[get_bond (a_view, a_ref) - 1].btype == 'S')))
6063
       heavy && (bond[get_bond (a_view, a_ref) - 1].btype == 'S')))
6068
    return false;
6064
    return false;
6069
  if (strcmp (atom[a_ref - 1].element, "N ")
6065
  if (strcmp (atom[a_ref - 1].element, "N ")
6070
      || atom[a_ref - 1].neighbor_count != 2)
6066
      || atom[a_ref - 1].neighbor_count != 2)
6071
    return false;
6067
    return false;
6072
  get_nextneighbors (nb, a_ref, a_view);
6068
  get_nextneighbors (nb, a_ref, a_view);
6073
  if (is_acyl (a_ref, nb[0]))
6069
  if (is_acyl (a_ref, nb[0]))
6074
    acyl_count++;
6070
    acyl_count++;
6075
  if (acyl_count == 1)
6071
  if (acyl_count == 1)
6076
    r = true;
6072
    r = true;
6077
  return r;
6073
  return r;
6078
}
6074
}
6079
 
6075
 
6080
 
6076
 
6081
static boolean
6077
static boolean
6082
is_subst_acylamino (a_view, a_ref)
6078
is_subst_acylamino (a_view, a_ref)
6083
     int a_view, a_ref;
6079
     int a_view, a_ref;
6084
{
6080
{
6085
  /* may be substituted _or_ unsubstituted acylamino group! */
6081
  /* may be substituted _or_ unsubstituted acylamino group! */
6086
  int i;
6082
  int i;
6087
  boolean r = false;
6083
  boolean r = false;
6088
  neighbor_rec nb;
6084
  neighbor_rec nb;
6089
  int acyl_count = 0;
6085
  int acyl_count = 0;
6090
  int FORLIM;
6086
  int FORLIM;
6091
 
6087
 
6092
  memset (nb, 0, sizeof (neighbor_rec));
6088
  memset (nb, 0, sizeof (neighbor_rec));
6093
  if (!
6089
  if (!
6094
      (atom[a_view - 1].
6090
      (atom[a_view - 1].
6095
       heavy && (bond[get_bond (a_view, a_ref) - 1].btype == 'S')))
6091
       heavy && (bond[get_bond (a_view, a_ref) - 1].btype == 'S')))
6096
    return false;
6092
    return false;
6097
  if (strcmp (atom[a_ref - 1].element, "N ")
6093
  if (strcmp (atom[a_ref - 1].element, "N ")
6098
      || atom[a_ref - 1].neighbor_count < 2)
6094
      || atom[a_ref - 1].neighbor_count < 2)
6099
    return false;
6095
    return false;
6100
  get_nextneighbors (nb, a_ref, a_view);
6096
  get_nextneighbors (nb, a_ref, a_view);
6101
  FORLIM = atom[a_ref - 1].neighbor_count - 2;
6097
  FORLIM = atom[a_ref - 1].neighbor_count - 2;
Line 6103... Line 6099...
6103
    {
6099
    {
6104
      if (is_acyl_gen (a_ref, nb[i]))   /* v0.3j */
6100
      if (is_acyl_gen (a_ref, nb[i]))   /* v0.3j */
6105
        acyl_count++;
6101
        acyl_count++;
6106
    }
6102
    }
6107
  if (acyl_count > 0)
6103
  if (acyl_count > 0)
6108
    r = true;
6104
    r = true;
6109
  return r;
6105
  return r;
6110
}
6106
}
6111
 
6107
 
6112
 
6108
 
6113
static boolean
6109
static boolean
6114
is_hydrazino (a_view, a_ref)
6110
is_hydrazino (a_view, a_ref)
6115
     int a_view, a_ref;
6111
     int a_view, a_ref;
6116
{
6112
{
6117
  int i;
6113
  int i;
6118
  boolean r = false;
6114
  boolean r = false;
6119
  neighbor_rec nb;
6115
  neighbor_rec nb;
6120
  int nr_count = 0;
6116
  int nr_count = 0;
6121
  int FORLIM;
6117
  int FORLIM;
6122
 
6118
 
6123
  memset (nb, 0, sizeof (neighbor_rec));
6119
  memset (nb, 0, sizeof (neighbor_rec));
6124
  if (!
6120
  if (!
6125
      (atom[a_view - 1].
6121
      (atom[a_view - 1].
6126
       heavy && (bond[get_bond (a_view, a_ref) - 1].btype == 'S')))
6122
       heavy && (bond[get_bond (a_view, a_ref) - 1].btype == 'S')))
6127
    return false;
6123
    return false;
6128
  if (strcmp (atom[a_ref - 1].element, "N ")
6124
  if (strcmp (atom[a_ref - 1].element, "N ")
6129
      || atom[a_ref - 1].neighbor_count < 2)
6125
      || atom[a_ref - 1].neighbor_count < 2)
6130
    return false;
6126
    return false;
6131
  get_nextneighbors (nb, a_ref, a_view);
6127
  get_nextneighbors (nb, a_ref, a_view);
6132
  FORLIM = atom[a_ref - 1].neighbor_count - 2;
6128
  FORLIM = atom[a_ref - 1].neighbor_count - 2;
6133
  for (i = 0; i <= FORLIM; i++)
6129
  for (i = 0; i <= FORLIM; i++)
6134
    {                           /* fixed in v0.3c */
6130
    {                           /* fixed in v0.3c */
6135
      if (is_amino (a_ref, nb[i]) || is_subst_amino (a_ref, nb[i]))
6131
      if (is_amino (a_ref, nb[i]) || is_subst_amino (a_ref, nb[i]))
6136
        nr_count++;
6132
        nr_count++;
6137
    }
6133
    }
6138
  if (nr_count == 1)
6134
  if (nr_count == 1)
6139
    r = true;
6135
    r = true;
6140
  return r;
6136
  return r;
6141
}
6137
}
6142
 
6138
 
6143
 
6139
 
6144
static boolean
6140
static boolean
6145
is_nitroso (a_view, a_ref)
6141
is_nitroso (a_view, a_ref)
6146
     int a_view, a_ref;
6142
     int a_view, a_ref;
6147
{
6143
{
6148
  /* new in v0.3j */
6144
  /* new in v0.3j */
6149
  boolean r = false;
6145
  boolean r = false;
Line 6176... Line 6172...
6176
{
6172
{
6177
  int i;
6173
  int i;
6178
  boolean r = false;
6174
  boolean r = false;
6179
  neighbor_rec nb;
6175
  neighbor_rec nb;
6180
  int nr_count = 0;
6176
  int nr_count = 0;
6181
  int a2, FORLIM;
6177
  int a2, FORLIM;
6182
 
6178
 
6183
  memset (nb, 0, sizeof (neighbor_rec));
6179
  memset (nb, 0, sizeof (neighbor_rec));
6184
  if (!
6180
  if (!
6185
      (atom[a_view - 1].
6181
      (atom[a_view - 1].
6186
       heavy && (bond[get_bond (a_view, a_ref) - 1].btype == 'S')))
6182
       heavy && (bond[get_bond (a_view, a_ref) - 1].btype == 'S')))
Line 6212... Line 6208...
6212
 
6208
 
6213
  if (((strcmp (atom[a_view - 1].atype, "C1 ") == 0) &
6209
  if (((strcmp (atom[a_view - 1].atype, "C1 ") == 0) &
6214
       (bond[get_bond (a_view, a_ref) - 1].btype == 'T')) &&
6210
       (bond[get_bond (a_view, a_ref) - 1].btype == 'T')) &&
6215
      !strcmp (atom[a_ref - 1].atype, "N1 ") &&
6211
      !strcmp (atom[a_ref - 1].atype, "N1 ") &&
6216
      atom[a_ref - 1].neighbor_count == 1)
6212
      atom[a_ref - 1].neighbor_count == 1)
6217
    r = true;
6213
    r = true;
6218
  return r;
6214
  return r;
6219
}
6215
}
6220
 
6216
 
6221
 
6217
 
6222
static boolean
6218
static boolean
Line 6229... Line 6225...
6229
  int FORLIM;
6225
  int FORLIM;
6230
 
6226
 
6231
  memset (nb, 0, sizeof (neighbor_rec));
6227
  memset (nb, 0, sizeof (neighbor_rec));
6232
  if (strcmp (atom[a_ref - 1].atype, "C1 ")
6228
  if (strcmp (atom[a_ref - 1].atype, "C1 ")
6233
      || atom[a_ref - 1].neighbor_count <= 0)
6229
      || atom[a_ref - 1].neighbor_count <= 0)
6234
    return false;
6230
    return false;
6235
  get_neighbors (nb, a_ref);
6231
  get_neighbors (nb, a_ref);
6236
  FORLIM = atom[a_ref - 1].neighbor_count;
6232
  FORLIM = atom[a_ref - 1].neighbor_count;
6237
  for (i = 0; i < FORLIM; i++)
6233
  for (i = 0; i < FORLIM; i++)
6238
    {
6234
    {
6239
      if (is_cyano (a_ref, nb[i]))
6235
      if (is_cyano (a_ref, nb[i]))
6240
        r = true;
6236
        r = true;
6241
    }
6237
    }
6242
  return r;
6238
  return r;
6243
}
6239
}
6244
 
6240
 
6245
 
6241
 
6246
static boolean
6242
static boolean
6247
is_nitrile (a_view, a_ref)
6243
is_nitrile (a_view, a_ref)
6248
     int a_view, a_ref;
6244
     int a_view, a_ref;
6249
{
6245
{
6250
  boolean r = false;
6246
  boolean r = false;
6251
  neighbor_rec nb;
6247
  neighbor_rec nb;
6252
  str2 nb_el;
6248
  str2 nb_el;
6253
 
6249
 
6254
  if (!is_cyano (a_view, a_ref))
6250
  if (!is_cyano (a_view, a_ref))
6255
    return false;
6251
    return false;
6256
  if (atom[a_view - 1].neighbor_count == 1
6252
  if (atom[a_view - 1].neighbor_count == 1
Line 6262... Line 6258...
6262
  if (!strcmp (nb_el, "C ")
6258
  if (!strcmp (nb_el, "C ")
6263
      || !strcmp (nb_el, "H ") /*|| !strcmp (nb_el, "D ") */ )
6259
      || !strcmp (nb_el, "H ") /*|| !strcmp (nb_el, "D ") */ )
6264
    /* v0.3n: D */
6260
    /* v0.3n: D */
6265
    r = true;
6261
    r = true;
6266
  /* HCN is also a nitrile! */
6262
  /* HCN is also a nitrile! */
6267
  return r;
6263
  return r;
6268
}
6264
}
6269
 
6265
 
6270
 
6266
 
6271
static boolean
6267
static boolean
6272
is_isonitrile (a_view, a_ref)
6268
is_isonitrile (a_view, a_ref)
6273
     int a_view, a_ref;
6269
     int a_view, a_ref;
6274
{
6270
{
6275
  /* only recognized with CN triple bond! */
6271
  /* only recognized with CN triple bond! */
Line 6278... Line 6274...
6278
  if (((strcmp (atom[a_view - 1].atype, "C1 ") == 0) &
6274
  if (((strcmp (atom[a_view - 1].atype, "C1 ") == 0) &
6279
       (bond[get_bond (a_view, a_ref) - 1].btype == 'T')) &&
6275
       (bond[get_bond (a_view, a_ref) - 1].btype == 'T')) &&
6280
      !strcmp (atom[a_ref - 1].atype, "N1 ") &&
6276
      !strcmp (atom[a_ref - 1].atype, "N1 ") &&
6281
      atom[a_ref - 1].neighbor_count == 2
6277
      atom[a_ref - 1].neighbor_count == 2
6282
      && atom[a_view - 1].neighbor_count == 1)
6278
      && atom[a_view - 1].neighbor_count == 1)
6283
    r = true;
6279
    r = true;
6284
  return r;
6280
  return r;
6285
}
6281
}
6286
 
6282
 
6287
 
6283
 
6288
static boolean
6284
static boolean
6289
is_cyanate (a_view, a_ref)
6285
is_cyanate (a_view, a_ref)
6290
     int a_view, a_ref;
6286
     int a_view, a_ref;
6291
{
6287
{
Line 6296... Line 6292...
6296
    return false;
6292
    return false;
6297
  if (atom[a_view - 1].neighbor_count != 2)
6293
  if (atom[a_view - 1].neighbor_count != 2)
6298
    return false;
6294
    return false;
6299
  get_nextneighbors (nb, a_view, a_ref);
6295
  get_nextneighbors (nb, a_view, a_ref);
6300
  if (is_alkoxy (a_view, nb[0]) || is_aryloxy (a_view, nb[0]))
6296
  if (is_alkoxy (a_view, nb[0]) || is_aryloxy (a_view, nb[0]))
6301
    r = true;
6297
    r = true;
6302
  return r;
6298
  return r;
6303
}
6299
}
6304
 
6300
 
6305
 
6301
 
6306
static boolean
6302
static boolean
6307
is_thiocyanate (a_view, a_ref)
6303
is_thiocyanate (a_view, a_ref)
6308
     int a_view, a_ref;
6304
     int a_view, a_ref;
6309
{
6305
{
Line 6352... Line 6348...
6352
          /* count single, double, triple, and aromatic bonds to all neighbor atoms */
6348
          /* count single, double, triple, and aromatic bonds to all neighbor atoms */
6353
          FORLIM1 = atom[i - 1].neighbor_count;
6349
          FORLIM1 = atom[i - 1].neighbor_count;
6354
          for (j = 0; j < FORLIM1; j++)
6350
          for (j = 0; j < FORLIM1; j++)
6355
            {
6351
            {
6356
              b_id = get_bond (i, nb[j]);
6352
              b_id = get_bond (i, nb[j]);
6357
              if (b_id > 0)
6353
              if (b_id > 0)
6358
                {
6354
                {
6359
                  if (bond[b_id - 1].btype == 'S')
6355
                  if (bond[b_id - 1].btype == 'S')
6360
                    single_count++;
6356
                    single_count++;
6361
                  if (bond[b_id - 1].btype == 'D')
6357
                  if (bond[b_id - 1].btype == 'D')
6362
                    double_count++;
6358
                    double_count++;
6363
                  if (bond[b_id - 1].btype == 'T')
6359
                  if (bond[b_id - 1].btype == 'T')
6364
                    triple_count++;
6360
                    triple_count++;
6365
                  if (bond[b_id - 1].btype == 'A')
6361
                  if (bond[b_id - 1].btype == 'A')
6366
                    arom_count++;
6362
                    arom_count++;
6367
                }
6363
                }
Line 6906... Line 6902...
6906
              atom[i - 1].y);
6902
              atom[i - 1].y);
6907
      printf ("%f", atom[i - 1].z);
6903
      printf ("%f", atom[i - 1].z);
6908
      printf ("  (%d heavy-atom neighbors, Hexp: %d Htot: %d)",
6904
      printf ("  (%d heavy-atom neighbors, Hexp: %d Htot: %d)",
6909
              atom[i - 1].neighbor_count, atom[i - 1].Hexp, atom[i - 1].Htot);
6905
              atom[i - 1].neighbor_count, atom[i - 1].Hexp, atom[i - 1].Htot);
6910
      if (atom[i - 1].formal_charge != 0)
6906
      if (atom[i - 1].formal_charge != 0)
6911
        printf ("  charge: %ld", atom[i - 1].formal_charge);
6907
        printf ("  charge: %d", atom[i - 1].formal_charge);
6912
      putchar ('\n');
6908
      putchar ('\n');
6913
    }
6909
    }
6914
  FORLIM = n_bonds;
6910
  FORLIM = n_bonds;
6915
  for (i = 1; i <= FORLIM; i++)
6911
  for (i = 1; i <= FORLIM; i++)
6916
    {
6912
    {
Line 6940... Line 6936...
6940
      /*for j := 1 to max_ringsize do if ring^[i,j] > 0 then testring[j] := ring^[i,j]; */
6936
      /*for j := 1 to max_ringsize do if ring^[i,j] > 0 then testring[j] := ring^[i,j]; */
6941
      for (j = 0; j < ring_size; j++)   /* v0.3j */
6937
      for (j = 0; j < ring_size; j++)   /* v0.3j */
6942
        testring[j] = ring[i][j];
6938
        testring[j] = ring[i][j];
6943
      /*ring_size := path_length(testring); */
6939
      /*ring_size := path_length(testring); */
6944
      /*a_prev := testring[ring_size]; */
6940
      /*a_prev := testring[ring_size]; */
6945
      for (j = 0; j < ring_size; j++)
6941
      for (j = 0; j < ring_size; j++)
6946
        {
6942
        {
6947
          printf ("%d ", testring[j]);
6943
          printf ("%d ", testring[j]);
6948
          /*a_ref := testring[j]; */
6944
          /*a_ref := testring[j]; */
6949
          /*if (not bond^[get_bond(a_prev,a_ref)].arom) then aromatic := false; */
6945
          /*if (not bond^[get_bond(a_prev,a_ref)].arom) then aromatic := false; */
6950
          /*a_prev := a_ref; */
6946
          /*a_prev := a_ref; */
Line 7229... Line 7225...
7229
  int i;
7225
  int i;
7230
  neighbor_rec nb;
7226
  neighbor_rec nb;
7231
  str2 nb_el;
7227
  str2 nb_el;
7232
  int het_count = 0, oh_count = 0, or_count = 0, hal_count = 0, n_count = 0,
7228
  int het_count = 0, oh_count = 0, or_count = 0, hal_count = 0, n_count = 0,
7233
    c_count = 0;
7229
    c_count = 0;
7234
  int FORLIM;
7230
  int FORLIM;
7235
 
7231
 
7236
  if (strcmp (atom[a_ref - 1].element, "B "))
7232
  if (strcmp (atom[a_ref - 1].element, "B "))
7237
    return;
7233
    return;
7238
  memset (nb, 0, sizeof (neighbor_rec));
7234
  memset (nb, 0, sizeof (neighbor_rec));
7239
  get_neighbors (nb, a_ref);
7235
  get_neighbors (nb, a_ref);
7240
  FORLIM = atom[a_ref - 1].neighbor_count;
7236
  FORLIM = atom[a_ref - 1].neighbor_count;
Line 7594... Line 7590...
7594
{
7590
{
7595
  int i;
7591
  int i;
7596
  neighbor_rec nb;
7592
  neighbor_rec nb;
7597
  str2 nb_el;
7593
  str2 nb_el;
7598
  int o_count = 0, n_count = 0, s_count = 0;
7594
  int o_count = 0, n_count = 0, s_count = 0;
7599
  int a_o, a_n, a_s, FORLIM;
7595
  int a_o = 0, a_n = 0, a_s = 0, FORLIM;
7600
 
7596
 
7601
  memset (nb, 0, sizeof (neighbor_rec));
7597
  memset (nb, 0, sizeof (neighbor_rec));
7602
  get_neighbors (nb, a_view);
7598
  get_neighbors (nb, a_view);
7603
  FORLIM = atom[a_view - 1].neighbor_count;
7599
  FORLIM = atom[a_view - 1].neighbor_count;
7604
  for (i = 0; i < FORLIM; i++)
7600
  for (i = 0; i < FORLIM; i++)
Line 9559... Line 9555...
9559
    printf ("nitroso compound\n");
9555
    printf ("nitroso compound\n");
9560
  if (fg[fg_nitro_compound - 1])
9556
  if (fg[fg_nitro_compound - 1])
9561
    printf ("nitro compound\n");
9557
    printf ("nitro compound\n");
9562
  if (fg[fg_nitrite - 1])
9558
  if (fg[fg_nitrite - 1])
9563
    printf ("nitrite\n");
9559
    printf ("nitrite\n");
9564
  if (fg[fg_nitrate - 1])
9560
  if (fg[fg_nitrate - 1])
9565
    printf ("nitrate\n");
9561
    printf ("nitrate\n");
9566
  /*  if fg[fg_sulfuric_acid_deriv]            then writeln('sulfuric acid derivative'); */
9562
  /*  if fg[fg_sulfuric_acid_deriv]            then writeln('sulfuric acid derivative'); */
9567
  if (fg[fg_sulfuric_acid - 1])
9563
  if (fg[fg_sulfuric_acid - 1])
9568
    printf ("sulfuric acid\n");
9564
    printf ("sulfuric acid\n");
9569
  if (fg[fg_sulfuric_acid_monoester - 1])
9565
  if (fg[fg_sulfuric_acid_monoester - 1])
Line 12039... Line 12035...
12039
 
12035
 
12040
 
12036
 
12041
static int
12037
static int
12042
find_ndl_ref_atom ()
12038
find_ndl_ref_atom ()
12043
{
12039
{
12044
  int Result, i;
12040
  int i;
12045
  int score = -1, index = 0;
12041
  int score = -1, index = 0;
12046
  int n_nb, n_hc, FORLIM;
12042
  int n_nb, n_hc, FORLIM;
12047
 
12043
 
12048
  /* finds a characteristic atom in the needle molecule, */
12044
  /* finds a characteristic atom in the needle molecule, */
12049
  /* i.e., one with as many substituents as possible and */
12045
  /* i.e., one with as many substituents as possible and */
Line 12055... Line 12051...
12055
  /* matchpath, regardless where the recursive search starts; */
12051
  /* matchpath, regardless where the recursive search starts; */
12056
  /* refined in v0.3f: exclude only alkene-C as reference atoms */
12052
  /* refined in v0.3f: exclude only alkene-C as reference atoms */
12057
  /* added in v0.3o: needle atom must be "tagged" in order to be */
12053
  /* added in v0.3o: needle atom must be "tagged" in order to be */
12058
  /* selected (prevents unconnected fragments from being overlooked) */
12054
  /* selected (prevents unconnected fragments from being overlooked) */
12059
  if (ndl_n_atoms == 0)
12055
  if (ndl_n_atoms == 0)
12060
    return Result;
12056
    return false;
12061
  if (ez_search && ndl_n_heavyatoms > 2)
12057
  if (ez_search && ndl_n_heavyatoms > 2)
12062
    {
12058
    {
12063
      FORLIM = ndl_n_atoms;
12059
      FORLIM = ndl_n_atoms;
12064
      for (i = 1; i <= FORLIM; i++)
12060
      for (i = 1; i <= FORLIM; i++)
12065
        {                       /* ignore sp2-carbons if not aromatic */
12061
        {                       /* ignore sp2-carbons if not aromatic */
Line 12290... Line 12286...
12290
  hst_nbc = atom[hst_a - 1].neighbor_count;
12286
  hst_nbc = atom[hst_a - 1].neighbor_count;
12291
  hst_Htot = atom[hst_a - 1].Htot;
12287
  hst_Htot = atom[hst_a - 1].Htot;
12292
  /* v0.3o: formal charges must be the same */
12288
  /* v0.3o: formal charges must be the same */
12293
 
12289
 
12294
  if (ndl_atom[ndl_a - 1].formal_charge != atom[hst_a - 1].formal_charge)
12290
  if (ndl_atom[ndl_a - 1].formal_charge != atom[hst_a - 1].formal_charge)
12295
    return false;
12291
    return false;
12296
 
12292
 
12297
  /* v0.3x: isotope nucleon numbers must be the same */
12293
  /* v0.3x: isotope nucleon numbers must be the same */
12298
 
12294
 
12299
  if (ndl_atom[ndl_a - 1].nucleon_number != atom[hst_a - 1].nucleon_number)
12295
  if (ndl_atom[ndl_a - 1].nucleon_number != atom[hst_a - 1].nucleon_number)
12300
    return false;
12296
    return false;
12301
 
12297
 
Line 12669... Line 12665...
12669
    res = false;
12665
    res = false;
12670
  if (ndl_btopo == btopo_exact_rc && hst_rc != ndl_rc)
12666
  if (ndl_btopo == btopo_exact_rc && hst_rc != ndl_rc)
12671
    res = false;
12667
    res = false;
12672
}    
12668
}    
12673
/* p2c: checkmol.pas, line 9098:
12669
/* p2c: checkmol.pas, line 9098:
12674
 * Note: Turbo Pascal conditional compilation directive was ignored [218] */
12670
 * Note: Turbo Pascal conditional compilation directive was ignored [218] */
12675
  /*$IFDEF debug */
12671
  /*$IFDEF debug */
12676
  /* if res = false then tstr := ' bond topology mismatch '+inttostr(ndl_rc)+'/'+inttostr(hst_rc); */
12672
  /* if res = false then tstr := ' bond topology mismatch '+inttostr(ndl_rc)+'/'+inttostr(hst_rc); */
12677
  /*$ENDIF */
12673
  /*$ENDIF */
12678
/* p2c: checkmol.pas, line 9102:
12674
/* p2c: checkmol.pas, line 9102:
12679
 * Note: Turbo Pascal conditional compilation directive was ignored [218] */
12675
 * Note: Turbo Pascal conditional compilation directive was ignored [218] */
12680
  /*$IFDEF debug */
12676
  /*$IFDEF debug */
12681
  /*
12677
  /*
12682
     if res then debugoutput('bond types OK ('+inttostr(ndl_b)+':'+ndl_btype+na+'/'+inttostr(hst_b)+':'+hst_btype+ha+')') else
12678
     if res then debugoutput('bond types OK ('+inttostr(ndl_b)+':'+ndl_btype+na+'/'+inttostr(hst_b)+':'+hst_btype+ha+')') else
12683
     debugoutput('bond types not OK ('+inttostr(ndl_b)+':'+ndl_btype+na+'/'+inttostr(hst_b)+':'+hst_btype+ha+tstr+')'); */
12679
     debugoutput('bond types not OK ('+inttostr(ndl_b)+':'+ndl_btype+na+'/'+inttostr(hst_b)+':'+hst_btype+ha+tstr+')'); */
12684
  /*$ENDIF */
12680
  /*$ENDIF */
12685
  return res;
12681
  return res;
12686
}
12682
}
12687
 
12683
 
12688
 
12684
 
12689
static boolean
12685
static boolean
12690
matrix_OK (m, ndl_dim, hst_dim)
12686
matrix_OK (m, ndl_dim, hst_dim)
12691
boolean (*m)[max_neighbors];
12687
boolean (*m)[max_neighbors];
12692
     int ndl_dim, hst_dim;
12688
     int ndl_dim, hst_dim;
12693
{
12689
{
12694
  /* new, recursive version in v0.2i: can handle up to max_neighbors substituents */
12690
  /* new, recursive version in v0.2i: can handle up to max_neighbors substituents */
Line 12791... Line 12787...
12791
              ndl_bond[i].stereo == bstereo_down)
12787
              ndl_bond[i].stereo == bstereo_down)
12792
            {
12788
            {
12793
              ba1 = ndl_bond[i].a1;
12789
              ba1 = ndl_bond[i].a1;
12794
              ba2 = ndl_bond[i].a2;
12790
              ba2 = ndl_bond[i].a2;
12795
              if (ba1 == ta1 && ndl_bond[i].stereo == bstereo_up)
12791
              if (ba1 == ta1 && ndl_bond[i].stereo == bstereo_up)
12796
                {
12792
                {
12797
                  up = true;
12793
                  up = true;
12798
                  if (ba2 == ta2 || ba2 == ta3 || ba2 == ta4)
12794
                  if (ba2 == ta2 || ba2 == ta3 || ba2 == ta4)
12799
                    {
12795
                    {
12800
                      updown = true;
12796
                      updown = true;
12801
                      if (ba2 == ta2)
12797
                      if (ba2 == ta2)
12802
                        np1.z += 0.8;
12798
                        np1.z += 0.8;
12803
                      if (ba2 == ta3)
12799
                      if (ba2 == ta3)
12804
                        np3.z += 0.8;
12800
                        np3.z += 0.8;
12805
                      if (ba2 == ta4)
12801
                      if (ba2 == ta4)
12806
                        np4.z += 0.8;
12802
                        np4.z += 0.8;
12807
                    }
12803
                    }
Line 13050... Line 13046...
13050
 
13046
 
13051
static boolean
13047
static boolean
13052
is_matching (ndl_xmp, hst_xmp)
13048
is_matching (ndl_xmp, hst_xmp)
13053
     int *ndl_xmp, *hst_xmp;
13049
     int *ndl_xmp, *hst_xmp;
13054
{
13050
{
13055
  boolean Result;
-
 
13056
  int i, j, k, l, m, ndl_n_nb, n_nb, ndl_a, hst_a;
13051
  int i, j, k, l, m, ndl_n_nb, n_nb, ndl_a, hst_a;
13057
  int ndl_b = 0, hst_b = 0, prev_ndl_a = 0, prev_hst_a = 0;
13052
  int ndl_b = 0, hst_b = 0, prev_ndl_a = 0, prev_hst_a = 0;
13058
  int next_ndl_a, next_hst_a;
13053
  int next_ndl_a, next_hst_a;
13059
  neighbor_rec ndl_nb, hst_nb;
13054
  neighbor_rec ndl_nb, hst_nb;
13060
  matchmatrix mm;
13055
  matchmatrix mm;
Line 14468... Line 14463...
14468
                      if (opt_fp && fpformat == fpf_decimal
14463
                      if (opt_fp && fpformat == fpf_decimal
14469
                          && fpindex == fp_blocksize)
14464
                          && fpindex == fp_blocksize)
14470
                        {
14465
                        {
14471
                          if (fp_exactblock)
14466
                          if (fp_exactblock)
14472
                            fpdecimal++;
14467
                            fpdecimal++;
14473
                          printf ("%ll\n", fpdecimal);
14468
                          printf ("%lld\n", fpdecimal);
14474
                          fpindex = 0;
14469
                          fpindex = 0;
14475
                          fpdecimal = 0;
14470
                          fpdecimal = 0;
14476
                          fp_exactblock = false;
14471
                          fp_exactblock = false;
14477
                        }
14472
                        }
14478
                      zap_molecule ();
14473
                      zap_molecule ();
Line 14491... Line 14486...
14491
      /* if filetype <> 'unknown' */
14486
      /* if filetype <> 'unknown' */
14492
      if (opt_fp && fpformat == fpf_decimal && fpindex > 0)
14487
      if (opt_fp && fpformat == fpf_decimal && fpindex > 0)
14493
        {
14488
        {
14494
          if (fp_exactblock)
14489
          if (fp_exactblock)
14495
            fpdecimal++;
14490
            fpdecimal++;
14496
          printf ("%ll\n", fpdecimal);
14491
          printf ("%lld\n", fpdecimal);
14497
        }
14492
        }
14498
      zap_needle ();
14493
      zap_needle ();
14499
      if (rfile_is_open)
14494
      if (rfile_is_open)
14500
        {                       /* new in v0.2g */
14495
        {                       /* new in v0.2g */
14501
          if (rfile != NULL)
14496
          if (rfile != NULL)