com.actelion.research.chem.phesa.pharmacophore.pp.AromRingPoint Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of openchemlib Show documentation
Show all versions of openchemlib Show documentation
Open Source Chemistry Library
package com.actelion.research.chem.phesa.pharmacophore.pp;
import java.util.ArrayList;
import java.util.List;
import com.actelion.research.chem.Coordinates;
import com.actelion.research.chem.StereoMolecule;
import com.actelion.research.chem.conf.Conformer;
public class AromRingPoint implements IPharmacophorePoint {
private int referenceAtom;
private List ringAtoms;
private Coordinates center;
private static final Coordinates directionality = new Coordinates(1.0,0.0,0.0);
public AromRingPoint(StereoMolecule mol, int a, List ringAtoms) {
referenceAtom = a;
this.ringAtoms = ringAtoms;
updateCoordinates(mol.getAtomCoordinates());
}
public AromRingPoint(AromRingPoint aP) {
referenceAtom = aP.referenceAtom;
center = new Coordinates(aP.center);
ringAtoms = new ArrayList();
for(int ringAtom : aP.ringAtoms) {
ringAtoms.add(ringAtom);
}
}
@Override
public Coordinates getCenter() {
return center;
}
@Override
public void updateCoordinates(Coordinates[] coords) {
Coordinates com = new Coordinates(0,0,0);
for(int ringAtom : ringAtoms) {
com.add(coords[ringAtom]);
}
com.scale(1.0/( ringAtoms.size()));
center = com;
}
@Override
public Coordinates getDirectionality() {
// TODO Auto-generated method stub
return directionality;
}
private AromRingPoint(String ppString, StereoMolecule mol) {
decode(ppString,mol);
}
public static AromRingPoint fromString(String ppString, StereoMolecule mol) {
return new AromRingPoint(ppString,mol);
}
private void decode(String ppString, StereoMolecule mol) {
String[] strings = ppString.split(" ");
referenceAtom = Integer.decode(strings[1]);
ringAtoms = new ArrayList();
for(int i=2;i