-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathRotamerLibrary.java
49 lines (43 loc) · 1.18 KB
/
RotamerLibrary.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
import java.util.*;
/**
* Represents backbone-dependent rotamer data for an amino acid.
*/
public abstract class RotamerLibrary
{
/** Represents (phi,psi) backbone angles. */
public static class Angles
{
public final double phi, psi;
public Angles(Double phi, Double psi)
{
if ( phi < -180.0 || phi > 180.0 || psi < -180.0 || psi > 180.0 )
throw new IllegalArgumentException("angle out of range");
this.phi = phi;
this.psi = psi;
}
@Override
public String toString()
{
return String.format("%.0f, %.0f", phi, psi);
}
@Override
public int hashCode()
{
return Objects.hash(phi,psi);
}
@Override
public boolean equals(Object obj)
{
if ( obj == null )
return false;
if ( obj == this )
return true;
if ( !(obj instanceof Angles) )
return false;
Angles a = (Angles)obj;
if ( phi == a.phi && psi == a.psi )
return true;
return false;
}
}
}